Re: VIM help for normal text files with extension .lib (on UNIX)

2006-10-16 Thread panshizhu
Kunapuli, Udaykumar [EMAIL PROTECTED] 写于 2006-10-16 14:37:33:
 Hi,

 I tried editing the filetype.vim in the runtime directory and
 commenting the portion with the .lib extension. But it didn't work.



Are you sure you had done it right? I removed the *.lib and it works.

this is the filetype.vim around 440 (after the *.lib removed)

 Cobol
au BufNewFile,BufRead *.cbl,*.cob   setf cobol


IMO, the *.lib is a common extension which should not be treated as cobol
file. So just remove the relationship here.

RE: VIM help for normal text files with extension .lib (on UNIX)

2006-10-16 Thread Kunapuli, Udaykumar
Looks like it is hard-coded. No matter what I try, VIM does recognize *.lib as 
a cobol file.
I have deleted the occurrence of cobol and .lib in the filetype.vim file. But 
of no use.
In fact there is no occurrence of cobol in any of my runtime files.

The irritating thing is the search pattern, regular expression change.
You can try hitting * on a word with underscore character (_) on a file 
with .lib extension, 
you will see that it considers underscore (_) as a distinct (non-word) 
character.


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Sunday, October 15, 2006 11:50 PM
To: Kunapuli, Udaykumar
Cc: vim@vim.org
Subject: Re: VIM help for normal text files with extension .lib (on UNIX)

Kunapuli, Udaykumar [EMAIL PROTECTED] 写于 2006-10-16 14:37:33:
 Hi,

 I tried editing the filetype.vim in the runtime directory and 
 commenting the portion with the .lib extension. But it didn't work.



Are you sure you had done it right? I removed the *.lib and it works.

this is the filetype.vim around 440 (after the *.lib removed)

 Cobol
au BufNewFile,BufRead *.cbl,*.cob   setf cobol


IMO, the *.lib is a common extension which should not be treated as cobol 
file. So just remove the relationship here.


RE: VIM help for normal text files with extension .lib (on UNIX)

2006-10-16 Thread panshizhu
Hi,

You problem can be worked around with :set isk+=_

But your problem may be you are not changing the one Vim is sourceing, or
if the settings are overrideed by future scripts.
you have a filetype.vim in system wide $VIM directory or your ~/.vim
directory or vimfiles/after directory?   see :h 'runtimepath'
or if there is directories like ~/.vim/ftdetect and scripts in there
overrides the default setting? see :h new-filetype

Hope that helps.
--
Sincerely, Pan, Shi Zhu. ext: 2606


Kunapuli, Udaykumar [EMAIL PROTECTED] 写于 2006-10-16 18:30:55:

 Looks like it is hard-coded. No matter what I try, VIM does
 recognize *.lib as a cobol file.
 I have deleted the occurrence of cobol and .lib in the filetype.vim
 file. But of no use.
 In fact there is no occurrence of cobol in any of my runtime files.

 The irritating thing is the search pattern, regular expression change.
 You can try hitting * on a word with underscore character (_) on
 a file with .lib extension,
 you will see that it considers underscore (_) as a distinct (non-
 word) character.


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: Sunday, October 15, 2006 11:50 PM
 To: Kunapuli, Udaykumar
 Cc: vim@vim.org
 Subject: Re: VIM help for normal text files with extension .lib (on UNIX)

 Kunapuli, Udaykumar [EMAIL PROTECTED] 写于 2006-10-16 14:37:33:
  Hi,
 
  I tried editing the filetype.vim in the runtime directory and
  commenting the portion with the .lib extension. But it didn't work.
 


 Are you sure you had done it right? I removed the *.lib and it works.

 this is the filetype.vim around 440 (after the *.lib removed)

  Cobol
 au BufNewFile,BufRead *.cbl,*.cob   setf cobol


 IMO, the *.lib is a common extension which should not be treated
 as cobol file. So just remove the relationship here.

Re: VIM help for normal text files with extension .lib (on UNIX)

2006-10-16 Thread A.J.Mechelynck

Kunapuli, Udaykumar wrote:

Looks like it is hard-coded. No matter what I try, VIM does recognize *.lib as 
a cobol file.
I have deleted the occurrence of cobol and .lib in the filetype.vim file. But 
of no use.
In fact there is no occurrence of cobol in any of my runtime files.

The irritating thing is the search pattern, regular expression change.
You can try hitting * on a word with underscore character (_) on a file with .lib extension, 
you will see that it considers underscore (_) as a distinct (non-word) character.


Did you restart Vim after that? If you didn't, the autocommands that were set 
up at startup to detect *.lib as filetype cobol are probably still in place.


Note: Any changes you make anywhere in the $VIMRUNTIME directory tree can be 
undone silently by any upgrade. You would be better off detecting your own 
filetypes in ~/.vim/filetype.vim (for Unix) or ~/vimfiles/filetype.vim (for 
Windows).



Best regards,
Tony.


Re: VIM help for normal text files with extension .lib (on UNIX)

2006-10-16 Thread Benji Fisher
On Sun, Oct 15, 2006 at 11:37:33PM -0700, Kunapuli, Udaykumar wrote:
 Hi,
  
 I am using VIM 7.0 on UNIX. I have files with extension .lib (*.lib 
 files). VIM automatically thinks that it is a Cobol filetype. The file 
 has nothing to do with Cobol. I have tried setting the following things 
 in my .vimrc. 
  
 au BufNewFile,BufRead *.lib set ft=text 
 au BufNewFile,BufRead *.lib filetype off
 au BufNewFile,BufRead *.lib filetype plugin indent off

 The first line should be enough.  The 'filetype' (abbreviated 'ft')
option is local to the buffer and should be set each time you edit a
*.lib buffer.  The :filetype command is global.  If you want to turn off
all filetype detection, add the line

filetype off

to your vimrc file.  I cannot think of any situation in which it makes
sense to put it in a BufNewFile,BufRead autocommand.

 I could take away the glaring syntax highlighting (red background on 
 all text!!!), but it was not of any help in terms of searching and 
 regular expression. 
 
 In ordinary text files, underscore (_) is considered as a legal part 
 of the word (or the regular expression \w). However in files with 
 extension .lib, VIM seems to consider underscore (_) as a special 
 character. 
 
 Is there anyway for me to make *.lib files to be treated as ordinary 
 text files by VIM for everything (syntax highlighting, indenting, 
 regular expression searching etc.)? 

 The problem is that autocommands are executed in the order in which
they are defined.  Apparently, the autocommand in your vimrc file,
setting ft=text, comes after the one that sets ft=cobol.  Thus things
happen in this order:

:set ft=cobol
:source $VIMRUNTIME/syntax/cobol.vim
:setlocal isk=@,48-57,-
:set ft=text

and nothing undoes the 'iskeyword' setting.

 The simple solution is to make sure that your autocommand comes
before any

filetype on

or

source $VIMRUNTIME/vimrc_example.vim

in your vimrc file.

 A more robust method (since it does not rely on the order of lines
in your vimrc file) is to use either method A or C from

:help new-filetype

 I tried editing the filetype.vim in the runtime directory and 
 commenting the portion with the .lib extension. But it didn't work.

 That is not recommended.  If you fix problems by editing things
under $VIMRUNTIME, then you will have to remember to fix them each time
you upgrade to a new version of vim.  In the long run, it is easier to
fix things in your own vim directory.

 Thanks,
 Uday

HTH --Benji Fisher


RE: VIM help for normal text files with extension .lib (on UNIX)

2006-10-16 Thread Kunapuli, Udaykumar
Thanks, it worked!
Actually I was mistaken about the runtime path. I was changing the filetype.vim 
in the wrong location (in the directory where I untarred and unzipped the 
files).

I did a :echo $VIM to find out the runtime path and it showed that the 
runtime path was in ~/share/vim/vim70.

I edited the filetype.vim in that directory and it worked.

Thanks again for your help.
 


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Monday, October 16, 2006 3:48 AM
To: Kunapuli, Udaykumar
Cc: vim@vim.org
Subject: RE: VIM help for normal text files with extension .lib (on UNIX)

Hi,

You problem can be worked around with :set isk+=_

But your problem may be you are not changing the one Vim is sourceing, or if 
the settings are overrideed by future scripts.
you have a filetype.vim in system wide $VIM directory or your ~/.vim
directory or vimfiles/after directory?   see :h 'runtimepath'
or if there is directories like ~/.vim/ftdetect and scripts in there overrides 
the default setting? see :h new-filetype

Hope that helps.
--
Sincerely, Pan, Shi Zhu. ext: 2606


Kunapuli, Udaykumar [EMAIL PROTECTED] 写于 2006-10-16 18:30:55:

 Looks like it is hard-coded. No matter what I try, VIM does recognize 
 *.lib as a cobol file.
 I have deleted the occurrence of cobol and .lib in the filetype.vim 
 file. But of no use.
 In fact there is no occurrence of cobol in any of my runtime files.

 The irritating thing is the search pattern, regular expression change.
 You can try hitting * on a word with underscore character (_) on a 
 file with .lib extension, you will see that it considers underscore 
 (_) as a distinct (non-
 word) character.


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: Sunday, October 15, 2006 11:50 PM
 To: Kunapuli, Udaykumar
 Cc: vim@vim.org
 Subject: Re: VIM help for normal text files with extension .lib (on 
 UNIX)

 Kunapuli, Udaykumar [EMAIL PROTECTED] 写于 2006-10-16 14:37:33:
  Hi,
 
  I tried editing the filetype.vim in the runtime directory and 
  commenting the portion with the .lib extension. But it didn't work.
 


 Are you sure you had done it right? I removed the *.lib and it works.

 this is the filetype.vim around 440 (after the *.lib removed)

  Cobol
 au BufNewFile,BufRead *.cbl,*.cob   setf cobol


 IMO, the *.lib is a common extension which should not be treated as 
 cobol file. So just remove the relationship here.