Quantcast

Typedef and struct colors in console vi

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Typedef and struct colors in console vi

Ulrar
Hi,

I'm new to vi, switching from emacs, and I'm trying to configure the colorsheme.
The only thing, my typedefs are colored the way I want but no the new type.

For example, if I write in a .h (in C) :
typedef struct
{
//things
} t_thing;

The t_thing are not colored.
In emacs the typedefs are considered as type like int or char, but in vi it's just text.
Any idea of what I have to link to my Type ?

An other thing, is there a way to color the prototype names ?
like int main(void), just color the main ?
The only way I found to color that is to change the text color, so the main content is colored too, and it's not what I want.

Thanks for reading.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Typedef and struct colors in console vi

Charles Campbell
Ulrar wrote:

> Hi,
>
> I'm new to vi, switching from emacs, and I'm trying to configure the
> colorsheme.
> The only thing, my typedefs are colored the way I want but no the new type.
>
> For example, if I write in a .h (in C) :
> typedef struct
> {
> //things
> } t_thing;
>
> The t_thing are not colored.
> In emacs the typedefs are considered as type like int or char, but in vi
> it's just text.
> Any idea of what I have to link to my Type ?
>
> An other thing, is there a way to color the prototype names ?
> like int main(void), just color the main ?
> The only way I found to color that is to change the text color, so the main
> content is colored too, and it's not what I want.
>
>    
May I suggest Al Budden's

http://www.vim.org/scripts/script.php?script_id=2646

Regards,
Chip Campbell

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Typedef and struct colors in console vi

Ulrar
Thanks, but I can't have it working.
I tried to :hi def link Structure Type
And, in my colorscheme, Type is my group for all the char, int, ect.
In the plugin doc I see that Typedef are in Type group so it is already in the right group, but nothing, the t_thing still white.

I have runned the :UpdateFileType before, of course.
What am I doing wrong ?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Typedef and struct colors in console vi

A. S. Budden
On 5 May 2011 10:32, Ulrar <[hidden email]> wrote:
> Thanks, but I can't have it working.
> I tried to :hi def link Structure Type
> And, in my colorscheme, Type is my group for all the char, int, ect.
> In the plugin doc I see that Typedef are in Type group so it is already in
> the right group, but nothing, the t_thing still white.
>
> I have runned the :UpdateFileType before, of course.
> What am I doing wrong ?

Are your source files all in the same directory and is it the
directory reported by

    :pwd

?

If they're not in the same directory, can you try using ":cd" to
change to the common parent and run:

    :UpdateTypesFile!

(note the exclamation mark)?

Is there a file called types_c.vim in the current directory?  If so,
can you check for a line with t_thing in it and post that to the list
or my email address.  If not, please can you run the following and
post the result?

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

the output will be saved in output.log... please post the contents.

Al

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

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Typedef and struct colors in console vi

Ulrar
I have nothing ending in .vim in my directory, and yes I am in the right one.

The output.log file :

output.log wrote
Starting UpdateTypesFile revision r458
Looking for ctags in /usr/local/bin,/usr/bin,/bin,/opt/bin,/usr/i686-pc-linux-gnu/gcc-bin/4.4.5,/usr/lib/subversion/bin,/usr/games/bin
Success.
Success.
python '/home/lemonn_k/.vim/mktypes.py' --ctags-dir=/usr/bin -r --include-locals --ctags-file tags --types-prefix types
/usr/bin/ctags: unrecognized option '--recurse'
        Try `/usr/bin/ctags --help' for a complete list of options.
Generating Tags
Generating types_c.vim
No tags found
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
Generating types_cs.vim
No tags found

/usr/bin/ctags: unrecognized option '--recurse'^@^ITry `/usr/bin/ctags --help' for a complete list of options.^@Generating Tags^@Generating types_c.vim^@No tags found^@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^@Generating types_cs.vim^@No tags found^@
Messages maintainer: Bram Moolenaar <Bram@vim.org>
"exec.c" [converted] 63L, 1369C
Starting UpdateTypesFile revision r458
Looking for ctags in /usr/local/bin,/usr/bin,/bin,/opt/bin,/usr/i686-pc-linux-gnu/gcc-bin/4.4.5,/usr/lib/subversion/bin,/usr/games/bin
Success.
Success.
/usr/bin/ctags: unrecognized option '--recurse'^@^ITry `/usr/bin/ctags --help' for a complete list of options.^@Generating Tags^@Generating types_c.vim^@No tags found^@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^@Generating types_cs.vim^@No tags found
Looks like the --recurse option don't exist.
I have vim 7.3.50 and ctags 5.7
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Typedef and struct colors in console vi

Ben Schmidt
>> Looking for ctags in
>> /usr/local/bin,/usr/bin,/bin,/opt/bin,/usr/i686-pc-linux-gnu/gcc-bin/4.4.5,/usr/lib/subversion/bin,/usr/games/bin
...
>> /usr/bin/ctags: unrecognized option '--recurse'
>> Try `/usr/bin/ctags --help' for a complete list of options.

> Looks like the --recurse option don't exist.
> I have vim 7.3.50 and ctags 5.7

Looks like the script is finding /usr/bin/ctags, which is not Exuberant
ctags 5.7 (which doesn't give the kind of error message above), but the
ctags that comes with emacs (which does). Maybe you need to reorder your
$PATH or something.

Ben.



--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Typedef and struct colors in console vi

A. S. Budden
On 5 May 2011 20:40, Ben Schmidt <[hidden email]> wrote:

>>> Looking for ctags in
>>>
>>> /usr/local/bin,/usr/bin,/bin,/opt/bin,/usr/i686-pc-linux-gnu/gcc-bin/4.4.5,/usr/lib/subversion/bin,/usr/games/bin
>
> ...
>>>
>>> /usr/bin/ctags: unrecognized option '--recurse'
>>>        Try `/usr/bin/ctags --help' for a complete list of options.
>
>> Looks like the --recurse option don't exist.
>> I have vim 7.3.50 and ctags 5.7
>
> Looks like the script is finding /usr/bin/ctags, which is not Exuberant
> ctags 5.7 (which doesn't give the kind of error message above), but the
> ctags that comes with emacs (which does). Maybe you need to reorder your
> $PATH or something.

Agreed.  It's one of the items on my wishlist to allow explicit
customisation of the path to ctags (in case multiple versions are
installed), but I haven't done this yet.  Do you have exuberant ctags
installed?  If so, where is it in the path?  If rearranging the path
is an option, then I'd suggest that.  Otherwise, I'll try to get that
fix done as soon as I can.

Al

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Typedef and struct colors in console vi

Ulrar
Yeah, I have emacs but I didn't even know that there was a ctags with it !

I've looked, I have that :
/usr/bin/exuberant-ctags

I guess I can't change the path, may be I can directly edit the plugin to make it look for exuberant-ctags ?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Typedef and struct colors in console vi

Christian Brabandt
Hi Ulrar!

On Fr, 06 Mai 2011, Ulrar wrote:

> Yeah, I have emacs but I didn't even know that there was a ctags with it !
>
> I've looked, I have that :
> /usr/bin/exuberant-ctags
>
> I guess I can't change the path, may be I can directly edit the plugin to
> make it look for exuberant-ctags ?

you could symlink /usr/bin/exuberant-ctags to e.g. ~/bin/ctags and put
~/bin in the beginning of your $PATH

regards,
Christian

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Typedef and struct colors in console vi

A. S. Budden
On 6 May 2011 10:25, Christian Brabandt <[hidden email]> wrote:

> Hi Ulrar!
>
> On Fr, 06 Mai 2011, Ulrar wrote:
>
>> Yeah, I have emacs but I didn't even know that there was a ctags with it !
>>
>> I've looked, I have that :
>> /usr/bin/exuberant-ctags
>>
>> I guess I can't change the path, may be I can directly edit the plugin to
>> make it look for exuberant-ctags ?
>
> you could symlink /usr/bin/exuberant-ctags to e.g. ~/bin/ctags and put
> ~/bin in the beginning of your $PATH

That's a good plan.  I've implemented a fix in the plugin that should
allow this to be customised, but I need to do a little more testing
before it's released.  In the meantime, the symlink should work well.

Al

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Typedef and struct colors in console vi

Ulrar
Thank you, the link works perfectly !

Great plugin :)
Loading...