1

I have installed Vim 8.0 on my Windows 7 and Windows 10 machines. When I edit a text file using restructured text (with a .txt extension) and use :set ft=rst, syntax highlighting starts up as expected.

Is there a Vim command to tell me which file is the source of these highlighting rules?

0

Look into vim's Filetype for this.

What I think you want to do is override the default. To do this you want to setup a custom $HOME\vimfiles\filetype.vim.

Here is an example where I want my test.crazy file to load like a .html file:

if exists("did_load_filetypes")
  finish
endif
augroup filetypedetect
  au! BufNewFile,BufRead *.crazy setf html
augroup END

However, this will only work if the filetype is not found. Example docs.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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