junegunn / fzf.vim

fzf :heart: vim
MIT License
9.65k stars 584 forks source link

fzf.vim looks different in macvim(text mode, under iterm2) #860

Closed markwu closed 5 years ago

markwu commented 5 years ago

I suppose fzf.vim should looks the same, no matter in macvim(gui/text) or neovim. But I just found the status line of fzf.vim disapper in macvim(text mode, under iterm2). Do I do anything wrong?

Neovim 0.40-dev(HEAD) (Inside iterm2, statusline is there): 螢幕快照 2019-08-21 下午5 15 24

Macvim 8.1-1722 (text mode, inside iterm2 and apple terminal, statusline disappered) 螢幕快照 2019-08-21 下午5 16 16

Macvim 8.1-1722 (gui mode, statusline is there) 螢幕快照 2019-08-21 下午5 16 48

My fzf version is 0.18.0, installed from homebrew, and my fzf.vim is install from vim-plug with master branch.

markwu commented 5 years ago

Here comes with my settings, nothing else:

let g:fzf_command_prefix = 'Fzf'

nnoremap <silent> <Space><Space> :FZF<CR>
nnoremap <silent> <Space>f  :FzfFiles<CR>
nnoremap <silent> <Space>b  :FzfBuffers<CR>
nnoremap <silent> <Space>r  :FzfHistory<CR>
nnoremap <silent> <Space>l  :FzfBLines<CR>
nnoremap <silent> <Space>L  :FzfLines<CR>
nnoremap <silent> <Space>c  :FzfColors<CR>
nnoremap <silent> <Space>?  :FzfHelptags<CR>
nnoremap <silent> <Space>hc :FzfHistory:<CR>
nnoremap <silent> <Space>hs :FzfHistory/<CR>
nnoremap <silent> <Space>t  :FzfTags <C-R><C-W><CR>
nnoremap <silent> <Space>T  :FzfTags<CR>
nnoremap <silent> <Space>o  :FzfBTags <C-R><C-W><CR>
nnoremap <silent> <Space>O  :FzfBTags<CR>
nnoremap <silent> <Space>m  :FzfMarks<CR>
markwu commented 5 years ago

I am tracing the code, it seems fzf.vim only support vim8 build in terminal inside gui_running. Can you enable it for macvim inside terminal? I have been use terminal for a while, it quite stable.

markwu commented 5 years ago

Change /usr/local/opt/fzf/plugin/fzf.vim line 395-396 to the following code, solve the problem.

  let use_term = has_nvim_term ||
    \ has_vim8_term && !has('win32unix') && (has('gui_running') || has('gui_macvim') || s:is_win || !use_height && s:present(dict, 'down', 'up', 'left', 'right', 'window'))
junegunn commented 5 years ago

You can force the plugin to use terminal buffer by setting g:fzf_layout with window option like so:

let g:fzf_layout = { 'window': 'bot20new' }

" 40% of the screen height
let g:fzf_layout = { 'window': 'bot'.float2nr(0.4 * &lines).'new' }

See https://github.com/junegunn/fzf/blob/master/README-VIM.md#fzf-inside-terminal-buffer