Skip to main content
Add script source
Source Link
Tae
  • 2.2k
  • 14
  • 22

You can add thisthis to your init.vim:

function! s:termclose() abort
  let buf = expand('#')
  if !empty(buf) && buflisted(buf) && bufnr(buf) != bufnr('%')
    execute 'autocmd BufWinLeave <buffer> split' buf
  endif
endfunction

autocmd TermClose *:$SHELL,*:\$SHELL call s:termclose()

(It is recommended to use a group for the auto command).

In Neovim terminal buffers are normal buffer's and when they close, :bdelete is executed, and :bdelete's behaviour is weird if you ask me. Anyway there are plans to definitely fix it

You can add this to your init.vim:

function! s:termclose() abort
  let buf = expand('#')
  if !empty(buf) && buflisted(buf) && bufnr(buf) != bufnr('%')
    execute 'autocmd BufWinLeave <buffer> split' buf
  endif
endfunction

autocmd TermClose *:$SHELL,*:\$SHELL call s:termclose()

(It is recommended to use a group for the auto command).

In Neovim terminal buffers are normal buffer's and when they close, :bdelete is executed, and :bdelete's behaviour is weird if you ask me. Anyway there are plans to definitely fix it

You can add this to your init.vim:

function! s:termclose() abort
  let buf = expand('#')
  if !empty(buf) && buflisted(buf) && bufnr(buf) != bufnr('%')
    execute 'autocmd BufWinLeave <buffer> split' buf
  endif
endfunction

autocmd TermClose *:$SHELL,*:\$SHELL call s:termclose()

(It is recommended to use a group for the auto command).

In Neovim terminal buffers are normal buffer's and when they close, :bdelete is executed, and :bdelete's behaviour is weird if you ask me. Anyway there are plans to definitely fix it

Source Link
Tae
  • 2.2k
  • 14
  • 22

You can add this to your init.vim:

function! s:termclose() abort
  let buf = expand('#')
  if !empty(buf) && buflisted(buf) && bufnr(buf) != bufnr('%')
    execute 'autocmd BufWinLeave <buffer> split' buf
  endif
endfunction

autocmd TermClose *:$SHELL,*:\$SHELL call s:termclose()

(It is recommended to use a group for the auto command).

In Neovim terminal buffers are normal buffer's and when they close, :bdelete is executed, and :bdelete's behaviour is weird if you ask me. Anyway there are plans to definitely fix it