Commit Graph

202 Commits (552414978ed74e7cd77bd57874f6fbbe3e0024c4)

Author SHA1 Message Date
Andrew Zhou 6c9adea0d3
[fish] Fix parser handling of option-like args (#2208)
Fixes error when option-like args are parsed (e.g. "-1").
4 years ago
Elvan Owen 2986e64a49 [completion] Make host completion handle source files without EOL 4 years ago
Junegunn Choi 9dfca77c36
[zsh] Keep current $BUFFER on ALT-C
Ideally, we could only use `print -sr` to update the command history.
However, the "cd" command by ALT-C is added to the history only after we
finalize the current command by pressing an additional enter key.

i.e. The cd command from ALT-C is not visible when you hit Up arrow. But
it appears once you hit enter key.

So when the current buffer is empty, we use `zle accept-line` so that
the command history is immediately updated.

Close #2200
4 years ago
octaltree 82c4af2902
[zsh] Record cd execution in history (#2193) 4 years ago
Yuji Nakao d785135606
[zsh] Fix the regular expression (#2140)
Fix the regular expression to capture the command containing asterisk.
4 years ago
Junegunn Choi f81feb1e69
Revert file mode of key-bindings.zsh 4 years ago
Slaven Rezić e6d33f77da
[zsh] Make CTRL-R work with older Perls (#2003)
s///r is only available since perl 5.14. The Perl oneliner
was changed to work with older Perls, possibly even with 5.000.

Fix #2001
4 years ago
Junegunn Choi 6e464ebd9b
Remove dead code 4 years ago
Junegunn Choi c329279339
[completion] Make kill completion more consistent with the others
Support both ordinary completion trigger and empty trigger

    kill <tab>
    kill foo**<tab>

Close #1988
Close #385
4 years ago
Junegunn Choi dea206b023
[zsh-completion] Fix error with backslash-prefixed commands
Fix #1973
Fix #1974
Fix #1975
4 years ago
Junegunn Choi 21f94ee800 [fzf-tmux] Split zsh variable expansion for old zsh
The following code works in zsh 5.8 but not in 5.4

  ${(Q)${(Z+n+)FZF_TMUX_OPTS:--d${FZF_TMUX_HEIGHT:-40%}}}
4 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
Roman Perepelitsa b1b916ce15
[zsh] Ensure that fzf code always parses the same way (#1944)
At the top of each zsh file options are set to their
standard values (those marked with <Z> in `man zshoptions`)
and `aliases` option is disabled.

At the bottom of the file the original options are restored.

Fix #1938
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
Chitoku 079046863c
[zsh-completion] Fix a bug where _fzf_complete did not iterate through args (#1936) 4 years ago
Junegunn Choi 14f90502a4
[bash] Restore --nth option in CTRL-R 4 years ago
Jakub Łuczyński b43b040512
Fuzzy completions: removed leftover debug echo (#1921) 4 years ago
Junegunn Choi 50b7608f9d
Change custom fuzzy completion API
To make it easier to write more complex fzf options. Although this
does not break backward compatibility, users are encouraged to update
their code accordingly.

  # Before
  _fzf_complete "FZF_ARG1 FZF_ARG2..." "$@" < <(
    # Print candidates
  )

  # After
  _fzf_complete FZF_ARG1 FZF_ARG2... -- "$@" < <(
    # Print candidates
  )
4 years ago
Junegunn Choi baf882ace7
[completion] Use file redirection instead of pipe
This change allows the completion system of bash and zsh to return
before the input process completes.

Related #1887
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
Junegunn Choi afa2c4e0af
[fish] Ignore empty environment variables 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
Junegunn Choi 9897ee9591
[bash] Strip trailing whitespace on kill completion 4 years ago
Junegunn Choi 5215415315
[completion] Allow users to customize fzf options via _fzf_comprun
Related #1809 #1850
4 years ago
Junegunn Choi 54891d11e0
[bash-completion] Minor optimization 4 years ago
Hiroki Konishi 2a60edcd52
Make pointer and multi-select marker customizable (#1844)
Add --pointer and --marker option which can provide additional context to the user
4 years ago
Chitoku f7b26b34cb [zsh-completion] Fix quoting/splitting issues (#1820) 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 d4ad4a25db
[bash-completion] Fix default alias/variable completion
Fix #1795
5 years ago
Henré Botha 5e42b1c9f8 [ssh completion] Skip only aliases matching * (#1788)
This commit fixes a bug where lines that declare multiple hostnames get
omitted from completion entirely if one of the hostnames matches *. For
example:

	Host foo.com bar.dev baz.*
5 years ago
David Gray 77cb906dfe
[completion] Add support for HostName lines in ~/.ssh/config (#1785)
Close #1783
5 years ago
John Purnell 357e82e51b [completion] Ignore hg repos (#1777)
* Update completion.bash
* Update completion.zsh
5 years ago
midchildan f51d61d57a [zsh] Prevent the current directory from appearing as `~dir` in prompts (#1774)
The zsh version of the cd widget sets the variable `dir` to the path of
the target directory before invoking `cd`. This causes zsh to treat the
target directory as a named directory, which has the effect of zsh
substituting '%~' with '~dir' instead of the proper path when it
performs prompt expansion.

This commit will cause the widget to unset `dir` before redrawing the
prompt to fix this issue.

Details of zsh prompt expansion can be found in:
http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html
5 years ago
zhaoyunfeng b911af200c
[zsh-completion] Fix prefix extraction when triggers start with ';' 5 years ago
Junegunn Choi 0c6c76e081
[zsh] Suppress global alias expansion in widget functions
Close #1708
5 years ago
Junegunn Choi a5a97be017
[bash-completion] Properly handle exit event
Related #1704
5 years ago
Junegunn Choi 5c7dcaffe8
[bash-completion] _fzf_setup_completion to retain previous options 5 years ago
Junegunn Choi 5095899245
[bash-completion] Add _fzf_setup_completion to enable fuzzy completion
While we can attach `_fzf_path_completion` or `_fzf_dir_completion` to
any command using the standard bash complete command, the functionality
of the existing completion function is lost.

Use _fzf_setup_completion if you want to extend the existing function
with fuzzy completion instead of completely replacing it.

e.g. _fzf_setup_completion path kubectl
5 years ago
ssjhv e7097a9d25 [fish] Remove perl from fish key bindings (#1635)
Perl was used to remove the trailing newline character, but fzf already
has --print0 to use null character as terminators, and fish read -z is
expecting null character as terminators. There is no reason to depend on
perl if --print0 is passed to fzf invocation.
5 years ago
Junegunn Choi 12ce76b56a
[bash] Make sure to execute builtin history
Fix #1592
5 years ago
Jesus Briales 03e8ed4d88 [bash-completion] Fix custom completion with dynamic loader enabled for non-standard command names (#1564)
Related to #1170.

Fix the solution for commands with non-standard names
where `$cmd` and `$orig_cmd` differ. e.g. `s.foo` -> `s_foo`
5 years ago
Junegunn Choi 309bae423c
[zsh-completion] Suppress "no matches found" message 5 years ago
Rui Coelho 3bd8441079
[completion] Look up on ~/.ssh/config.d/* files when doing ssh host complete (#1420) 5 years ago
Junegunn Choi 8cf45a5197
[shell] Skip loading completion code on non-interactive shell
This change is not required if you use the install script to generate
~/.fzf.bash or ~/.fzf.zsh which already has the proper guard statement.

Close #1474
5 years ago
Paul Frybarger fd8d371ac7 [zsh] Fix multiline prompt issue with 'zle reset-prompt' (#1397)
Close #867 
Close #1256
6 years ago
Jay 6de1ad9d3d [completion] Filter out non-hostnames in SSH config file (#1329)
* Correctly exclude SSH config options with Host

SSH config files have 14 options containing 'Host'.
Previously The zsh and bash completion scripts would include lines
containing these options when doing command-line completion of SSH hosts
with `ssh **`.

This commit fixes that problem by only including lines with 'host '.

* Don't autocomplete SSH hostnames using ?

SSH config files support ? as well as * for wildcards in Host lines.
This commit excludes lines containing ? for zsh/bash command line
completeion using `ssh **`
6 years ago