[vim] Use native --tmux option instead of fzf-tmux when possible
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Junegunn Choi · committed by Junegunn Choi · parent 83b6033 · Browse files · 3 files·+21 added−17 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
3 files+21 added−17 removed
- other:+21 added−17 removed
Provenance
- Commit
685fb71- Tree
3764111- Author
Junegunn Choi <junegunn.c@gmail.com>- Committer
Junegunn Choi <junegunn.c@gmail.com>- Parent
83b6033
3 files changed+21 added−17 removed
modified:doc/fzf.txt+5 added-4 removed
309 unmodified lines310 `sinklist` (or `sink*` ) | funcref | Similar to `sink` , but takes the list of output lines at once311 `options` | string/list | Options to fzf312 `dir` | string | Working directory313 `up` / `down` / `left` / `right` | number/string | (Layout) Window position and size (e.g. `20` , `50%` )314- `tmux` | string | (Layout) fzf-tmux options (e.g. `-p90%,60%` )314+ `tmux` | string | (Layout) `--tmux` options (e.g. `90%,70%` )315 `window` (Vim 8 / Neovim) | string | (Layout) Command to open fzf window (e.g. `vertical aboveleft 30new` )316 `window` (Vim 8 / Neovim) | dict | (Layout) Popup window settings (e.g. `{'width': 0.9, 'height': 0.6}` )317 ---------------------------+---------------+----------------------------------------------------------------------318 149 unmodified lines468 " - 'rounded' / 'sharp' / 'horizontal' / 'vertical' / 'top' / 'bottom' / 'left' / 'right'469 let g:fzf_layout = { 'window': { 'width': 0.9, 'height': 0.6 } }470 <471 Alternatively, you can make fzf open in a tmux popup window (requires tmux 3.2472-or above) by putting fzf-tmux options in `tmux` key.472+or above) by putting `--tmux` options in `tmux` key.473 >474- " See `man fzf-tmux` for available options474+ " See `--tmux` option in `man fzf` for available options475+ " [center|top|bottom|left|right][,SIZE[%]][,SIZE[%]]476 if exists('$TMUX')476- let g:fzf_layout = { 'tmux': '-p90%,60%' }477+ let g:fzf_layout = { 'tmux': '90%,70%' }478 else479 let g:fzf_layout = { 'window': { 'width': 0.9, 'height': 0.6 } }480 endif481 <27 unmodified linesmodified:plugin/fzf.vim+11 added-9 removed
571 unmodified lines572 let size = get(a:dict, 'tmux', '')573 if empty(size)574 for o in ['up', 'down', 'left', 'right']575 if s:present(a:dict, o)576- let spec = a:dict[o]577- if (o == 'up' || o == 'down') && spec[0] == '~'578- let size = '-'.o[0].s:calc_size(&lines, spec, a:dict)579- else580- " Legacy boolean option581- let size = '-'.o[0].(spec == 1 ? '' : substitute(spec, '^\~', '', ''))582- endif576+ let size = o . ',' . a:dict[o]577 break578 endif579 endfor580 endif581+582+ " Legacy fzf-tmux options583+ if size =~ '-'587- return printf('LINES=%d COLUMNS=%d %s %s %s --',588- \ &lines, &columns, fzf#shellescape(s:fzf_tmux), size, (has_key(a:dict, 'source') ? '' : '-'))584+ return printf('LINES=%d COLUMNS=%d %s %s %s --',585+ \ &lines, &columns, fzf#shellescape(s:fzf_tmux), size, (has_key(a:dict, 'source') ? '' : '-'))586+ end587+588+ " Using native --tmux option589+ let in = (has_key(a:dict, 'source') ? '' : ' < /dev/tty')590+ return printf('%s --tmux %s%s', fzf#shellescape(fzf#exec()), size, in)591 endfunction592 593 function! s:splittable(dict)594 return s:present(a:dict, 'up', 'down') && &lines > 15 ||502 unmodified linesmodified:README-VIM.md+5 added-4 removed
292 unmodified lines293 | `sinklist` (or `sink*`) | funcref | Similar to `sink`, but takes the list of output lines at once |294 | `options` | string/list | Options to fzf |295 | `dir` | string | Working directory |296 | `up`/`down`/`left`/`right` | number/string | (Layout) Window position and size (e.g. `20`, `50%`) |297-| `tmux` | string | (Layout) fzf-tmux options (e.g. `-p90%,60%`) |297+| `tmux` | string | (Layout) `--tmux` options (e.g. `90%,70%`) |298 | `window` (Vim 8 / Neovim) | string | (Layout) Command to open fzf window (e.g. `vertical aboveleft 30new`) |299 | `window` (Vim 8 / Neovim) | dict | (Layout) Popup window settings (e.g. `{'width': 0.9, 'height': 0.6}`) |300 301 `options` entry can be either a string or a list. For simple cases, string154 unmodified lines456 let g:fzf_layout = { 'window': { 'width': 0.9, 'height': 0.6 } }457 ```458 459 Alternatively, you can make fzf open in a tmux popup window (requires tmux 3.2460-or above) by putting fzf-tmux options in `tmux` key.460+or above) by putting `--tmux` option value in `tmux` key.461 462 ```vim463-" See `man fzf-tmux` for available options463+" See `--tmux` option in `man fzf` for available options464+" [center|top|bottom|left|right][,SIZE[%]][,SIZE[%]]465 if exists('$TMUX')465- let g:fzf_layout = { 'tmux': '-p90%,60%' }466+ let g:fzf_layout = { 'tmux': '90%,70%' }467 else468 let g:fzf_layout = { 'window': { 'width': 0.9, 'height': 0.6 } }469 endif470 ```24 unmodified lines