I want to make toggleable window with terminal buffer similar to every IDE terminal feature.

Currently i have mapped:

noremap <F4> :botright 8split term://bash<CR>
tnoremap <F4> <C-\><C-n>:q<CR>
autocmd BufEnter term://* startinsert | set wfh

but buffer is lost whenever is not active on any window (ex. on :q)

EDIT And how to reopen the same buffer whenever it already eixsts instead of creating new one every time?

  • 1
    duplicate of my own question here vi.stackexchange.com/questions/19276/… – klaus Mar 23 '19 at 10:22
  • 1
    And thanks for :h wfh, I didn't think there was something like that built in. Nice one! – klaus Mar 23 '19 at 10:23
  • And try to wrap autocmd's in augroup. Check here for why. – klaus Mar 23 '19 at 10:26
  • thanks! But :h terminal says: 'bufhidden' defaults to "hide", so I didin't try myself – Mesco Mar 23 '19 at 10:32
  • Oh, it does, doesn't it? But check, after launching nvim with nvim -u NORC and opening terminal with :term and then check :set bufhidden?. I see bufhidden=, so not defaults to hide. Must be a bug. What do you see? We might need to notify neovim community to edit their help documents! – klaus Mar 23 '19 at 10:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.