.zshrc (2938B)
1 # Luke's config for the Zoomer Shell 2 3 # Enable colors and change prompt: 4 autoload -U colors && colors # Load colors 5 PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b " 6 setopt autocd # Automatically cd into typed directory. 7 stty stop undef # Disable ctrl-s to freeze terminal. 8 setopt interactive_comments 9 10 # History in cache directory: 11 HISTSIZE=10000000 12 SAVEHIST=10000000 13 HISTFILE="${XDG_CACHE_HOME:-$HOME/.cache}/zsh/history" 14 setopt inc_append_history 15 16 # Load aliases and shortcuts if existent. 17 [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc" 18 [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutenvrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutenvrc" 19 [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc" 20 [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc" 21 22 # Basic auto/tab complete: 23 autoload -U compinit 24 zstyle ':completion:*' menu select 25 zmodload zsh/complist 26 compinit 27 _comp_options+=(globdots) # Include hidden files. 28 29 # vi mode 30 bindkey -v 31 export KEYTIMEOUT=1 32 33 # Use vim keys in tab complete menu: 34 bindkey -M menuselect 'h' vi-backward-char 35 bindkey -M menuselect 'k' vi-up-line-or-history 36 bindkey -M menuselect 'l' vi-forward-char 37 bindkey -M menuselect 'j' vi-down-line-or-history 38 bindkey -v '^?' backward-delete-char 39 40 # Change cursor shape for different vi modes. 41 function zle-keymap-select () { 42 case $KEYMAP in 43 vicmd) echo -ne '\e[1 q';; # block 44 viins|main) echo -ne '\033[0 q';; # beam 45 esac 46 } 47 zle -N zle-keymap-select 48 zle-line-init() { 49 zle -K viins # initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere) 50 echo -ne '\033[0 q' 51 } 52 zle -N zle-line-init 53 echo -ne '\033[0 q' # Use beam shape cursor on startup. 54 preexec() { echo -ne '\033[0 q' ;} # Use beam shape cursor for each new prompt. 55 56 # Use lf to switch directories and bind it to ctrl-o 57 function y() { 58 local tmp="$(mktemp -t "yazi-cwd.XXXXXX")" cwd 59 yazi "$@" --cwd-file="$tmp" 60 if cwd="$(command cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then 61 builtin cd -- "$cwd" 62 fi 63 rm -f -- "$tmp" > /dev/null 64 } 65 bindkey -s '^o' '^uy\n' 66 67 bindkey -s '^a' '^ubc -lq\n' 68 69 bindkey -s '^f' '^ucd "$(dirname "$(fzf)")"\n' 70 71 bindkey '^[[P' delete-char 72 73 # Edit line in vim with ctrl-e: 74 autoload edit-command-line; zle -N edit-command-line 75 bindkey '^e' edit-command-line 76 bindkey -M vicmd '^[[P' vi-delete-char 77 bindkey -M vicmd '^e' edit-command-line 78 bindkey -M visual '^[[P' vi-delete 79 80 source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh 81 # Load syntax highlighting; should be last. 82 source /usr/share/zsh/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh 2>/dev/null