Skip to content
Myr

README-VIM: g:fzf_action doesn't work with custom sink

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Fix https://github.com/junegunn/fzf.vim/issues/1131

authored by Junegunn Choi · committed by Junegunn Choi · parent 6c9adea · Browse files · 2 files+47 added−18 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+47 added−18 removed

  • other:+47 added−18 removed

2 files+47 added−18 removed

modified:doc/fzf.txt+28 added-13 removed
1fzf.txt fzf Last change: April 4 20201fzf.txt fzf Last change: October 18 20202FZF - TABLE OF CONTENTS *fzf* *fzf-toc*3==============================================================================45 FZF Vim integration
4 unmodified lines
10 Examples11 Explanation of g:fzf_colors12 fzf#run13 fzf#wrap14 Global options supported by fzf#wrap15 Tips16 fzf inside terminal buffer17 Starting fzf in a popup window18 Hide statusline
86 unmodified lines
105106 " Bang version starts fzf in fullscreen mode107 :FZF!108<108Similarly to {ctrlp.vim}{2}, use enter key, CTRL-T, CTRL-X or CTRL-V to open109Similarly to {ctrlp.vim}{3}, use enter key, CTRL-T, CTRL-X or CTRL-V to open110selected files in the current window, in new tabs, in horizontal splits, or in111vertical splits respectively.112113Note that the environment variables `FZF_DEFAULT_COMMAND` and114`FZF_DEFAULT_OPTS` also apply here.115115 {2} https://github.com/kien/ctrlp.vim116 {3} https://github.com/kien/ctrlp.vim117118119< Configuration >_____________________________________________________________~120 *fzf-configuration*
33 unmodified lines
154 \ 'ctrl-x': 'split',155 \ 'ctrl-v': 'vsplit' }156157 " Default fzf layout157 " - down / up / left / right / window158 let g:fzf_layout = { 'down': '~40%' }158 " - Popup window159 let g:fzf_layout = { 'window': { 'width': 0.9, 'height': 0.6 } }160161 " You can set up fzf window using a Vim command (Neovim or latest Vim 8 required)161 " - down / up / left / right162 let g:fzf_layout = { 'down': '40%' }163164 " - Window using a Vim command165 let g:fzf_layout = { 'window': 'enew' }166 let g:fzf_layout = { 'window': '-tabnew' }167 let g:fzf_layout = { 'window': '10new' }168
180 unmodified lines
349After we "wrap" our spec, we pass it to `fzf#run`.350>351 call fzf#run(fzf#wrap({'source': 'ls'}))352<350Now it supports CTRL-T, CTRL-V, and CTRL-X key bindings and it opens fzf351window according to `g:fzf_layout` setting.353Now it supports CTRL-T, CTRL-V, and CTRL-X key bindings (configurable via354`g:fzf_action`) and it opens fzf window according to `g:fzf_layout` setting.355356To make it easier to use, let's define `LS` command.357>358 command! LS call fzf#run(fzf#wrap({'source': 'ls'}))
21 unmodified lines
380 command! -bang -complete=dir -nargs=* LS381 \ call fzf#run(fzf#wrap('ls', {'source': 'ls', 'dir': <q-args>}, <bang>0))382<383384< Global options supported by fzf#wrap >______________________________________~385 *fzf-global-options-supported-by-fzf#wrap*386387 - `g:fzf_layout`388 - `g:fzf_action`389 - Works only when no custom `sink` (or `sink*`) is provided390 - Having custom sink usually means that each entry is not an ordinary391 file path (e.g. name of color scheme), so we can't blindly apply the392 same strategy (i.e. `tabedit some-color-scheme` doesn't make sense)393 - `g:fzf_colors`394 - `g:fzf_history_dir`395396397TIPS *fzf-tips*398==============================================================================399400
12 unmodified lines
413Starting fzf in a popup window~414 *fzf-starting-fzf-in-a-popup-window*415>416 " Required:401 " - width [float range [0 ~ 1]]402 " - height [float range [0 ~ 1]]417 " - width [float range [0 ~ 1]] or [integer range [8 ~ ]]418 " - height [float range [0 ~ 1]] or [integer range [4 ~ ]]419 "420 " Optional:421 " - xoffset [float default 0.5 range [0 ~ 1]]422 " - yoffset [float default 0.5 range [0 ~ 1]]
19 unmodified lines
442When fzf starts in a terminal buffer, the file type of the buffer is set to443`fzf`. So you can set up `FileType fzf` autocmd to customize the settings of444the window.445430For example, if you use a non-popup layout (e.g. `{'down': '40%'}`) on431Neovim, you might want to temporarily disable the statusline for a cleaner432look.446For example, if you use a non-popup layout (e.g. `{'down': '40%'}`) on Neovim,447you might want to temporarily disable the statusline for a cleaner look.448>449 if has('nvim') && !exists('g:fzf_layout')450 autocmd! FileType fzf451 autocmd FileType fzf set laststatus=0 noshowmode noruler
13 unmodified lines
modified:README-VIM.md+19 added-5 removed
125 unmodified lines
126 \ 'ctrl-x': 'split',127 \ 'ctrl-v': 'vsplit' }128129" Default fzf layout130" - down / up / left / right / window131let g:fzf_layout = { 'down': '40%' }130" - Popup window131let g:fzf_layout = { 'window': { 'width': 0.9, 'height': 0.6 } }132134" You can set up fzf window using a Vim command (Neovim or latest Vim 8 required)133" - down / up / left / right134let g:fzf_layout = { 'down': '40%' }135136" - Window using a Vim command137let g:fzf_layout = { 'window': 'enew' }138let g:fzf_layout = { 'window': '-tabnew' }139let g:fzf_layout = { 'window': '10new' }140
192 unmodified lines
333```vim334call fzf#run(fzf#wrap({'source': 'ls'}))335```336335Now it supports `CTRL-T`, `CTRL-V`, and `CTRL-X` key bindings and it opens fzf336window according to `g:fzf_layout` setting.337Now it supports `CTRL-T`, `CTRL-V`, and `CTRL-X` key bindings (configurable338via `g:fzf_action`) and it opens fzf window according to `g:fzf_layout`339setting.340341To make it easier to use, let's define `LS` command.342343```vim
28 unmodified lines
372command! -bang -complete=dir -nargs=* LS373 \ call fzf#run(fzf#wrap('ls', {'source': 'ls', 'dir': <q-args>}, <bang>0))374```375376### Global options supported by `fzf#wrap`377378- `g:fzf_layout`379- `g:fzf_action`380 - **Works only when no custom `sink` (or `sink*`) is provided**381 - Having custom sink usually means that each entry is not an ordinary382 file path (e.g. name of color scheme), so we can't blindly apply the383 same strategy (i.e. `tabedit some-color-scheme` doesn't make sense)384- `g:fzf_colors`385- `g:fzf_history_dir`386387Tips388----389390### fzf inside terminal buffer
60 unmodified lines