I'm using a hotkey for switching buffers and I have the problem that some windows are drawn in the main window when I'm switching through the buffers.
I was able to disable the mappings for NERDTree, the Quickfix window and Tagbar window but I always need the window name in order to achieve this with an autocommand. Finding the window name mostly requires reading through a lot of help files or even plugin sources and this is very time consuming :D
For example I use this for the quickfix window:
augroup qf
autocmd!
autocmd FileType qf set nobuflisted
augroup END
Is there an easier way to get the name of the current window?
Buffer name: :echo @%. File type: :echo &ft. Buffer number: echo bufnr(@%).
I am not sure you are talking about vim's window or buffer.
Is there an easier way to get the name of the current window?
vim window has winnr, you can get it by calling function winnr(), same for buffer nr, get current buffer number: bufnr('%'), and to get current buffer name (the file name) bufname('%')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With