Take the 2-minute tour ×

How to know which programming language is set for highlighting the syntax in vim. I can set the language by "setf" command, but how to get the current language?


share|improve this question

2 Answers 2

up vote 30 down vote accepted

You can type :set ft? (Note that the question mark is part of the command)

share|improve this answer
It works :), thanks. –  MKo Mar 16 '11 at 12:16

try :echo &filetype. You can also put %{&filetype} in the statusline setting.

Also see this vim tip

share|improve this answer
:echo &fileformat doesn't return the programming language name, try ":setf cpp", then ":echo &fileformat" and you get unix again. –  MKo Mar 16 '11 at 12:13
@MKo: yes because I have told stupidly fileformat instead of filetype. –  Benoit Mar 16 '11 at 12:23
ft == filetype, Thanks. –  MKo Mar 16 '11 at 12:51
@MKo: If you are happy you should accept Peter's answer by clicking on the checkmark below the answer score. That's how this site works. –  Benoit Mar 16 '11 at 13:07

Your Answer


