[vim] Use Vim 8 terminal when appropriate
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Close #1055
authored by Junegunn Choi · committed by Junegunn Choi · parent ee40212 · Browse files · 3 files·+24 added−16 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+24 added−16 removed
- other:+24 added−16 removed
Provenance
- Commit
077ae51- Tree
e780cc6- Author
Junegunn Choi <junegunn.c@gmail.com>- Committer
Junegunn Choi <junegunn.c@gmail.com>- Parent
ee40212
3 files changed+24 added−16 removed
modified:doc/fzf.txt+12 added-6 removed
1-fzf.txt fzf Last change: August 14 20171+fzf.txt fzf Last change: September 29 20172 FZF - TABLE OF CONTENTS *fzf* *fzf-toc*3 ==============================================================================4 5 FZF Vim integration54 unmodified lines60 - `g:fzf_action`61 - Customizable extra key bindings for opening selected files in different62 ways63 - `g:fzf_layout`64- - Determines the size and position of fzf window (tmux pane or Neovim split)64+ - Determines the size and position of fzf window65 - `g:fzf_colors`66 - Customizes fzf colors to match the current color scheme67 - `g:fzf_history_dir`68 - Enables history feature27 unmodified lines96 " Default fzf layout97 " - down / up / left / right98 let g:fzf_layout = { 'down': '~40%' }99 100- " In Neovim, you can set up fzf window using a Vim command100+ " You can set up fzf window using a Vim command (Neovim or latest Vim 8 required)101 let g:fzf_layout = { 'window': 'enew' }102 let g:fzf_layout = { 'window': '-tabnew' }103 let g:fzf_layout = { 'window': '10split enew' }104 5 unmodified lines110 \ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],111 \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],112 \ 'hl+': ['fg', 'Statement'],113 \ 'info': ['fg', 'PreProc'],114+ \ 'border': ['fg', 'Ignore'],115 \ 'prompt': ['fg', 'Conditional'],116 \ 'pointer': ['fg', 'Exception'],117 \ 'marker': ['fg', 'Keyword'],118 \ 'spinner': ['fg', 'Label'],22 unmodified lines141 `sink*` | funcref | Similar to `sink` , but takes the list of output lines at once142 `options` | string/list | Options to fzf143 `dir` | string | Working directory144 `up` / `down` / `left` / `right` | number/string | Use tmux pane with the given size (e.g. `20` , `50%` )144- `window` (Neovim only) | string | Command to open fzf window (e.g. `vertical aboveleft 30new` )145+ `window` (Vim 8 / Neovim) | string | Command to open fzf window (e.g. `vertical aboveleft 30new` )146 `launcher` | string | External terminal emulator to start fzf with (GVim only)147 `launcher` | funcref | Function for generating `launcher` string (GVim only)148 ---------------------------+---------------+--------------------------------------------------------------149 19 unmodified lines169 170 GVIM *fzf-gvim*171 ==============================================================================172 172-In GVim, you need an external terminal emulator to start fzf with. `xterm`173-command is used by default, but you can customize it with `g:fzf_launcher`.173+With the latest version of GVim, fzf will start inside the builtin terminal174+emulator of Vim. Please note that this terminal feature of Vim is still young175+and unstable and you may run into some issues.176+177+If you have an older version of GVim, you need an external terminal emulator178+to start fzf with. `xterm` command is used by default, but you can customize179+it with `g:fzf_launcher`.180 >181 " This is the default. %s is replaced with fzf command182 let g:fzf_launcher = 'xterm -e bash -ic %s'183 18 unmodified linesmodified:plugin/fzf.vim+9 added-7 removed
384 unmodified lines385 let prefix = ''386 endif387 388 let prefer_tmux = get(g:, 'fzf_prefer_tmux', 0)389- let use_height = has_key(dict, 'down') &&390- \ !(has('nvim') || s:is_win || has('win32unix') || s:present(dict, 'up', 'left', 'right')) &&389+ let use_height = has_key(dict, 'down') && !has('gui_running') &&390+ \ !(has('nvim') || s:is_win || has('win32unix') || s:present(dict, 'up', 'left', 'right', 'window')) &&391 \ executable('tput') && filereadable('/dev/tty')392- let use_term = has('nvim-0.2.1') || (has('nvim') && !s:is_win) || (has('terminal') && has('patch-8.0.995') && (has('gui_running') || s:is_win))392+ let has_term = has('nvim-0.2.1') || has('nvim') && !s:is_win || has('terminal') && has('patch-8.0.995')393+ let use_term = has_term && (has('gui_running') || s:is_win || !use_height && s:present(dict, 'down', 'up', 'left', 'right', 'window'))394 let use_tmux = (!use_height && !use_term || prefer_tmux) && !has('win32unix') && s:tmux_enabled() && s:splittable(dict)395 if prefer_tmux && use_tmux396 let use_height = 0397 let use_term = 02 unmodified lines400 let height = s:calc_size(&lines, dict.down, dict)401 let optstr .= ' --height='.height402 elseif use_term403 let optstr .= ' --no-height'403- if !has('nvim') && !s:is_win404- let optstr .= ' --bind ctrl-j:accept'405- endif404 endif405 let command = prefix.(use_tmux ? s:fzf_tmux(dict) : fzf_exec).' '.optstr.' > '.temps.result406 407 if use_term288 unmodified lines696 let command .= s:term_marker697 if has('nvim')698 call termopen(command, fzf)699 else702- call term_start([&shell, &shellcmdflag, command], {'curwin': fzf.buf, 'exit_cb': function(fzf.on_exit)})700+ let t = term_start([&shell, &shellcmdflag, command], {'curwin': fzf.buf, 'exit_cb': function(fzf.on_exit)})701+ " FIXME: https://github.com/vim/vim/issues/1998702+ if !has('nvim') && !s:is_win703+ call term_wait(t, 20)704+ endif705 endif706 finally707 if s:present(a:dict, 'dir')708 lcd -98 unmodified linesmodified:README-VIM.md+3 added-3 removed
35 unmodified lines3637383940404142434426 unmodified lines7172737475757677787935 unmodified lines11511611711811911912012112212351 unmodified lines35 unmodified lines
- `g:fzf_action` - Customizable extra key bindings for opening selected files in different ways- `g:fzf_layout` - Determines the size and position of fzf window (tmux pane or Neovim split) - Determines the size and position of fzf window- `g:fzf_colors` - Customizes fzf colors to match the current color scheme- `g:fzf_history_dir` - Enables history feature26 unmodified lines" Default fzf layout" - down / up / left / rightlet g:fzf_layout = { 'down': '~40%' }
" In Neovim, you can set up fzf window using a Vim command" You can set up fzf window using a Vim command (Neovim or latest Vim 8 required)let g:fzf_layout = { 'window': 'enew' }let g:fzf_layout = { 'window': '-tabnew' }let g:fzf_layout = { 'window': '10split enew' }
35 unmodified lines| `sink*` | funcref | Similar to `sink`, but takes the list of output lines at once || `options` | string/list | Options to fzf || `dir` | string | Working directory || `up`/`down`/`left`/`right` | number/string | Use tmux pane with the given size (e.g. `20`, `50%`) || `window` (*Neovim only*) | string | Command to open fzf window (e.g. `vertical aboveleft 30new`) || `window` (Vim 8 / Neovim) | string | Command to open fzf window (e.g. `vertical aboveleft 30new`) || `launcher` | string | External terminal emulator to start fzf with (GVim only) || `launcher` | funcref | Function for generating `launcher` string (GVim only) |
`options` entry can be either a string or a list. For simple cases, string51 unmodified lines