i had to re init again nice
This commit is contained in:
commit
702b9bd25e
|
@ -0,0 +1,132 @@
|
|||
# ~/.bashrc: executed by bash(1) for non-login shells.
|
||||
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
|
||||
# for examples
|
||||
|
||||
# If not running interactively, don't do anything
|
||||
case $- in
|
||||
*i*) ;;
|
||||
*) return;;
|
||||
esac
|
||||
|
||||
# don't put duplicate lines or lines starting with space in the history.
|
||||
# See bash(1) for more options
|
||||
HISTCONTROL=ignoreboth
|
||||
|
||||
# append to the history file, don't overwrite it
|
||||
shopt -s histappend
|
||||
|
||||
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
|
||||
HISTSIZE=1000
|
||||
HISTFILESIZE=2000
|
||||
|
||||
# check the window size after each command and, if necessary,
|
||||
# update the values of LINES and COLUMNS.
|
||||
shopt -s checkwinsize
|
||||
|
||||
# If set, the pattern "**" used in a pathname expansion context will
|
||||
# match all files and zero or more directories and subdirectories.
|
||||
#shopt -s globstar
|
||||
|
||||
# make less more friendly for non-text input files, see lesspipe(1)
|
||||
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
|
||||
|
||||
# set variable identifying the chroot you work in (used in the prompt below)
|
||||
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
|
||||
debian_chroot=$(cat /etc/debian_chroot)
|
||||
fi
|
||||
|
||||
# set a fancy prompt (non-color, unless we know we "want" color)
|
||||
case "$TERM" in
|
||||
xterm-color|*-256color) color_prompt=yes;;
|
||||
esac
|
||||
|
||||
# uncomment for a colored prompt, if the terminal has the capability; turned
|
||||
# off by default to not distract the user: the focus in a terminal window
|
||||
# should be on the output of commands, not on the prompt
|
||||
#force_color_prompt=yes
|
||||
|
||||
if [ -n "$force_color_prompt" ]; then
|
||||
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
|
||||
# We have color support; assume it's compliant with Ecma-48
|
||||
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
|
||||
# a case would tend to support setf rather than setaf.)
|
||||
color_prompt=yes
|
||||
else
|
||||
color_prompt=
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$color_prompt" = yes ]; then
|
||||
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\n\$ '
|
||||
else
|
||||
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\n\$ '
|
||||
fi
|
||||
unset color_prompt force_color_prompt
|
||||
|
||||
# If this is an xterm set the title to user@host:dir
|
||||
case "$TERM" in
|
||||
xterm*|rxvt*)
|
||||
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
# enable color support of ls and also add handy aliases
|
||||
if [ -x /usr/bin/dircolors ]; then
|
||||
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
||||
alias ls='ls --color=auto'
|
||||
#alias dir='dir --color=auto'
|
||||
#alias vdir='vdir --color=auto'
|
||||
|
||||
alias grep='grep --color=auto'
|
||||
alias fgrep='fgrep --color=auto'
|
||||
alias egrep='egrep --color=auto'
|
||||
fi
|
||||
|
||||
# colored GCC warnings and errors
|
||||
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
|
||||
|
||||
# some more ls aliases
|
||||
alias ll='ls -alF'
|
||||
alias la='ls -A'
|
||||
alias l='ls -CF'
|
||||
|
||||
# Add an "alert" alias for long running commands. Use like so:
|
||||
# sleep 10; alert
|
||||
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
|
||||
|
||||
# Alias definitions.
|
||||
# You may want to put all your additions into a separate file like
|
||||
# ~/.bash_aliases, instead of adding them here directly.
|
||||
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
|
||||
|
||||
if [ -f ~/.bash_aliases ]; then
|
||||
. ~/.bash_aliases
|
||||
fi
|
||||
|
||||
# enable programmable completion features (you don't need to enable
|
||||
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
|
||||
# sources /etc/bash.bashrc).
|
||||
if ! shopt -oq posix; then
|
||||
if [ -f /usr/share/bash-completion/bash_completion ]; then
|
||||
. /usr/share/bash-completion/bash_completion
|
||||
elif [ -f /etc/bash_completion ]; then
|
||||
. /etc/bash_completion
|
||||
fi
|
||||
fi
|
||||
# Install Ruby Gems to ~/gems
|
||||
export GEM_HOME="$HOME/gems"
|
||||
export PATH="$HOME/gems/bin/:$PATH"
|
||||
|
||||
# my aliases
|
||||
alias x='exit'
|
||||
alias clr='clear'
|
||||
alias bashcrawl='cd ~/bashcrawl/bashcrawl-master/'
|
||||
|
||||
|
||||
export NVM_DIR="$HOME/.nvm"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
||||
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
|
||||
|
||||
export PATH="$HOME/.cargo/bin:$PATH"
|
|
@ -0,0 +1,124 @@
|
|||
# ~/.bashrc: executed by bash(1) for non-login shells.
|
||||
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
|
||||
# for examples
|
||||
|
||||
# If not running interactively, don't do anything
|
||||
case $- in
|
||||
*i*) ;;
|
||||
*) return;;
|
||||
esac
|
||||
|
||||
# don't put duplicate lines or lines starting with space in the history.
|
||||
# See bash(1) for more options
|
||||
HISTCONTROL=ignoreboth
|
||||
|
||||
# append to the history file, don't overwrite it
|
||||
shopt -s histappend
|
||||
|
||||
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
|
||||
HISTSIZE=1000
|
||||
HISTFILESIZE=2000
|
||||
|
||||
# check the window size after each command and, if necessary,
|
||||
# update the values of LINES and COLUMNS.
|
||||
shopt -s checkwinsize
|
||||
|
||||
# If set, the pattern "**" used in a pathname expansion context will
|
||||
# match all files and zero or more directories and subdirectories.
|
||||
#shopt -s globstar
|
||||
|
||||
# make less more friendly for non-text input files, see lesspipe(1)
|
||||
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
|
||||
|
||||
# set variable identifying the chroot you work in (used in the prompt below)
|
||||
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
|
||||
debian_chroot=$(cat /etc/debian_chroot)
|
||||
fi
|
||||
|
||||
# set a fancy prompt (non-color, unless we know we "want" color)
|
||||
case "$TERM" in
|
||||
xterm-color|*-256color) color_prompt=yes;;
|
||||
esac
|
||||
|
||||
# uncomment for a colored prompt, if the terminal has the capability; turned
|
||||
# off by default to not distract the user: the focus in a terminal window
|
||||
# should be on the output of commands, not on the prompt
|
||||
#force_color_prompt=yes
|
||||
|
||||
if [ -n "$force_color_prompt" ]; then
|
||||
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
|
||||
# We have color support; assume it's compliant with Ecma-48
|
||||
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
|
||||
# a case would tend to support setf rather than setaf.)
|
||||
color_prompt=yes
|
||||
else
|
||||
color_prompt=
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$color_prompt" = yes ]; then
|
||||
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
|
||||
else
|
||||
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
|
||||
fi
|
||||
unset color_prompt force_color_prompt
|
||||
|
||||
# If this is an xterm set the title to user@host:dir
|
||||
case "$TERM" in
|
||||
xterm*|rxvt*)
|
||||
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
# enable color support of ls and also add handy aliases
|
||||
if [ -x /usr/bin/dircolors ]; then
|
||||
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
||||
alias ls='ls --color=auto'
|
||||
#alias dir='dir --color=auto'
|
||||
#alias vdir='vdir --color=auto'
|
||||
|
||||
alias grep='grep --color=auto'
|
||||
alias fgrep='fgrep --color=auto'
|
||||
alias egrep='egrep --color=auto'
|
||||
fi
|
||||
|
||||
# colored GCC warnings and errors
|
||||
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
|
||||
|
||||
# some more ls aliases
|
||||
alias ll='ls -alF'
|
||||
alias la='ls -A'
|
||||
alias l='ls -CF'
|
||||
|
||||
# Add an "alert" alias for long running commands. Use like so:
|
||||
# sleep 10; alert
|
||||
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
|
||||
|
||||
# Alias definitions.
|
||||
# You may want to put all your additions into a separate file like
|
||||
# ~/.bash_aliases, instead of adding them here directly.
|
||||
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
|
||||
|
||||
if [ -f ~/.bash_aliases ]; then
|
||||
. ~/.bash_aliases
|
||||
fi
|
||||
|
||||
# enable programmable completion features (you don't need to enable
|
||||
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
|
||||
# sources /etc/bash.bashrc).
|
||||
if ! shopt -oq posix; then
|
||||
if [ -f /usr/share/bash-completion/bash_completion ]; then
|
||||
. /usr/share/bash-completion/bash_completion
|
||||
elif [ -f /etc/bash_completion ]; then
|
||||
. /etc/bash_completion
|
||||
fi
|
||||
fi
|
||||
']]]]'
|
||||
|
||||
export NVM_DIR="$HOME/.nvm"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
||||
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
|
||||
|
||||
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
|
|
@ -0,0 +1,189 @@
|
|||
#
|
||||
# aerc main configuration
|
||||
|
||||
[ui]
|
||||
#
|
||||
# Describes the format for each row in a mailbox view. This field is compatible
|
||||
# with mutt's printf-like syntax.
|
||||
#
|
||||
# Default: %D %-17.17n %Z %s
|
||||
index-format=%D %-17.17n %Z %s
|
||||
|
||||
#
|
||||
# See time.Time#Format at https://godoc.org/time#Time.Format
|
||||
#
|
||||
# Default: 2006-01-02 03:04 PM (ISO 8601 + 12 hour time)
|
||||
timestamp-format=2006-01-02 03:04 PM
|
||||
|
||||
#
|
||||
# Width of the sidebar, including the border.
|
||||
#
|
||||
# Default: 20
|
||||
sidebar-width=20
|
||||
|
||||
#
|
||||
# Message to display when viewing an empty folder.
|
||||
#
|
||||
# Default: (no messages)
|
||||
empty-message=(no messages)
|
||||
|
||||
# Message to display when no folders exists or are all filtered
|
||||
#
|
||||
# Default: (no folders)
|
||||
empty-dirlist=(no folders)
|
||||
|
||||
# Enable mouse events in the ui, e.g. clicking and scrolling with the mousewheel
|
||||
#
|
||||
# Default: false
|
||||
mouse-enabled=false
|
||||
|
||||
#
|
||||
# Ring the bell when new messages are received
|
||||
#
|
||||
# Default: true
|
||||
new-message-bell=true
|
||||
|
||||
# Marker to show before a pinned tab's name.
|
||||
#
|
||||
# Default: `
|
||||
pinned-tab-marker='`'
|
||||
|
||||
# Describes the format string to use for the directory list
|
||||
#
|
||||
# Default: %n %>r
|
||||
dirlist-format=%n %>r
|
||||
|
||||
# List of space-separated criteria to sort the messages by, see *sort*
|
||||
# command in *aerc*(1) for reference. Prefixing a criterion with "-r "
|
||||
# reverses that criterion.
|
||||
#
|
||||
# Example: "from -r date"
|
||||
#
|
||||
# Default: ""
|
||||
sort=
|
||||
|
||||
# Moves to next message when the current message is deleted
|
||||
#
|
||||
# Default: true
|
||||
next-message-on-delete=true
|
||||
|
||||
[viewer]
|
||||
#
|
||||
# Specifies the pager to use when displaying emails. Note that some filters
|
||||
# may add ANSI codes to add color to rendered emails, so you may want to use a
|
||||
# pager which supports ANSI codes.
|
||||
#
|
||||
# Default: less -R
|
||||
pager=less -R
|
||||
|
||||
#
|
||||
# If an email offers several versions (multipart), you can configure which
|
||||
# mimetype to prefer. For example, this can be used to prefer plaintext over
|
||||
# html emails.
|
||||
#
|
||||
# Default: text/plain,text/html
|
||||
alternatives=text/plain,text/html
|
||||
|
||||
#
|
||||
# Default setting to determine whether to show full headers or only parsed
|
||||
# ones in message viewer.
|
||||
#
|
||||
# Default: false
|
||||
show-headers=false
|
||||
|
||||
#
|
||||
# Layout of headers when viewing a message. To display multiple headers in the
|
||||
# same row, separate them with a pipe, e.g. "From|To". Rows will be hidden if
|
||||
# none of their specified headers are present in the message.
|
||||
#
|
||||
# Default: From|To,Cc|Bcc,Date,Subject
|
||||
header-layout=From|To,Cc|Bcc,Date,Subject
|
||||
|
||||
# Whether to always show the mimetype of an email, even when it is just a single part
|
||||
#
|
||||
# Default: false
|
||||
always-show-mime=false
|
||||
|
||||
# How long to wait after the last input before auto-completion is triggered.
|
||||
#
|
||||
# Default: 250ms
|
||||
completion-delay=250ms
|
||||
|
||||
#
|
||||
# Global switch for completion popovers
|
||||
#
|
||||
# Default: true
|
||||
completion-popovers=true
|
||||
|
||||
[compose]
|
||||
#
|
||||
# Specifies the command to run the editor with. It will be shown in an embedded
|
||||
# terminal, though it may also launch a graphical window if the environment
|
||||
# supports it. Defaults to $EDITOR, or vi.
|
||||
editor=
|
||||
|
||||
#
|
||||
# Default header fields to display when composing a message. To display
|
||||
# multiple headers in the same row, separate them with a pipe, e.g. "To|From".
|
||||
#
|
||||
# Default: To|From,Subject
|
||||
header-layout=To|From,Subject
|
||||
|
||||
#
|
||||
# Specifies the command to be used to tab-complete email addresses. Any
|
||||
# occurrence of "%s" in the address-book-cmd will be replaced with what the
|
||||
# user has typed so far.
|
||||
#
|
||||
# The command must output the completions to standard output, one completion
|
||||
# per line. Each line must be tab-delimited, with an email address occurring as
|
||||
# the first field. Only the email address field is required. The second field,
|
||||
# if present, will be treated as the contact name. Additional fields are
|
||||
# ignored.
|
||||
address-book-cmd=
|
||||
|
||||
[filters]
|
||||
#
|
||||
# Filters allow you to pipe an email body through a shell command to render
|
||||
# certain emails differently, e.g. highlighting them with ANSI escape codes.
|
||||
#
|
||||
# The first filter which matches the email's mimetype will be used, so order
|
||||
# them from most to least specific.
|
||||
#
|
||||
# You can also match on non-mimetypes, by prefixing with the header to match
|
||||
# against (non-case-sensitive) and a comma, e.g. subject,text will match a
|
||||
# subject which contains "text". Use header,~regex to match against a regex.
|
||||
subject,~^\[PATCH=awk -f /usr/local/share/aerc/filters/hldiff
|
||||
#text/html=/usr/local/share/aerc/filters/html
|
||||
text/*=awk -f /usr/local/share/aerc/filters/plaintext
|
||||
#image/*=catimg -w $(tput cols) -
|
||||
|
||||
[triggers]
|
||||
#
|
||||
# Triggers specify commands to execute when certain events occur.
|
||||
#
|
||||
# Example:
|
||||
# new-email=exec notify-send "New email from %n" "%s"
|
||||
|
||||
#
|
||||
# Executed when a new email arrives in the selected folder
|
||||
new-email=
|
||||
|
||||
[templates]
|
||||
# Templates are used to populate email bodies automatically.
|
||||
#
|
||||
|
||||
# The directories where the templates are stored. It takes a colon-separated
|
||||
# list of directories.
|
||||
#
|
||||
# default: /usr/local/share/aerc/templates/
|
||||
template-dirs=/usr/local/share/aerc/templates/
|
||||
|
||||
# The template to be used for quoted replies.
|
||||
#
|
||||
# default: quoted_reply
|
||||
quoted-reply=quoted_reply
|
||||
|
||||
# The template to be used for forward as body.
|
||||
#
|
||||
# default: forward_as_body
|
||||
forwards=forward_as_body
|
|
@ -0,0 +1,103 @@
|
|||
# Binds are of the form <key sequence> = <command to run>
|
||||
# To use '=' in a key sequence, substitute it with "Eq": "<Ctrl+Eq>"
|
||||
# If you wish to bind #, you can wrap the key sequence in quotes: "#" = quit
|
||||
<C-p> = :prev-tab<Enter>
|
||||
<C-n> = :next-tab<Enter>
|
||||
<C-t> = :term<Enter>
|
||||
|
||||
[messages]
|
||||
q = :quit<Enter>
|
||||
|
||||
j = :next<Enter>
|
||||
<Down> = :next<Enter>
|
||||
<C-d> = :next 50%<Enter>
|
||||
<C-f> = :next 100%<Enter>
|
||||
<PgDn> = :next -s 100%<Enter>
|
||||
|
||||
k = :prev<Enter>
|
||||
<Up> = :prev<Enter>
|
||||
<C-u> = :prev 50%<Enter>
|
||||
<C-b> = :prev 100%<Enter>
|
||||
<PgUp> = :prev -s 100%<Enter>
|
||||
g = :select 0<Enter>
|
||||
G = :select -1<Enter>
|
||||
|
||||
J = :next-folder<Enter>
|
||||
K = :prev-folder<Enter>
|
||||
|
||||
v = :mark -t<Enter>
|
||||
V = :mark -v<Enter>
|
||||
|
||||
<Enter> = :view<Enter>
|
||||
d = :prompt 'Really delete this message?' 'delete-message'<Enter>
|
||||
D = :delete<Enter>
|
||||
A = :archive flat<Enter>
|
||||
|
||||
C = :compose<Enter>
|
||||
|
||||
rr = :reply -a<Enter>
|
||||
rq = :reply -aq<Enter>
|
||||
Rr = :reply<Enter>
|
||||
Rq = :reply -q<Enter>
|
||||
|
||||
c = :cf<space>
|
||||
$ = :term<space>
|
||||
! = :term<space>
|
||||
| = :pipe<space>
|
||||
|
||||
/ = :search<space>
|
||||
\ = :filter<space>
|
||||
n = :next-result<Enter>
|
||||
N = :prev-result<Enter>
|
||||
|
||||
[view]
|
||||
q = :close<Enter>
|
||||
| = :pipe<space>
|
||||
D = :delete<Enter>
|
||||
S = :save<space>
|
||||
A = :archive flat<Enter>
|
||||
|
||||
f = :forward<Enter>
|
||||
rr = :reply -a<Enter>
|
||||
rq = :reply -aq<Enter>
|
||||
Rr = :reply<Enter>
|
||||
Rq = :reply -q<Enter>
|
||||
|
||||
H = :toggle-headers<Enter>
|
||||
<C-k> = :prev-part<Enter>
|
||||
<C-j> = :next-part<Enter>
|
||||
J = :next<Enter>
|
||||
K = :prev<Enter>
|
||||
|
||||
[compose]
|
||||
# Keybindings used when the embedded terminal is not selected in the compose
|
||||
# view
|
||||
$ex = <C-x>
|
||||
<C-k> = :prev-field<Enter>
|
||||
<C-j> = :next-field<Enter>
|
||||
<tab> = :next-field<Enter>
|
||||
|
||||
[compose::editor]
|
||||
# Keybindings used when the embedded terminal is selected in the compose view
|
||||
$noinherit = true
|
||||
$ex = <C-x>
|
||||
<C-k> = :prev-field<Enter>
|
||||
<C-j> = :next-field<Enter>
|
||||
<C-p> = :prev-tab<Enter>
|
||||
<C-n> = :next-tab<Enter>
|
||||
|
||||
[compose::review]
|
||||
# Keybindings used when reviewing a message to be sent
|
||||
y = :send<Enter>
|
||||
n = :abort<Enter>
|
||||
p = :postpone<Enter>
|
||||
q = :abort<Enter>
|
||||
e = :edit<Enter>
|
||||
a = :attach<space>
|
||||
|
||||
[terminal]
|
||||
$noinherit = true
|
||||
$ex = <C-x>
|
||||
|
||||
<C-p> = :prev-tab<Enter>
|
||||
<C-n> = :next-tab<Enter>
|
|
@ -0,0 +1,4 @@
|
|||
bass 'export GEM_HOME=$HOME/gems'
|
||||
bass 'export BROWSER=w3m'
|
||||
set -g __fish_git_prompt_char_cleanstate "="
|
||||
umask 0002
|
|
@ -0,0 +1,6 @@
|
|||
function apt-up
|
||||
sudo apt update && sudo apt upgrade -y
|
||||
sudo apt-get dist-upgrade -y
|
||||
sudo apt autoremove
|
||||
end
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
# Defined in - @ line 1
|
||||
function clr --wraps=clear --description 'alias clr=clear'
|
||||
clear $argv;
|
||||
end
|
|
@ -0,0 +1,18 @@
|
|||
function cprac
|
||||
if test -e /mnt/c/Users/hedyh/codeprac/
|
||||
set -gx cprac_path /mnt/c/Users/hedyh/codeprac/
|
||||
else
|
||||
echo "codeprac path not found, please enter path: "
|
||||
read -gx cprac_path
|
||||
end
|
||||
if string length -q -- $argv
|
||||
if test -e $cprac_path$argv[1]
|
||||
cd $cprac_path$argv[1]
|
||||
else
|
||||
cd $cprac_path/*/$argv[1]/
|
||||
end
|
||||
else
|
||||
cd $cprac_path
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
function cproj
|
||||
if test -e /mnt/c/Users/hedyh/codeproj/
|
||||
set -gx cproj_path /mnt/c/Users/hedyh/codeproj/
|
||||
else
|
||||
echo "codeproj path not found, please enter path"
|
||||
read -gx cproj_path
|
||||
end
|
||||
if string length -q -- $argv
|
||||
cd $cproj_path$argv[1]
|
||||
else
|
||||
cd $cproj_path
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
function fish_greeting
|
||||
echo lol
|
||||
end
|
|
@ -0,0 +1,84 @@
|
|||
function fish_prompt --description 'Write out the prompt'
|
||||
set -l last_pipestatus $pipestatus
|
||||
|
||||
if not set -q __fish_git_prompt_show_informative_status
|
||||
set -g __fish_git_prompt_show_informative_status 1
|
||||
end
|
||||
if not set -q __fish_git_prompt_hide_untrackedfiles
|
||||
set -g __fish_git_prompt_hide_untrackedfiles 1
|
||||
end
|
||||
if not set -q __fish_git_prompt_color_branch
|
||||
set -g __fish_git_prompt_color_branch magenta --bold
|
||||
end
|
||||
if not set -q __fish_git_prompt_showupstream
|
||||
set -g __fish_git_prompt_showupstream "informative"
|
||||
end
|
||||
if not set -q __fish_git_prompt_char_upstream_ahead
|
||||
set -g __fish_git_prompt_char_upstream_ahead "↑"
|
||||
end
|
||||
if not set -q __fish_git_prompt_char_upstream_behind
|
||||
set -g __fish_git_prompt_char_upstream_behind "↓"
|
||||
end
|
||||
if not set -q __fish_git_prompt_char_upstream_prefix
|
||||
set -g __fish_git_prompt_char_upstream_prefix ""
|
||||
end
|
||||
if not set -q __fish_git_prompt_char_stagedstate
|
||||
set -g __fish_git_prompt_char_stagedstate "●"
|
||||
end
|
||||
if not set -q __fish_git_prompt_char_dirtystate
|
||||
set -g __fish_git_prompt_char_dirtystate "✚"
|
||||
end
|
||||
if not set -q __fish_git_prompt_char_untrackedfiles
|
||||
set -g __fish_git_prompt_char_untrackedfiles "…"
|
||||
end
|
||||
if not set -q __fish_git_prompt_char_invalidstate
|
||||
set -g __fish_git_prompt_char_invalidstate "✖"
|
||||
end
|
||||
if not set -q __fish_git_prompt_char_cleanstate
|
||||
set -g __fish_git_prompt_char_cleanstate "✔"
|
||||
end
|
||||
if not set -q __fish_git_prompt_color_dirtystate
|
||||
set -g __fish_git_prompt_color_dirtystate blue
|
||||
end
|
||||
if not set -q __fish_git_prompt_color_stagedstate
|
||||
set -g __fish_git_prompt_color_stagedstate yellow
|
||||
end
|
||||
if not set -q __fish_git_prompt_color_invalidstate
|
||||
set -g __fish_git_prompt_color_invalidstate red
|
||||
end
|
||||
if not set -q __fish_git_prompt_color_untrackedfiles
|
||||
set -g __fish_git_prompt_color_untrackedfiles $fish_color_normal
|
||||
end
|
||||
if not set -q __fish_git_prompt_color_cleanstate
|
||||
set -g __fish_git_prompt_color_cleanstate green --bold
|
||||
end
|
||||
|
||||
set -l color_cwd
|
||||
set -l prefix
|
||||
set -l suffix
|
||||
switch "$USER"
|
||||
case root toor
|
||||
if set -q fish_color_cwd_root
|
||||
set color_cwd $fish_color_cwd_root
|
||||
else
|
||||
set color_cwd $fish_color_cwd
|
||||
end
|
||||
set suffix '#'
|
||||
case '*'
|
||||
set color_cwd $fish_color_cwd
|
||||
set suffix '$'
|
||||
end
|
||||
|
||||
# PWD
|
||||
set_color $color_cwd
|
||||
echo -n (prompt_pwd)
|
||||
set_color normal
|
||||
|
||||
printf '%s ' (fish_vcs_prompt)
|
||||
|
||||
set -l pipestatus_string (__fish_print_pipestatus "[" "] " "|" (set_color $fish_color_status) (set_color --bold $fish_color_status) $last_pipestatus)
|
||||
echo -n $pipestatus_string
|
||||
set_color normal
|
||||
|
||||
echo -n "$suffix "
|
||||
end
|
|
@ -0,0 +1,84 @@
|
|||
function fish_prompt --description 'Write out the prompt'
|
||||
set -l last_pipestatus $pipestatus
|
||||
|
||||
if not set -q __fish_git_prompt_show_informative_status
|
||||
set -g __fish_git_prompt_show_informative_status 1
|
||||
end
|
||||
if not set -q __fish_git_prompt_hide_untrackedfiles
|
||||
set -g __fish_git_prompt_hide_untrackedfiles 1
|
||||
end
|
||||
if not set -q __fish_git_prompt_color_branch
|
||||
set -g __fish_git_prompt_color_branch magenta --bold
|
||||
end
|
||||
if not set -q __fish_git_prompt_showupstream
|
||||
set -g __fish_git_prompt_showupstream "informative"
|
||||
end
|
||||
if not set -q __fish_git_prompt_char_upstream_ahead
|
||||
set -g __fish_git_prompt_char_upstream_ahead "↑"
|
||||
end
|
||||
if not set -q __fish_git_prompt_char_upstream_behind
|
||||
set -g __fish_git_prompt_char_upstream_behind "↓"
|
||||
end
|
||||
if not set -q __fish_git_prompt_char_upstream_prefix
|
||||
set -g __fish_git_prompt_char_upstream_prefix ""
|
||||
end
|
||||
if not set -q __fish_git_prompt_char_stagedstate
|
||||
set -g __fish_git_prompt_char_stagedstate "●"
|
||||
end
|
||||
if not set -q __fish_git_prompt_char_dirtystate
|
||||
set -g __fish_git_prompt_char_dirtystate "✚"
|
||||
end
|
||||
if not set -q __fish_git_prompt_char_untrackedfiles
|
||||
set -g __fish_git_prompt_char_untrackedfiles "…"
|
||||
end
|
||||
if not set -q __fish_git_prompt_char_invalidstate
|
||||
set -g __fish_git_prompt_char_invalidstate "✖"
|
||||
end
|
||||
if not set -q __fish_git_prompt_char_cleanstate
|
||||
set -g __fish_git_prompt_char_cleanstate "="
|
||||
end
|
||||
if not set -q __fish_git_prompt_color_dirtystate
|
||||
set -g __fish_git_prompt_color_dirtystate blue
|
||||
end
|
||||
if not set -q __fish_git_prompt_color_stagedstate
|
||||
set -g __fish_git_prompt_color_stagedstate yellow
|
||||
end
|
||||
if not set -q __fish_git_prompt_color_invalidstate
|
||||
set -g __fish_git_prompt_color_invalidstate red
|
||||
end
|
||||
if not set -q __fish_git_prompt_color_untrackedfiles
|
||||
set -g __fish_git_prompt_color_untrackedfiles $fish_color_normal
|
||||
end
|
||||
if not set -q __fish_git_prompt_color_cleanstate
|
||||
set -g __fish_git_prompt_color_cleanstate green --bold
|
||||
end
|
||||
|
||||
set -l color_cwd
|
||||
set -l prefix
|
||||
set -l suffix
|
||||
switch "$USER"
|
||||
case root toor
|
||||
if set -q fish_color_cwd_root
|
||||
set color_cwd $fish_color_cwd_root
|
||||
else
|
||||
set color_cwd $fish_color_cwd
|
||||
end
|
||||
set suffix '#'
|
||||
case '*'
|
||||
set color_cwd $fish_color_cwd
|
||||
set suffix '$'
|
||||
end
|
||||
|
||||
# PWD
|
||||
set_color $color_cwd
|
||||
echo -n (prompt_pwd)
|
||||
set_color normal
|
||||
|
||||
printf '%s ' (fish_vcs_prompt)
|
||||
|
||||
set -l pipestatus_string (__fish_print_pipestatus "[" "] " "|" (set_color $fish_color_status) (set_color --bold $fish_color_status) $last_pipestatus)
|
||||
echo -n $pipestatus_string
|
||||
set_color normal
|
||||
|
||||
echo -n "$suffix "
|
||||
end
|
|
@ -0,0 +1,4 @@
|
|||
# Defined in - @ line 1
|
||||
function getpyjoke --wraps=python3\ -c\ \'import\ pyjokes\;\ print\(pyjokes.get_joke\(\)\)\' --description alias\ getpyjoke=python3\ -c\ \'import\ pyjokes\;\ print\(pyjokes.get_joke\(\)\)\'
|
||||
python3 -c 'import pyjokes; print(pyjokes.get_joke())' $argv;
|
||||
end
|
|
@ -0,0 +1,17 @@
|
|||
function gitsimhis
|
||||
cd $argv[1]
|
||||
if read_confirm 'Everything in this directory will be replaced. Do you want to continue? '
|
||||
rm -rf *
|
||||
else
|
||||
echo 'Aborting...'
|
||||
return 1
|
||||
end
|
||||
|
||||
echo '1' > a
|
||||
git init && git add . && git commit -m '1'
|
||||
echo '2' >> a
|
||||
git add . && git commit -m '2'
|
||||
echo '3' >> a
|
||||
git add . && git commit -m '3'
|
||||
end
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
function hellofish
|
||||
|
||||
end
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
function la --description 'List contents of directory, including hidden files in directory.'
|
||||
ls -ah $argv
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
function ll
|
||||
exa -lahg --git -t modified $argv
|
||||
end
|
|
@ -0,0 +1,4 @@
|
|||
function nvm
|
||||
bass source ~/.nvm/nvm.sh --no-use ';' nvm $argv
|
||||
end
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
# Defined in - @ line 1
|
||||
function q --wraps=qalc --description 'alias q=qalc'
|
||||
qalc $argv;
|
||||
end
|
|
@ -0,0 +1,13 @@
|
|||
function read_confirm
|
||||
while true
|
||||
read -l -P "$argv[1] [y/N] " confirm
|
||||
|
||||
switch $confirm
|
||||
case Y y
|
||||
return 0
|
||||
case '' N n
|
||||
return 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
# Defined in - @ line 1
|
||||
function rm --wraps=trash --description 'alias rm=trash'
|
||||
trash $argv;
|
||||
end
|
|
@ -0,0 +1,4 @@
|
|||
# Defined in - @ line 1
|
||||
function td --wraps=termdown --description 'alias td=termdown'
|
||||
termdown $argv;
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
# Defined in - @ line 1
|
||||
function x
|
||||
if test -e ~/.git_creds
|
||||
if read_confirm 'gitlock?'
|
||||
gitlock
|
||||
end
|
||||
end
|
||||
exit $argv;
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
# Defined in - @ line 1
|
||||
function xo
|
||||
if test -e ~/.git_creds && read_confirm 'gitlock?'
|
||||
gitlock
|
||||
end
|
||||
exit 0 $argv;
|
||||
end
|
|
@ -0,0 +1,4 @@
|
|||
# Defined in - @ line 1
|
||||
function y --wraps=yadm --description 'alias y=yadm'
|
||||
yadm $argv;
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"coc.preferences.hoverTarget": "float"
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
" Set up :make to use fish for syntax checking.
|
||||
compiler fish
|
||||
|
||||
" set indent size
|
||||
set shiftwidth=4
|
||||
|
||||
" Set this to have long lines wrap inside comments.
|
||||
setlocal textwidth=79
|
||||
|
||||
" Enable folding of block structures in fish.
|
||||
setlocal foldmethod=expr
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
function! IsWSL()
|
||||
if has("unix")
|
||||
let lines = readfile("/proc/version")
|
||||
if lines[0] =~ "Microsoft"
|
||||
return 1
|
||||
endif
|
||||
endif
|
||||
return 0
|
||||
endfunction
|
|
@ -0,0 +1,99 @@
|
|||
""""""""""""""""""
|
||||
" General settings
|
||||
" """"""""""""""
|
||||
|
||||
set number
|
||||
set mouse=a " allow mouse for all
|
||||
set hlsearch " highlight search
|
||||
set showcmd " show incomplete commands
|
||||
set wildmenu " command line's tab complete in a menu
|
||||
set cursorline " highlight cursor line
|
||||
set noerrorbells " no beeps
|
||||
set visualbell " flash screen instead
|
||||
set title " set window title to file name
|
||||
set autoindent
|
||||
set softtabstop=2 " indent by 2 spaces when with tab
|
||||
set tabstop=4 " show existing tab with 4 spaces width
|
||||
set shiftwidth=4
|
||||
set incsearch " find next match while typing search
|
||||
set scrolloff=6 " screen lines to keep above and below cursor
|
||||
set sidescrolloff=8 " screen columns to keep on left and right of cursor
|
||||
set confirm " display confirmation when closing unsaved file
|
||||
set encoding=utf-8 " set encoding with Unicode
|
||||
set showmatch " match brackets when text indecator is over it
|
||||
set mat=2 " how mny tenths of second to blink when matching brackets
|
||||
set inccommand=nosplit " neovim only
|
||||
|
||||
" settings required from coc
|
||||
set hidden
|
||||
set cmdheight=2
|
||||
set updatetime=300
|
||||
set shortmess+=c
|
||||
" Always show the signcolumn, otherwise it would shift the text each time
|
||||
" diagnostics appear/become resolved.
|
||||
if has("patch-8.1.1564")
|
||||
" Recently vim can merge signcolumn and number column into one
|
||||
set signcolumn=number
|
||||
else
|
||||
set signcolumn=yes
|
||||
endif
|
||||
|
||||
|
||||
|
||||
|
||||
set laststatus=2 " show status line
|
||||
"set statusline=%F%m%r%h%w%=(%{&ff}/%Y)\ (line\ %l\/%L\ \|\ col\ %c)
|
||||
|
||||
set whichwrap+=<,>,h,l
|
||||
|
||||
"" fold settings
|
||||
set foldenable
|
||||
set foldlevelstart=10
|
||||
set foldnestmax=10
|
||||
set foldmethod=manual
|
||||
set foldcolumn=2
|
||||
|
||||
|
||||
" set the swp, backup and undo settings
|
||||
set noswapfile
|
||||
set nobackup nowritebackup
|
||||
set undodir=~/.local/share/nvim/undodir/
|
||||
set undofile
|
||||
"
|
||||
"" Ignore compiled files
|
||||
set wildignore=*.o,*~,*.pyc
|
||||
if has("win16") || has("win32")
|
||||
set wildignore+=.git\*,.hg\*,.svn\*
|
||||
else
|
||||
set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store
|
||||
endif
|
||||
|
||||
" Return to last edit position when opening files (You want
|
||||
" this!)
|
||||
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
|
||||
"au ColorScheme * hi Normal ctermbg=None
|
||||
|
||||
"" highlight extra whitespace
|
||||
match ErrorMsg '\s\+$'
|
||||
|
||||
" setting the shell for fish to sh
|
||||
"if &shell =~# 'fish$'
|
||||
" set shell=bash
|
||||
"endif
|
||||
"
|
||||
|
||||
if IsWSL()
|
||||
let g:clipboard = {
|
||||
\ 'name': 'WSLClip',
|
||||
\ 'copy': {
|
||||
\ '+': 'clip.exe',
|
||||
\ '*': 'clip.exe',
|
||||
\ },
|
||||
\ 'paste': {
|
||||
\ '+': 'pbpaste',
|
||||
\ '*': 'pbpaste',
|
||||
\ },
|
||||
\ 'cache_enabled': 0,
|
||||
\ }
|
||||
endif
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
set nocompatible
|
||||
let mapleader=";" " setting leader key to ';'
|
||||
|
||||
source $HOME/.config/nvim/functions.vim
|
||||
source $HOME/.config/nvim/general.vim
|
||||
source $HOME/.config/nvim/mappings.vim
|
||||
source $HOME/.config/nvim/plugins.vim
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
"""""""""""
|
||||
" Mappings
|
||||
""""""""""
|
||||
" leader mappings
|
||||
nnoremap <Leader>rn :set relativenumber!<CR>
|
||||
nnoremap <Leader>z zR
|
||||
nnoremap <Leader>w :w<CR>
|
||||
nnoremap <Leader>x :wqa<CR>
|
||||
nnoremap <Leader>q :qa<CR>
|
||||
|
||||
" no highlight - when finished search
|
||||
nnoremap <Leader>nh :noh<CR>
|
||||
" paste shortcut below
|
||||
" must be recursive bcus "+p is aldy mapped above (in WSLYank - paste)
|
||||
nmap <Leader>pa "+p
|
||||
nnoremap <Leader>rg :registers<CR>
|
||||
|
||||
" other mappings
|
||||
" dot command in visual mode
|
||||
vnoremap . :normal.<CR>
|
||||
|
||||
nnoremap Q :q<CR>
|
||||
" move visual selection
|
||||
vnoremap J :m '>+1<CR>gv=gv
|
||||
vnoremap K :m '<-2<CR>gv=gv
|
||||
|
||||
noremap <M-j> :m+1<CR>==
|
||||
noremap <M-k> :m-2<CR>==
|
||||
|
||||
noremap <M-J> :t.<CR>==
|
||||
noremap <M-K> :t.-1<CR>==
|
||||
|
||||
" Visual mode pressing * or # searches for the current selection
|
||||
" Super useful! From an idea by Michael Naumann
|
||||
vnoremap <silent> * :<C-u>call VisualSelection('', '')<CR>/<C-R>=@/<CR><CR>
|
||||
vnoremap <silent> # :<C-u>call VisualSelection('', '')<CR>?<C-R>=@/<CR><CR>"
|
||||
|
||||
" Smart way to move between windows
|
||||
noremap <C-j> <C-W>j
|
||||
noremap <C-k> <C-W>k
|
||||
noremap <C-h> <C-W>h
|
||||
noremap <C-l> <C-W>l
|
||||
|
||||
" managing buffers
|
||||
nnoremap <leader>bd :bd<cr>
|
||||
nnoremap <leader>bn :bn<cr>
|
||||
nnoremap <leader>bp :b<cr>
|
||||
|
||||
" Useful mappings for managing tabs
|
||||
noremap <leader>tn :tabnew<cr>
|
||||
noremap <leader>to :tabonly<cr>
|
||||
noremap <leader>tc :tabclose<cr>
|
||||
noremap <leader>tm :tabmove
|
||||
noremap <leader>t<leader> :tabnext
|
||||
noremap <leader>bn :bnext<cr>
|
||||
noremap <leader>bp :bprev<cr>
|
||||
|
||||
" terminal mappings
|
||||
noremap <C-`> :split term://fish<cr>i
|
||||
noremap <leader>t :split term://fish<cr>i
|
||||
tnoremap <Esc> <C-\><C-n>
|
||||
|
||||
" command mode mappings
|
||||
cnoremap <C-p> PlugInstall<cr>
|
||||
cnoremap <C-f> Format<cr>
|
||||
|
||||
" my commands
|
||||
command! ReloadConfig so $HOME/.config/nvim/init.vim
|
||||
nnoremap <Leader>rc :ReloadConfig<cr>
|
||||
|
|
@ -0,0 +1,154 @@
|
|||
call plug#begin(stdpath('data') . '/plugged')
|
||||
|
||||
Plug 'dracula/vim', {'name': 'dracula'} " dracula color theme
|
||||
Plug 'preservim/nerdtree'
|
||||
Plug 'Xuyuanp/nerdtree-git-plugin'
|
||||
Plug 'prettier/vim-prettier', { 'do': 'npm install' }
|
||||
Plug 'Yggdroot/indentLine' " indentLine plugin
|
||||
Plug 'stautob/vim-fish' " fish support for vim
|
||||
Plug 'jiangmiao/auto-pairs' " auto insert and del quotes in pairs
|
||||
Plug 'tpope/vim-surround' " quoting and parenthesizing plugin
|
||||
Plug 'preservim/nerdcommenter' " commenting made simple
|
||||
Plug 'vim-airline/vim-airline' " airline plugin for status bar
|
||||
Plug 'mbbill/undotree' " undo tree
|
||||
Plug 'bling/vim-bufferline' " buffer line
|
||||
Plug 'tpope/vim-fugitive'
|
||||
Plug 'ctrlpvim/ctrlp.vim'
|
||||
Plug 'airblade/vim-gitgutter'
|
||||
Plug 'majutsushi/tagbar'
|
||||
Plug 'jreybert/vimagit'
|
||||
Plug 'neoclide/coc.nvim', {'branch': 'release'}
|
||||
Plug 'adelarsq/vim-hackernews'
|
||||
Plug 'laurentgoudet/vim-howdoi'
|
||||
Plug 'wakatime/vim-wakatime' " wakatime for vim
|
||||
|
||||
call plug#end()
|
||||
|
||||
let g:dracula_colorterm = 0
|
||||
colorscheme dracula
|
||||
|
||||
" airline integrations
|
||||
let g:airline#extensions#tagbar#enabled = 1
|
||||
|
||||
" open current dir in nerdtree
|
||||
noremap <Leader>nf :NERDTreeFind<CR>
|
||||
" open nerdtree when openning a dir in vim
|
||||
let NERDTreeWinSize = 20
|
||||
autocmd vimenter * :NERDTree %
|
||||
noremap <Leader>n :NERDTreeToggle %<CR>
|
||||
|
||||
" NerdTree Git plugin
|
||||
let g:NERDTreeGitStatusIndicatorMapCustom = {
|
||||
\ "Modified" : "M",
|
||||
\ "Staged" : "A",
|
||||
\ "Untracked" : "?",
|
||||
\ "Renamed" : "R",
|
||||
\ "Unmerged" : "═",
|
||||
\ "Deleted" : "D",
|
||||
\ "Dirty" : "X",
|
||||
\ "Clean" : "✔︎",
|
||||
\ 'Ignored' : 'i',
|
||||
\ "Unknown" : "??"
|
||||
\ }
|
||||
|
||||
|
||||
" tagbar
|
||||
nnoremap <leader>tt :TagbarToggle<CR>
|
||||
|
||||
" coc-yank
|
||||
nnoremap <silent> <space>y :<C-u>CocList -A --normal yank<cr>
|
||||
|
||||
|
||||
" coc settings
|
||||
|
||||
" Use tab for trigger completion with characters ahead and navigate.
|
||||
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
|
||||
" other plugin before putting this into your config.
|
||||
inoremap <silent><expr> <TAB>
|
||||
\ pumvisible() ? "\<C-n>" :
|
||||
\ <SID>check_back_space() ? "\<TAB>" :
|
||||
\ coc#refresh()
|
||||
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
|
||||
|
||||
function! s:check_back_space() abort
|
||||
let col = col('.') - 1
|
||||
return !col || getline('.')[col - 1] =~# '\s'
|
||||
endfunction
|
||||
|
||||
" Use <c-space> to trigger completion.
|
||||
inoremap <silent><expr> <c-space> coc#refresh()
|
||||
|
||||
" Use <cr> to confirm completion, `<C-g>u` means break undo chain at current
|
||||
" position. Coc only does snippet and additional edit on confirm.
|
||||
" <cr> could be remapped by other vim plugin, try `:verbose imap <CR>`.
|
||||
if exists('*complete_info')
|
||||
inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
|
||||
else
|
||||
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
|
||||
endif
|
||||
|
||||
" Use `[g` and `]g` to navigate diagnostics
|
||||
nmap <silent> [g <Plug>(coc-diagnostic-prev)
|
||||
nmap <silent> ]g <Plug>(coc-diagnostic-next)
|
||||
|
||||
" GoTo code navigation.
|
||||
nmap <silent> gd <Plug>(coc-definition)
|
||||
nmap <silent> gy <Plug>(coc-type-definition)
|
||||
nmap <silent> gi <Plug>(coc-implementation)
|
||||
nmap <silent> gr <Plug>(coc-references)
|
||||
|
||||
" Use K to show documentation in preview window.
|
||||
nnoremap <silent> K :call <SID>show_documentation()<CR>
|
||||
|
||||
function! s:show_documentation()
|
||||
if (index(['vim','help'], &filetype) >= 0)
|
||||
execute 'h '.expand('<cword>')
|
||||
else
|
||||
call CocAction('doHover')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Highlight the symbol and its references when holding the cursor.
|
||||
autocmd CursorHold * silent call CocActionAsync('highlight')
|
||||
|
||||
" Symbol renaming.
|
||||
nmap <F2> <Plug>(coc-rename)
|
||||
|
||||
" Formatting selected code.
|
||||
xmap <leader>f <Plug>(coc-format-selected)
|
||||
nmap <leader>f <Plug>(coc-format-selected)
|
||||
|
||||
|
||||
" Add `:Format` command to format current buffer.
|
||||
command! -nargs=0 Format :call CocAction('format')
|
||||
|
||||
" Add `:Fold` command to fold current buffer.
|
||||
command! -nargs=? Fold :call CocAction('fold', <f-args>)
|
||||
|
||||
" Add `:OR` command for organize imports of the current buffer.
|
||||
command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport')
|
||||
|
||||
" Mappings using CoCList:
|
||||
" Show all diagnostics.
|
||||
nnoremap <silent> <space>a :<C-u>CocList diagnostics<cr>
|
||||
" Manage extensions.
|
||||
nnoremap <silent> <space>e :<C-u>CocList extensions<cr>
|
||||
" Show commands.
|
||||
nnoremap <silent> <space>c :<C-u>CocList commands<cr>
|
||||
" Find symbol of current document.
|
||||
nnoremap <silent> <space>o :<C-u>CocList outline<cr>
|
||||
" Search workspace symbols.
|
||||
nnoremap <silent> <space>s :<C-u>CocList -I symbols<cr>
|
||||
" Do default action for next item.
|
||||
nnoremap <silent> <space>j :<C-u>CocNext<CR>
|
||||
" Do default action for previous item.
|
||||
nnoremap <silent> <space>k :<C-u>CocPrev<CR>
|
||||
" Resume latest coc list.
|
||||
nnoremap <silent> <space>p :<C-u>CocListResume<CR>
|
||||
|
||||
" coc-bookmark
|
||||
nmap <Leader>bj <Plug>(coc-bookmark-next)
|
||||
nmap <Leader>bk <Plug>(coc-bookmark-prev)
|
||||
nmap <Leader>bt <Plug>(coc-bookmark-toggle)
|
||||
nmap <Leader>ba <Plug>(coc-bookmark-annotate)
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
[core]
|
||||
editor = nvim
|
||||
autocrlf = input
|
||||
excludesfile = /home/hedy/.gitignore_global
|
||||
|
||||
[user]
|
||||
name = Hedy Li
|
||||
email = hedyhyry@gmail.com
|
||||
|
||||
[alias]
|
||||
st = status
|
||||
cm = commit
|
||||
br = branch
|
||||
ls-alias = config --get-regexp alias
|
||||
llog = log --oneline
|
||||
sst = status -s
|
||||
ch = checkout
|
||||
chb = checkout -b
|
||||
mylog = log --pretty=format:'%C(yellow)%h %C(bold blue)%an, %C(green)%ar: %C(white)"%s"'
|
||||
lgraph = log --oneline --graph --decorate --all
|
||||
brd = branch -d
|
||||
l = log --oneline
|
||||
fame = !python3 -m gitfame
|
||||
|
||||
[credential]
|
||||
helper = store --file="$HOME/.git_creds"
|
||||
helper = cache --timeout 90000
|
||||
|
||||
[help]
|
||||
autocorrect = 30
|
||||
[pull]
|
||||
rebase = false
|
||||
[sendemail]
|
||||
smtpserver = smtp.gmail.com
|
||||
smtpuser = hedyhyry@gmail.com
|
||||
smtpencryption = tls
|
||||
smtpserverport = 587
|
||||
annotate = yes
|
||||
|
||||
[include]
|
||||
path = ~/.gitconfig-priv
|
|
@ -0,0 +1 @@
|
|||
.vim/
|
|
@ -0,0 +1,30 @@
|
|||
# ~/.profile: executed by the command interpreter for login shells.
|
||||
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
|
||||
# exists.
|
||||
# see /usr/share/doc/bash/examples/startup-files for examples.
|
||||
# the files are located in the bash-doc package.
|
||||
|
||||
# the default umask is set in /etc/profile; for setting the umask
|
||||
# for ssh logins, install and configure the libpam-umask package.
|
||||
#umask 022
|
||||
|
||||
# if running bash
|
||||
if [ -n "$BASH_VERSION" ]; then
|
||||
# include .bashrc if it exists
|
||||
if [ -f "$HOME/.bashrc" ]; then
|
||||
. "$HOME/.bashrc"
|
||||
fi
|
||||
fi
|
||||
|
||||
# set PATH so it includes user's private bin if it exists
|
||||
if [ -d "$HOME/bin" ] ; then
|
||||
PATH="$HOME/bin:$PATH"
|
||||
fi
|
||||
|
||||
# set PATH so it includes user's private bin if it exists
|
||||
if [ -d "$HOME/.local/bin" ] ; then
|
||||
PATH="$HOME/.local/bin:$PATH"
|
||||
fi
|
||||
eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
|
||||
|
||||
export PATH="$HOME/.cargo/bin:$PATH"
|
|
@ -0,0 +1,183 @@
|
|||
set nocompatible
|
||||
|
||||
""""""""""""""""
|
||||
" Vundle Plugins
|
||||
""""""""""""""""
|
||||
filetype off
|
||||
set rtp+=~/.vim/bundle/Vundle.vim
|
||||
call vundle#begin()
|
||||
|
||||
Plugin 'VundleVim/Vundle.vim'
|
||||
Plugin 'dracula/vim', {'name': 'dracula'} " dracula color theme
|
||||
Plugin 'stautob/vim-fish' " fish support for vim
|
||||
Plugin 'jiangmiao/auto-pairs' " auto insert and del quotes in pairs
|
||||
Plugin 'tpope/vim-surround' " quoting and parenthesizing plugin
|
||||
Plugin 'preservim/nerdcommenter' " commenting made simple
|
||||
Plugin 'bling/vim-bufferline' " buffer line
|
||||
Plugin 'preservim/nerdtree' " NERDTree :)
|
||||
|
||||
|
||||
|
||||
call vundle#end()
|
||||
filetype plugin indent on
|
||||
" Brief help
|
||||
" :PluginList - lists configured plugins
|
||||
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
|
||||
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
|
||||
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
|
||||
" see :h vundle for more details or wiki for FAQ
|
||||
|
||||
" end of vundle stuff
|
||||
|
||||
|
||||
""""""""""""""""""
|
||||
" General settings
|
||||
""""""""""""""""""
|
||||
colorscheme dracula
|
||||
|
||||
let mapleader=";" " setting leader key to ';'
|
||||
set number
|
||||
syntax on
|
||||
set mouse=a " allow mouse for all
|
||||
set undofile " save undo to a file
|
||||
set hlsearch " highlight search
|
||||
set showcmd " show incomplete commands
|
||||
set wildmenu " command line's tab complete in a menu
|
||||
set cursorline " highlight cursor line
|
||||
set noerrorbells " no beeps
|
||||
set visualbell " flash screen instead
|
||||
set title " set window title to file name
|
||||
set autoindent
|
||||
set softtabstop=2 " indent by 2 spaces when with tab
|
||||
set tabstop=4 " show existing tab with 4 spaces width
|
||||
set shiftwidth=4
|
||||
set wrap " dont wrap
|
||||
set incsearch " find next match while typing search
|
||||
set linebreak " wrap lines at convenient points
|
||||
set scrolloff=6 " screen lines to keep above and below cursor
|
||||
set sidescrolloff=8 " screen columns to keep on left and right of cursor
|
||||
set confirm " display confirmation when closing unsaved file
|
||||
set encoding=utf-8 " set encoding with Unicode
|
||||
set lazyredraw " don't redraw when exe macros
|
||||
set showmatch " match brackets when text indecator is over it
|
||||
set mat=2 " how mny tenths of second to blink when matching brackets
|
||||
|
||||
set laststatus=2 " show status line
|
||||
set statusline=%F%m%r%h%w%=(%{&ff}/%Y)\ (line\ %l\/%L\ \|\ col\ %c)
|
||||
|
||||
" Configure backspace so it acts as it should act
|
||||
set backspace=eol,start,indent
|
||||
set whichwrap+=<,>,h,l
|
||||
|
||||
" fold settings
|
||||
set foldenable
|
||||
set foldlevelstart=10
|
||||
set foldnestmax=10
|
||||
set foldmethod=manual
|
||||
set foldcolumn=2
|
||||
|
||||
|
||||
"set the swp, backup and undo settings
|
||||
set noswapfile
|
||||
set nobackup nowritebackup
|
||||
set undodir=~/.vim/undodir
|
||||
set undofile
|
||||
|
||||
" Ignore compiled files
|
||||
set wildignore=*.o,*~,*.pyc
|
||||
if has("win16") || has("win32")
|
||||
set wildignore+=.git\*,.hg\*,.svn\*
|
||||
else
|
||||
set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store
|
||||
endif
|
||||
|
||||
" Return to last edit position when opening files (You want this!)
|
||||
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
|
||||
|
||||
" highlight extra whitespace
|
||||
match ErrorMsg '\s\+$'
|
||||
|
||||
"""""""""""
|
||||
" Mappings
|
||||
""""""""""
|
||||
" enabling clipboard syncing in WSL
|
||||
source $HOME/iswsl.vim
|
||||
if IsWSL()
|
||||
let s:clip = '/mnt/c/Windows/System32/clip.exe'
|
||||
if executable(s:clip)
|
||||
augroup WSLYank
|
||||
autocmd!
|
||||
autocmd TextYankPost * call system('echo '.shellescape(join(v:event.regcontents, "\<CR>")).' | '.s:clip)
|
||||
augroup END
|
||||
end
|
||||
map <silent> "=p :r !powershell.exe -Command Get-Clipboard<CR>
|
||||
map! <silent> <C-r>= :r !powershell.exe -Command Get-Clipboard<CR>
|
||||
noremap "+p :exe 'norm a'.system('/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -Command Get-Clipboard')<CR>
|
||||
endif
|
||||
|
||||
" leader mappings
|
||||
nnoremap <Leader>rn :set relativenumber!<CR>
|
||||
nnoremap <Leader>z zR
|
||||
nnoremap <Leader>w :w<CR>
|
||||
nnoremap <Leader>x :wqa<CR>
|
||||
nnoremap <Leader>q :qa<CR>
|
||||
noremap <Leader>n :NERDTreeToggle %<CR>
|
||||
" no highlight - when finished search
|
||||
nnoremap <Leader>nh :noh<CR>
|
||||
" paste shortcut below
|
||||
" must be recursive bcus "+p is aldy mapped above (in WSLYank - paste)
|
||||
nmap <Leader>pa "+p
|
||||
nnoremap <Leader>rg :registers<CR>
|
||||
|
||||
" other mappings
|
||||
" dot command in visual mode
|
||||
vnoremap . :normal.<CR>
|
||||
nnoremap Q :q<CR>
|
||||
" move visual selection
|
||||
vnoremap J :m '>+1<CR>gv=gv
|
||||
vnoremap K :m '<-2<CR>gv=gv
|
||||
|
||||
if IsWSL()
|
||||
execute "set <A-j>=\ej"
|
||||
execute "set <A-k>=\ek"
|
||||
execute "set <A-J>=\eJ"
|
||||
execute "set <A-K>=\eK"
|
||||
endif
|
||||
|
||||
nnoremap <A-j> :m+1<CR>==
|
||||
nnoremap <A-k> :m-2<CR>==
|
||||
|
||||
nnoremap <A-J> :t.<CR>==
|
||||
nnoremap <A-K> :t.-1<CR>==
|
||||
|
||||
" Visual mode pressing * or # searches for the current selection
|
||||
" Super useful! From an idea by Michael Naumann
|
||||
vnoremap <silent> * :<C-u>call VisualSelection('', '')<CR>/<C-R>=@/<CR><CR>
|
||||
vnoremap <silent> # :<C-u>call VisualSelection('', '')<CR>?<C-R>=@/<CR><CR>"
|
||||
|
||||
" Smart way to move between windows
|
||||
map <C-j> <C-W>j
|
||||
map <C-k> <C-W>k
|
||||
map <C-h> <C-W>h
|
||||
map <C-l> <C-W>l
|
||||
|
||||
" Useful mappings for managing tabs
|
||||
map <leader>tn :tabnew<cr>
|
||||
map <leader>to :tabonly<cr>
|
||||
map <leader>tc :tabclose<cr>
|
||||
map <leader>tm :tabmove
|
||||
map <leader>t<leader> :tabnext
|
||||
map <leader>bn :bnext<cr>
|
||||
map <leader>bp :bprev<cr>
|
||||
|
||||
noremap <Leader>n :NERDTreeToggle %<CR>
|
||||
|
||||
|
||||
""""""""""""""""
|
||||
" other settings
|
||||
""""""""""""""""
|
||||
" setting the shell for fish to sh
|
||||
"if &shell =~# 'fish$'
|
||||
" set shell=bash
|
||||
"endif
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
# dotfiles
|
||||
Welcome, these are for Ubuntu/Debian and WSL
|
|
@ -0,0 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
# my own copy script
|
||||
|
||||
echo '$1' > ~/clipped.txt
|
||||
echo $1 | clip.exe
|
||||
|
||||
exit 0
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
#!/bin/bash
|
||||
|
||||
# my own paste from clipboard script
|
||||
|
||||
powershell.exe Get-Clipboard | sed 's/\r$//' | sed -z '$ s/\n$//' > ~/clipped.txt
|
||||
|
||||
cat ~/clipped.txt
|
||||
|
||||
exit 0
|
||||
|
|
@ -0,0 +1,297 @@
|
|||
#!/usr/bin/env bash
|
||||
## source: https://github.com/kdabir/has
|
||||
|
||||
## To add more tools, search for "__detect" function in this file
|
||||
|
||||
## Important so that version is not extracted for failed commands (not found)
|
||||
set -o pipefail
|
||||
|
||||
readonly BINARY_NAME="has"
|
||||
readonly VERSION="v1.5.0"
|
||||
|
||||
## constants - symbols for success failure
|
||||
if [[ -z $TERM ]]; then
|
||||
$TERM="xterm"
|
||||
fi
|
||||
readonly txtreset="$(tput -T $TERM sgr0)"
|
||||
readonly txtbold="$(tput -T $TERM bold)"
|
||||
readonly txtblack="$(tput -T $TERM setaf 0)"
|
||||
readonly txtred="$(tput -T $TERM setaf 1)"
|
||||
readonly txtgreen="$(tput -T $TERM setaf 2)"
|
||||
readonly txtyellow="$(tput -T $TERM setaf 3)"
|
||||
readonly txtblue="$(tput -T $TERM setaf 4)"
|
||||
readonly txtpurple="$(tput -T $TERM setaf 5)"
|
||||
readonly txtcyan="$(tput -T $TERM setaf 6)"
|
||||
readonly txtwhite="$(tput -T $TERM setaf 7)"
|
||||
# unicode "✗"
|
||||
readonly fancyx='\342\234\227'
|
||||
# unicode "✓"
|
||||
readonly checkmark='\342\234\223'
|
||||
# PASS="\e[1m\e[38;5;2m✔\e[m"
|
||||
# FAIL="\e[1m\e[38;5;1m✘\e[m"
|
||||
readonly PASS="${txtbold}${txtgreen}${checkmark}${txtreset}"
|
||||
readonly FAIL="${txtbold}${txtred}${fancyx}${txtreset}"
|
||||
|
||||
## These variables are used to keep track of passed and failed commands
|
||||
OK=0
|
||||
KO=0
|
||||
|
||||
## Regex to extract simple version - extracts numeric sem-ver style versions
|
||||
REGEX_SIMPLE_VERSION="([[:digit:]]+\.?){2,3}"
|
||||
|
||||
## name of RC file that can contain list of tools to be checked
|
||||
RC_FILE=".hasrc"
|
||||
|
||||
# try to extract version by executing "${1}" with "${2}" arg
|
||||
# command name to be executed is dynamically passed to this function as ${1}
|
||||
# arg to ${1} is passed in ${2}
|
||||
__dynamic_detect(){
|
||||
cmd="${1}"
|
||||
params="${2}"
|
||||
version=$( eval "${cmd}" "${params}" "2>&1" | grep -Eo "${REGEX_SIMPLE_VERSION}" | head -1)
|
||||
status=$?
|
||||
}
|
||||
|
||||
# commands that use `--version` flag
|
||||
__dynamic_detect--version(){
|
||||
__dynamic_detect "${1}" "--version"
|
||||
}
|
||||
|
||||
# commands that use `-version` flag
|
||||
__dynamic_detect-version(){
|
||||
__dynamic_detect "${1}" "-version"
|
||||
}
|
||||
|
||||
# commands that use `-v` flag
|
||||
__dynamic_detect-v(){
|
||||
__dynamic_detect "${1}" "-v"
|
||||
}
|
||||
|
||||
# commands that use `-V` flag
|
||||
__dynamic_detect-V(){
|
||||
__dynamic_detect "${1}" "-V"
|
||||
}
|
||||
|
||||
# commands that use `version` argument
|
||||
__dynamic_detect-arg_version(){
|
||||
__dynamic_detect "${1}" "version"
|
||||
}
|
||||
|
||||
## the main function
|
||||
__detect(){
|
||||
name="${1}"
|
||||
|
||||
# setup aliases - maps commonly used name to exact command name
|
||||
case ${name} in
|
||||
golang ) command="go" ;;
|
||||
jre ) command="java" ;;
|
||||
jdk ) command="javac" ;;
|
||||
nodejs ) command="node" ;;
|
||||
goreplay ) command="gor" ;;
|
||||
httpie ) command="http" ;;
|
||||
homebrew ) command="brew" ;;
|
||||
awsebcli ) command="eb" ;;
|
||||
awscli ) command="aws" ;;
|
||||
postgresql ) command="psql" ;;
|
||||
*coreutils|linux*utils) command="gnu_coreutils" ;;
|
||||
* ) command=${name} ;;
|
||||
esac
|
||||
|
||||
case "${command}" in
|
||||
|
||||
# commands that need --version flag
|
||||
|
||||
## Shells
|
||||
bash|zsh) __dynamic_detect--version "${command}" ;;
|
||||
|
||||
## VCS
|
||||
git|hg|svn|bzr) __dynamic_detect--version "${command}" ;;
|
||||
|
||||
## Http
|
||||
curl|wget|http) __dynamic_detect--version "${command}" ;;
|
||||
|
||||
## Editors
|
||||
vim|emacs|nano) __dynamic_detect--version "${command}" ;;
|
||||
subl|code) __dynamic_detect--version "${command}" ;;
|
||||
|
||||
## File system search and navigation
|
||||
jq) __dynamic_detect--version "${command}" ;;
|
||||
ag|ack|rg) __dynamic_detect--version "${command}" ;;
|
||||
tree|autojump) __dynamic_detect--version "${command}" ;;
|
||||
|
||||
## package mangers
|
||||
apt|apt-get|aptitude) __dynamic_detect--version "${command}" ;;
|
||||
brew) __dynamic_detect--version "${command}" ;;
|
||||
|
||||
## System tools
|
||||
sed|awk|grep|file|sudo) __dynamic_detect--version "${command}" ;;
|
||||
gzip|xz|unar|bzip2) __dynamic_detect--version "${command}" ;;
|
||||
tar|pv) __dynamic_detect--version "${command}" ;;
|
||||
|
||||
# Container runtimes
|
||||
docker|podman) __dynamic_detect--version "${command}" ;;
|
||||
|
||||
## Database CLI
|
||||
psql) __dynamic_detect--version "${command}" ;;
|
||||
|
||||
## Scripting Language / runtime
|
||||
ruby|R|python|python3) __dynamic_detect--version "${command}" ;;
|
||||
perl|perl6|php|php5) __dynamic_detect--version "${command}" ;;
|
||||
groovy|node) __dynamic_detect--version "${command}" ;;
|
||||
|
||||
## Compile
|
||||
gcc|make|bats) __dynamic_detect--version "${command}" ;;
|
||||
|
||||
## Build tools
|
||||
lein|gradle|mvn) __dynamic_detect--version "${command}" ;;
|
||||
grunt|brunch) __dynamic_detect--version "${command}" ;;
|
||||
gem|rake|bundle) __dynamic_detect--version "${command}" ;;
|
||||
npm|yarn) __dynamic_detect--version "${command}" ;;
|
||||
|
||||
|
||||
## Cloud Tools
|
||||
aws|eb|sls|gcloud) __dynamic_detect--version "${command}" ;;
|
||||
heroku) __dynamic_detect--version "${command}" ;;
|
||||
netlify) __dynamic_detect--version "${command}" ;;
|
||||
netlifyctl) __dynamic_detect-arg_version "${command}" ;;
|
||||
|
||||
## Hashicorp Tools
|
||||
terraform|packer) __dynamic_detect--version "${command}" ;;
|
||||
vagrant|consul) __dynamic_detect--version "${command}" ;;
|
||||
nomad) __dynamic_detect--version "${command}" ;;
|
||||
|
||||
# commands that need -v flag
|
||||
unzip) __dynamic_detect-v "${command}" ;;
|
||||
|
||||
# commands that need -V flag
|
||||
ab) __dynamic_detect-V "${command}" ;;
|
||||
|
||||
# commands that need -version flag
|
||||
ant) __dynamic_detect-version "${command}" ;;
|
||||
java|javac|scala|kotlin) __dynamic_detect-version "${command}" ;;
|
||||
|
||||
# commands that need version arg
|
||||
go|hugo) __dynamic_detect-arg_version "${command}" ;;
|
||||
|
||||
## Example of commands that need custom processing
|
||||
|
||||
## TODO cleanup, currently need to add extra space in regex, otherwise the time gets selected
|
||||
gulp)
|
||||
version=$( gulp --version 2>&1| grep -Eo " ${REGEX_SIMPLE_VERSION}" | head -1)
|
||||
status=$?
|
||||
;;
|
||||
|
||||
## gor returns version but does not return normal status code, hence needs custom processing
|
||||
gor)
|
||||
version=$( gor version 2>&1 | grep -Eo "${REGEX_SIMPLE_VERSION}" | head -1)
|
||||
if [ $? -eq 1 ]; then status=0; else status=127; fi
|
||||
;;
|
||||
|
||||
sbt)
|
||||
version=$( sbt about 2>&1 | grep -Eo "([[:digit:]]{1,4}\.){2}[[:digit:]]{1,4}" | head -1)
|
||||
status=$?
|
||||
;;
|
||||
|
||||
## use 'readlink' to test for GNU coreutils
|
||||
# readlink (GNU coreutils) 8.28
|
||||
gnu_coreutils) __dynamic_detect--version readlink ;;
|
||||
|
||||
## hub uses --version but version string is on second line, or third if HUB_VERBOSE set
|
||||
hub)
|
||||
version=$( HUB_VERBOSE='' hub --version 2>&1 | sed -n 2p | grep -Eo "${REGEX_SIMPLE_VERSION}" | head -1)
|
||||
status=$?
|
||||
;;
|
||||
|
||||
## zip uses -v but version string is on second line
|
||||
zip)
|
||||
version=$( zip -v 2>&1 | sed -n 2p | grep -Eo "${REGEX_SIMPLE_VERSION}" | head -1)
|
||||
status=$?
|
||||
;;
|
||||
|
||||
has)
|
||||
version=$( has 2>&1 | grep -Eo "${REGEX_SIMPLE_VERSION}" | head -1)
|
||||
status=$?
|
||||
;;
|
||||
|
||||
*)
|
||||
## Can allow dynamic checking here, i.e. checking commands that are not listed above
|
||||
if [[ "${HAS_ALLOW_UNSAFE}" == "y" ]]; then
|
||||
__dynamic_detect--version "${command}"
|
||||
## fallback checking based on status!=127 (127 means command not found)
|
||||
## TODO can check other type of supported version-checks if status was not 127
|
||||
else
|
||||
## -1 is special way to tell command is not supported/whitelisted by `has`
|
||||
status="-1"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "$status" -eq "-1" ]; then ## When unsafe processing is not allowed, the -1 signifies
|
||||
printf '%b %s not understood\n' "${FAIL}" "${command}" > "$OUTPUT"
|
||||
KO=$(( KO+1 ))
|
||||
|
||||
elif [ ${status} -eq 127 ]; then ## command not installed
|
||||
printf '%b %s\n' "${FAIL}" "${command}" > "$OUTPUT"
|
||||
KO=$(( KO+1 ))
|
||||
|
||||
elif [ ${status} -eq 0 ] || [ ${status} -eq 141 ]; then ## successfully executed
|
||||
printf "%b %s %b\n" "${PASS}" "${command}" "${txtbold}${txtyellow}${version}${txtreset}" > "$OUTPUT"
|
||||
OK=$(( OK+1 ))
|
||||
|
||||
else ## as long as its not 127, command is there, but we might not have been able to extract version
|
||||
printf '%b %s\n' "${PASS}" "${command}" > "$OUTPUT"
|
||||
OK=$(( OK+1 ))
|
||||
fi
|
||||
} #end __detect
|
||||
|
||||
OPTIND=1
|
||||
OUTPUT=/dev/stdout
|
||||
|
||||
while getopts "q" opt; do
|
||||
case "$opt" in
|
||||
q) QUIET="true"
|
||||
OUTPUT=/dev/null
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
shift $((OPTIND-1))
|
||||
|
||||
if [ -s "${RC_FILE}" ]; then
|
||||
HASRC="true"
|
||||
fi
|
||||
|
||||
# if HASRC is not set AND no arguments passed to script
|
||||
if [[ -z "${HASRC}" ]] && [ "$#" -eq 0 ]; then
|
||||
# print help
|
||||
printf '%s %s\n' "${BINARY_NAME}" "${VERSION}" > "$OUTPUT"
|
||||
printf 'USAGE:\t %s [-q] <command-names>..\n' "${BINARY_NAME}" > "$OUTPUT"
|
||||
printf 'EXAMPLE: %s git curl node\n' "${BINARY_NAME}" > "$OUTPUT"
|
||||
|
||||
else
|
||||
# for each cli-arg
|
||||
for cmd in "$@"; do
|
||||
__detect "${cmd}"
|
||||
done
|
||||
|
||||
## display found / total
|
||||
# echo ${OK} / $(($OK+$KO))
|
||||
|
||||
## if HASRC has been set
|
||||
if [[ -n "${HASRC}" ]]; then
|
||||
## for all
|
||||
while read -r line; do
|
||||
__detect "${line}"
|
||||
done <<<"$( grep -Ev "^\s*(#|$)" "${RC_FILE}" )"
|
||||
fi
|
||||
|
||||
## max status code that can be returned
|
||||
MAX_STATUS_CODE=126
|
||||
|
||||
if [[ "${KO}" -gt "${MAX_STATUS_CODE}" ]]; then
|
||||
exit "${MAX_STATUS_CODE}"
|
||||
else
|
||||
exit "${KO}"
|
||||
fi
|
||||
|
||||
fi
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/bash
|
||||
|
||||
# the pbcopy script
|
||||
|
||||
tee | clip.exe
|
||||
|
||||
exit 0
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/bash
|
||||
|
||||
# the pbpaste script
|
||||
|
||||
powershell.exe Get-Clipboard | sed 's/\r$//' | sed -z '$ s/\n$//'
|
||||
|
||||
exit 0
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
#!/usr/bin/python3
|
||||
print('Hello! ')
|
Loading…
Reference in New Issue