On 2012-11-05, analogsix wrote:
> have a systemverilog.vim file that I source from my .vimrc through the following command:
>
> syntax on
> au BufEnter *.sv, *.svh source ~/.vim/syntax/systemverilog.vim
>
> When opening mulitple .sv files through the command-line for editing, VIM does not syntax highlight the files.
>
> Only opening individual files works.
>
> What could be wrong?
A couple of things.
First off, if you're going to use syntax highlighting, you should
really do it the way it's designed to work and not go off and do it
somehow differently. Rather than put an autocommand in your
~/.vimrc, just use
filetype on
and if you discover that Vim does not detect the systemverilog
filetype, then create a file named ~/.vim/ftdetect/systemverilog.vim
and put this in it:
au BufRead,BufNewFile *.sv,*.svh set filetype=systemverilog
Secondly, a BufEnter autocommand is triggered only when you enter a
buffer, not when you just display it. For example, execute this
command,
vim -Nu NONE --cmd 'au BufEnter * echomsg "hello" expand("%")' -O file1 file2 file3
then execute
:messages
You will see this:
"file1" 0L, 0C
hello file1
"file2" 0L, 0C
"file3" 0L, 0C
hello file1
If you then type Ctrl-W Ctrl-W twice and execute ":messages" again
you will see this:
"file1" 0L, 0C
hello file1
"file2" 0L, 0C
"file3" 0L, 0C
hello file1
hello file2
hello file3
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
Tuesday, November 6, 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment