How can I configure the (X) in the upper right to close the current buffer? It doesn't seem to response to anything, except when NERDtree is open I can get the status bar to display NERDTree: cannot close tree root
Thanks in advance!
Let me see the result of :set mouse?.
@itchyny mouse=a
Okay, I figured out what's happening. The X closes the current tab, not the current buffer. Try :tabnew and click the X. Unfortunately we cannot configure the action for the closing mark in Vim.
For neovim users; configure as follows to make it close the buffer.
let g:lightline = {
\ 'component': {
\ 'close': '%@LightlineCloseBuffer@ X %',
\ },
\ }
function! LightlineCloseBuffer(...)
try
bdelete
catch
echohl ErrorMsg
echom v:exception
echohl None
endtry
endfunction
Note that %@ in tabline is neovim only.
@itchyny Thanks, that's getting me closer. Is there a turn-key setup that will have lightline Just Work(tm) with opening files and closing them from the top bar without any of the religious tabs vs buffers vs windows vs
Thanks again for your help.
Hmm, it's hard to configure as opening files from tabline in Vim. You may try plugins like CtrlP or use GVim.
Thanks for the pointers, and thanks again for all your help!
Most helpful comment
Okay, I figured out what's happening. The
Xcloses the current tab, not the current buffer. Try:tabnewand click the X. Unfortunately we cannot configure the action for the closing mark in Vim.For neovim users; configure as follows to make it close the buffer.
Note that
%@in tabline is neovim only.