Update zshrc files
This commit is contained in:
		
							parent
							
								
									66897bdbdc
								
							
						
					
					
						commit
						463ec25767
					
				| 
						 | 
					@ -1,27 +1,33 @@
 | 
				
			||||||
#!/bin/zsh
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export p=~/Dropbox/projects
 | 
					export p=~/Dropbox/projects
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					alias -g ...="../.."
 | 
				
			||||||
 | 
					alias -g ....="../../.."
 | 
				
			||||||
 | 
					alias -g .....="../../../.."
 | 
				
			||||||
 | 
					
 | 
				
			||||||
alias q=exit
 | 
					alias q=exit
 | 
				
			||||||
alias clr=clear
 | 
					alias clr=clear
 | 
				
			||||||
alias sudo='sudo '
 | 
					alias sudo='sudo '
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Homebrew
 | 
					 | 
				
			||||||
alias br='brew'
 | 
					 | 
				
			||||||
alias bru='brew update && brew upgrade --all'
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Tools
 | 
					# Tools
 | 
				
			||||||
alias codekit='open -a CodeKit'
 | 
					 | 
				
			||||||
alias ag='nocorrect noglob ag'
 | 
					alias ag='nocorrect noglob ag'
 | 
				
			||||||
alias ls="ls -G"
 | 
					 | 
				
			||||||
alias l="ls -l"
 | 
					alias l="ls -l"
 | 
				
			||||||
alias ll="ls -l"
 | 
					alias ll="ls -1"
 | 
				
			||||||
 | 
					alias la="ls -la"
 | 
				
			||||||
alias ln="ln -v"                    # Verbose ln
 | 
					alias ln="ln -v"                    # Verbose ln
 | 
				
			||||||
alias wget='wget -c'                # Resume dl if possible
 | 
					alias wget='wget -c'                # Resume dl if possible
 | 
				
			||||||
alias rsyncd='rsync -va --delete'   # Hard sync two directories
 | 
					alias rsyncd='rsync -va --delete'   # Hard sync two directories
 | 
				
			||||||
zman() { PAGER="less -g -s '+/^       "$1"'" man zshall; }
 | 
					zman() { PAGER="less -g -s '+/^       "$1"'" man zshall; }
 | 
				
			||||||
mkd()  { mkdir "$1" && cd "$1"; }
 | 
					mkd()  { mkdir "$1" && cd "$1"; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					j() {
 | 
				
			||||||
 | 
					  local fasd_ret="$(fasd -i -d "$@")"
 | 
				
			||||||
 | 
					  if [[ -d "$fasd_ret" ]]; then
 | 
				
			||||||
 | 
					    cd "$fasd_ret"
 | 
				
			||||||
 | 
					  else
 | 
				
			||||||
 | 
					    print "$fasd_ret"
 | 
				
			||||||
 | 
					  fi
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# transmission-remote
 | 
					# transmission-remote
 | 
				
			||||||
if is-callable 'transmission-remote'; then
 | 
					if is-callable 'transmission-remote'; then
 | 
				
			||||||
    alias bt='transmission-remote server'
 | 
					    alias bt='transmission-remote server'
 | 
				
			||||||
| 
						 | 
					@ -43,12 +49,8 @@ if is-callable 'transmission-remote'; then
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Editors
 | 
					# Editors
 | 
				
			||||||
v() { [ $# -eq 0 ] && vim . || vim $@ }
 | 
					v() { vim ${@:-.}; }             # Open in vim
 | 
				
			||||||
e() { # emacs
 | 
					e() { emacsclient -n ${@:-.}; }  # Open in emacs (daemon)
 | 
				
			||||||
    local input
 | 
					 | 
				
			||||||
    [ ! $# -eq 0 ] && input=$@
 | 
					 | 
				
			||||||
    emacsclient -n ${input:-.}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
ee() { # emacs in project root
 | 
					ee() { # emacs in project root
 | 
				
			||||||
    if git root 2>/dev/null; then
 | 
					    if git root 2>/dev/null; then
 | 
				
			||||||
        e "$(git rev-parse --show-toplevel)"
 | 
					        e "$(git rev-parse --show-toplevel)"
 | 
				
			||||||
| 
						 | 
					@ -68,9 +70,6 @@ alias b='bundle'
 | 
				
			||||||
alias be='bundle exec'
 | 
					alias be='bundle exec'
 | 
				
			||||||
alias bi='bundle install -path vendor'
 | 
					alias bi='bundle install -path vendor'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
alias c11='clang++ -std=c++11 -stdlib=libc++'
 | 
					 | 
				
			||||||
alias eclimd='/Applications/eclipse/eclimd'
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Build tools
 | 
					# Build tools
 | 
				
			||||||
alias rk='noglob rake'
 | 
					alias rk='noglob rake'
 | 
				
			||||||
alias rkg='noglob rake -g'
 | 
					alias rkg='noglob rake -g'
 | 
				
			||||||
| 
						 | 
					@ -82,9 +81,11 @@ g() { [ $# -eq 0 ] && git status --short || git $* }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
alias gi='git init'
 | 
					alias gi='git init'
 | 
				
			||||||
alias gs='git status'
 | 
					alias gs='git status'
 | 
				
			||||||
 | 
					alias gsu='git submodule'
 | 
				
			||||||
alias gco='git checkout'
 | 
					alias gco='git checkout'
 | 
				
			||||||
alias gc='git commit'
 | 
					alias gc='git commit'
 | 
				
			||||||
alias gcm='noglob git commit -m'
 | 
					alias gcm='noglob git commit -m'
 | 
				
			||||||
 | 
					alias gcam='noglob git commit --amend -m'
 | 
				
			||||||
alias gd='git diff'
 | 
					alias gd='git diff'
 | 
				
			||||||
alias gp='git push'
 | 
					alias gp='git push'
 | 
				
			||||||
alias gl='git pull'
 | 
					alias gl='git pull'
 | 
				
			||||||
| 
						 | 
					@ -93,6 +94,7 @@ alias ge='git exec'
 | 
				
			||||||
alias gb='git branch'
 | 
					alias gb='git branch'
 | 
				
			||||||
alias gap='git add --patch'
 | 
					alias gap='git add --patch'
 | 
				
			||||||
alias gr='git reset "HEAD^"'
 | 
					alias gr='git reset "HEAD^"'
 | 
				
			||||||
 | 
					alias gre='git remote'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Tmux
 | 
					# Tmux
 | 
				
			||||||
if is-callable 'tmux'; then
 | 
					if is-callable 'tmux'; then
 | 
				
			||||||
| 
						 | 
					@ -107,3 +109,35 @@ if is-callable 'tmux'; then
 | 
				
			||||||
    # New instance attached to old session
 | 
					    # New instance attached to old session
 | 
				
			||||||
    alias tn='tmux new-session -t $(hostname)'
 | 
					    alias tn='tmux new-session -t $(hostname)'
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if is-mac; then
 | 
				
			||||||
 | 
					    alias o='open'
 | 
				
			||||||
 | 
					    alias ls="ls -G"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    alias c11='clang++ -std=c++11 -stdlib=libc++'
 | 
				
			||||||
 | 
					    alias eclimd='/Applications/eclipse/eclimd'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Homebrew
 | 
				
			||||||
 | 
					    alias br='brew'
 | 
				
			||||||
 | 
					    alias bru='brew update && brew upgrade --all'
 | 
				
			||||||
 | 
					    alias brc='brew cask'
 | 
				
			||||||
 | 
					    alias codekit='open -a CodeKit'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Quicklook
 | 
				
			||||||
 | 
					    ql() { (( $# > 0 )) && qlmanage -p "$@" &> /dev/null; }
 | 
				
			||||||
 | 
					elif is-cygwin; then
 | 
				
			||||||
 | 
					    alias o='cygstart'
 | 
				
			||||||
 | 
					    alias pbcopy='tee > /dev/clipboard'
 | 
				
			||||||
 | 
					    alias pbpaste='cat /dev/clipboard'
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
					    alias o='xdg-open'
 | 
				
			||||||
 | 
					    alias ls="ls --color=auto"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (( $+commands[xclip] )); then
 | 
				
			||||||
 | 
					        alias pbcopy='xclip -selection clipboard -in'
 | 
				
			||||||
 | 
					        alias pbpaste='xclip -selection clipboard -out'
 | 
				
			||||||
 | 
					    elif (( $+commands[xsel] )); then
 | 
				
			||||||
 | 
					        alias pbcopy='xsel --clipboard --input'
 | 
				
			||||||
 | 
					        alias pbpaste='xsel --clipboard --output'
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										28
									
								
								zsh/functions.zsh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								zsh/functions.zsh
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,28 @@
 | 
				
			||||||
 | 
					is-callable() {
 | 
				
			||||||
 | 
					    (( $+commands[$1] )) || (( $+functions[$1] )) || (( $+aliases[$1] ))
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					cache() {
 | 
				
			||||||
 | 
					    is-callable "$1" || return 1
 | 
				
			||||||
 | 
					    local cache="$HOME/.zsh/cache/$1-cache"
 | 
				
			||||||
 | 
					    if [ ! -s "$cache" ]; then
 | 
				
			||||||
 | 
					        echo "Caching $1"
 | 
				
			||||||
 | 
					        $@ >| "$cache" 2> /dev/null
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					    source $cache
 | 
				
			||||||
 | 
					    unset cache
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					is-mac() {
 | 
				
			||||||
 | 
					    [[ "$OSTYPE" == "darwin"* ]]
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					is-deb() {
 | 
				
			||||||
 | 
					    [[ "$OSTYPE" == "linux-gnu" ]]
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					is-cygwin() {
 | 
				
			||||||
 | 
					    [[ "$OSTYPE" == "cygwin"* ]]
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					fpath=("${0:h}/functions" $fpath)
 | 
				
			||||||
							
								
								
									
										13
									
								
								zsh/functions/_lsarchive
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										13
									
								
								zsh/functions/_lsarchive
									
									
									
									
									
										Executable file
									
								
							| 
						 | 
					@ -0,0 +1,13 @@
 | 
				
			||||||
 | 
					#compdef lsarchive
 | 
				
			||||||
 | 
					#autoload
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# Completes lsarchive.
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# Authors:
 | 
				
			||||||
 | 
					#   Sorin Ionescu <sorin.ionescu@gmail.com>
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					_arguments \
 | 
				
			||||||
 | 
					  '(-v --verbose)'{-v,--remove}'[verbose archive listing]' \
 | 
				
			||||||
 | 
					  "*::archive file:_files -g '(#i)*.(tar|tgz|tbz|tbz2|txz|tlz|gz|bz2|xz|lzma|Z|zip|rar|7z)(-.)'" && return 0
 | 
				
			||||||
							
								
								
									
										13
									
								
								zsh/functions/_unarchive
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										13
									
								
								zsh/functions/_unarchive
									
									
									
									
									
										Executable file
									
								
							| 
						 | 
					@ -0,0 +1,13 @@
 | 
				
			||||||
 | 
					#compdef unarchive
 | 
				
			||||||
 | 
					#autoload
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# Completes unarchive.
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# Authors:
 | 
				
			||||||
 | 
					#   Sorin Ionescu <sorin.ionescu@gmail.com>
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					_arguments \
 | 
				
			||||||
 | 
					  '(-r --remove)'{-r,--remove}'[remove archive]' \
 | 
				
			||||||
 | 
					  "*::archive file:_files -g '(#i)*.(tar|tgz|tbz|tbz2|txz|tlz|gz|bz2|xz|lzma|Z|zip|rar|7z|deb)(-.)'" && return 0
 | 
				
			||||||
							
								
								
									
										55
									
								
								zsh/functions/lsarchive
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										55
									
								
								zsh/functions/lsarchive
									
									
									
									
									
										Executable file
									
								
							| 
						 | 
					@ -0,0 +1,55 @@
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# Lists the contents of archives.
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# Authors:
 | 
				
			||||||
 | 
					#   Sorin Ionescu <sorin.ionescu@gmail.com>
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					local verbose
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (( $# == 0 )); then
 | 
				
			||||||
 | 
					  cat >&2 <<EOF
 | 
				
			||||||
 | 
					usage: $0 [-option] [file ...]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					options:
 | 
				
			||||||
 | 
					    -v, --verbose    verbose archive listing
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Report bugs to <sorin.ionescu@gmail.com>.
 | 
				
			||||||
 | 
					EOF
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if [[ "$1" == "-v" || "$1" == "--verbose" ]]; then
 | 
				
			||||||
 | 
					  verbose=0
 | 
				
			||||||
 | 
					  shift
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					while (( $# > 0 )); do
 | 
				
			||||||
 | 
					  if [[ ! -s "$1" ]]; then
 | 
				
			||||||
 | 
					    print "$0: file not valid: $1" >&2
 | 
				
			||||||
 | 
					    shift
 | 
				
			||||||
 | 
					    continue
 | 
				
			||||||
 | 
					  fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  case "$1:l" in
 | 
				
			||||||
 | 
					    (*.tar.gz|*.tgz) tar t${verbose:+v}vzf "$1" ;;
 | 
				
			||||||
 | 
					    (*.tar.bz2|*.tbz|*.tbz2) tar t${verbose:+v}jf "$1" ;;
 | 
				
			||||||
 | 
					    (*.tar.xz|*.txz) tar --xz --help &> /dev/null \
 | 
				
			||||||
 | 
					      && tar --xz -t${verbose:+v}f "$1" \
 | 
				
			||||||
 | 
					      || xzcat "$1" | tar t${verbose:+v}f - ;;
 | 
				
			||||||
 | 
					    (*.tar.zma|*.tlz) tar --lzma --help &> /dev/null \
 | 
				
			||||||
 | 
					      && tar --lzma -t${verbose:+v}f "$1" \
 | 
				
			||||||
 | 
					      || lzcat "$1" | tar x${verbose:+v}f - ;;
 | 
				
			||||||
 | 
					    (*.tar) tar t${verbose:+v}f "$1" ;;
 | 
				
			||||||
 | 
					    (*.zip) unzip -l${verbose:+v} "$1" ;;
 | 
				
			||||||
 | 
					    (*.rar) unrar &> /dev/null \
 | 
				
			||||||
 | 
					      && unrar ${${verbose:+v}:-l} "$1" \
 | 
				
			||||||
 | 
					      || rar ${${verbose:+v}:-l} "$1" ;;
 | 
				
			||||||
 | 
					    (*.7z) 7za l "$1" ;;
 | 
				
			||||||
 | 
					    (*)
 | 
				
			||||||
 | 
					      print "$0: cannot list: $1" >&2
 | 
				
			||||||
 | 
					      success=1
 | 
				
			||||||
 | 
					    ;;
 | 
				
			||||||
 | 
					  esac
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  shift
 | 
				
			||||||
 | 
					done
 | 
				
			||||||
							
								
								
									
										78
									
								
								zsh/functions/unarchive
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										78
									
								
								zsh/functions/unarchive
									
									
									
									
									
										Executable file
									
								
							| 
						 | 
					@ -0,0 +1,78 @@
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# Extracts the contents of archives.
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# Authors:
 | 
				
			||||||
 | 
					#   Sorin Ionescu <sorin.ionescu@gmail.com>
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					local remove_archive
 | 
				
			||||||
 | 
					local success
 | 
				
			||||||
 | 
					local file_name
 | 
				
			||||||
 | 
					local extract_dir
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (( $# == 0 )); then
 | 
				
			||||||
 | 
					  cat >&2 <<EOF
 | 
				
			||||||
 | 
					usage: $0 [-option] [file ...]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					options:
 | 
				
			||||||
 | 
					    -r, --remove    remove archive
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Report bugs to <sorin.ionescu@gmail.com>.
 | 
				
			||||||
 | 
					EOF
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					remove_archive=1
 | 
				
			||||||
 | 
					if [[ "$1" == "-r" || "$1" == "--remove" ]]; then
 | 
				
			||||||
 | 
					  remove_archive=0
 | 
				
			||||||
 | 
					  shift
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					while (( $# > 0 )); do
 | 
				
			||||||
 | 
					  if [[ ! -s "$1" ]]; then
 | 
				
			||||||
 | 
					    print "$0: file not valid: $1" >&2
 | 
				
			||||||
 | 
					    shift
 | 
				
			||||||
 | 
					    continue
 | 
				
			||||||
 | 
					  fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  success=0
 | 
				
			||||||
 | 
					  file_name="${1:t}"
 | 
				
			||||||
 | 
					  extract_dir="${file_name:r}"
 | 
				
			||||||
 | 
					  case "$1:l" in
 | 
				
			||||||
 | 
					    (*.tar.gz|*.tgz) tar xvzf "$1" ;;
 | 
				
			||||||
 | 
					    (*.tar.bz2|*.tbz|*.tbz2) tar xvjf "$1" ;;
 | 
				
			||||||
 | 
					    (*.tar.xz|*.txz) tar --xz --help &> /dev/null \
 | 
				
			||||||
 | 
					      && tar --xz -xvf "$1" \
 | 
				
			||||||
 | 
					      || xzcat "$1" | tar xvf - ;;
 | 
				
			||||||
 | 
					    (*.tar.zma|*.tlz) tar --lzma --help &> /dev/null \
 | 
				
			||||||
 | 
					      && tar --lzma -xvf "$1" \
 | 
				
			||||||
 | 
					      || lzcat "$1" | tar xvf - ;;
 | 
				
			||||||
 | 
					    (*.tar) tar xvf "$1" ;;
 | 
				
			||||||
 | 
					    (*.gz) gunzip "$1" ;;
 | 
				
			||||||
 | 
					    (*.bz2) bunzip2 "$1" ;;
 | 
				
			||||||
 | 
					    (*.xz) unxz "$1" ;;
 | 
				
			||||||
 | 
					    (*.lzma) unlzma "$1" ;;
 | 
				
			||||||
 | 
					    (*.Z) uncompress "$1" ;;
 | 
				
			||||||
 | 
					    (*.zip) unzip "$1" -d $extract_dir ;;
 | 
				
			||||||
 | 
					    (*.rar) unrar &> /dev/null \
 | 
				
			||||||
 | 
					      && unrar x -ad "$1" \
 | 
				
			||||||
 | 
					      || rar x -ad "$1" ;;
 | 
				
			||||||
 | 
					    (*.7z) 7za x "$1" ;;
 | 
				
			||||||
 | 
					    (*.deb)
 | 
				
			||||||
 | 
					      mkdir -p "$extract_dir/control"
 | 
				
			||||||
 | 
					      mkdir -p "$extract_dir/data"
 | 
				
			||||||
 | 
					      cd "$extract_dir"; ar vx "../${1}" > /dev/null
 | 
				
			||||||
 | 
					      cd control; tar xzvf ../control.tar.gz
 | 
				
			||||||
 | 
					      cd ../data; tar xzvf ../data.tar.gz
 | 
				
			||||||
 | 
					      cd ..; rm *.tar.gz debian-binary
 | 
				
			||||||
 | 
					      cd ..
 | 
				
			||||||
 | 
					    ;;
 | 
				
			||||||
 | 
					    (*)
 | 
				
			||||||
 | 
					      print "$0: cannot extract: $1" >&2
 | 
				
			||||||
 | 
					      success=1
 | 
				
			||||||
 | 
					    ;;
 | 
				
			||||||
 | 
					  esac
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  (( success = $success > 0 ? $success : $? ))
 | 
				
			||||||
 | 
					  (( $success == 0 )) && (( $remove_archive == 0 )) && rm "$1"
 | 
				
			||||||
 | 
					  shift
 | 
				
			||||||
 | 
					done
 | 
				
			||||||
| 
						 | 
					@ -8,8 +8,6 @@ bindkey -M viins '^[b' backward-word
 | 
				
			||||||
bindkey -M vicmd 'yy' vi-yank-whole-line
 | 
					bindkey -M vicmd 'yy' vi-yank-whole-line
 | 
				
			||||||
bindkey -M vicmd 'Y' vi-yank-eol
 | 
					bindkey -M vicmd 'Y' vi-yank-eol
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bindkey -M vicmd '^r' redo
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
bindkey -M viins ' ' magic-space
 | 
					bindkey -M viins ' ' magic-space
 | 
				
			||||||
bindkey -M viins 'jk' vi-cmd-mode
 | 
					bindkey -M viins 'jk' vi-cmd-mode
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -31,14 +29,12 @@ bindkey '^[[A' history-substring-search-up
 | 
				
			||||||
bindkey '^[[B' history-substring-search-down]]]]
 | 
					bindkey '^[[B' history-substring-search-down]]]]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Edit command in an external editor.
 | 
					# Edit command in an external editor.
 | 
				
			||||||
bindkey -M vicmd "v" edit-command-line
 | 
					bindkey -M vicmd "R" edit-command-line
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# # Undo/Redo
 | 
					# # Undo/Redo
 | 
				
			||||||
bindkey -M vicmd "u" undo
 | 
					bindkey -M vicmd "u" undo
 | 
				
			||||||
bindkey -M vicmd "$key_info[Control]R" redo
 | 
					bindkey -M vicmd "$key_info[Control]R" redo
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bindkey -M viins "." expand-dot-to-parent-directory-path
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Completing words in buffer in tmux
 | 
					# Completing words in buffer in tmux
 | 
				
			||||||
if [ -n "$TMUX" ]; then
 | 
					if [ -n "$TMUX" ]; then
 | 
				
			||||||
    _tmux_pane_words() {
 | 
					    _tmux_pane_words() {
 | 
				
			||||||
| 
						 | 
					@ -62,13 +58,3 @@ if [ -n "$TMUX" ]; then
 | 
				
			||||||
    zstyle ':completion:tmux-pane-words-(prefix|anywhere):*' ignore-line current
 | 
					    zstyle ':completion:tmux-pane-words-(prefix|anywhere):*' ignore-line current
 | 
				
			||||||
    zstyle ':completion:tmux-pane-words-anywhere:*' matcher-list 'b:=* m:{A-Za-z}={a-zA-Z}'
 | 
					    zstyle ':completion:tmux-pane-words-anywhere:*' matcher-list 'b:=* m:{A-Za-z}={a-zA-Z}'
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					 | 
				
			||||||
# Expands .... to ../..
 | 
					 | 
				
			||||||
function expand-dot-to-parent-directory-path {
 | 
					 | 
				
			||||||
  if [[ $LBUFFER = *.. ]]; then
 | 
					 | 
				
			||||||
    LBUFFER+='/..'
 | 
					 | 
				
			||||||
  else
 | 
					 | 
				
			||||||
    LBUFFER+='.'
 | 
					 | 
				
			||||||
  fi
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
zle -N expand-dot-to-parent-directory-path
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										37
									
								
								zshrc
									
									
									
									
									
								
							
							
						
						
									
										37
									
								
								zshrc
									
									
									
									
									
								
							| 
						 | 
					@ -1,9 +1,14 @@
 | 
				
			||||||
function is-callable {
 | 
					### zshrc
 | 
				
			||||||
  (( $+commands[$1] )) || (( $+functions[$1] )) || (( $+aliases[$1] ))
 | 
					# By Henrik Lissner <henrik@lissner.net>
 | 
				
			||||||
}
 | 
					# Uses zgen to manage plugins
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Source component rcfiles
 | 
					export PATH="$HOME/.rbenv/bin:$HOME/.pyenv/bin:$PATH"
 | 
				
			||||||
if [[ -z "$EMACS" ]]; then
 | 
					
 | 
				
			||||||
 | 
					source ~/.zsh/functions.zsh
 | 
				
			||||||
 | 
					source ~/.zsh/aliases.zsh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# if not running through emacs' shell-command
 | 
				
			||||||
 | 
					if [ -z "$EMACS" ]; then
 | 
				
			||||||
    source ~/.zsh/zgen/zgen.zsh
 | 
					    source ~/.zsh/zgen/zgen.zsh
 | 
				
			||||||
    if ! zgen saved; then
 | 
					    if ! zgen saved; then
 | 
				
			||||||
        echo "Creating zgen save"
 | 
					        echo "Creating zgen save"
 | 
				
			||||||
| 
						 | 
					@ -11,7 +16,6 @@ if [[ -z "$EMACS" ]]; then
 | 
				
			||||||
        zgen load zsh-users/zsh-syntax-highlighting
 | 
					        zgen load zsh-users/zsh-syntax-highlighting
 | 
				
			||||||
        zgen load zsh-users/zsh-history-substring-search
 | 
					        zgen load zsh-users/zsh-history-substring-search
 | 
				
			||||||
        zgen load zsh-users/zsh-completions src
 | 
					        zgen load zsh-users/zsh-completions src
 | 
				
			||||||
        zgen load clvv/fasd
 | 
					 | 
				
			||||||
        zgen load hchbaw/opp.zsh
 | 
					        zgen load hchbaw/opp.zsh
 | 
				
			||||||
        zgen load Tarrasch/zsh-bd
 | 
					        zgen load Tarrasch/zsh-bd
 | 
				
			||||||
        zgen load houjunchen/zsh-vim-mode
 | 
					        zgen load houjunchen/zsh-vim-mode
 | 
				
			||||||
| 
						 | 
					@ -19,29 +23,16 @@ if [[ -z "$EMACS" ]]; then
 | 
				
			||||||
        zgen save
 | 
					        zgen save
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    source ~/.zsh/aliases.zsh
 | 
					 | 
				
			||||||
    source ~/.zsh/config.zsh
 | 
					    source ~/.zsh/config.zsh
 | 
				
			||||||
 | 
					    source ~/.zsh/completion.zsh
 | 
				
			||||||
    source ~/.zsh/keybinds.zsh
 | 
					    source ~/.zsh/keybinds.zsh
 | 
				
			||||||
    source ~/.zsh/prompt.zsh
 | 
					    source ~/.zsh/prompt.zsh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fasd_cache="$HOME/.fasd-cache"
 | 
					    cache fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install
 | 
				
			||||||
    if [ "$(command -v fasd)" -nt "$fasd_cache" -o ! -s "$fasd_cache" ]; then
 | 
					 | 
				
			||||||
        fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install >| "$fasd_cache"
 | 
					 | 
				
			||||||
    fi
 | 
					 | 
				
			||||||
    source "$fasd_cache"
 | 
					 | 
				
			||||||
    unset fasd_cache
 | 
					 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## PATHS ###############################################
 | 
					cache rbenv init - --no-rehash
 | 
				
			||||||
if [ -d ~/.rbenv ]; then
 | 
					cache pyenv init - --no-rehash
 | 
				
			||||||
    export PATH=~/.rbenv/bin:$PATH
 | 
					 | 
				
			||||||
    eval "$(rbenv init - --no-rehash)"
 | 
					 | 
				
			||||||
fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
if [ -d ~/.pyenv ]; then
 | 
					 | 
				
			||||||
    export PATH=~/.pyenv/bin:~/.pyenv/shims:$PATH
 | 
					 | 
				
			||||||
    eval "$(pyenv init - --no-rehash)"
 | 
					 | 
				
			||||||
fi
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
export ANDROID_HOME=/usr/local/opt/android-sdk
 | 
					export ANDROID_HOME=/usr/local/opt/android-sdk
 | 
				
			||||||
export ANDROID_SDK=/usr/local/Cellar/android-sdk/24.2
 | 
					export ANDROID_SDK=/usr/local/Cellar/android-sdk/24.2
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue