If I want to set the filetype manually in vim, I would like to tab complete filetypes vim recognizes. However, right now vim just inserts a literal ^I

:set ft=markd^I

Is this possible?

2 Answers 2


AFAIK, we cannot add completion to standard commands.

You'll have to define your own :SetFT command and complete with -complete=filetype Something like:

" untested
command! -nargs=1 -complete=filetype SetFt :set ft=<args>
  • 1
    That's too bad. I'd like to stick with the default command and would rather try to ask a vim developer to support it. But I guess this won't happen. Thanks for your answer!
    – Hotschke
    Commented Oct 25, 2017 at 10:34
  • 4
    Honestly, there is no reason it can't be done. You can try to open a Feature Request issue on vim github. Who knows? Commented Oct 25, 2017 at 10:48

Builtin command :setfiletype

For setting the filetype there is additionally a dedicated vim command :setfiletype which supports tab completion and <C-d>:

:setfiletype mar<tab>
:setfiletype <C-d>

The command can be abbreviated as following:

:setf mar<tab>
:setf <C-d>

Plugin fzf.vim

The plugin fzf.vim provides furthermore the command :Filetypes.

> prompt

At the prompt you can enter a filetype with fuzzy matching e.g. mkd for markdown or jsc for javascript.

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.