vim-floaterm
vim-floaterm copied to clipboard
How to use gd gf inside floating window
I was trying to use gd gf on file links inside the floating terminal, but then nvim switch to a new or an existing buffer inside the floating window itself.
Put this code into after/ftplugin/floaterm.vim
:
function s:open_in_normal_window() abort
let f = findfile(expand('<cfile>'))
if !empty(f) && has_key(nvim_win_get_config(win_getid()), 'anchor')
FloatermHide
execute 'e ' . f
endif
endfunction
nnoremap <silent><buffer> gf :call <SID>open_in_normal_window()<CR>
or use autocmd
in your vimrc like this:
function s:open_in_normal_window() abort
let f = findfile(expand('<cfile>'))
if !empty(f) && has_key(nvim_win_get_config(win_getid()), 'anchor')
FloatermHide
execute 'e ' . f
endif
endfunction
autocmd FileType floaterm nnoremap <silent><buffer> gf :call <SID>open_in_normal_window()<CR>
I feel it would be awesome if the floaterm supports gf
, gF
by itself like git commit things.