Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use gd gf inside floating window #208

Open
ahmadie opened this issue Nov 20, 2020 · 2 comments
Open

How to use gd gf inside floating window #208

ahmadie opened this issue Nov 20, 2020 · 2 comments
Labels
enhancement New feature or request faq

Comments

@ahmadie
Copy link

ahmadie commented Nov 20, 2020

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.

@voldikss voldikss added the enhancement New feature or request label Dec 3, 2020
@voldikss voldikss added the faq label Dec 17, 2020
@voldikss voldikss reopened this Dec 17, 2020
@voldikss
Copy link
Owner

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>

@voldikss voldikss removed the enhancement New feature or request label Dec 18, 2020
@Matts966
Copy link

Matts966 commented Mar 4, 2021

I feel it would be awesome if the floaterm supports gf, gF by itself like git commit things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request faq
Projects
None yet
Development

No branches or pull requests

3 participants