This commit is contained in:
Luke Smith 2022-04-30 17:15:45 -04:00
parent 58b06ee021
commit fc6dc7b761
No known key found for this signature in database
GPG key ID: 4C50B54A911F6252

View file

@ -10,7 +10,7 @@ setopt interactive_comments
# History in cache directory: # History in cache directory:
HISTSIZE=10000000 HISTSIZE=10000000
SAVEHIST=10000000 SAVEHIST=10000000
HISTFILE=~/.cache/zsh/history HISTFILE="${XDG_CACHE_HOME:-$HOME/.cache}/zsh/history"
# Load aliases and shortcuts if existent. # Load aliases and shortcuts if existent.
[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc" [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc"
@ -53,25 +53,28 @@ preexec() { echo -ne '\e[5 q' ;} # Use beam shape cursor for each new prompt.
# Use lf to switch directories and bind it to ctrl-o # Use lf to switch directories and bind it to ctrl-o
lfcd () { lfcd () {
tmp="$(mktemp)" tmp="$(mktemp -uq)"
trap 'rm -f $tmp >/dev/null 2>&1' HUP INT QUIT TERM PWR EXIT
lf -last-dir-path="$tmp" "$@" lf -last-dir-path="$tmp" "$@"
if [ -f "$tmp" ]; then if [ -f "$tmp" ]; then
dir="$(cat "$tmp")" dir="$(cat "$tmp")"
rm -f "$tmp" >/dev/null
[ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir" [ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir"
fi fi
} }
bindkey -s '^o' 'lfcd\n' bindkey -s '^o' '^ulfcd\n'
bindkey -s '^a' 'bc -lq\n' bindkey -s '^a' '^ubc -lq\n'
bindkey -s '^f' 'cd "$(dirname "$(fzf)")"\n' bindkey -s '^f' '^ucd "$(dirname "$(fzf)")"\n'
bindkey '^[[P' delete-char bindkey '^[[P' delete-char
# Edit line in vim with ctrl-e: # Edit line in vim with ctrl-e:
autoload edit-command-line; zle -N edit-command-line autoload edit-command-line; zle -N edit-command-line
bindkey '^e' edit-command-line bindkey '^e' edit-command-line
bindkey -M vicmd '^[[P' vi-delete-char
bindkey -M vicmd '^e' edit-command-line
bindkey -M visual '^[[P' vi-delete
# Load syntax highlighting; should be last. # Load syntax highlighting; should be last.
source /usr/share/zsh/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh 2>/dev/null source /usr/share/zsh/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh 2>/dev/null