views:

61

answers:

1

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 kzz

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

A: 

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.

kemp
Thanks, that worked perfectly ;)
joxnas