diff options
-rw-r--r-- | README-VIM.md | 6 | ||||
-rw-r--r-- | doc/fzf.txt | 18 | ||||
-rw-r--r-- | plugin/fzf.vim | 16 |
3 files changed, 24 insertions, 16 deletions
diff --git a/README-VIM.md b/README-VIM.md index 3c8bab0e..4913fc74 100644 --- a/README-VIM.md +++ b/README-VIM.md @@ -37,7 +37,7 @@ Note that the environment variables `FZF_DEFAULT_COMMAND` and - `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` @@ -72,7 +72,7 @@ let g:fzf_action = { " - down / up / left / right let 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' } @@ -116,7 +116,7 @@ following options. | `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) | diff --git a/doc/fzf.txt b/doc/fzf.txt index a5239030..d0001149 100644 --- a/doc/fzf.txt +++ b/doc/fzf.txt @@ -1,4 +1,4 @@ -fzf.txt fzf Last change: August 14 2017 +fzf.txt fzf Last change: September 29 2017 FZF - TABLE OF CONTENTS *fzf* *fzf-toc* ============================================================================== @@ -61,7 +61,7 @@ Note that the environment variables `FZF_DEFAULT_COMMAND` and - 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` @@ -97,7 +97,7 @@ Examples~ " - down / up / left / right let 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' } @@ -111,6 +111,7 @@ Examples~ \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'], \ 'hl+': ['fg', 'Statement'], \ 'info': ['fg', 'PreProc'], + \ 'border': ['fg', 'Ignore'], \ 'prompt': ['fg', 'Conditional'], \ 'pointer': ['fg', 'Exception'], \ 'marker': ['fg', 'Keyword'], @@ -141,7 +142,7 @@ following options. `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) ---------------------------+---------------+-------------------------------------------------------------- @@ -169,8 +170,13 @@ function that decorates the options dictionary so that it understands GVIM *fzf-gvim* ============================================================================== -In GVim, you need an external terminal emulator to start fzf with. `xterm` -command is used by default, but you can customize it with `g:fzf_launcher`. +With the latest version of GVim, fzf will start inside the builtin terminal +emulator of Vim. Please note that this terminal feature of Vim is still young +and unstable and you may run into some issues. + +If you have an older version of GVim, you need an external terminal emulator +to start fzf with. `xterm` command is used by default, but you can customize +it with `g:fzf_launcher`. > " This is the default. %s is replaced with fzf command let g:fzf_launcher = 'xterm -e bash -ic %s' diff --git a/plugin/fzf.vim b/plugin/fzf.vim index c0bae817..bf80cfbd 100644 --- a/plugin/fzf.vim +++ b/plugin/fzf.vim @@ -386,10 +386,11 @@ try endif let prefer_tmux = get(g:, 'fzf_prefer_tmux', 0) - let use_height = has_key(dict, 'down') && - \ !(has('nvim') || s:is_win || has('win32unix') || s:present(dict, 'up', 'left', 'right')) && + let use_height = has_key(dict, 'down') && !has('gui_running') && + \ !(has('nvim') || s:is_win || has('win32unix') || s:present(dict, 'up', 'left', 'right', 'window')) && \ executable('tput') && filereadable('/dev/tty') - 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)) + let has_term = has('nvim-0.2.1') || has('nvim') && !s:is_win || has('terminal') && has('patch-8.0.995') + let use_term = has_term && (has('gui_running') || s:is_win || !use_height && s:present(dict, 'down', 'up', 'left', 'right', 'window')) let use_tmux = (!use_height && !use_term || prefer_tmux) && !has('win32unix') && s:tmux_enabled() && s:splittable(dict) if prefer_tmux && use_tmux let use_height = 0 @@ -400,9 +401,6 @@ try let optstr .= ' --height='.height elseif use_term let optstr .= ' --no-height' - if !has('nvim') && !s:is_win - let optstr .= ' --bind ctrl-j:accept' - endif endif let command = prefix.(use_tmux ? s:fzf_tmux(dict) : fzf_exec).' '.optstr.' > '.temps.result @@ -699,7 +697,11 @@ function! s:execute_term(dict, command, temps) abort if has('nvim') call termopen(command, fzf) else - call term_start([&shell, &shellcmdflag, command], {'curwin': fzf.buf, 'exit_cb': function(fzf.on_exit)}) + let t = term_start([&shell, &shellcmdflag, command], {'curwin': fzf.buf, 'exit_cb': function(fzf.on_exit)}) + " FIXME: https://github.com/vim/vim/issues/1998 + if !has('nvim') && !s:is_win + call term_wait(t, 20) + endif endif finally if s:present(a:dict, 'dir') |