On 20/02/09 12:53, molecula21 wrote:
> hi,
>
> i'm sure this has been talked aroud here a lot but i cannot find any
> thread about it.
>
> i want Vim/Gvim to highlight other type of files (.cu for example) as
> it was a .c/.cpp file. what should i put on my vimrc? running latest
> VIm on Linux.
>
> thanks
Well, C++ and C syntaxes are different but similar.
Add a ~/.vim/filetype.vim if it doesn't exist (and if ~/.vim/ doesn't
exist, create it too). That file should have:
- near the top:
augroup filetypedetect
- near the bottom:
augroup END
- between these lines, one or more filetype-detection autocommands.
Yours will be
au BufRead,BufNewFile *.cu setf cpp
or
au BufRead,BufNewFile *.cu setf c
depending on whether you want to use C++ or C syntax (respectively) for
such files.
If you want to create a new syntax, which would build upon C the way C++
does but differently, that's more complicated; but you might have a look
at the $VIMRUNTIME/*/cpp.vim scripts for an example and maybe a source
of inspiration.
Best regards,
Tony.
--
#define BITCOUNT(x) (((BX_(x)+(BX_(x)>>4)) & 0x0F0F0F0F) % 255)
#define BX_(x) ((x) - (((x)>>1)&0x77777777) \
- (((x)>>2)&0x33333333) \
- (((x)>>3)&0x11111111))
-- really weird C code to count the number of bits in a word
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---