Where is filetype vim




















You can use up to 10 of these commands, independently from "-c" commands. Improve this answer. Lix Lix Add a comment. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password.

Post as a guest Name. Email Required, but never shown. The Overflow Blog. To do this, edit the following file:. As well as configuring filetype.

Vim Tips Wiki Explore. Main Page All Pages Community. Community portal. To do. Active 1 year, 11 months ago. Viewed 27k times. How can I get a list of the names of filetypes that vim currently knows about?

Improve this question. Praxeolitic Praxeolitic 2, 1 1 gold badge 10 10 silver badges 25 25 bronze badges. You can view a list when you try to autocomplete on :setfiletype i. Type a letter or a few to filter the list and show entries which is started with these letters.

Add a comment. Active Oldest Votes. Simple Solution Type :setfiletype with a space afterwards , then press Ctrl-d. See :help cmdline-completion for more on autocompletion in vim's command line. Complicated Solution This solution uses the 'runtimepath' option to get all available syntax directories, and then fetches a list of the vimscript files in those directories with their extensions removed.

This may not be the safest way to do it, so improvements are welcome: function! GetFiletypes " Get a list of all the runtime directories by taking the value of that " option and splitting it using a comma as the separator.

You could accomplish that like so: for f in GetFiletypes echo f endfor Note that this probably can be compacted quite a bit, it is just like this for readability. Improve this answer. EvergreenTree EvergreenTree 7, 1 1 gold badge 30 30 silver badges 55 55 bronze badges. Java is not in the list. You can use many different patterns to match the name of your file.

Directory names can also be included. Adding this to the example above:. To avoid trouble with this, put the filetype. That file is found in runtimepath first. What will happen now is that Vim searches for filetype. Then Vim finds the filetype. The pattern for ruby matches too, and the "setf ruby" is executed. But since filetype was already set to text , nothing happens here.

Only the one for ruby matches and "setf ruby" sets filetype to ruby. If your file cannot be recognized by its file name, you might be able to recognize it by its contents.



0コメント

  • 1000 / 1000