2

As title. Currently, I only have the buffer number, I need to know which filetype it is.

1 Answer 1

5

You can use getbufvar() to get a variable definition, together with the '&filteype' syntax to get the value of an option rather than a variable.

:echo getbufvar(2, '&filetype')
2
  • 1
    was about 3 seconds late :)
    – Maxim Kim
    Commented Feb 7, 2022 at 17:46
  • @MaximKim: thank you guys!! Commented Feb 7, 2022 at 17:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.