开发者

VIM: created syntax not showing up?

HI people

I recently changed to VIM for coding in C.

I'd like to hightlight the operators +-<=& ... etc

I searched in google how should i do it, and i found the answer in this website: I was suppose to do something like:

syntax match Operadores /[][><()&!|+*={}-]/
hi Operadores guifg=#000000 gui=BOLD

Those characters were supposed to appear as black, bold characters. However, that doesn't happen when I open my .C files. However, if I create a newfile, (where there the C syntax doesn't show up), I am able to see the black, bolded operators.

How can i correct this situation, and why is this happening (it seams like if my syntax is beeing overwrided by the C syntax).

I'm using gvim, and this is my vimrc:

colorscheme nicotine
set smartindent
set number
set guifont=Inconsolata\ Medium\ 11
set numberwidth=5
noremap j jzz
noremap k kz开发者_Python百科z

Thanks, any help is appreciated. (And dont forget I'm a novice in VIM, and ..sorry for my English)


The best way to do this is putting those two lines in the following file:

~/.vim/ftplugin/c.vim

creating it if it's not already present (of course you need to adjust the path to your personal Vim directory if you're not on un*x). That file is called for every C file you edit, and it's executed after the default scripts so your syntax won't be overridden.

For ftplugin to work you also have to add

filetype on

although a full

filetype plugin indent on

is usually more generally useful.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜