zsh:keys: Bind Ctrl-Shift-G to insert-shcwd

This commit is contained in:
2023-11-20 19:38:13 +01:00
parent 93467176f6
commit 97f00e1dd0

View File

@@ -207,17 +207,27 @@ function shcwd-fzf {
| grep -vFx "$PWD" \
| FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse
--bind=ctrl-z:ignore $FZF_DEFAULT_OPTS" \
$(__fzfcmd) +m
$(__fzfcmd) "$@"
}
function go-shcwd {
dir="$(shcwd-fzf)"
dir="$(shcwd-fzf +m)"
[[ -z $dir ]] || pushd -q "$dir"
redraw-prompt
}
zle -N go-shcwd
bindkey '^G' go-shcwd
function insert-shcwd {
dir="$(shcwd-fzf --multi)"
# (q) escapes newlines as $'\n'
[[ -z $dir ]] || LBUFFER+="${${(q)dir}//\$\'\\n\'/ }"
redraw-prompt
}
zle -N insert-shcwd
# Ctrl-Shift-G
bindkey '^[[71;6u' insert-shcwd
# move one directory up on ^U (mnemonic: 'Up')
function cd-up {
pushd -q ..