[fish] Use consistent function names for key bindings (#546)

- fzf-file-widget
- fzf-history-widget
- fzf-cd-widget
This commit is contained in:
Junegunn Choi 2016-04-24 13:55:48 +09:00
parent c727ba1d99
commit e986f20a85

View File

@ -13,7 +13,7 @@ function fzf_key_bindings
end end
end end
function __fzf_ctrl_t function fzf-file-widget
set -q FZF_CTRL_T_COMMAND; or set -l FZF_CTRL_T_COMMAND " set -q FZF_CTRL_T_COMMAND; or set -l FZF_CTRL_T_COMMAND "
command find -L . \\( -path '*/\\.*' -o -fstype 'dev' -o -fstype 'proc' \\) -prune \ command find -L . \\( -path '*/\\.*' -o -fstype 'dev' -o -fstype 'proc' \\) -prune \
-o -type f -print \ -o -type f -print \
@ -25,14 +25,14 @@ function fzf_key_bindings
rm -f $TMPDIR/fzf.result rm -f $TMPDIR/fzf.result
end end
function __fzf_ctrl_r function fzf-history-widget
history | eval (__fzfcmd) +s +m --tiebreak=index --toggle-sort=ctrl-r $FZF_CTRL_R_OPTS > $TMPDIR/fzf.result history | eval (__fzfcmd) +s +m --tiebreak=index --toggle-sort=ctrl-r $FZF_CTRL_R_OPTS > $TMPDIR/fzf.result
and commandline (cat $TMPDIR/fzf.result) and commandline (cat $TMPDIR/fzf.result)
commandline -f repaint commandline -f repaint
rm -f $TMPDIR/fzf.result rm -f $TMPDIR/fzf.result
end end
function __fzf_alt_c function fzf-cd-widget
set -q FZF_ALT_C_COMMAND; or set -l FZF_ALT_C_COMMAND " set -q FZF_ALT_C_COMMAND; or set -l FZF_ALT_C_COMMAND "
command find -L . \\( -path '*/\\.*' -o -fstype 'dev' -o -fstype 'proc' \\) -prune \ command find -L . \\( -path '*/\\.*' -o -fstype 'dev' -o -fstype 'proc' \\) -prune \
-o -type d -print 2> /dev/null | sed 1d | cut -b3-" -o -type d -print 2> /dev/null | sed 1d | cut -b3-"
@ -58,14 +58,14 @@ function fzf_key_bindings
end end
end end
bind \ct '__fzf_ctrl_t' bind \ct fzf-file-widget
bind \cr '__fzf_ctrl_r' bind \cr fzf-history-widget
bind \ec '__fzf_alt_c' bind \ec fzf-cd-widget
if bind -M insert > /dev/null 2>&1 if bind -M insert > /dev/null 2>&1
bind -M insert \ct '__fzf_ctrl_t' bind -M insert \ct fzf-file-widget
bind -M insert \cr '__fzf_ctrl_r' bind -M insert \cr fzf-history-widget
bind -M insert \ec '__fzf_alt_c' bind -M insert \ec fzf-cd-widget
end end
end end