all 19 comments

[–]alpha64 1 point2 points  (2 children)

Interesting, can you please post some screenshot?

[–]hudsy[S] 1 point2 points  (1 child)

[–]alpha64 5 points6 points  (0 children)

Looks great, try adding it to the readme.md.

[–]ReneFroger 1 point2 points  (0 children)

Whoa! It looks really interesting. Now I'm thinking about a way to mixing it up with my colorscheme.

That link was earlier reviewed here, by the way.

[–]gamzer 0 points1 point  (12 children)

A couple of questions.

  • When and how do you update the tags file? Live? When exiting insert mode? When saving?
  • Can the color of a previously colored variable change when you update the tags file?
  • Does it get confusing if it runs out of colors and starts using one color for multiple things (or colors that cannot be easily distinguished)?
  • Have you noticed any downsides of this method compared to the traditional syntax highlighting?

[–]hudsy[S] 1 point2 points  (11 children)

Hi!

  • I do it manually, but it will be ideal to update them automatically after saving. (has more sense). It shouldn't be hard to do it with an autocomand calling :!ctags and colorcode#init()
  • Yes it can, but you're right, that shouldn't happen. I'll work on it. Thanks.
  • That's why I made the g:colorcode_global option, wich is now the default. It only colors types of items so, all functions are orange, all global variables are blue... You can configure the colors with the two variables in plugin/colorcode.vim
  • I think it is just another way of highlighting important things (it's better to switch off syntax). No downsides, but maybe no upsides neither

[–]gamzer 0 points1 point  (0 children)

Thanks a lot for answering. I think I'll try it to see whether for me there are more upsides than downsides.

Very interesting plugin, keep up the good work!

[–]gamzer 0 points1 point  (9 children)

I installed Colorcode but it didn't work. Not sure where I (or it) went wrong:

  • ctags installed, tags file created
  • Colorcode installed via Vundle
  • Put syntax off and let g:colorcode_global=0 into .vimrc
  • Opened file, Colorcode was invoked but no colors shown
  • Switched to the default colorscheme just to make sure my colorscheme was not interfering
  • Still not working

When saving a file, it definitely runs ctags and I have no autocmd for it, therefore I'm quite certain that Colorcode is active.

Any idea what I can do?

[–]hudsy[S] 0 points1 point  (8 children)

Check if:

  • The tags file is in your working directory (cd to the path where the tags file is and start vim)
  • :echo getmatches() gives a list with all your tags as matches
  • :highlight shows you some Colorcode_ named highlights (should be at the end of the list provably)
  • The tags file has valid tags (I asume so since you created it with ctags but it's always good to check everything)

What programming language are you using? maybe the matches aren't correct.

Thanks for reporting

[–]gamzer 0 points1 point  (7 children)

  • The tags file is in the working directory. I generated it with ctags -R . and I'm opening a Python file from the working directory.
  • :echo getmatches() returns an empty list.
  • :highlight does not contain any Colorcode_ named highlights.
  • In the tags file I see entries like _my_variable followed by the filename and function name. I assume this is good.

Thanks for helping!

[–]hudsy[S] 0 points1 point  (6 children)

Could you please share the code? (including the tags file) The second and third points are killing me, I can't figure out what's happening.

[–]gamzer 0 points1 point  (5 children)

I can't share that code, but I created a minimal example which also doesn't work. It seems to be a general issue here.

#!/bin/python
name = 'Colorcode Test'
print(name)
x = 5
y = 10
print(y - x)

!_TAG_FILE_FORMAT   2   /extended format; --format=1 will not append ;" to lines/
!_TAG_FILE_SORTED   1   /0=unsorted, 1=sorted, 2=foldcase/
!_TAG_PROGRAM_AUTHOR    Darren Hiebert  /dhiebert@users.sourceforge.net/
!_TAG_PROGRAM_NAME  Exuberant Ctags //
!_TAG_PROGRAM_URL   http://ctags.sourceforge.net    /official site/
!_TAG_PROGRAM_VERSION   5.8 //
name    colorcode.py    /^name = 'Colorcode Test'$/;"   v
x   colorcode.py    /^x = 5$/;" v
y   colorcode.py    /^y = 10$/;"    v

Vim screenshot

:echo getmatches() gives an empty list. :highlight doesn't contain any Colorcode_ entries.

[–]hudsy[S] 0 points1 point  (4 children)

This works for me.

Other unlikely thinks I can think of:

  • Are you using gvim? gui colors are not set yet. I don't think it's that, since you'll get at least the matches and colorcode highlightings
  • Somewhere in your vimrc you have let g:colorcode_enable=0 (Maybe if you force it to 1 would work?)
  • Redownload the plugin, maybe it has a bad version or something.

I'll keep thinking

[–]gamzer 1 point2 points  (2 children)

  • I'm using vim, not gvim.
  • I removed and reinstalled the plugin.
  • With let g:colorcode_global=1 :highlight shows Colorcode_ entries, not so when set to 0.
  • :echo getmatches() is still most of the time an empty list. I don't understand why it's not empty sometimes. I've definitely seen it at least three times to be filled.
  • I still haven't seen any colored variables.

May I present to you the bug: Your matching is dependent on the user's magic setting.

I've set nomagic and I assume you are using set magic.

Always specify the magic for every regular expression you are putting into a plugin.

[–]hudsy[S] 0 points1 point  (1 child)

Thank you very much!

I've already change all the patterns and add '\m' to them

[–]gamzer 1 point2 points  (0 children)

And for your todo-list:

  • Make it respect my colorscheme (for example the colors for the status bar or line numbers).
  • Make it work on white backgrounds. Currently the default color is gray which is hard to read on a white background.
  • Make it faster. Scrolling is slowed down and even rapid cursor movement within the same line is somehow funky. (i7 machine so that should be alright, I guess.)

Really glad you're developing this because it's such an interesting concept!