Saturday, June 25, 2011

Re: add filetype comment for everyfile

On Jun 25, 10:57 am, stardiviner <numbch...@gmail.com> wrote:
> I saw that most file has a comment at the bottom of file.
> for example in ~/.muttrc
> {{
>     set folder=~/.mutt/mails
>     # vim: ft=muttrc}}
>
> in this case, the last line, "# vim: ft=muttrc" is a filetype comment for file
> muttrc.
> I hope to add a function that let vim automatically add this last comment line
> to every file in my ~/.vimrc .
> Thanks  in advance.
>

You usually don't need it, if you have one of the following in
your .vimrc:

filetype on
filetype plugin on
filetype indent on
filetype indent plugin on

Any of these will automatically detect many file types with no need
for the modeline in the file.

If you really want this, it's easy enough to use the append() function
in a script to add text to the last line. You may want to use the
current filetype setting in your script, using &l:filetype.

--
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

No comments:

Post a Comment