Commit Graph

70 Commits (4603d540c3ae648c9e2ef84f33433b275290aa7c)

Author SHA1 Message Date
John Fred Fadrigalan 4603d540c3
[shell] Make bash/zsh completion and bindings work with 'set -u' (#2999)
Co-authored-by: Junegunn Choi <junegunn.c@gmail.com>
2 years ago
Junegunn Choi 6fb41a202a
Add --scheme=[default|path|history] option to choose scoring scheme
Close #2909
Close #2930
2 years ago
kissge 475469a2e7
[zsh] Make awk regex compatible with both GNU and macOS (#2906) 2 years ago
Jakub Jirutka 8df872a482
[zsh] Replace perl with awk (#2777)
Unlike awk, which is even defined in POSIX, perl is not pre-installed
on all *nix systems. This awk command is functionally equivalent to
the original perl command.
2 years ago
Ajeet D'Souza 54841248e7
[shell] ALT-C: Use builtin cd to avoid conflicts (#2799) 2 years ago
Junegunn Choi 5f385d88e0
[zsh] Set up bindings for all three keymaps: emacs, vicmd, and viins
Fix #2694
2 years ago
zsugabubus 205f885d69
[shell] Use cd -- (#2659)
Otherwise directories starting with '-' may treated as options.
3 years ago
Marlon Richert 43b3b907f8
[zsh] Don't run precmd hooks in cd widget (#2340)
`precmd` hooks expect the Zsh Line Editor to not be active.
Running these when the ZLE is active can lead to unpredictable results.
See https://github.com/marlonrichert/zsh-autocomplete/issues/180
3 years ago
Junegunn Choi 37708ad9cd
Revert "[zsh] Use shell redirection (#2281)"
This reverts commit e9bc7331bd.

The change is no longer necessary since 090dee8.
3 years ago
Junegunn Choi b234647a63
[shell] Disable CTRL-Z
Fix #2289
3 years ago
林千里 e9bc7331bd
[zsh] Use shell redirection (#2281)
zsh sends SIGCONT when running fzf in a pipe in certain cases,
causing mouse mode to become disabled

Fix #2101
4 years ago
Junegunn Choi 00f4551a7b
Revert "[zsh] Reload shared history before searching (#2251)"
This reverts commit b62a74b315.

https://github.com/junegunn/fzf/pull/2251#issuecomment-740551383
4 years ago
Martin Polden b62a74b315
[zsh] Reload shared history before searching (#2251) 4 years ago
ratijas c61eb94b3f
[zsh] Declare variable as local before assignment (#2266) 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 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
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
Junegunn Choi 0c6c76e081
[zsh] Suppress global alias expansion in widget functions
Close #1708
5 years ago
Paul Frybarger fd8d371ac7 [zsh] Fix multiline prompt issue with 'zle reset-prompt' (#1397)
Close #867 
Close #1256
6 years ago
Aaron Jensen 2cd0d4a9f7 [zsh] Fire zsh precmd functions after cd (#1136)
Fixes #915
7 years ago
Daniel Schaffrath 3af63bcf1f [zsh] Use fc -r instead of fzf --tac to speed up loadtime (#1097)
Reference: http://zsh.sourceforge.net/Doc/Release/Shell-Builtin-Commands.html

> The flag -r reverses the order of the events
7 years ago
Ionel Cristian Mărieș 0580fe9046 Don't do shell quoting for weird chars (#1079)
* Don't do shell quoting for weird chars

This would prevent tabs from being escaped as `$'\t'` (definitely not what I would want to see as initial value in the search).

* Do different escape.
7 years ago
Junegunn Choi 337cdbb37c
[zsh] Use setopt noposixbuiltins instead of emulate -L zsh
Close #858
3a6af27586 (commitcomment-21135641)
7 years ago
Junegunn Choi 05fdf91fc5
Revert "[zsh] emulate -L zsh to avoid issues with incompatible options"
This reverts commit 3a6af27586.
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 3a6af27586
[zsh] emulate -L zsh to avoid issues with incompatible options
Close #858
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
Daniel Gray afa25d8c57 [zsh] Do not cd when cancelling alt+c keybind (#840) 7 years ago
Junegunn Choi 95c77bfb98
Use --bind instead of --toggle-sort
Related #822
7 years ago
Junegunn Choi d09ad13208
[zsh] Workaround trailing esacped space bug in go-shellwords
https://github.com/mattn/go-shellwords/issues/3

Close #812
8 years ago
Junegunn Choi 8ac37d5927
[shell] Do not override --reverse in CTRL-R
Close #807
8 years ago
Junegunn Choi 7ef0e50507
[bash/zsh] Remove unused --reverse in CTRL-R binding
Related #807
8 years ago
Junegunn Choi 208d4f2173
[shell] Make layout configurable via $FZF_DEFAULT_OPTS and $FZF_{KEY}_OPTS 8 years ago
Junegunn Choi 1448d631a7
Add --height option 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 c36413fdf6
[zsh] Suppress error message when pipefail is not supported
Close #615
8 years ago
Sebastian Reuße fed5e5d5af [zsh] Re-initialize zle when widgets finish
zle automatically calls zle-line-init when it starts to read a new line. Many
Zsh setups use this hook to set the terminal into application mode, since this
will then allow defining keybinds based on the $terminfo variable (the escape
codes in said variable are only valid in application mode).

However, fzf resets the terminal into raw mode, rendering $terminfo values
invalid once the widget has finished. Accordingly, keyboard bindings defined
via $terminfo won’t work anymore.

This fixes the issue by calling zle-line-init when widgets finish. Care is taken
to not call this widget when it is undefined.

Fixes #279
8 years ago
Daniel Hahler 38a2076b89 zsh: pass through exit code from widgets
This allows to have a custom widget like the following, which would
additionally accept the line, but only in case of entries being
selected:

    fzf-file-widget-with-accept() {
      zle fzf-file-widget
      if [[ "$?" == 0 ]] && (( $#BUFFER )); then
        zle accept-line
      fi
    }
    zle     -N   fzf-file-widget-with-accept
    bindkey '\e^T' fzf-file-widget-with-accept

With this `<C-a>t` will launch fzf, and simulate the pressing of "Enter"
afterwards.
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 bdb94fba7d
[zsh] Fix #579 - Locally unset globsubst 8 years ago