Why the MACRO I defined can not highlight?

169 views
Skip to first unread message

stone

unread,
Sep 9, 2009, 11:42:03 PM9/9/09
to vim_use
Hi. vim_use
I use GVIM in windows to edit C/C++ program,
But the MACRO and ENUM I have defined can not highlight.

I have set the : sy on and sy enable in my vimrc file.

Thanks.

A. S. Budden

unread,
Sep 10, 2009, 10:15:33 AM9/10/09
to vim...@googlegroups.com
2009/9/10 stone <lbzh...@gmail.com>:

There's no built in support for highlighting your own macros and enums
etc. Have a look at my plugin
(http://sites.google.com/site/abudden/contents/Vim-Scripts/ctags-highlighting),
which adds this feature (using ctags). If you have any problems
getting it setup, please let me know.

Al

--
http://sites.google.com/site/abudden

stone

unread,
Sep 10, 2009, 10:06:13 PM9/10/09
to vim_use
Very Thanks.

Your plugin is the one which I want.
I have download the ctags-highlight plugin.

But , when I input the command: UpdateTypeFile.

There are some errors like:

Error detected while processing function UpdateTypesFile:
line 23:
E684: list index out of range: 0
E15: Invalid expression: split(globpath(&rtp,"ctags.exe"))[0]
line 29:
E605: Exception not caught: Cannot find ctags

what this means?

I use Gvim 7.2 in windows XP. and I have put ctags.exe in c:\Windows
\System32, so I can use ctags in command console.

waitting your reply.
Thanks again.

On 9月10日, 下午10时15分, "A. S. Budden" <abud...@gmail.com> wrote:
> 2009/9/10 stone <lbzha...@gmail.com>:
>
>
>
> > Hi. vim_use
> > I use GVIM in windows to edit C/C++ program,
> > But the MACRO and ENUM I have defined can not highlight.
>
> > I have set the : sy on and sy enable in my vimrc file.
>
> There's no built in support for highlighting your own macros and enums
> etc. Have a look at my plugin
> (http://sites.google.com/site/abudden/contents/Vim-Scripts/ctags-highl...),

stone

unread,
Sep 10, 2009, 10:06:19 PM9/10/09
to vim_use
Very Thanks.

Your plugin is the one which I want.
I have download the ctags-highlight plugin.

But , when I input the command: UpdateTypeFile.

There are some errors like:

Error detected while processing function UpdateTypesFile:
line 23:
E684: list index out of range: 0
E15: Invalid expression: split(globpath(&rtp,"ctags.exe"))[0]
line 29:
E605: Exception not caught: Cannot find ctags

what this means?

I use Gvim 7.2 in windows XP. and I have put ctags.exe in c:\Windows
\System32, so I can use ctags in command console.

waitting your reply.
Thanks again.

On 9月10日, 下午10时15分, "A. S. Budden" <abud...@gmail.com> wrote:
> 2009/9/10 stone <lbzha...@gmail.com>:
>
>
>
> > Hi. vim_use
> > I use GVIM in windows to edit C/C++ program,
> > But the MACRO and ENUM I have defined can not highlight.
>
> > I have set the : sy on and sy enable in my vimrc file.
>
> There's no built in support for highlighting your own macros and enums
> etc. Have a look at my plugin
> (http://sites.google.com/site/abudden/contents/Vim-Scripts/ctags-highl...),

Matt Wozniski

unread,
Sep 11, 2009, 10:45:03 AM9/11/09
to vim...@googlegroups.com
Please bottom post (post replies below the quoted message) on this list.
I've reformatted your message accordingly.

stone wrote:
> "A. S. Budden" wrote:


>> stone wrote:
>>
>> > Hi. vim_use
>> > I use GVIM in windows to edit C/C++ program,
>> > But the MACRO and ENUM I have defined can not highlight.
>>
>> > I have set the : sy on and sy enable in my vimrc file.
>>
>> There's no built in support for highlighting your own macros and enums
>> etc. Have a look at my plugin
>> (http://sites.google.com/site/abudden/contents/Vim-Scripts/ctags-highl...),
>> which adds this feature (using ctags). If you have any problems
>> getting it setup, please let me know.
>

> Very Thanks.
>
> Your plugin is the one which I want.
> I have download the ctags-highlight plugin.
>
> But , when I input the command: UpdateTypeFile.
>
> There are some errors like:
>
> Error detected while processing function UpdateTypesFile:
> line 23:
> E684: list index out of range: 0
> E15: Invalid expression: split(globpath(&rtp,"ctags.exe"))[0]
> line 29:
> E605: Exception not caught: Cannot find ctags
>
> what this means?

This means that the plugin isn't looking for ctags.exe in PATH (which
may be a bug?). Instead, it's looking in &runtimepath. Try running the
command

:set runtimepath?

to see the list of directories that the plugin is looking in to find
ctags.exe, and put it in one of those directories (probably
$HOME/vimfiles is the best choice).

> I use Gvim 7.2 in windows XP. and I have put ctags.exe in c:\Windows
> \System32, so I can use ctags in command console.

~Matt

A. S. Budden

unread,
Sep 11, 2009, 2:42:02 PM9/11/09
to vim...@googlegroups.com
2009/9/11 Matt Wozniski <m...@drexel.edu>:

The plugin looks first for ctags.exe in the path and if it doesn't
find it there, it looks in the runtimepath.

I have ctags.exe installed in the \vim\vimfiles directory (so that it
works if I copy it to a USB stick and I don't have to put ctags on the
path of every machine I use) and it's been while since I tested it
with ctags in a normal path. I won't have access to a Windows machine
until Monday, but I'll do some more testing when I'm there and will
make sure that this works correctly.

As an aside, the fact that the exception isn't caught is a bug (and a
simple one to fix), but I'm surprised it doesn't find ctags in the
path if it's in C:\Windows\System32.

If you could let me know the output of:

:echo substitute($PATH, ';', ',', 'g')

then I can probably work out what's happening a bit quicker.

Al

stone

unread,
Sep 12, 2009, 3:23:46 AM9/12/09
to vim...@googlegroups.com
Thanks for your replay.
I put my ctags.exe in windows/system32, so we can use ctags.exe in console .
I will run the :":echo substitute($PATH, ';', ',', 'g')" in Monday.

Best Regards.


2009/9/12 A. S. Budden <abu...@gmail.com>


--~--~---------~--~----~------
------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

John Beckett

unread,
Sep 12, 2009, 3:35:19 AM9/12/09
to vim...@googlegroups.com
NEW USERS ON THIS MAILING LIST:

Please bottom post on this list. Quote a small (relevant) part
of the message you are replying to, and put your text underneath.

See
http://groups.google.com/group/vim_use/web/vim-information

Find out what the above means before posting on this list.

A. S. Budden

unread,
Sep 14, 2009, 11:08:42 AM9/14/09
to vim...@googlegroups.com
2009/9/12 stone <lbzh...@gmail.com>:

> Thanks for your replay.
> I put my ctags.exe in windows/system32, so we can use ctags.exe in console .
> I will run the :":echo substitute($PATH, ';', ',', 'g')" in Monday.

I've just added a preliminary test version (with a few bug fixes) to
my site (http://sites.google.com/site/abudden/contents/Vim-Scripts/ctags-highlighting).
Please could you download this version and see whether it works (I've
only updated ctags_highlighting.vba)? If it doesn't, it would be
useful to see the debugging output that this version includes: enter
the following:

:redir > ctags_hl_output.txt
:let g:CTagsHighlighterDebug = g:DBG_Information
:call UpdateTypesFile(1,0)
:redir END

This will create a file called ctags_hl_output.txt in the current
directory with some useful debugging information. If you could post
this file then I should be able to work out where it's going wrong.

Thanks,

Al

stone

unread,
Sep 14, 2009, 9:28:42 PM9/14/09
to vim...@googlegroups.com


2009/9/14 A. S. Budden <abu...@gmail.com>

I've just added a preliminary test version (with a few bug fixes) to
my site (http://sites.google.com/site/abudden/contents/Vim-Scripts/ctags-highlighting).
 Please could you download this version and see whether it works (I've
only updated ctags_highlighting.vba)?  If it doesn't, it would be
useful to see the debugging output that this version includes: enter
the following:

   :redir > ctags_hl_output.txt
   :let g:CTagsHighlighterDebug = g:DBG_Information
   :call UpdateTypesFile(1,0)
   :redir END

This will create a file called ctags_hl_output.txt in the current
directory with some useful debugging information.  If you could post
this file then I should be able to work out where it's going wrong.

Thanks,


Thanks for your relpy.

the command:

:echo substitute($PATH, ';', ',', 'g')

result is:

C:\Program Files\PC Connectivity Solution\,C:\WINDOWS\system32,C:\WINDOWS,C:\WINDOWS\System32\Wbem,C:\Program Files\Common Files\Roxio Shared\DLLShared\,C:\Program Files\doxygen\bin,,D:\Stone\software\install\job_tools\cvsnt,C:\Program Files\IVI Foundation\VISA\WinNT\Bin,D:\Stone\software\install\job_tools\Vim\vim72

ctags.ext has been in C:\WINDOWS\system32.

And I have downloaded the new copy, The error shows again. 

Error detected while processing function UpdateTypesFile..<SNR>19_FindExePath:
line   33:
E605: Exception not caught: Cannot find file ctags.exe

the command:
   :redir > ctags_hl_output.txt
   :let g:CTagsHighlighterDebug = g:DBG_Information
   :call UpdateTypesFile(1,0)
   :redir END

the result below:

Starting UpdateTypesFile
Looking for ctags.exe in C:\Program Files\PC Connectivity Solution\,C:\WINDOWS\system32,C:\WINDOWS,C:\WINDOWS\System32\Wbem,C:\Program Files\Common Files\Roxio Shared\DLLShared\,C:\Program Files\doxygen\bin,,D:\Stone\software\install\job_tools\cvsnt,C:\Program Files\IVI Foundation\VISA\WinNT\Bin,D:\Stone\software\install\job_tools\Vim\vim72
Not found.
Looking for ctags in C:\Documents and Settings\zhao-52\vimfiles,D:\Stone\software\install\job_tools\Vim/vimfiles,D:\Stone\software\install\job_tools\Vim\vim72,D:\Stone\software\install\job_tools\Vim/vimfiles/after,C:\Documents and Settings\zhao-52\vimfiles/after
Not found.
Could not find ctags.exe
Error detected while processing function UpdateTypesFile..<SNR>19_FindExePath:
line   33:
E605: Exception not caught: Cannot find file ctags.exe

It looks like the program can not find the ctags.exe. But I am sure the exe file has been in C:\WINDOWS\system32.What happened?

PS:
I have make the tag file for all symbol by use awk command. And save these symbols to the tag_highlight.hi file. 

Then in my _vimrc I add thiese sentences:

if filereadable("tag_highlight.hi")
autocmd BufRead,BufNewFile * so tag_highlight.hi
endif

So I can highlight my symbols in my code. But I feel some slowly when I open my code file.

How about your plugin? 
Is it using the same  method? 
Will it create a tag symbol file? 
Will it make it slowly when open code file?

Thanks again.

stone

unread,
Sep 14, 2009, 9:32:52 PM9/14/09
to vim...@googlegroups.com
2009/9/14 A. S. Budden <abu...@gmail.com>
>I've just added a preliminary test version (with a few bug fixes) to
>my site (http://sites.google.com/site/abudden/contents/Vim-Scripts/ctags-highlighting).
> Please could you download this version and see whether it works (I've
>only updated ctags_highlighting.vba)?  If it doesn't, it would be
>useful to see the debugging output that this version includes: enter
>the following:
Thanks for your relpy.

the command:

:echo substitute($PATH, ';', ',', 'g')

result is:

C:\Program Files\PC Connectivity Solution\,C:\WINDOWS\system32,C:\WINDOWS,C:\WINDOWS\System32\Wbem,C:\Program Files\Common Files\Roxio Shared\DLLShared\,C:\Program Files\doxygen\bin,,D:\Stone\software\install\job_tools\cvsnt,C:\Program Files\IVI Foundation\VISA\WinNT\Bin,D:\Stone\software\install\job_tools\Vim\vim72

ctags.ext has been in C:\WINDOWS\system32.

And I have downloaded the new copy, The error shows again. 

Error detected while processing function UpdateTypesFile..<SNR>19_FindExePath:
line   33:
E605: Exception not caught: Cannot find file ctags.exe

the command:
   :redir > ctags_hl_output.txt
   :let g:CTagsHighlighterDebug = g:DBG_Information
   :call UpdateTypesFile(1,0)
   :redir END

the result below:

Starting UpdateTypesFile
Looking for ctags.exe in C:\Program Files\PC Connectivity Solution\,C:\WINDOWS\system32,C:\WINDOWS,C:\WINDOWS\System32\Wbem,C:\Program Files\Common Files\Roxio Shared\DLLShared\,C:\Program Files\doxygen\bin,,D:\Stone\software\install\job_tools\cvsnt,C:\Program Files\IVI Foundation\VISA\WinNT\Bin,D:\Stone\software\install\job_tools\Vim\vim72
Not found.
Looking for ctags in C:\Documents and Settings\zhao-52\vimfiles,D:\Stone\software\install\job_tools\Vim/vimfiles,D:\Stone\software\install\job_tools\Vim\vim72,D:\Stone\software\install\job_tools\Vim/vimfiles/after,C:\Documents and Settings\zhao-52\vimfiles/after
Not found.
Could not find ctags.exe
Error detected while processing function UpdateTypesFile..<SNR>19_FindExePath:
line   33:

A. S. Budden

unread,
Sep 15, 2009, 5:05:22 AM9/15/09
to vim...@googlegroups.com
2009/9/15 stone <lbzh...@gmail.com>:

> 2009/9/14 A. S. Budden <abu...@gmail.com>
>>
>> I've just added a preliminary test version (with a few bug fixes) to
>> my site
>> (http://sites.google.com/site/abudden/contents/Vim-Scripts/ctags-highlighting).
>> Please could you download this version and see whether it works (I've
>> only updated ctags_highlighting.vba)? If it doesn't, it would be
>> useful to see the debugging output that this version includes: enter
>> the following:
>>
>> :redir > ctags_hl_output.txt
>> :let g:CTagsHighlighterDebug = g:DBG_Information
>> :call UpdateTypesFile(1,0)
>> :redir END
>>
>> This will create a file called ctags_hl_output.txt in the current
>> directory with some useful debugging information. If you could post
>> this file then I should be able to work out where it's going wrong.
>>
>> Thanks,
>>
> Starting UpdateTypesFile
> Looking for ctags.exe in C:\Program Files\PC Connectivity Solution\,C:\WINDOWS\system32,C:\WINDOWS,C:\WINDOWS\System32\Wbem,C:\Program Files\Common Files\Roxio Shared\DLLShared\,C:\Program Files\doxygen\bin,,D:\Stone\software\install\job_tools\cvsnt,C:\Program Files\IVI Foundation\VISA\WinNT\Bin,D:\Stone\software\install\job_tools\Vim\vim72
> Not found.
[snip]

> E605: Exception not caught: Cannot find file ctags.exe
> It looks like the program can not find the ctags.exe. But I am sure the exe
> file has been in C:\WINDOWS\system32.What happened?

This is indeed very strange. The problem is coming from globpath( )
as far as I can tell: it doesn't think that the file exists. Your
path looks correct (and in the right format for globpath), so it's
bizarre that it can't find ctags.exe. Please can you try the
following?

:redir > logfile.txt
:let path = substitute($PATH, ';', ',', 'g')
:echo "Bare Path:"
:echo $PATH
:echo "Path:"
:echo path
:echo "Path Glob:"
:echo globpath(path, 'ctags.exe')
:echo "Winsys Glob:"
:echo globpath('c:\windows\system32', 'ctags.exe')
:echo "Path Glob for xcopy.exe:"
:echo globpath(path, 'xcopy.exe')
:echo "Winsys Glob for xcopy.exe:"
:echo globpath('c:\windows\system32', 'xcopy.exe')
:echo "Readable?"
:echo filereadable('c:\windows\system32\ctags.exe')
:redir END

Sorry for the tedious entry: as an alternative, save all of that to a
file (e.g. c:\testfile.vim) without the leading colons and do:

:source c:\testfile.vim

We'll get to the bottom of this in the end!

> PS:
> I have make the tag file for all symbol by use awk command. And save these
> symbols to the tag_highlight.hi file.
> Then in my _vimrc I add thiese sentences:
> if filereadable("tag_highlight.hi")
> autocmd BufRead,BufNewFile * so tag_highlight.hi
> endif
> So I can highlight my symbols in my code. But I feel some slowly when I open
> my code file.
> How about your plugin?
> Is it using the same method?
> Will it create a tag symbol file?
> Will it make it slowly when open code file?

My plugin uses a similar method (it runs ctags, then parses it using
python to generate a symbol file). It probably adds a little delay
opening the code file, but I don't really notice it. It obviously
depends on the number of symbols and how you are doing the
highlighting. It's important that you use "syn keyword" instead of
"syn match" (as the latter is much slower) and it is beneficial to put
multiple keywords on one line (although there is a line length limit
that must be obeyed as well) in order to reduce the size of the
highlight file.

Hope that helps,

Al

--
http://sites.google.com/site/abudden

Matt Wozniski

unread,
Sep 15, 2009, 10:09:54 AM9/15/09
to vim...@googlegroups.com
2009/9/15 A. S. Budden <abu...@gmail.com>:
>
> 2009/9/15 stone <lbzh...@gmail.com>:

Removing the colons isn't necessary, so - for the purpose of easy
copy-pasting of a one-off script - I would just leave them in
c:\testfile.vim

~Matt

stone

unread,
Sep 15, 2009, 8:52:29 PM9/15/09
to vim...@googlegroups.com


2009/9/15 Matt Wozniski <m...@drexel.edu>

2009/9/15 A. S. Budden <abu...@gmail.com>:
>
> 2009/9/15 stone <lbzh...@gmail.com>:
>
> Removing the colons isn't necessary, so - for the purpose of easy
> copy-pasting of a one-off script - I would just leave them in
> c:\testfile.vim

Ok, Thank your remind.

stone

unread,
Sep 15, 2009, 9:06:04 PM9/15/09
to vim...@googlegroups.com


2009/9/15 A. S. Budden <abu...@gmail.com>

2009/9/15 stone <lbzh...@gmail.com>:
> 2009/9/14 A. S. Budden <abu...@gmail.com>

> This is indeed very strange.  The problem is coming from globpath( )
> as far as I can tell: it doesn't think that the file exists.  Your
> path looks correct (and in the right format for globpath), so it's
> bizarre that it can't find ctags.exe.  Please can you try the
> following?

> Sorry for the tedious entry: as an alternative, save all of that to a
> file (e.g. c:\testfile.vim) without the leading colons and do:

> :source c:\testfile.vim

> We'll get to the bottom of this in the end!

The result is like this:

Path:

C:\Program Files\PC Connectivity Solution\,C:\WINDOWS\system32,C:\WINDOWS,C:\WINDOWS\System32\Wbem,C:\Program Files\Common Files\Roxio Shared\DLLShared\,C:\Program Files\doxygen\bin,,D:\Stone\software\install\job_tools\cvsnt,C:\Program Files\IVI Foundation\VISA\WinNT\Bin,D:\Stone\software\install\job_tools\Vim\vim72
1 line less; before #1  2 seconds ago

Path Glob:

1 line less; before #2  2 seconds ago

Winsys Glob:

c:\windows\system32\ctags.exe

Path Glob for xcopy.exe:
1 line less; before #3  2 seconds ago



Winsys Glob for xcopy.exe:

c:\windows\system32\xcopy.exe

Readable?

1

> My plugin uses a similar method (it runs ctags, then parses it using
> python to generate a symbol file).  It probably adds a little delay
> opening the code file, but I don't really notice it.  It obviously
> depends on the number of symbols and how you are doing the
> highlighting.  It's important that you use "syn keyword" instead of
> "syn match" (as the latter is much slower) and it is beneficial to put
> multiple keywords on one line (although there is a line length limit
> that must be obeyed as well) in order to reduce the size of the
> highlight file.

> Hope that helps,

Thank you for your advise. And How about one line length limit?

--

A. S. Budden

unread,
Sep 16, 2009, 3:18:11 AM9/16/09
to vim...@googlegroups.com
2009/9/16 stone <lbzh...@gmail.com>:
[snip]

Okay! I think I've figured out what's going on. Please can you
download the latest version from
http://sites.google.com/site/abudden/contents/Vim-Scripts/ctags-highlighting
and let me know whether it works?

There's a note (that I'd previously missed) in :help globpath() that
says "Note that on MS-Windows a directory may have a trailing
backslash, remove it if you put a comma after it.". I think that the
first entry in your path (which ends in a backslash) was being treated
as a single path: "C:\Program Files\PC Connectivity
Solution,C:\WINDOWS\system32", which doesn't make sense. As a result,
C:\WINDOWS\system32 wasn't being searched. Therefore, I've changed
the path substitution to:

let path = substitute($PATH, '\\\?;', ',', 'g')

which removes any trailing backslash at the same time as adding the
comma. Hopefully this will fix the problem.

>> My plugin uses a similar method (it runs ctags, then parses it using
>> python to generate a symbol file).  It probably adds a little delay
>> opening the code file, but I don't really notice it.  It obviously
>> depends on the number of symbols and how you are doing the
>> highlighting.  It's important that you use "syn keyword" instead of
>> "syn match" (as the latter is much slower) and it is beneficial to put
>> multiple keywords on one line (although there is a line length limit
>> that must be obeyed as well) in order to reduce the size of the
>> highlight file.
>> Hope that helps,
> Thank you for your advise. And How about one line length limit?

I think it's 512 characters (based on re-reading mktypes.py).
Hopefully with the fixed version of my plugin, you won't need it
though!

Al

--
http://sites.google.com/site/abudden

stone

unread,
Sep 20, 2009, 9:30:34 PM9/20/09
to vim...@googlegroups.com


2009/9/16 A. S. Budden <abu...@gmail.com>

>Okay!  I think I've figured out what's going on.  Please can you
>download the latest version from
>and let me know whether it works?

>There's a note (that I'd previously missed) in :help globpath() that
>says "Note that on MS-Windows a directory may have a trailing
>backslash, remove it if you put a comma after it.".  I think that the
>first entry in your path (which ends in a backslash) was being treated
>as a single path: "C:\Program Files\PC Connectivity
>Solution,C:\WINDOWS\system32", which doesn't make sense.  As a result,
>C:\WINDOWS\system32 wasn't being searched.  Therefore, I've changed
>the path substitution to:

>let path = substitute($PATH, '\\\?;', ',', 'g')
>
>which removes any trailing backslash at the same time as adding the
>comma.  Hopefully this will fix the problem.

Thank you for your reply.
And now, when I run :UpdataTypesFile, there is no error any more.
But the highlight do not show.The tags such as: MACRO define, typedef look 
same with before.

How to do with this?


--

A. S. Budden

unread,
Sep 21, 2009, 3:05:51 AM9/21/09
to vim...@googlegroups.com
2009/9/21 stone <lbzh...@gmail.com>:

There are three possibilities that I can think of:

1) The problem may be that you don't have the various colour groups
defined in your colour scheme. If I'm correct, entering the following
should help:

:hi Type guifg=blue ctermfg=blue

A quick test would be to enter: ":hi DefinedName" and see whether it
reports an error. See ":help ctags_highlighting-colours" for more
information.

The above will, of course, only highlight types, but it's a good way
of quickly testing it. If this works, the full list of highlight
groups that need to be defined are:

ClassName
DefinedName
Enumerator
Function
EnumerationName
Member
Structure
Type
Union
GlobalConstant
GlobalVariable

A quick (but not necessarily appealing to you) way of getting all of
these defined is to download my "Bandit" colour scheme from:

http://sites.google.com/site/abudden/contents/Vim-Scripts/bandit-colour-scheme

(save to vimfiles/colors and enter :colorscheme bandit). Of course,
this will override your colour scheme and you may not like mine!

2) A second possibility is that the generated types file isn't being
read correctly. If this is the case, ":source types_c.vim" will fix
the problem temporarily, but we'll need to look in a bit more detail
to identify why it isn't being read automatically.

3) The other possibility is that types_c.vim doesn't contain the
necessary entries (check by opening it in vim). The most common
reason for this is that the source and header files are spread over
multiple directories and the recursive option wasn't selected. If
your files are all in one folder, make sure you run ":cd %:p:h" before
you run :UpdateTypesFile (to make sure you're in the correct working
directory). If they're spread out like this:

c:/path/to/ProjectDir/Source/*.c
c:/path/to/ProjectDir/Headers/*.h

or something like that, do ":cd c:/path/to/ProjectDir" then ":e
Source/MyFile.c" followed by ":UpdateTypesFile!" (note the exclamation
mark for recursive operation). Alternatively you do ":let
b:TypesFileRecurse = 1" for each buffer and then you won't need the
exclamation mark. If you use the project plugin, the CD= and in=
parameters make all of this very easy. Hopefully I'll tidy up the
options system in the ctags highlighting plugin very soon.

Please let me know how you get on: I'm really keen to see this working for you!

Regards,

Al

--
http://sites.google.com/site/abudden

stone

unread,
Sep 24, 2009, 10:28:57 AM9/24/09
to vim...@googlegroups.com

2009/9/21 A. S. Budden <abu...@gmail.com>
Thank you for your reply.
I am sorry response so slowly , because I'm busy in working.

So I have try the plugin again. And I Have these results:

1.
I am using the colortheme: "desert". So muse I use your colortheme?
When I run :hi DefinedName, the vim show: no highlight group.

2.
I can not find types_c.vim in my directory.I guess the file should not been created.
So How can I create this file.

3.I have not tried yet.

--

A. S. Budden

unread,
Sep 25, 2009, 3:07:18 AM9/25/09
to vim...@googlegroups.com
2009/9/24 stone <lbzh...@gmail.com>:

You don't have to use my colour scheme, but you will have to modify
the colour scheme to add the extra highlight groups. A very simple
way of doing this would be to add the following lines to the end of
desert.vim (it's probably better to copy it to your vimfiles/colors
directory):

hi link ClassName Statement
hi link DefinedName Statement
hi link Enumerator Statement
hi link Function Statement
hi link EnumerationName Statement
hi link Member Statement
hi link Structure Statement
hi link Type Statement
hi link Union Statement
hi link GlobalConstant Statement
hi link GlobalVariable Statement

> 2.
> I can not find types_c.vim in my directory.I guess the file should not been
> created.
> So How can I create this file.

This file should have been created by :UpdateTypesFile - the fact it's
not there is rather strange. How are your projects structured? Are
all the files in one directory or are they in a number of
subdirectories. If the latter, make sure you :cd to the bottom level
directory of the project and use :UpdateTypesFile! (note the
exclamation mark) to run recursively and include subdirectories.

Perhaps you could run the following and let me know the output:

:redir @+>
:call UpdateTypesFile(1,0)
:redir END

(this will redirect the output into the system clipboard, so you can
then paste it into an email).

> 3.I have not tried yet.

Please let me know how you get on with the above.

Al

--
http://sites.google.com/site/abudden

stone

unread,
Sep 25, 2009, 11:13:30 AM9/25/09
to vim...@googlegroups.com


2009/9/25 A. S. Budden <abu...@gmail.com>

> You don't have to use my colour scheme, but you will have to modify
> the colour scheme to add the extra highlight groups.  A very simple
> way of doing this would be to add the following lines to the end of
> desert.vim (it's probably better to copy it to your vimfiles/colors
> directory):

> hi link ClassName Statement

> 2.
> I can not find types_c.vim in my directory.I guess the file should not been
> created.
> So How can I create this file.

> This file should have been created by :UpdateTypesFile - the fact it's
> not there is rather strange.  How are your projects structured?  Are
> all the files in one directory or are they in a number of
> subdirectories.  If the latter, make sure you :cd to the bottom level
> directory of the project and use :UpdateTypesFile! (note the
> exclamation mark) to run recursively and include subdirectories.

> Perhaps you could run the following and let me know the output:

> :redir @+>
> :call UpdateTypesFile(1,0)
> :redir END

> (this will redirect the output into the system clipboard, so you can
> then paste it into an email).

> 3.I have not tried yet.

> Please let me know how you get on with the above.

Thank for your reply.
I am so happy that the plugin have worked OK!
It is a very good plugin. The tags file it created run faster than my tags file.

I add the "hi link" and run the command UpdateTypeFile!. So it can work. It is my mistake do not prepare the color scheme.

And the out of the commands:

> :redir @+>
> :call UpdateTypesFile(1,0)
> :redir END

is :



python "D:\Stone\software\install\job_tools\Vim\vimfiles\mktypes.py" --ctags-dir="C:\WINDOWS\system32" -r
'python' is not recognized as an internal or external command,
operable program or batch file.

Using compiled mktypes
Generating Tags
Generating types_c.vim
Generating types_java.vim
No tags found
Generating types_pl.vim
No tags found
Generating types_py.vim
No tags found
Generating types_ruby.vim
No tags found
Generating types_vhdl.vim
No tags found
Generating types_php.vim
No tags found

'python' is not recognized as an internal or external command,^@operable program or batch file.^@^@Using compiled mktypes^@Generating Tags^@Generating types_c.vim^@Generating types_java.vim^@No tags found^@Generating types_pl.vim^@No tags found^@Generating types_py.vim^@No tags found^@Generating types_ruby.vim^@No tags found^@Generating types_vhdl.vim^@No tags found^@Generating types_php.vim^@No tags found^@
Messages maintainer: Bram Moolenaar <Br...@vim.org>
"SensorBoardApp\BoardCmd\SensorBoard_CtrlCmd.c" 1733L, 70975C
"MainBoardApp\BoardCmd\MainBoard_CtrlCmd.c" 2307L, 94594C
D:\Stone\Projects\Software_Draft_0.1
'python' is not recognized as an internal or external command,^@operable program or batch file.^@^@Using compiled mktypes^@Generating Tags^@Generating types_c.vim^@Generating types_java.vim^@No tags found^@Generating types_pl.vim^@No tags found^@Generating types_py.vim^@No tags found^@Generating types_ruby.vim^@No tags found^@Generating types_vhdl.vim^@No tags found^@Generating types_php.vim^@No tags found

So, thank you again. For your good skills in vim and your good patience.

PS:

One question. When I add or modify my define such as MACRO. Should I need run the UpdateTypeFile! again?
Do you have good way to run the command auto or timely?

And do your plugin used cscope?

--


stone

unread,
Sep 25, 2009, 11:20:58 AM9/25/09
to vim...@googlegroups.com


2009/9/25 stone <lbzh...@gmail.com>

And will your plugin interfer with the lookup file plugin?

After I run the UpdateTypeFile! . Somthing strange to my look up file plugin.

Thank you.

--



stone

unread,
Sep 25, 2009, 11:26:19 AM9/25/09
to vim...@googlegroups.com


2009/9/25 stone <lbzh...@gmail.com>

And do your plugin support c++ file?

I used this command to create my tags file:

ctags -R  --c++-kinds=-f-n-v -o ../tag_highlight

And do you had same command?

--


A. S. Budden

unread,
Sep 26, 2009, 1:31:51 PM9/26/09
to vim...@googlegroups.com
2009/9/25 stone <lbzh...@gmail.com>:
[snip]

>> Please let me know how you get on with the above.
> Thank for your reply.
> I am so happy that the plugin have worked OK!

Excellent, I'm really pleased!

> It is a very good plugin. The tags file it created run faster than my tags
> file.
> I add the "hi link" and run the command UpdateTypeFile!. So it can work. It
> is my mistake do not prepare the color scheme.

[snip]

> One question. When I add or modify my define such as MACRO. Should I need
> run the UpdateTypeFile! again?

Yes, it only works if you tell it to update the files.

> Do you have good way to run the command auto or timely?

At the moment, no. I tend to find that I only occasionally add new
macros etc, so I tend to run it manually (it is quite slow) after each
significant change. It would be fairly easy to integrate into the
make process if you're using make and wanted to do that. Basically
run:

c:\path\to\vimfiles\extra_source\mktypes\dist\mktypes.exe


--ctags-dir="C:\WINDOWS\system32" -r

from the project root directory as part of the make process. Then you
just need something in vim to run :ReadTypes on any open files.

> And do your plugin used cscope?

Yes and no. It doesn't use cscope at all, but (for my purposes), I
have configured it to run cscope in the background to regenerate the
cscope.out database (so I can update the tags, types and cscope
database in one go). It only does this if both of the following
conditions are true:

1) There is a file in the current directory called cscope.files
2) The buffer-local variable b:CheckForCScopeFiles is set to 1.

All the best,

Al

--
http://sites.google.com/site/abudden

A. S. Budden

unread,
Sep 26, 2009, 1:32:32 PM9/26/09
to vim...@googlegroups.com
2009/9/25 stone <lbzh...@gmail.com>:

The short answer is: I don't know.

What is the lookup file plugin and what exactly strange is happening?

Al

--
http://sites.google.com/site/abudden

A. S. Budden

unread,
Sep 26, 2009, 1:36:54 PM9/26/09
to vim...@googlegroups.com
2009/9/25 stone <lbzh...@gmail.com>:

>
>
> 2009/9/25 stone <lbzh...@gmail.com>
> And do your plugin support c++ file?

Yes! Most of the testing has been done on (embedded) C code, but it
should support C++ code with no problems at all.

> I used this command to create my tags file:
> ctags -R  --c++-kinds=-f-n-v -o ../tag_highlight
> And do you had same command?

I call ctags with (if memory serves me correctly):

ctags --recurse --exclude=docs --exclude=Documentation --languages=c,c++ .

This generates a file called tags, which is then parsed to generate types_c.vim.

It treats C and C++ files as equivalent, but it has always seemed to
work for me. Are you having trouble with C++ code?

Al

--
http://sites.google.com/site/abudden

stone

unread,
Sep 26, 2009, 9:57:30 PM9/26/09
to vim...@googlegroups.com


2009/9/27 A. S. Budden <abu...@gmail.com>

>> And do your plugin used cscope?

>Yes and no.  It doesn't use cscope at all, but (for my purposes), I
>have configured it to run cscope in the background to regenerate the
>cscope.out database (so I can update the tags, types and cscope
>database in one go).  It only does this if both of the following
>conditions are true:
>
>1) There is a file in the current directory called cscope.files
>2) The buffer-local variable b:CheckForCScopeFiles is set to 1.
>
>All the best,
>
>Al


Thank for your reply, so in your plugin. It will not call csope command, will it?
>The short answer is: I don't know.

>What is the lookup file plugin and what exactly strange is happening?


It is a plugin to help find a file in current project.

When I use it, I will create a special tag file , only include file name.

I have found that why the strange thing happend.Because the lookup file plugin has look up file 
in your tag file and my file name tag file together.


>> I used this command to create my tags file:
>> ctags -R  --c++-kinds=-f-n-v -o ../tag_highlight
>> And do you had same command?

>I call ctags with (if memory serves me correctly):

>ctags --recurse --exclude=docs --exclude=Documentation --languages=c,c++ .

>This generates a file called tags, which is then parsed to generate types_c.vim.

>It treats C and C++ files as equivalent, but it has always seemed to
>work for me.  Are you having trouble with C++ code?


I creat the tag file use this command: 
ctags -R --c++-kinds=+p+x --fields=+iaS --extra=+q 

The options in the commad: --c++-kinds=+p+x will add function prototype for c++ file;
--fields=+iaS  and --extra=+q  add special information for c++ class.

So, adding these options, the tag file will help me to auto complete the c++ file.

So, Would you tell me how can I add this options in your plugin. I this it will help me much.

At the same time ,if I have created a tag file using my command. After I run the UpdateTypeFile! to modify the tag 
file, does the command will replace my tag file or append my tag file?

PS:
The command :UpdateTypefile! will create tag file in current directory. Must the tag file name is : tags?
Do I change the tags file name?
And when I have created the tags file ,I run the command next time, Should it run fater than I run it at first?


Anyway, Thank you very much. I enjoy this plugin very much.

--

stone

unread,
Sep 27, 2009, 1:20:43 AM9/27/09
to vim...@googlegroups.com

Budden:

I think you are skilled in using vim to code.

Now I have two trouble when I using vim:

1.
How can I copy and paste a word in a souce file.

for example:
in this sentence:
I love emacs.

I want relace the emacs to vim.

so I use "yw" to copy the "vim" word from another sentence.

And now I must use "dw" to delete the "emcs" word, then I use " "0p " to 
copy the "vim" in reg 0 to paste the word "vim".

Is there a simpler and faster way?

2.
How can I modify all the symbols( such as: function name, class name) which I have founded by cscope.

for example:
When I want to modify a function name. And now I must use cscope to find all the reference. Then I modify the function name file by flie.

Is there a simpler and faster way?

--

Reply all
Reply to author
Forward
0 new messages