Skip to content
This repository has been archived by the owner on Dec 20, 2021. It is now read-only.

No HighLight #5

Closed
ghost opened this issue Dec 5, 2016 · 9 comments
Closed

No HighLight #5

ghost opened this issue Dec 5, 2016 · 9 comments

Comments

@ghost
Copy link

ghost commented Dec 5, 2016

Today I'm trying to bring some better highlight on my neovim config. Because I really think that could help if this code was more readable:

#define FOO int

FOO test;

Class Foo2 {};

Foo2 test2;

I want to see FOO and Foo2 with some colors, and that's why I wanted to use [neotags][1] (so neotags should be able to resolve this right?)

So why even with let g:neotags_enabled = 1 and the tags file which is generated correctly (I can see define and class), I still don't have colors even when I remove every other plugins?

@ghost
Copy link
Author

ghost commented Dec 5, 2016

I'm such a noob, seems that let g:neotags_highlight default value is not 1 for me. Doc not updated or issue?
But still, the color is pretty hard to see, how can I change the colors?

@c0r73x
Copy link
Owner

c0r73x commented Dec 5, 2016

Hi

I'm trying to fix it. I've got a problem where some functions dont want to run, and sometimes crash the plugin when you run "nvim [file]" because of that i disabled the highlight feature on load, you have to save the file one time to trigger it.

Yes you can change the colors, this is what i use in my colorscheme.

" neotags {{{2
" c/cpp {{{3
call s:h("cTypeTag",                { "fg": s:brown })
call s:h("cPreProcTag",             { "fg": s:purple })
call s:h("cFunctionTag",            { "fg": s:darkred })

call s:h("cMemberTag",              { "link": "cMember" })
call s:h("cEnumTag",                { "link": "cEnum" })

call s:h("cppTypeTag",              { "fg": s:brown })
call s:h("cppPreProcTag",           { "fg": s:purple })
call s:h("cppFunctionTag",          { "fg": s:darkred })

call s:h("cppMemberTag",            { "link": "cppMember" })
call s:h("cppEnumTag",              { "link": "cppEnum" })
" 3}}}
" java {{{3
call s:h("JavaClassTag",            { "fg": s:brown })
call s:h("JavaInterfaceTag",        { "fg": s:purple })
call s:h("JavaMethodTag",           { "fg": s:darkred })
" 3}}}
" perl {{{3
call s:h("perlFunctionTag",         { "fg": s:darkred })
" 3}}}
" ruby {{{3
call s:h("rubyModuleNameTag",       { "fg": s:darkgreen })
call s:h("rubyClassNameTag",        { "fg": s:brown })
call s:h("rubyMethodNameTag",       { "fg": s:darkred })
" 3}}}
" shell {{{3
call s:h("shFunctionTag",           { "fg": s:darkred })
" 3}}}
" vim {{{3
call s:h("vimAutoGroupTag",         { "fg": s:purple })
call s:h("vimCommandTag",           { "fg": s:brown })
call s:h("vimFuncNameTag",          { "fg": s:darkred })
call s:h("vimScriptFuncNameTag",    { "fg": s:darkred })
" 3}}}
" python {{{3
call s:h("pythonFunctionTag",       { "fg": s:darkred })
call s:h("pythonMethodTag",         { "fg": s:darkred })
call s:h("pythonClassTag",          { "fg": s:brown })
" 3}}}
" php {{{3
call s:h("phpFunctionsTag",         { "fg": s:darkred })
call s:h("phpClassesTag",           { "fg": s:brown })
" 3}}}
" javascript {{{3
call s:h("javascriptFunctionTag",   { "fg": s:darkred })
call s:h("javascriptClassTag",      { "fg": s:brown })
call s:h("javascriptConstantTag",   { "fg": s:purple })
call s:h("javascriptMethodTag",     { "fg": s:darkred })
call s:h("javascriptObjectTag",     { "fg": s:cyan })
" 3}}}
" 2}}}

@ghost
Copy link
Author

ghost commented Dec 5, 2016

Thanks :) You was working on it, that's why I got a new error message, good to know.
That may sound stupid, but how do you declare s:brown? I didn't find :s

@c0r73x
Copy link
Owner

c0r73x commented Dec 5, 2016

I define my colors like this

let s:brown      = { "gui": "#ffa000", "cterm": "3" }

then I have a function to set the colors

" util {{{1
function! s:h(group, style)
    if(has_key(a:style, "link"))
        exec "highlight! link " a:group a:style.link
    else
        exec "highlight" a:group
                    \ "guifg="   (has_key(a:style, "fg")    ? a:style.fg.gui   : "NONE")
                    \ "guibg="   (has_key(a:style, "bg")    ? a:style.bg.gui   : "NONE")
                    \ "guisp="   (has_key(a:style, "sp")    ? a:style.sp.gui   : "NONE")
                    \ "gui="     (has_key(a:style, "deco")  ? a:style.gui      : "NONE")
                    \ "ctermfg=" (has_key(a:style, "fg")    ? a:style.fg.cterm : "NONE")
                    \ "ctermbg=" (has_key(a:style, "bg")    ? a:style.bg.cterm : "NONE")
                    \ "cterm="   (has_key(a:style, "deco")  ? a:style.cterm    : "NONE")
    endif
endfunction
" 1}}}

@c0r73x
Copy link
Owner

c0r73x commented Dec 5, 2016

Now highlighting should work as expected. You might have to run :UpdateRemoteTags to get the new changes.

@ghost
Copy link
Author

ghost commented Dec 5, 2016

Yes I'm able to see highlight right now, but my neovim is so slow.
I think it's because my ctags is huge "googletest was completely parsed because I have #include "gtest.h". Anyway to improve that? Anyway the issue is solved.

EDIT: I think g:neotags_recursive will resolve my lag.

@c0r73x
Copy link
Owner

c0r73x commented Dec 5, 2016

I noticed that vim gets slow when I add big libs or system includes into the ctags files. Because of that I've added excludes for all libs in my config. That way i only get highlighting for my classes/functions.

Might not be what you want though.

Also switching to something like silver_searcher helps alot when generating the tag files.

@ghost
Copy link
Author

ghost commented Dec 5, 2016

I did that too but with ack directly, that really fast now :) I'm happy, thanks for your plugin.

@c0r73x
Copy link
Owner

c0r73x commented Dec 5, 2016

Ah nice :)

No problem, I'm glad you like it ;)

@c0r73x c0r73x closed this as completed Dec 5, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant