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" \ | grep -vFx "$PWD" \
| FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse
--bind=ctrl-z:ignore $FZF_DEFAULT_OPTS" \ --bind=ctrl-z:ignore $FZF_DEFAULT_OPTS" \
$(__fzfcmd) +m $(__fzfcmd) "$@"
} }
function go-shcwd { function go-shcwd {
dir="$(shcwd-fzf)" dir="$(shcwd-fzf +m)"
[[ -z $dir ]] || pushd -q "$dir" [[ -z $dir ]] || pushd -q "$dir"
redraw-prompt redraw-prompt
} }
zle -N go-shcwd zle -N go-shcwd
bindkey '^G' 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') # move one directory up on ^U (mnemonic: 'Up')
function cd-up { function cd-up {
pushd -q .. pushd -q ..