vim-startify icon indicating copy to clipboard operation
vim-startify copied to clipboard

Startify leaving an empty buffer and split after closing built-in terminal

Open legendaryzyper opened this issue 3 years ago • 1 comments

Steps to recreate

  1. Startify screen
  2. :term
  3. exit the shell

Screenshots image

Happens in vanilla vim as well image

legendaryzyper avatar Aug 09 '22 08:08 legendaryzyper

I ended up kinda-fixing it with a custom event and closing the empty buffer:

let s:terminal_opened = 0
function! s:trigger()
    if empty(filter(range(1, bufnr('$')), 'buflisted(v:val) && "terminal" ==? getbufvar(v:val, "&buftype")'))
        if s:terminal_opened == 1
            let s:terminal_opened = 0
            if exists('#User#TerminalClose')
                execute 'doautocmd User TerminalClose'
            endif
        endif
    endif
endfunction
augroup startify_fix
    autocmd!
    autocmd TerminalOpen * let s:terminal_opened = 1
    autocmd BufEnter * call s:trigger()
    autocmd User TerminalClose if line2byte('.') == -1 && winnr('$') > 1 && empty(bufname()) | execute winnr('#') ' wincmd w' | execute 'Bdelete! nameless' | endif
augroup END

I only tested it slightly so let me know if you have the same issue and found bugs in the solution above.

legendaryzyper avatar Aug 09 '22 08:08 legendaryzyper

Right so I found out that this was covered in the FAQs but with vim-plug.

legendaryzyper avatar Jan 02 '23 12:01 legendaryzyper