Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[VIM] Syntax Highlighting .LIB file

334 views
Skip to first unread message

gnat

unread,
Nov 13, 2003, 2:19:49 PM11/13/03
to
Hello,

I am using a compiler that uses .LIB files like they were .h
files. My problem is that when I load one of these files into
VIM it gets highlighted strangely - black text with a red
background. I would like to have VIM highlight a .LIB file the
same as a .c or a .h file. Can anyone tell me how?

Thanks.
--
gnat.

Gary Johnson

unread,
Nov 13, 2003, 4:57:11 PM11/13/03
to

:help new-filetype

Following the instructions there, your filetype.vim should look like
this:

if exists("did_load_filetypes")
finish
endif
augroup filetypedetect
au! BufRead,BufNewFile *.lib,*.LIB setfiletype c
augroup END

HTH,
Gary

gnat

unread,
Nov 13, 2003, 5:23:11 PM11/13/03
to
Gary Johnson wrote:

perfect :)

Thanks.

--
gnat.

Mikolaj Machowski

unread,
Nov 13, 2003, 7:08:59 PM11/13/03
to
gnat scripsit:

Win/*nix?

*nix:
~/.vim/filetype.vim

au BufNewFile,BufRead *.LIB setf c

Also can be in your .vimrc

m.
--
LaTeX + Vim = http://vim-latex.sourceforge.net/
Learn Touch Typing with Vim? Oui. Ja. Yes. Tak:
http://vim.sourceforge.net/script.php?script_id=461
vim.pl - http://skawina.eu.org/mikolaj

gnat

unread,
Nov 18, 2003, 4:29:47 PM11/18/03
to
Mikolaj Machowski wrote:

> gnat scripsit:
>
>>Hello,
>>I am using a compiler that uses .LIB files like they were .h
>>files. My problem is that when I load one of these files into
>>VIM it gets highlighted strangely - black text with a red
>>background. I would like to have VIM highlight a .LIB file the
>>same as a .c or a .h file. Can anyone tell me how?
>
>
> Win/*nix?
>
> *nix:
> ~/.vim/filetype.vim
>
> au BufNewFile,BufRead *.LIB setf c
>
> Also can be in your .vimrc
>
> m.

I am using Win - i can't seem to get it to work when i put it in
my _vimrc file (though other things in there work).

It's kind of academic because i got the .LIB highlighting working
with the filetype.vim file (just have to remember to back it up
if i want to re-install.

One more question relating to this topic - I was going through
the filetype.vim file and I was wondering if i can make the set
number command run on selected file types (i.e. c, cpp, h, LIB,
etc.).

I guess a better question is where can i go to learn how to do
vim scripting :)

Thanks.

--
gnat.

Mikolaj Machowski

unread,
Nov 18, 2003, 7:46:40 PM11/18/03
to
gnat scripsit:

> Mikolaj Machowski wrote:
>> gnat scripsit:
>>>Hello,
>>>I am using a compiler that uses .LIB files like they were .h
>>>files. My problem is that when I load one of these files into
>>>VIM it gets highlighted strangely - black text with a red
>>>background. I would like to have VIM highlight a .LIB file the
>>>same as a .c or a .h file. Can anyone tell me how?
>> Win/*nix?
>> *nix:
>> ~/.vim/filetype.vim
>> au BufNewFile,BufRead *.LIB setf c
>> Also can be in your .vimrc
>> m.
> I am using Win - i can't seem to get it to work when i put it in
> my _vimrc file (though other things in there work).
> It's kind of academic because i got the .LIB highlighting working
> with the filetype.vim file (just have to remember to back it up
> if i want to re-install.

You can/have to create vimfiles directory (inside vim dir) and there
create alternative tree structure. Vimfiles won't be overwritten.

> One more question relating to this topic - I was going through
> the filetype.vim file and I was wondering if i can make the set
> number command run on selected file types (i.e. c, cpp, h, LIB,
> etc.).

:help ftplugin

> I guess a better question is where can i go to learn how to do
> vim scripting :)

:h usr_toc

0 new messages