zsh keybind changes
This commit is contained in:
parent
93a0555eb9
commit
61ea7daf72
1 changed files with 24 additions and 36 deletions
|
@ -1,15 +1,6 @@
|
||||||
# ____ ____
|
#!/bin/zsh
|
||||||
# / __/___ / __/
|
|
||||||
# / /_/_ / / /_
|
# TODO: move this into other zsh config
|
||||||
# / __/ / /_/ __/
|
|
||||||
# /_/ /___/_/ 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
|
|
||||||
|
|
||||||
# Key bindings
|
# Key bindings
|
||||||
# ------------
|
# ------------
|
||||||
|
@ -71,30 +62,27 @@ bindkey -M vicmd '^T' fzf-file-widget
|
||||||
bindkey -M viins '^T' fzf-file-widget
|
bindkey -M viins '^T' fzf-file-widget
|
||||||
|
|
||||||
# ALT-C - cd into the selected directory
|
# ALT-C - cd into the selected directory
|
||||||
# WARN: Disabled because the vim-browse patch for st uses this key combo already
|
fzf-cd-widget() {
|
||||||
# LF is better for this anyways
|
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-"}"
|
||||||
# fzf-cd-widget() {
|
setopt localoptions pipefail no_aliases 2> /dev/null
|
||||||
# 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 \
|
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)"
|
||||||
# -o -type d -print 2> /dev/null | cut -b3-"}"
|
if [[ -z "$dir" ]]; then
|
||||||
# setopt localoptions pipefail no_aliases 2> /dev/null
|
zle redisplay
|
||||||
# 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)"
|
return 0
|
||||||
# if [[ -z "$dir" ]]; then
|
fi
|
||||||
# zle redisplay
|
zle push-line # Clear buffer. Auto-restored on next prompt.
|
||||||
# return 0
|
BUFFER="builtin cd -- ${(q)dir}"
|
||||||
# fi
|
zle accept-line
|
||||||
# zle push-line # Clear buffer. Auto-restored on next prompt.
|
local ret=$?
|
||||||
# BUFFER="builtin cd -- ${(q)dir}"
|
unset dir # ensure this doesn't end up appearing in prompt expansion
|
||||||
# zle accept-line
|
zle reset-prompt
|
||||||
# local ret=$?
|
return $ret
|
||||||
# unset dir # ensure this doesn't end up appearing in prompt expansion
|
}
|
||||||
# zle reset-prompt
|
zle -N fzf-cd-widget
|
||||||
# return $ret
|
bindkey -M emacs '\ec' fzf-cd-widget
|
||||||
# }
|
bindkey -M vicmd '\ec' fzf-cd-widget
|
||||||
# zle -N fzf-cd-widget
|
bindkey -M viins '\ec' 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
|
# CTRL-R - Paste the selected command from history into the command line
|
||||||
fzf-history-widget() {
|
fzf-history-widget() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue