Closed chaesngmin closed 3 years ago
no, i've put some minimal effort into trying to fix this behavior but i haven't figured it out. i don't know how startify or dashboard do it. the BufUnload
event for example fires before the new buffer has been opened, thus you can't delete the alpha buffer yet or there would temporarily be no open buffers.
This is a hacky workaround. Call a function which clears all empty buffers (found here).
function! CleanEmptyBuffers()
let buffers = filter(range(1, bufnr('$')), 'buflisted(v:val) && empty(bufname(v:val)) && bufwinnr(v:val)<0 && !getbufvar(v:val, "&mod")')
if !empty(buffers)
exe 'bw ' . join(buffers, ' ')
endif
endfunction
then call it on non alpha
filetypes:
autocmd WinEnter,BufRead,BufNewFile * if &ft != 'alpha' | set showtabline=2 | call CleanEmptyBuffers() | endif
Not sure if it's any good but it's working fine for me.
fixed in https://github.com/goolord/alpha-nvim/commit/667a820164aa33ca2195977dba07561fd8745d08 the empty buffer was actually the buffer vim opens by default on vimenter. no jank required
ok, maybe not no jank. i kinda forsee vim.api.nvim_buf_delete(1, {})
maybe having some nasty interactions with other plugins. idk. probably won't be a problem unless any other plugins are messing with buffers on vimenter. i'll just let someone report if it's doing something nasty for them :)
ok, maybe not no jank. i kinda forsee
vim.api.nvim_buf_delete(1, {})
maybe having some nasty interactions with other plugins. idk. probably won't be a problem unless any other plugins are messing with buffers on vimenter. i'll just let someone report if it's doing something nasty for them :)
This hides/disables the tabline for me after I open any file in the same buffer using :e
. I have the following autocmd set up to disable tabline in the alpha buffer and re-enable it after opening a new file.
autocmd FileType alpha set showtabline=0 | autocmd WinLeave <buffer> set showtabline=2
Running set showtabline=2
manually enables the tabline.
@sadmanbd change WinLeave
to BufUnload
and it should work
Thanks that worked perfectly :+1:
@sadmanbd change
WinLeave
toBufUnload
and it should work
Hi! I try this but I still getting the empty buffer :(
Hi, I have a question.
Any idea how to remove empty buffer after file is open from
dashboard or startify
?current
desired