Monday, September 30, 2019

Re: Set filetype for specific file?

On Mon, Sep 30, 2019 at 7:44 PM Ven Tadipatri <vtadipatri@gmail.com> 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.
>
> Thanks,
> Ven

See :help modeline

For instance, add near the top or bottom of the file a line with either

-- vim: ft=sql
(modeline form 1, which goes to the end of the line)

or

/* vim: set ft=sql :*/
(modeline form 2, which can be followed by a colon and then anything,
such as a comment terminator)

as an SQL comment, and optionally with additional options to be set
for that file as with :setlocal. Anything is allowed before the "
vim:" modeline leader; usually a comment leader for the current
language is placed there.

Best regards,
Tony.

--
--
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/CAJkCKXuZEhZhDUkJF4hnahdge8g9Amzy6DDf19M_MwH37kU3rg%40mail.gmail.com.

No comments: