From fc6dc7b761ad639adc23e75bcf202bfe159fcc82 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Sat, 30 Apr 2022 17:15:45 -0400 Subject: [PATCH] close #1115 --- .config/zsh/.zshrc | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index 22a166e..7e96734 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -10,7 +10,7 @@ setopt interactive_comments # History in cache directory: HISTSIZE=10000000 SAVEHIST=10000000 -HISTFILE=~/.cache/zsh/history +HISTFILE="${XDG_CACHE_HOME:-$HOME/.cache}/zsh/history" # Load aliases and shortcuts if existent. [ -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 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" "$@" 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 '^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 # Edit line in vim with ctrl-e: autoload edit-command-line; zle -N 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. source /usr/share/zsh/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh 2>/dev/null