Search code examples
vimwindowbuffer

How to get the type of the current window in vim


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?


Solution

  • Buffer name: :echo @%. File type: :echo &ft. Buffer number: echo bufnr(@%).