summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2015-04-22 14:33:03 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2015-04-22 14:33:03 +0900
commit305ec3b3ce16141ecac0b8657ad00b371fc7a133 (patch)
treec3da083ad4ba39cbc3899d09573d3f9275dcf418
parentf4fe93338beda6b7410db3c790829e1d664f7180 (diff)
[fish] Remove buffering delay by not using subroutines0.9.11
Close #169
-rw-r--r--shell/key-bindings.fish20
1 files changed, 6 insertions, 14 deletions
diff --git a/shell/key-bindings.fish b/shell/key-bindings.fish
index 8be5ab5f..36beee18 100644
--- a/shell/key-bindings.fish
+++ b/shell/key-bindings.fish
@@ -7,18 +7,6 @@ function fzf_key_bindings
set -g TMPDIR /tmp
end
- function __fzf_list
- command find -L . \( -path '*/\.*' -o -fstype 'dev' -o -fstype 'proc' \) -prune \
- -o -type f -print \
- -o -type d -print \
- -o -type l -print 2> /dev/null | sed 1d | cut -b3-
- end
-
- function __fzf_list_dir
- command find -L . \( -path '*/\.*' -o -fstype 'dev' -o -fstype 'proc' \) \
- -prune -o -type d -print 2> /dev/null | sed 1d | cut -b3-
- end
-
function __fzf_escape
while read item
echo -n (echo -n "$item" | sed -E 's/([ "$~'\''([{<>})])/\\\\\\1/g')' '
@@ -26,7 +14,10 @@ function fzf_key_bindings
end
function __fzf_ctrl_t
- __fzf_list | eval (__fzfcmd) -m > $TMPDIR/fzf.result
+ command find -L . \( -path '*/\.*' -o -fstype 'dev' -o -fstype 'proc' \) -prune \
+ -o -type f -print \
+ -o -type d -print \
+ -o -type l -print 2> /dev/null | sed 1d | cut -b3- | eval (__fzfcmd) -m > $TMPDIR/fzf.result
and commandline -i (cat $TMPDIR/fzf.result | __fzf_escape)
commandline -f repaint
rm -f $TMPDIR/fzf.result
@@ -41,7 +32,8 @@ function fzf_key_bindings
function __fzf_alt_c
# Fish hangs if the command before pipe redirects (2> /dev/null)
- __fzf_list_dir | eval (__fzfcmd) +m > $TMPDIR/fzf.result
+ command find -L . \( -path '*/\.*' -o -fstype 'dev' -o -fstype 'proc' \) \
+ -prune -o -type d -print 2> /dev/null | sed 1d | cut -b3- | eval (__fzfcmd) +m > $TMPDIR/fzf.result
[ (cat $TMPDIR/fzf.result | wc -l) -gt 0 ]
and cd (cat $TMPDIR/fzf.result)
commandline -f repaint