Skip to content
Myr

[shell] Add FZF_CTRL_T_COMMAND for CTRL-T

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Close #40

authored by Junegunn Choi · committed by Junegunn Choi · parent 14e3b84 · Browse files · 5 files+35 added−9 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

5 files+35 added−9 removed

  • tests:+21 added−0 removed
  • other:+14 added−9 removed

5 files+35 added−9 removed

modified:shell/key-bindings.bash+4 added-3 removed
modified:shell/key-bindings.fish+4 added-2 removed
12 unmodified lines
13 end14 end1516 function __fzf_ctrl_t17 command find -L . \( -path '*/\.*' -o -fstype 'dev' -o -fstype 'proc' \) -prune \17 set -q FZF_CTRL_T_COMMAND; or set -l FZF_CTRL_T_COMMAND "18 command find -L . \\( -path '*/\\.*' -o -fstype 'dev' -o -fstype 'proc' \\) -prune \19 -o -type f -print \20 -o -type d -print \20 -o -type l -print 2> /dev/null | sed 1d | cut -b3- | eval (__fzfcmd) -m > $TMPDIR/fzf.result21 -o -type l -print 2> /dev/null | sed 1d | cut -b3-"22 eval $FZF_CTRL_T_COMMAND | eval (__fzfcmd) -m > $TMPDIR/fzf.result23 and commandline -i (cat $TMPDIR/fzf.result | __fzf_escape)24 commandline -f repaint25 rm -f $TMPDIR/fzf.result26 end
43 unmodified lines
modified:shell/key-bindings.zsh+3 added-2 removed
modified:test/test_go.rb+21 added
146 unmodified lines
147 end148149 def setup150 ENV.delete 'FZF_DEFAULT_OPTS'151 ENV.delete 'FZF_CTRL_T_COMMAND'152 ENV.delete 'FZF_DEFAULT_COMMAND'153 end154155 def readonce
495 unmodified lines
651 def teardown652 @tmux.kill653 end654655 def set_var name, val656 tmux.prepare657 tmux.send_keys "export #{name}='#{val}'", :Enter658 tmux.prepare659 end660661 def test_ctrl_t662 tmux.prepare663 tmux.send_keys 'C-t', pane: 0664 lines = tmux.until(1) { |lines| lines.item_count > 1 }
11 unmodified lines
676 tmux.until(0) { |lines| lines[-1].include? expected }677 tmux.send_keys 'C-c', 'C-d'678 end679680 def test_ctrl_t_command681 set_var "FZF_CTRL_T_COMMAND", "seq 100"682 tmux.send_keys 'C-t', pane: 0683 lines = tmux.until(1) { |lines| lines.item_count == 100 }684 tmux.send_keys :BTab, :BTab, :BTab, :Enter, pane: 1685 tmux.until(0) { |lines| lines[-1].include? '1 2 3' }686 end687688 def test_alt_c689 tmux.prepare690 tmux.send_keys :Escape, :c, pane: 0691 lines = tmux.until(1) { |lines| lines.item_count > 0 && lines[-3][2..-1] }
164 unmodified lines
856 tmux.send_keys 'function fish_prompt; end; clear', :Enter857 tmux.until { |lines| lines.empty? }858 end859860 def set_var name, val861 tmux.prepare862 tmux.send_keys "set -l #{name} '#{val}'", :Enter863 tmux.prepare864 end865866 def setup867 super868 @tmux = Tmux.new :fish869 end
2 unmodified lines
modified:README.md+3 added-2 removed
145 unmodified lines
146147The install script will setup the following key bindings for bash, zsh, and148fish.149150- `CTRL-T` - Paste the selected file path(s) into the command line151- `CTRL-R` - Paste the selected command from history into the command line150- `CTRL-T` - Paste the selected files and directories onto the command line151 - Set `FZF_CTRL_T_COMMAND` to override the default command152- `CTRL-R` - Paste the selected command from history onto the command line153 - Sort is disabled by default to respect chronological ordering154 - Press `CTRL-R` again to toggle sort155- `ALT-C` - cd into the selected directory156
285 unmodified lines