0

Currently I'm using ctags and highlighting colored syntax in vim. but problem is that the colored syntax highlighting off when I refresh the vim window with "e!".

my .vimrc is

syntax on

set exrc

set ruler

set exrc

au BufNewFile, BufRead *.sv, *.v so ~/.vim/syntax/verilogsystemverilog.vim

Would you please help me what problem makes this happen?

0

That autocmd as written shouldn't work at all. There must not be any whitespace inside the {event} and {pat} enumerations:

au BufNewFile,BufRead *.sv,*.v so ~/.vim/syntax/verilogsystemverilog.vim

Additionally, you're circumventing Vim's filetype mechanism completely. Even if you don't use filetype plugins (which can supply specific indent, formatting, etc. settings and mappings), it's advisable to follow that mechanism.

To enable this, put filetype on in your ~/.vimrc. Then (following :help new-filetype), create a custom detection ~/.vim/ftdetect/verilogsystemverilog.vim with the following contents:

au BufRead,BufNewFile *.sv,*.v setfiletype verilogsystemverilog

This will automatically set 'syntax', and with that, loads your syntax script (from ~/.vim/syntax/verilogsystemverilog.vim, but without having you specify the full path directly).


PS: You have set exrc twice, and you could even combine all into a single command set exrc ruler.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.