zshrc: bind '^O' to a custom 'fzf-open' zle widget
This commit is contained in:
parent
af6266010c
commit
085ae5852e
@ -44,3 +44,12 @@ delete-branches() {
|
||||
fzf --multi --preview="git log {} --" |
|
||||
xargs --no-run-if-empty git branch --delete --force
|
||||
}
|
||||
|
||||
fzf-open() {
|
||||
local output
|
||||
output=$(fzf </dev/tty)
|
||||
vim --not-a-term ${output}
|
||||
zle reset-prompt
|
||||
}
|
||||
|
||||
zle -N fzf-open
|
||||
|
2
.zshrc
2
.zshrc
@ -88,9 +88,11 @@
|
||||
# map arrow up/down to control fish-like history substring search and highlighting
|
||||
bindkey '^[[A' history-substring-search-up
|
||||
bindkey '^[[B' history-substring-search-down
|
||||
bindkey '^o' fzf-open
|
||||
# also map the same keys in 'viins' (INSERT) mode...
|
||||
bindkey -M viins '^[[A' history-substring-search-up
|
||||
bindkey -M viins '^[[B' history-substring-search-down
|
||||
bindkey -M viins '^o' fzf-open
|
||||
# ...and in 'vicmd' (NORMAL) mode...
|
||||
bindkey -M vicmd '^[[A' history-substring-search-up
|
||||
bindkey -M vicmd '^[[B' history-substring-search-down
|
||||
|
Loading…
Reference in New Issue
Block a user