On 20/10/12 04:18, Josh . wrote:
I have this in my .vimrc:

autocmd FileType lisp,scheme setlocal commentstring=;%s
autocmd BufEnter,BufNewFile *.coffee setlocal filetype=coffee
autocmd BufEnter,BufNewFile *.styl setlocal filetype=stylus

Should this be needed?  Shouldn't comments in lisp start w/';' by
default and coffeescript files have the coffee filetype when opened?
I've seen some plugins have 'ftdetect' folders (or files?), is that
what's needed here?


Remove your vimrc or give it a different name, restart Vim, and see what happens. If these filetypes and comment strings are still recognised, then these commands are indeed not needed (or maybe they once were but the need has disappeared). Note that AFAIK, current Vim doesn't know any "coffee" or "stylus" filetypes out of the box. For both lisp and scheme, and even when 'filetype' is not set, my Vim sets 'commentstring' to /*%s*/ which is the default. According to the help, that option is only used to set fold markers.

A similar FileType autocommand ought to be in $VIMRUNTIME/ftplugin/lisp.vim and/or $VIMRUNTIME/ftplugin/scheme.vim ; similar BufEnter,BufNewFile autocommands ought to be in $VIMRUNTIME/filetype.vim

HOWEVER, if they aren't there, DON'T modify those files in place: any upgrade of the runtime files may silently undo any changes you make there. Instead, you may, if you wish, and if they aren't already present, add these autocommands in *new* files which Vim will read if present but never modify (if their directories don't exist yet, create them too):

the FileType autocommand goes into ~/.vim/after/ftplugin/lisp.vim and/or ~/.vim/after/ftplugin/scheme.vim

the BufEnter,BufNewFile autocommands go between "augroup filetypedetect" and "augroup END" (both without quotes and on their own linres) in ~/.vim/filetype.vim

On Windows, replace ~/.vim/ by $HOME/vimfiles/


Best regards,
Tony.
--
It has been observed that one's nose is never so happy as when it is
thrust into the affairs of another, from which some physiologists have
drawn the inference that the nose is devoid of the sense of smell.
                -- Ambrose Bierce, "The Devil's Dictionary"

--
You received this message from the "vim_dev" 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

Raspunde prin e-mail lui