[shell] Add $FZF_CTRL_T_OPTS and $FZF_ALT_C_OPTS
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Close #596
authored by Junegunn Choi · committed by Junegunn Choi · parent 07f176f · Browse files · 4 files·+10 added−7 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
4 files+10 added−7 removed
- other:+10 added−7 removed
Provenance
- Commit
c39c039- Tree
8e1ab12- Author
Junegunn Choi <junegunn.c@gmail.com>- Committer
Junegunn Choi <junegunn.c@gmail.com>- Parent
07f176f
4 files changed+10 added−7 removed
modified:shell/key-bindings.bash+3 added-3 removed
3 unmodified lines456788910111212 unmodified lines252627282929303132338 unmodified lines4243444546464748495075 unmodified lines3 unmodified lines 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-"}" eval "$cmd" | fzf -m | while read -r item; do eval "$cmd | fzf -m $FZF_CTRL_T_OPTS" | while read -r item; do printf '%q ' "$item" done echo}12 unmodified lines else height="-l $height" fi
tmux split-window $height "cd $(printf %q "$PWD"); FZF_DEFAULT_OPTS=$(printf %q "$FZF_DEFAULT_OPTS") PATH=$(printf %q "$PATH") FZF_CTRL_T_COMMAND=$(printf %q "$FZF_CTRL_T_COMMAND") bash -c 'source \"${BASH_SOURCE[0]}\"; tmux send-keys -t $TMUX_PANE \"\$(__fzf_select__)\"'" tmux split-window $height "cd $(printf %q "$PWD"); FZF_DEFAULT_OPTS=$(printf %q "$FZF_DEFAULT_OPTS") PATH=$(printf %q "$PATH") FZF_CTRL_T_COMMAND=$(printf %q "$FZF_CTRL_T_COMMAND") FZF_CTRL_T_OPTS=$(printf %q "$FZF_CTRL_T_OPTS") bash -c 'source \"${BASH_SOURCE[0]}\"; tmux send-keys -t $TMUX_PANE \"\$(__fzf_select__)\"'"}
fzf-file-widget() { if __fzf_use_tmux__; then8 unmodified lines__fzf_cd__() { local cmd dir cmd="${FZF_ALT_C_COMMAND:-"command find -L . \\( -path '*/\\.*' -o -fstype 'dev' -o -fstype 'proc' \\) -prune \ -o -type d -print 2> /dev/null | sed 1d | cut -b3-"}" dir=$(eval "$cmd" | $(__fzfcmd) +m) && printf 'cd %q' "$dir" dir=$(eval "$cmd | $(__fzfcmd) +m $FZF_ALT_C_OPTS") && printf 'cd %q' "$dir"}
__fzf_history__() ( local line75 unmodified linesmodified:shell/key-bindings.fish+2 added-2 removed
17 unmodified lines18 command find -L . \\( -path '*/\\.*' -o -fstype 'dev' -o -fstype 'proc' \\) -prune \19 -o -type f -print \20 -o -type d -print \21 -o -type l -print 2> /dev/null | sed 1d | cut -b3-"22- eval "$FZF_CTRL_T_COMMAND | "(__fzfcmd)" -m > $TMPDIR/fzf.result"22+ eval "$FZF_CTRL_T_COMMAND | "(__fzfcmd)" -m $FZF_CTRL_T_OPTS > $TMPDIR/fzf.result"23 and for i in (seq 20); commandline -i (cat $TMPDIR/fzf.result | __fzf_escape) 2> /dev/null; and break; sleep 0.1; end24 commandline -f repaint25 rm -f $TMPDIR/fzf.result26 end9 unmodified lines36 set -q FZF_ALT_C_COMMAND; or set -l FZF_ALT_C_COMMAND "37 command find -L . \\( -path '*/\\.*' -o -fstype 'dev' -o -fstype 'proc' \\) -prune \38 -o -type d -print 2> /dev/null | sed 1d | cut -b3-"39 # Fish hangs if the command before pipe redirects (2> /dev/null)40- eval "$FZF_ALT_C_COMMAND | "(__fzfcmd)" +m > $TMPDIR/fzf.result"40+ eval "$FZF_ALT_C_COMMAND | "(__fzfcmd)" +m $FZF_ALT_C_OPTS > $TMPDIR/fzf.result"41 [ (cat $TMPDIR/fzf.result | wc -l) -gt 0 ]42 and cd (cat $TMPDIR/fzf.result)43 commandline -f repaint44 rm -f $TMPDIR/fzf.result27 unmodified linesmodified:shell/key-bindings.zsh+2 added-2 removed
6 unmodified lines7891011111213141512 unmodified lines2829303132323334353619 unmodified lines6 unmodified lines 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-"}" eval "$cmd" | $(__fzfcmd) -m | while read item; do eval "$cmd | $(__fzfcmd) -m $FZF_CTRL_T_OPTS" | while read item; do echo -n "${(q)item} " done echo}12 unmodified lines# ALT-C - cd into the selected directoryfzf-cd-widget() { local cmd="${FZF_ALT_C_COMMAND:-"command find -L . \\( -path '*/\\.*' -o -fstype 'dev' -o -fstype 'proc' \\) -prune \ -o -type d -print 2> /dev/null | sed 1d | cut -b3-"}" cd "${$(eval "$cmd" | $(__fzfcmd) +m):-.}" cd "${$(eval "$cmd | $(__fzfcmd) +m $FZF_ALT_C_OPTS"):-.}" zle reset-prompt}zle -N fzf-cd-widgetbindkey '\ec' fzf-cd-widget19 unmodified linesmodified:README.md+3 added
176 unmodified lines177 fish.178 179 - `CTRL-T` - Paste the selected files and directories onto the command line180 - Set `FZF_CTRL_T_COMMAND` to override the default command181+ - Set `FZF_CTRL_T_OPTS` to pass additional options182 - `CTRL-R` - Paste the selected command from history onto the command line183 - Sort is disabled by default to respect chronological ordering184 - Press `CTRL-R` again to toggle sort185+ - Set `FZF_CTRL_R_OPTS` to pass additional options186 - `ALT-C` - cd into the selected directory187 - Set `FZF_ALT_C_COMMAND` to override the default command188+ - Set `FZF_ALT_C_OPTS` to pass additional options189 190 If you're on a tmux session, fzf will start in a split pane. You may disable191 this tmux integration by setting `FZF_TMUX` to 0, or change the height of the192 pane with `FZF_TMUX_HEIGHT` (e.g. `20`, `50%`).221 unmodified lines