Commit Graph

56 Commits (3312cf525d23b3e12ae3a7261220a0e952c43ead)

Author SHA1 Message Date
Jan Warchoł 3312cf525d
[bash] Allow passing args to __fzf_select__ via fzf-file-widget (#2783)
This makes it easier to make customizations, for example instead of

    bind -x '"\C-o\C-i": FZF_CTRL_T_COMMAND="fasd -Rl" FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS --tiebreak=index " fzf-file-widget'

it's enough to just

    bind -x '"\C-o\C-i": FZF_CTRL_T_COMMAND="fasd -Rl" fzf-file-widget --tiebreak=index'
2 years ago
zsugabubus 205f885d69
[shell] Use cd -- (#2659)
Otherwise directories starting with '-' may treated as options.
3 years ago
a1346054 8f899aaf8a use proper bash-style notation 3 years ago
Junegunn Choi b234647a63
[shell] Disable CTRL-Z
Fix #2289
3 years ago
Junegunn Choi 540bfd7a72 [fzf-tmux] Fall back to plain fzf when split failed 4 years ago
Junegunn Choi bf65e8cd12 [fzf-tmux] Add option to start fzf in tmux popup window
Requires latest tmux built from source (e.g. brew install tmux --HEAD)

Examples:

  # 50%/50% width and height on the center of the screen
  fzf-tmux -p

  # 80%/80%
  fzf-tmux -p80%

  # 80%/40%
  fzf-tmux -p80%,40%

  # Separate -w and -h
  fzf-tmux -w80% -h40%

  # 80%/40% at position (0, 0)
  fzf-tmux -w80% -h40% -x0 -y0

You can configure key bindings and fuzzy completion to open in tmux
popup window like so:

  FZF_TMUX_OPTS='-p 80%'
4 years ago
Junegunn Choi 18261fe31c
[shell] Update CTRL-R to remove duplicate commands
Close #1940
Related: #1363 #749 #270 #49 #88 #492 #600
4 years ago
Junegunn Choi 14f90502a4
[bash] Restore --nth option in CTRL-R 4 years ago
Junegunn Choi b2c0413a98
[bash] Fix --query argument of CTRL-R
Fix #1898
4 years ago
Jack Bates 7c447bbdc7
[bash] Start C-r search with current command line (#1886)
Restore the original line when search is aborted. Add --query
"$READLINE_LINE" and fall back to the current behavior pre Bash 4.

Co-authored-by: Junegunn Choi <junegunn.c@gmail.com>
4 years ago
Jack Bates 5cae8ea733
[bash] Multiline C-r without histexpand (#1837)
Close #1370 

Parses the history list, converts it to a NUL-delimited list of possibly
multiline entries. Adds the fzf --read0 option. Works with and without
histexpand enabled.

Co-authored-by: Junegunn Choi <junegunn.c@gmail.com>
4 years ago
Jack Bates 1ccd8f6a64
[bash] Restore insertion point pre Bash 4 (#1881)
Make C-t more consistent pre and post Bash 4. It already kills the
command line separately before and after the insertion point. Add
set-mark and exchange-point-and-mark to restore the insertion point
after yanking back and apply the same behavior to M-c.

* CTRL-T should put extra space after pasted items

Co-authored-by: Junegunn Choi <junegunn.c@gmail.com>
4 years ago
Jack Bates 9c293bb82b
[bash] Put C-t items at point in vi mode (#1876)
Be consistent with emacs mode and put the items at the point vs. the end
of the command line.
4 years ago
Jack Bates 82bf8c138d [bash] Populate emacs and vi keymaps (#1815)
Enables the right bindings when switching between editing modes.
4 years ago
Junegunn Choi 12ce76b56a
[bash] Make sure to execute builtin history
Fix #1592
5 years ago
Junegunn Choi 89de1340af
[bash] Add --sync to the default CTRL-R options
This compensates the use of --tac. fzf will not render on the screen
until the complete list of commands are loaded.
6 years ago
Junegunn Choi 3f868fd792
[bash] Fix CTRL-R to preserve the latest yank
Close #1216

1. Append a single space so that step 3 won't fail
2. CTRL-E to move to the end of the line
3. CTRL-U to delete the whole line before the cursor
4. CTRL-Y to paste the deleted line
5. ESC+Y to rotate the kill ring and bring back the previous yank before step 3
6. CTRL-U to delete the whole line again
7. Paste `__fzf_history__`
8. ESC+CTRL-E to expand the command substitution
9. ESC+R to redraw the line
10. ESC+^ to expand the history entry (!NUMBER)
6 years ago
Junegunn Choi 93aeae1985
[bash] Trigger redraw-current-line before history-expand-line
Close #681
7 years ago
Junegunn Choi c387689d1c
[shell] Enable sorting by default in CTRL-R
CTRL-R binding used to start with --no-sort to list the matched commands
in chronological order. However, it has been a constant source of
confusion. Let's enable it by default from now on. The sorted result
shouldn't be too confusing as we use --tiebreak=index.
7 years ago
Junegunn Choi 11407bf656
Exclude sysfs in find commands 7 years ago
Pierre Neidhardt ce43ea9f42 [shell] Replace `sed` with `-mindepth 1` and `cut` (#844) 7 years ago
Junegunn Choi 95c77bfb98
Use --bind instead of --toggle-sort
Related #822
7 years ago
Junegunn Choi 8ac37d5927
[shell] Do not override --reverse in CTRL-R
Close #807
7 years ago
Junegunn Choi 7ef0e50507
[bash/zsh] Remove unused --reverse in CTRL-R binding
Related #807
7 years ago
Junegunn Choi 208d4f2173
[shell] Make layout configurable via $FZF_DEFAULT_OPTS and $FZF_{KEY}_OPTS 7 years ago
Junegunn Choi 1448d631a7
Add --height option 8 years ago
Junegunn Choi 45faad7e04
[bash] Addendum fix for #580 8 years ago
Pierre Neidhardt c7b0764002 [shell] Use '-mindepth 1' to omit root folder in 'find' output (#779)
This removes the need for the 'sed' call. Faster, cleaner.
8 years ago
Junegunn Choi c49e65d926
[shell] Fix pruning condition of find command for CTRL-T and ALT-C
`-fstype dev` is invalid. It's devfs on macOS and devtmpfs on Linux.
8 years ago
Junegunn Choi 3a4e053af7
[bash] Fall back to send-keys if named paste buffer is not supported
Related: #616
8 years ago
Sean b36b0a91f5 use tmux buffers for sending output to preserve character encoding 8 years ago
Junegunn Choi 6081eac58a
[shell] Suppress alias/function expansion
Close #611
8 years ago
Junegunn Choi c39c039e15
[shell] Add $FZF_CTRL_T_OPTS and $FZF_ALT_C_OPTS
Close #596
8 years ago
Junegunn Choi 95b34de339
[bash/zsh] Fix $FZF_CTRL_R_OPTS with option values with spaces 8 years ago
Junegunn Choi e0b29e437b
[bash] Use backticks to avoid delay with blink-matching-paren
Close #580
8 years ago
Junegunn Choi d86cee2a69 [bash] Export fzf-file-widget function for bash 4+ (#546)
e.g. Remapping fzf-file-widget to CTRL-X CTRL-T intead of CTRL-T

    bind -x '"\C-x\C-t": fzf-file-widget'
    bind '"\C-t": transpose-chars'
8 years ago
Gene Pavlovsky 63dbf48546 Update key-bindings.bash
Faster startup. Use internal bash globbing instead of external grep binary (adapter from Gentoo's `/etc/bash/bashrc` TERM checking). Insignificant on Linux, but on Cygwin this cuts startup time by 40 ms on my Core i7 laptop.
8 years ago
William Chargin 12230f8043 Fix bash-vimode normal-mode cd completion 8 years ago
William Chargin 0c8de1ca44 Fix Bash+vimode pre-launch delay
Summary:
Fix adapted from [@adamheins: fzf, vi-mode, and fixing delays][1].

  [1]: https://adamheins.com/blog/fzf-vi-mode-and-fixing-delays

The basic problem is that
fzf presses <Esc> to enter vi-movement-mode
(as opposed to insert mode)
and then presses a bunch of keys to set up the buffer.
But the <Esc> keypress is also the prefix for a bunch of other commands,
so Bash will dutifully wait an excruciating half-second
before actually executing this command.
Instead, we bind <C-x><C-a>, which is unused by default
and seems reasonably unlikely to be custom-bound,
to be another way to enter vi-movement-mode;
this binding is unambiguous, so fzf can use it without delay.

This change was made by just `:s/\\e/\\C-x\\C-a/gc`
in the relevant section,
after adding the actual binding and comment at the top.
8 years ago
Junegunn Choi a57b375b41 Add $FZF_CTRL_R_OPTS for overriding the default options for CTRL-R
Close #526
8 years ago
Junegunn Choi 09a2ab39fe [bash] Fix shellcheck warnings
Close #516
8 years ago
Kobe Lipkens 3b9984379c Pass FZF_DEFAULT_OPTS to non-interactive bash instance 9 years ago
Chaoren Lin 54b4b0c56f Dynamically select which __fzf_select__ to use for tmux with bash 4+.
Instead of choosing one at initialization, choose the correct one
when it's actually called, so that the behavior is correct even after
resizing.

Bonus fixes for tmux with bash 4+:
- No extra space when cancelling CTRL-T.
- Fix cursor position problem in vi mode.
9 years ago
Chaoren Lin 033afde3b5 Fix CTRL-T in tmux with non-standard configuration.
- Don't assume ~/.fzf.bash exists.
- Source the current script for __fzf_select__.
- Forward $PATH.
9 years ago
Junegunn Choi e99731ea85 [shell] Add FZF_ALT_C_COMMAND for ALT-C (#408) 9 years ago
Junegunn Choi 392da53f53 [bash] Make CTRL-R work when histexpand is unset (#286)
Note that it still can't handle properly multi-line commands.
Thanks to @jpcirrus for the bug report and the fix.
9 years ago
Junegunn Choi 938151a834 [shell] Add FZF_CTRL_T_COMMAND for CTRL-T
Close #40
9 years ago
Junegunn Choi 56100f0fa7 [bash] Use `command \find` for ALT-C
ALT-C can fail with the following aliases as pointed out in #272

    alias find='noglob find'
    alias command='command '
9 years ago
Junegunn Choi 40761b11b1 [bash] Ignore asterisk (modified) in history 9 years ago
Junegunn Choi b4a05ff27e [bash] CTRL-R to use history-expand-line
Close #146
9 years ago