├── plugins.txt ├── lib ├── functions.zsh ├── history.zsh └── completion.zsh └── zshrc /plugins.txt: -------------------------------------------------------------------------------- 1 | zsh-users/zsh-completions 2 | zsh-users/zsh-syntax-highlighting 3 | zsh-users/zsh-history-substring-search 4 | mgdm/zsh-theme 5 | -------------------------------------------------------------------------------- /lib/functions.zsh: -------------------------------------------------------------------------------- 1 | # fo [FUZZY PATTERN] - Open the selected file with the default editor 2 | # - CTRL-O to open with `open` command, 3 | # - CTRL-E or Enter key to open with the $EDITOR 4 | fo() { 5 | local out file key 6 | local IFS=$'\n' out=($(fzf-tmux --query="$1" --exit-0 --expect=ctrl-o,ctrl-e)) 7 | key=$(head -1 <<< "$out") 8 | file=$(head -2 <<< "$out" | tail -1) 9 | if [ -n "$file" ]; then 10 | [ "$key" = ctrl-o ] && open "$file" || ${EDITOR:-vim} "$file" 11 | fi 12 | } 13 | 14 | # fd - cd to selected directory 15 | fd() { 16 | local dir 17 | dir=$(find ${1:-.} -path '*/\.*' -prune \ 18 | -o -type d -print 2> /dev/null | fzf +m) && 19 | cd "$dir" 20 | } 21 | -------------------------------------------------------------------------------- /lib/history.zsh: -------------------------------------------------------------------------------- 1 | ## Command history configuration 2 | if [ -z "$HISTFILE" ]; then 3 | HISTFILE=$HOME/.zsh_history 4 | fi 5 | 6 | HISTSIZE=10000 7 | SAVEHIST=10000 8 | 9 | # Show history 10 | case $HIST_STAMPS in 11 | "mm/dd/yyyy") alias history='fc -fl 1' ;; 12 | "dd.mm.yyyy") alias history='fc -El 1' ;; 13 | "yyyy-mm-dd") alias history='fc -il 1' ;; 14 | *) alias history='fc -l 1' ;; 15 | esac 16 | 17 | setopt append_history 18 | setopt extended_history 19 | setopt hist_expire_dups_first 20 | setopt hist_ignore_dups # ignore duplication command history list 21 | setopt hist_ignore_space 22 | setopt hist_verify 23 | setopt inc_append_history 24 | setopt share_history # share command history data 25 | -------------------------------------------------------------------------------- /zshrc: -------------------------------------------------------------------------------- 1 | ANTIBODY_HOME=$HOME/.zsh-antibody 2 | setopt PROMPT_SUBST 3 | source <(antibody init) 4 | antibody bundle < $ANTIBODY_HOME/plugins.txt 5 | 6 | for file in $ANTIBODY_HOME/lib/*.zsh; do 7 | source $file 8 | done 9 | 10 | export PATH=$HOME/bin:$PATH 11 | export EDITOR=vim 12 | 13 | export FZF_DEFAULT_COMMAND='rg --files --no-ignore --hidden --follow --glob "!.git/*"' 14 | 15 | bindkey '^[[A' history-substring-search-up 16 | bindkey '^[[B' history-substring-search-down 17 | 18 | 19 | if [ -d $HOME/.rbenv ]; then 20 | eval "$(rbenv init - --no-rehash)" 21 | fi 22 | 23 | #if [ -d $HOME/.nvm ]; then 24 | # export NVM_DIR="$HOME/.nvm" 25 | # . "$(brew --prefix nvm)/nvm.sh" --no-use 26 | # alias node='unalias node ; unalias npm ; nvm use default ; node $@' 27 | # alias npm='unalias node ; unalias npm ; nvm use default ; npm $@' 28 | #fi 29 | 30 | if [ -d $HOME/.phpbrew ]; then 31 | source $HOME/.phpbrew/bashrc 32 | fi 33 | 34 | if [ -f $HOME/.localrc ]; then 35 | source $HOME/.localrc 36 | fi 37 | 38 | -------------------------------------------------------------------------------- /lib/completion.zsh: -------------------------------------------------------------------------------- 1 | unsetopt menu_complete # do not autoselect the first completion entry 2 | unsetopt flowcontrol 3 | setopt auto_menu # show completion menu on succesive tab press 4 | setopt complete_in_word 5 | setopt always_to_end 6 | 7 | autoload -Uz compinit 8 | if [ $(date +'%j') != $(stat -f '%Sm' -t '%j' ~/.zcompdump) ]; then 9 | compinit 10 | else 11 | compinit -C 12 | fi 13 | 14 | zstyle ':completion:*' menu select 15 | 16 | WORDCHARS='' 17 | 18 | zmodload -i zsh/complist 19 | 20 | ## case-insensitive (all),partial-word and then substring completion 21 | if [ "x$CASE_SENSITIVE" = "xtrue" ]; then 22 | zstyle ':completion:*' matcher-list 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' 23 | unset CASE_SENSITIVE 24 | else 25 | if [ "x$HYPHEN_INSENSITIVE" = "xtrue" ]; then 26 | zstyle ':completion:*' matcher-list 'm:{a-zA-Z-_}={A-Za-z_-}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' 27 | unset HYPHEN_INSENSITIVE 28 | else 29 | zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' 30 | fi 31 | fi 32 | 33 | zstyle ':completion:*' list-colors '' 34 | 35 | # should this be in keybindings? 36 | bindkey -M menuselect '^o' accept-and-infer-next-history 37 | 38 | zstyle ':completion:*:*:*:*:*' menu select 39 | zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01' 40 | if [ "$OSTYPE[0,7]" = "solaris" ] 41 | then 42 | zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm" 43 | else 44 | zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm -w -w" 45 | fi 46 | 47 | # disable named-directories autocompletion 48 | zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories 49 | 50 | # Use caching so that commands like apt and dpkg complete are useable 51 | zstyle ':completion::complete:*' use-cache 1 52 | zstyle ':completion::complete:*' cache-path $ZSH_CACHE_DIR 53 | 54 | 55 | --------------------------------------------------------------------------------