0

I often find myself jotting notes in Vim using an empty buffer which in this case has 'no ft' (status line).

I know I could set the filetype with :setfiletype text but I honestly wonder what that would buy me.

Now my questions is: How can I get help about file type specifics. List known filetypes gives me a listing about known file types but :help text for example doesn't give me a clue about highlighting, specific key bindings, text objects, ect. for this specific file type.

2 Answers 2

3

Filetype relevant options are available in the help and follow the following pattern:

Those might not always exists for all specific filetypes that Vim comes with. But if there are options available for changing the behaviour, it should be documented and follow the mentioned pattern.

For external filetype plugins (once you install separately and that do not come with Vim bundled), they should follow a similar rule. For example my csv filetype plugin comes with a help file, that is called ft-csv.txt and covers all commands, options and settings related to the CSV filetype.

1
  • Seems like ft text is such a given feature in Vim that there are no specifics and therefore no specific help. Standard key bindings do apply, no remapping.
    – JohnDoe
    Nov 12, 2018 at 11:44
2

If you want to know what options are enabled when specifying a file type you can follow this procedure:

  • Use :scriptnames and take note of the number of the last line.
  • Set the file type e.g. set filetype=text.
  • Use :scriptnames and look at the new entries: this will be the scripts executed by the commands. On my setup I get /usr/share/vim/vim80/ftplugin/text.vim which is the default ft-plugin script which comes with vim. If I use set ft=javascript I also get other scripts because I have custom ft plugins and also indent and syntax scripts for this filetype.

If you want to get a list of all the default filetype specific scripts and what they do, you can use :echo $VIMRUNTIME, this will give you a directory that you can then browse looking for its subdirectories ftplugin, indent and syntax.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.