# ZSH config # Load plugins first [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc" # GPG export GPG_TTY="$(tty)" # 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') # 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 SAVEHIST=100000 HISTFILE=~/.cache/zsh/history HISTDUP=erase setopt inc_append_history setopt sharehistory setopt hist_ignore_space setopt hist_save_no_dups setopt hist_ignore_dups setopt hist_find_no_dups export CLICOLOR=1 # FZF search files bindkey "รง" fzf-cd-widget # Search history bindkey "^[[A" history-beginning-search-backward bindkey "^[[B" history-beginning-search-forward # 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 # Source language managers source $ZDOTDIR/managers