fzf をインストールするときに、毎回迷うのでメモしておく。
今回は、Ver.0.25.1 の例。シェルは bash。
1. fzf の github からリリースバージョンをダウンロード
git でやっても良いが、下記から tar.gz をダウンロード。
https://github.com/junegunn/fzf/tags
2. インストール
$ tar zxvf fzf-0.25.1.tar.gz
$ cd fzf-0.25.1
$ ./install
Downloading bin/fzf ...
- Already exists
- Checking fzf executable ... 0.25.1
Do you want to enable fuzzy auto-completion? ([y]/n) n
Do you want to enable key bindings? ([y]/n) n
Generate /home/masao/.fzf.bash ... OK
Do you want to update your shell configuration files? ([y]/n) n
Update /home/ohmoto/.bashrc:
- [ -f ~/.fzf.bash ] && source ~/.fzf.bash
~ Skipped
For more information, see: https://github.com/junegunn/fzf
$ sudo cp bin/fzf* /usr/local/bin
$ sudo cp man/man1/fzf* /usr/share/man/man1/
$ cp shell/completion.bash ~/.fzf_completion.bash
$ cp shell/key-bindings.bash ~/.fzf_key-bindings.bash
3. 設定
.bashrc に、下記を設定。設定はお好みで。
export HISTSIZE=100000
export HISTCONTROL=ignoreboth:erasedups # history を重複登録しないための設定
export PROMPT_COMMAND='history -a; history -c; history -r' # 複数のシェルで history を共有するための設定
shopt -u histappend # 同上
source ~/.fzf_completion.bash
source ~/.fzf_key-bindings.bash
export FZF_DEFAULT_OPTS='--height 40% --reverse --border'
export FZF_CTRL_R_OPTS="--preview-window up:3:wrap --preview 'echo {}'"
● fzf, history, 重複

0 件のコメント:
コメントを投稿