Add support for search history

- Add `--history` option (e.g. fzf --history ~/.fzf.history)
- Add `--history-max` option for limiting the size of the file (default 1000)
- Add `previous-history` and `next-history` actions for `--bind`
    - CTRL-P and CTRL-N are automatically remapped to these actions when
      `--history` is used

Closes #249, #251
This commit is contained in:
Junegunn Choi
2015-06-14 00:43:44 +09:00
parent 2e84b1db64
commit 3b52811796
6 changed files with 163 additions and 11 deletions

View File

@@ -45,7 +45,10 @@ _fzf_opts_completion() {
--print-query
--expect
--toggle-sort
--sync"
--sync
--null
--history
--history-max"
case "${prev}" in
--tiebreak)
@@ -56,6 +59,10 @@ _fzf_opts_completion() {
COMPREPLY=( $(compgen -W "dark light 16 bw" -- ${cur}) )
return 0
;;
--history)
COMPREPLY=()
return 0
;;
esac
if [[ ${cur} =~ ^-|\+ ]]; then
@@ -207,7 +214,7 @@ EOF
}
# fzf options
complete -F _fzf_opts_completion fzf
complete -o default -F _fzf_opts_completion fzf
d_cmds="cd pushd rmdir"
f_cmds="