I want to list all filetypes Vim recognizes from its runtimepath.
ada arc c clojure common-lisp elisp go python
How can I do it?
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
If you need those for a custom command that takes filetype arguments, you can just use
:command -complete=filetype. Else, you can derive the list via the
globpath() function yourself:
echo join(map(split(globpath(&rtp, 'ftplugin/*.vim'), '\n'), 'fnamemodify(v:val, ":t:r")'), "\n")
This gets all ftplugin scripts from the runtimepath, and then modifies the filespec via
fnamemodify() to only list the root of the filename.
split() converts into a List, and
join() back to lines for