Monday, September 30, 2019

Re: Set filetype for specific file?

On 2019-09-30, Ven Tadipatri wrote:
> Is there a way to set the file type permanently for a specific file
> (not based on extension)?
> For example, if I have a file ~/dir/myfile.properties, I'd like to
> always set the filetype to be sql, without having to run :set
> filetype=sql every time I open the file.

The easiest way is to create a file in your ~/.vim/ftdetect
directory. I don't think the name matters except perhaps for ending
in .vim. Put this line in that file.

au BufRead,BufNewFile ~/dir/myfile.properties set filetype=sql

For more on this, see:

:help new-filetype

Regards,
Gary

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20190930175920.GA14172%40phoenix.

No comments: