Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get buffer type in vimscript

Tags:

vim

How can I get the buffer type of a buffer given its buffer id? I know I can switch to that buffer and use :set buftype? to get the type.

But how can I do it without jumping to that buffer?

(I would expect to have something like buftype(id) working similarly to bufname(id))

like image 337
DavidEG Avatar asked Feb 04 '23 12:02

DavidEG


1 Answers

You're looking for :h getbufvar()

:echo getbufvar(bufid, '&buftype', 'ERROR')
like image 107
Luc Hermitte Avatar answered Feb 27 '23 09:02

Luc Hermitte