diff options
Diffstat (limited to '.config/zsh/.zshrc')
-rw-r--r-- | .config/zsh/.zshrc | 54 |
1 files changed, 49 insertions, 5 deletions
diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index c39dc9d..f37b8a5 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -1,20 +1,38 @@ # ZSH config - # Load plugins first [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc" -[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/zsh/plugins.zsh" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/zsh/plugins.zsh" -[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/zsh/functions.zsh" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/zsh/functions.zsh" # Uncomment the following line to use case-sensitive completion. CASE_SENSITIVE="true" +# some useful options (man zshoptions) +setopt autocd extendedglob nomatch menucomplete +setopt interactive_comments +stty stop undef # Disable ctrl-s to freeze terminal. + zle_highlight=('paste:none') -autoload -U colors && colors +# beeping is annoying +unsetopt BEEP # For autocomplete to work autoload -U +X compinit && compinit autoload -U +X bashcompinit && bashcompinit +zstyle ':completion:*' menu select +zmodload zsh/complist +_comp_options+=(globdots) # Include hidden files. + + +# Useful functions +source "$ZDOTDIR/functions" +zsh_add_file "vi-mode" +zsh_add_file "prompt" + +# Plugins +zsh_add_plugin "zsh-users/zsh-autosuggestions" +zsh_add_plugin "zsh-users/zsh-syntax-highlighting" +# For more plugins: https://github.com/unixorn/awesome-zsh-plugins +# More completions https://github.com/zsh-users/zsh-completions # History in cache directory: HISTSIZE=100000 @@ -30,4 +48,30 @@ bindkey "รง" fzf-cd-widget bindkey "^[[A" history-beginning-search-backward bindkey "^[[B" history-beginning-search-forward -eval "$(pyenv init -)" +# Use lf to switch directories and bind it to ctrl-o +lfcd () { + tmp="$(mktemp)" + lf -last-dir-path="$tmp" "$@" + if [ -f "$tmp" ]; then + dir="$(cat "$tmp")" + rm -f "$tmp" >/dev/null + [ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir" + fi +} +bindkey -s '^o' 'lfcd\n' + +bindkey -s '^a' 'bc -lq\n' + +bindkey -s '^f' 'cd "$(dirname "$(fzf)")"\n' + +bindkey '^[[P' delete-char + +# FZF +[ -f /usr/share/fzf/completion.zsh ] && source /usr/share/fzf/completion.zsh +[ -f /usr/share/fzf/key-bindings.zsh ] && source /usr/share/fzf/key-bindings.zsh + +compinit + +# Edit line in vim with ctrl-e: +autoload edit-command-line; zle -N edit-command-line +bindkey '^e' edit-command-line |