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
Is this possible?
Vi and Vim Stack Exchange is a question and answer site for people using the vi and Vim families of text editors. It only takes a minute to sign up.Sign up to join this community
AFAIK, we cannot add completion to standard commands.
You'll have to define your own
:SetFT command and complete with
" untested command! -nargs=1 -complete=filetype SetFt :set ft=<args>
For setting the filetype there is additionally a dedicated vim command
:setfiletype which supports tab completion and
:setfiletype mar<tab> :setfiletype <C-d>
The command can be abbreviated as following:
:setf mar<tab> :setf <C-d>
The plugin fzf.vim provides furthermore the command
:Filet[ypes]<CR> > prompt
At the prompt you can enter a filetype with fuzzy matching e.g.