Josh, I'm forwarding your messages to the list, because I don't know
everything. Also I'm not sure which list (vim_use or vim_dev) is the
best for this particular kind of question. I would have asked on vim_use
but I'm keeping the thread where you started it, on vim_dev.
-------- Original Message --------
Subject: Re: ftdetect and commentstring
Date: Sat, 20 Oct 2012 10:05:08 -0500
From: Josh . <[email protected]>
To: Tony Mechelynck <[email protected]>
Sorry for the spam, but I just got a new version of vim-unbundle, and
new versions of vim-coffee-script and vim-stylus, and now both
coffeescript and stylus work just fine :). So I guess I'm just
confused about the comment string thing.
On Sat, Oct 20, 2012 at 10:02 AM, Josh . <[email protected]> wrote:
Hmm, the $VIMRUNTIME/ftplugin/lisp.vim file has `setl
comments^=:;;;,:;;,sr:#\|,mb:\|,ex:\|#`, and something similar in
scheme.vim file in the same directory. As to the coffeescript/stylus
files, I think the plugins I use should add the filetype detection,
right? for instance:
(https://github.com/wavded/vim-stylus/blob/master/ftdetect/stylus.vim).
Unfortunately, that doesn't seem to be working when I read a new
*.styl file. Could it be that the plugin's not being loaded by
unbundle (https://github.com/sunaku/vim-unbundle)? I don't see it in
`:scriptnames`, but I'm not sure if/when it should show up. Thoughts?
Thanks for the help thus far,
Josh
On Fri, Oct 19, 2012 at 10:22 PM, Tony Mechelynck
<[email protected]> wrote:
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