summaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2015-06-26 01:00:58 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2015-06-26 01:02:44 +0900
commit938151a834c1858ffdd6091cbcb42688a3784b6b (patch)
tree6ffbb24708486b37fd92210b830accd1e1ead9d2 /shell
parent14e3b84073215e29f90f10e6ccce35704598e51d (diff)
[shell] Add FZF_CTRL_T_COMMAND for CTRL-T
Close #40
Diffstat (limited to 'shell')
-rw-r--r--shell/key-bindings.bash7
-rw-r--r--shell/key-bindings.fish6
-rw-r--r--shell/key-bindings.zsh5
3 files changed, 11 insertions, 7 deletions
diff --git a/shell/key-bindings.bash b/shell/key-bindings.bash
index ee79cc35..c04dc440 100644
--- a/shell/key-bindings.bash
+++ b/shell/key-bindings.bash
@@ -1,10 +1,11 @@
# Key bindings
# ------------
__fzf_select__() {
- command find -L . \( -path '*/\.*' -o -fstype 'dev' -o -fstype 'proc' \) -prune \
+ local cmd="${FZF_CTRL_T_COMMAND:-"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- | fzf -m | while read item; do
+ -o -type l -print 2> /dev/null | sed 1d | cut -b3-"}"
+ eval "$cmd" | fzf -m | while read item; do
printf '%q ' "$item"
done
echo
@@ -24,7 +25,7 @@ __fzf_select_tmux__() {
else
height="-l $height"
fi
- tmux split-window $height "cd $(printf %q "$PWD");bash -c 'source ~/.fzf.bash; tmux send-keys -t $TMUX_PANE \"\$(__fzf_select__)\"'"
+ tmux split-window $height "cd $(printf %q "$PWD"); FZF_CTRL_T_COMMAND=$(printf %q "$FZF_CTRL_T_COMMAND") bash -c 'source ~/.fzf.bash; tmux send-keys -t $TMUX_PANE \"\$(__fzf_select__)\"'"
}
__fzf_cd__() {
diff --git a/shell/key-bindings.fish b/shell/key-bindings.fish
index b86a4ef3..c79d0fdd 100644
--- a/shell/key-bindings.fish
+++ b/shell/key-bindings.fish
@@ -14,10 +14,12 @@ function fzf_key_bindings
end
function __fzf_ctrl_t
- command find -L . \( -path '*/\.*' -o -fstype 'dev' -o -fstype 'proc' \) -prune \
+ set -q FZF_CTRL_T_COMMAND; or set -l FZF_CTRL_T_COMMAND "
+ 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
+ -o -type l -print 2> /dev/null | sed 1d | cut -b3-"
+ eval $FZF_CTRL_T_COMMAND | eval (__fzfcmd) -m > $TMPDIR/fzf.result
and commandline -i (cat $TMPDIR/fzf.result | __fzf_escape)
commandline -f repaint
rm -f $TMPDIR/fzf.result
diff --git a/shell/key-bindings.zsh b/shell/key-bindings.zsh
index 642a35e8..735aa501 100644
--- a/shell/key-bindings.zsh
+++ b/shell/key-bindings.zsh
@@ -4,10 +4,11 @@ if [[ $- =~ i ]]; then
# CTRL-T - Paste the selected file path(s) into the command line
__fsel() {
- command find -L . \( -path '*/\.*' -o -fstype 'dev' -o -fstype 'proc' \) -prune \
+ local cmd="${FZF_CTRL_T_COMMAND:-"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- | $(__fzfcmd) -m | while read item; do
+ -o -type l -print 2> /dev/null | sed 1d | cut -b3-"}"
+ eval "$cmd" | $(__fzfcmd) -m | while read item; do
printf '%q ' "$item"
done
echo