Skip to content
Myr

[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

3 files+24 added−16 removed

modified:doc/fzf.txt+12 added-6 removed
1fzf.txt fzf Last change: August 14 20171fzf.txt fzf Last change: September 29 20172FZF - TABLE OF CONTENTS *fzf* *fzf-toc*3==============================================================================45 FZF Vim integration
54 unmodified lines
60 - `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 feature
27 unmodified lines
96 " Default fzf layout97 " - down / up / left / right98 let g:fzf_layout = { 'down': '~40%' }99100 " 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 lines
110 \ '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 lines
141 `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 lines
169170GVIM *fzf-gvim*171==============================================================================172172In GVim, you need an external terminal emulator to start fzf with. `xterm`173command is used by default, but you can customize it with `g:fzf_launcher`.173With the latest version of GVim, fzf will start inside the builtin terminal174emulator of Vim. Please note that this terminal feature of Vim is still young175and unstable and you may run into some issues.176177If you have an older version of GVim, you need an external terminal emulator178to start fzf with. `xterm` command is used by default, but you can customize179it 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 lines
modified:plugin/fzf.vim+9 added-7 removed
384 unmodified lines
385 let prefix = ''386 endif387388 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 = 0
2 unmodified lines
400 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.result406407 if use_term
288 unmodified lines
696 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 lines
modified:README-VIM.md+3 added-3 removed