zsh keybind changes
This commit is contained in:
parent
93a0555eb9
commit
61ea7daf72
|
@ -1,15 +1,6 @@
|
|||
# ____ ____
|
||||
# / __/___ / __/
|
||||
# / /_/_ / / /_
|
||||
# / __/ / /_/ __/
|
||||
# /_/ /___/_/ key-bindings.zsh
|
||||
#
|
||||
# - $FZF_TMUX_OPTS
|
||||
# - $FZF_CTRL_T_COMMAND
|
||||
# - $FZF_CTRL_T_OPTS
|
||||
# - $FZF_CTRL_R_OPTS
|
||||
# - $FZF_ALT_C_COMMAND
|
||||
# - $FZF_ALT_C_OPTS
|
||||
#!/bin/zsh
|
||||
|
||||
# TODO: move this into other zsh config
|
||||
|
||||
# Key bindings
|
||||
# ------------
|
||||
|
@ -71,30 +62,27 @@ bindkey -M vicmd '^T' fzf-file-widget
|
|||
bindkey -M viins '^T' fzf-file-widget
|
||||
|
||||
# ALT-C - cd into the selected directory
|
||||
# WARN: Disabled because the vim-browse patch for st uses this key combo already
|
||||
# LF is better for this anyways
|
||||
|
||||
# fzf-cd-widget() {
|
||||
# local cmd="${FZF_ALT_C_COMMAND:-"command find -L . -mindepth 1 \\( -path '*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) -prune \
|
||||
# -o -type d -print 2> /dev/null | cut -b3-"}"
|
||||
# setopt localoptions pipefail no_aliases 2> /dev/null
|
||||
# local dir="$(eval "$cmd" | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse --bind=ctrl-z:ignore $FZF_DEFAULT_OPTS $FZF_ALT_C_OPTS" $(__fzfcmd) +m)"
|
||||
# if [[ -z "$dir" ]]; then
|
||||
# zle redisplay
|
||||
# return 0
|
||||
# fi
|
||||
# zle push-line # Clear buffer. Auto-restored on next prompt.
|
||||
# BUFFER="builtin cd -- ${(q)dir}"
|
||||
# zle accept-line
|
||||
# local ret=$?
|
||||
# unset dir # ensure this doesn't end up appearing in prompt expansion
|
||||
# zle reset-prompt
|
||||
# return $ret
|
||||
# }
|
||||
# zle -N fzf-cd-widget
|
||||
# bindkey -M emacs '\ec' fzf-cd-widget
|
||||
# bindkey -M vicmd '\ec' fzf-cd-widget
|
||||
# bindkey -M viins '\ec' fzf-cd-widget
|
||||
fzf-cd-widget() {
|
||||
local cmd="${FZF_ALT_C_COMMAND:-"command find -L . -mindepth 1 \\( -path '*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) -prune \
|
||||
-o -type d -print 2> /dev/null | cut -b3-"}"
|
||||
setopt localoptions pipefail no_aliases 2> /dev/null
|
||||
local dir="$(eval "$cmd" | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse --bind=ctrl-z:ignore $FZF_DEFAULT_OPTS $FZF_ALT_C_OPTS" $(__fzfcmd) +m)"
|
||||
if [[ -z "$dir" ]]; then
|
||||
zle redisplay
|
||||
return 0
|
||||
fi
|
||||
zle push-line # Clear buffer. Auto-restored on next prompt.
|
||||
BUFFER="builtin cd -- ${(q)dir}"
|
||||
zle accept-line
|
||||
local ret=$?
|
||||
unset dir # ensure this doesn't end up appearing in prompt expansion
|
||||
zle reset-prompt
|
||||
return $ret
|
||||
}
|
||||
zle -N fzf-cd-widget
|
||||
bindkey -M emacs '\ec' fzf-cd-widget
|
||||
bindkey -M vicmd '\ec' fzf-cd-widget
|
||||
bindkey -M viins '\ec' fzf-cd-widget
|
||||
|
||||
# CTRL-R - Paste the selected command from history into the command line
|
||||
fzf-history-widget() {
|
||||
|
|
Loading…
Reference in New Issue