Closed nimeco closed 7 months ago
The guard around :syntax enable
should be redundant but unrelated.
FWIW I can't reproduce this (without treesitter); that is, executing :colorscheme dracula
multiple times doesn't change the highlighting for me.
It might be worth seeing if you can refresh the LSP highlighting somehow, but the last two screenshots suggest it might be unrelated to LSP?
Is there a lot of stuff you should guard against sourcing them again? I've started with vim not so long ago, so, my rc isn't pretty long and/or advanced.
You mean, you couldn't reproduce because you don't have treesitter at all, or only the tests without treesitter? The rest worked?
I don't really know if LSP is interfering with it, I got it on my main rc, does it do anything without being in the rc in this case?
I don't follow your first question, but there are some things you shouldn't do in :source $MYVIMRC
that you might do on startup (and some you probably don't want to do at all). It mostly boils down to understanding the side effects of any statements in your configuration.
What I mean is that I don't have treesitter (I use vim, not neovim). However, running :colorscheme dracula
didn't cause the breakage in your screenshots for the few files I tested.
Ah, I meant, what should be guarded and what doesn't matter if you execute more than once. Couldn't find a list of "don't do this twice or stuff will break".
Oh, alright, I'll keep trying stuff here. Thanks!
Reduced the rc to:
call plug#begin()
Plug 'dracula/vim', {'as': 'dracula'}
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
call plug#end()
lua << EOF
require'nvim-treesitter.configs'.setup { highlight = { enable = true, }, indent = { enable = true }, }
EOF
colorscheme dracula
and outputted :highlight
to a file.
Ran :colorscheme dracula
once more, colors are gone, comparing :highlight
from before and after:
On another try, the rc without :colorscheme dracula
and typing it manually inside nvim, the colors I get are the broken ones already. So, the colors only work on the first execution of the rc, at startup. Anything besides that, I lose the colors with either :so
or manual :colorscheme
.
Highlights overwritten are TS*
, and off screen javaScript*
and js*
.
I tried repeating the rest of the stuff from the rc as well, :syntax
changes it a bit but doesn't make it lose the majority of the colors, the rest doesn't seem to break it like :colorscheme
did.
I have no idea where to start 'debugging' this, still kinda noob vim wise.
Ok, this is good to know.
Now we want to find out
Can you show :scriptnames
as well as :verbose highlight <cleared group>
before and after?
:scriptnames
didn't change:
1: d:\tools\neovim\share\nvim\runtime\ftplugin.vim
2: d:\tools\neovim\share\nvim\runtime\indent.vim
3: ~\AppData\Local\nvim\error.vim
4: ~\AppData\Local\nvim-data\site\autoload\plug.vim
5: d:\tools\neovim\share\nvim\runtime\filetype.lua
6: d:\tools\neovim\share\nvim\runtime\filetype.vim
7: ~\AppData\Local\nvim-data\plugged\nvim-treesitter\ftdetect\fusion.vim
8: ~\AppData\Local\nvim-data\plugged\nvim-treesitter\ftdetect\gdresource.vim
9: ~\AppData\Local\nvim-data\plugged\nvim-treesitter\ftdetect\gdscript.vim
10: ~\AppData\Local\nvim-data\plugged\nvim-treesitter\ftdetect\glimmer.vim
11: ~\AppData\Local\nvim-data\plugged\nvim-treesitter\ftdetect\glsl.vim
12: ~\AppData\Local\nvim-data\plugged\nvim-treesitter\ftdetect\gowork.vim
13: ~\AppData\Local\nvim-data\plugged\nvim-treesitter\ftdetect\graphql.vim
14: ~\AppData\Local\nvim-data\plugged\nvim-treesitter\ftdetect\hack.vim
15: ~\AppData\Local\nvim-data\plugged\nvim-treesitter\ftdetect\hcl.vim
16: ~\AppData\Local\nvim-data\plugged\nvim-treesitter\ftdetect\heex.vim
17: ~\AppData\Local\nvim-data\plugged\nvim-treesitter\ftdetect\hjson.vim
18: ~\AppData\Local\nvim-data\plugged\nvim-treesitter\ftdetect\json5.vim
19: ~\AppData\Local\nvim-data\plugged\nvim-treesitter\ftdetect\ledger.vim
20: ~\AppData\Local\nvim-data\plugged\nvim-treesitter\ftdetect\nix.vim
21: ~\AppData\Local\nvim-data\plugged\nvim-treesitter\ftdetect\prisma.vim
22: ~\AppData\Local\nvim-data\plugged\nvim-treesitter\ftdetect\pug.vim
23: ~\AppData\Local\nvim-data\plugged\nvim-treesitter\ftdetect\ql.vim
24: ~\AppData\Local\nvim-data\plugged\nvim-treesitter\ftdetect\query.vim
25: ~\AppData\Local\nvim-data\plugged\nvim-treesitter\ftdetect\surface.vim
26: ~\AppData\Local\nvim-data\plugged\nvim-treesitter\ftdetect\teal.vim
27: ~\AppData\Local\nvim-data\plugged\nvim-treesitter\ftdetect\tlaplus.vim
28: ~\AppData\Local\nvim-data\plugged\nvim-treesitter\ftdetect\yang.vim
29: d:\tools\neovim\share\nvim\runtime\syntax\syntax.vim
30: d:\tools\neovim\share\nvim\runtime\syntax\synload.vim
31: ~\AppData\Local\nvim-data\plugged\dracula\colors\dracula.vim
32: ~\AppData\Local\nvim-data\plugged\dracula\autoload\dracula.vim
33: ~\AppData\Local\nvim-data\plugged\nvim-treesitter\plugin\nvim-treesitter.vim
34: d:\tools\neovim\share\nvim\runtime\plugin\gzip.vim
35: d:\tools\neovim\share\nvim\runtime\plugin\health.vim
36: d:\tools\neovim\share\nvim\runtime\plugin\man.vim
37: d:\tools\neovim\share\nvim\runtime\plugin\matchit.vim
38: d:\tools\neovim\share\nvim\runtime\pack\dist\opt\matchit\plugin\matchit.vim
39: d:\tools\neovim\share\nvim\runtime\plugin\matchparen.vim
40: d:\tools\neovim\share\nvim\runtime\plugin\netrwPlugin.vim
41: d:\tools\neovim\share\nvim\runtime\plugin\rplugin.vim
42: d:\tools\neovim\share\nvim\runtime\plugin\shada.vim
43: d:\tools\neovim\share\nvim\runtime\plugin\spellfile.vim
44: d:\tools\neovim\share\nvim\runtime\plugin\tarPlugin.vim
45: d:\tools\neovim\share\nvim\runtime\plugin\tohtml.vim
46: d:\tools\neovim\share\nvim\runtime\plugin\tutor.vim
47: d:\tools\neovim\share\nvim\runtime\plugin\zipPlugin.vim
48: ~\AppData\Local\nvim-data\plugged\dracula\after\plugin\dracula.vim
As for the highlights, before:
TSNone xxx ctermfg=253 guifg=foreground
Last set from ~\AppData\Local\nvim-data\plugged\nvim-treesitter\plugin\nvim-treesitter.vim line 28
TSPunctSpecial xxx links to Special
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\plugin\dracula.vim line 72
TSConstMacro xxx links to Macro
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\plugin\dracula.vim line 74
TSStringEscape xxx links to Character
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\plugin\dracula.vim line 75
TSFuncBuiltin xxx links to DraculaCyan
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\plugin\dracula.vim line 80
TSFuncMacro xxx links to Function
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\plugin\dracula.vim line 81
TSParameter xxx links to DraculaOrangeItalic
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\plugin\dracula.vim line 82
TSParameterReference xxx links to DraculaOrange
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\plugin\dracula.vim line 83
TSField xxx links to DraculaOrange
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\plugin\dracula.vim line 84
TSConstructor xxx links to DraculaCyan
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\plugin\dracula.vim line 85
TSAnnotation xxx links to DraculaYellow
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\plugin\dracula.vim line 77
TSAttribute xxx links to DraculaGreenItalic
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\plugin\dracula.vim line 78
TSSymbol xxx links to DraculaPurple
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\plugin\dracula.vim line 76
TSLabel xxx links to DraculaPurpleItalic
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\plugin\dracula.vim line 87
TSVariableBuiltin xxx links to DraculaPurpleItalic
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\plugin\dracula.vim line 89
TSStrong xxx cterm=bold gui=bold
links to DraculaFgBold
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\plugin\dracula.vim line 91
TSEmphasis xxx cterm=italic gui=italic
links to DraculaFg
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\plugin\dracula.vim line 92
TSUnderline xxx cterm=underline gui=underline
links to Underlined
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\plugin\dracula.vim line 93
TSStrike xxx cterm=strikethrough gui=strikethrough
Last set from ~\AppData\Local\nvim-data\plugged\nvim-treesitter\plugin\nvim-treesitter.vim line 80
TSTitle xxx links to DraculaYellow
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\plugin\dracula.vim line 94
TSLiteral xxx links to DraculaYellow
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\plugin\dracula.vim line 95
TSURI xxx links to DraculaYellow
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\plugin\dracula.vim line 96
TSTagAttribute xxx links to DraculaGreenItalic
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\plugin\dracula.vim line 99
javaScriptNumber xxx links to Constant
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\syntax\javascript.vim line 6
javaScriptNull xxx links to Constant
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\syntax\javascript.vim line 7
javaScriptFunction xxx links to Keyword
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\syntax\javascript.vim line 8
javaScriptBraces xxx links to Delimiter
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\syntax\javascript.vim line 5
jsArrowFunction xxx links to Operator
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\syntax\javascript.vim line 12
jsBuiltins xxx links to DraculaCyan
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\syntax\javascript.vim line 13
jsClassDefinition xxx links to DraculaCyan
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\syntax\javascript.vim line 14
jsClassMethodType xxx links to Keyword
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\syntax\javascript.vim line 15
jsDestructuringAssignment xxx links to DraculaOrangeItalic
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\syntax\javascript.vim line 16
jsDocParam xxx links to DraculaOrangeItalic
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\syntax\javascript.vim line 17
jsDocTags xxx links to Keyword
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\syntax\javascript.vim line 18
jsDocType xxx links to Type
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\syntax\javascript.vim line 19
jsDocTypeBrackets xxx links to DraculaCyan
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\syntax\javascript.vim line 20
jsFuncArgOperator xxx links to Operator
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\syntax\javascript.vim line 21
jsFuncArgs xxx links to DraculaOrangeItalic
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\syntax\javascript.vim line 22
jsFunction xxx links to Keyword
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\syntax\javascript.vim line 23
jsNull xxx links to Constant
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\syntax\javascript.vim line 24
jsObjectColon xxx links to DraculaPink
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\syntax\javascript.vim line 25
jsSuper xxx links to DraculaPurpleItalic
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\syntax\javascript.vim line 26
jsTemplateBraces xxx links to Special
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\syntax\javascript.vim line 27
jsThis xxx links to DraculaPurpleItalic
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\syntax\javascript.vim line 28
jsUndefined xxx links to Constant
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\syntax\javascript.vim line 29
jsxTag xxx links to Keyword
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\syntax\javascript.vim line 35
jsxTagName xxx links to Keyword
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\syntax\javascript.vim line 36
jsxComponentName xxx links to Type
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\syntax\javascript.vim line 37
jsxCloseTag xxx links to Type
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\syntax\javascript.vim line 38
jsxAttrib xxx links to DraculaGreenItalic
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\syntax\javascript.vim line 39
jsxCloseString xxx links to Identifier
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\syntax\javascript.vim line 40
jsxOpenPunct xxx links to Identifier
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\syntax\javascript.vim line 41
htmlSpecialChar xxx links to DraculaPurple
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\syntax\html.vim line 9
htmlArg xxx links to DraculaGreenItalic
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\syntax\html.vim line 6
htmlTag xxx links to DraculaFg
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\syntax\html.vim line 5
htmlStrike xxx cterm=strikethrough gui=strikethrough
Last set from d:\tools\neovim\share\nvim\runtime\syntax\html.vim line 297
htmlBoldUnderline xxx cterm=bold,underline gui=bold,underline
Last set from d:\tools\neovim\share\nvim\runtime\syntax\html.vim line 290
htmlBoldItalic xxx cterm=bold,italic gui=bold,italic
Last set from d:\tools\neovim\share\nvim\runtime\syntax\html.vim line 291
htmlBold xxx cterm=bold gui=bold
Last set from d:\tools\neovim\share\nvim\runtime\syntax\html.vim line 289
htmlBoldUnderlineItalic xxx cterm=bold,underline,italic gui=bold,underline,italic
Last set from d:\tools\neovim\share\nvim\runtime\syntax\html.vim line 292
htmlUnderlineItalic xxx cterm=underline,italic gui=underline,italic
Last set from d:\tools\neovim\share\nvim\runtime\syntax\html.vim line 294
htmlUnderline xxx cterm=underline gui=underline
Last set from d:\tools\neovim\share\nvim\runtime\syntax\html.vim line 293
htmlItalic xxx cterm=italic gui=italic
Last set from d:\tools\neovim\share\nvim\runtime\syntax\html.vim line 295
htmlH1 xxx links to DraculaFg
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\syntax\html.vim line 8
htmlTitle xxx links to DraculaFg
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\syntax\html.vim line 7
cssAttributeSelector xxx links to DraculaGreenItalic
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\syntax\css.vim line 7
cssUnitDecorators xxx links to DraculaPink
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\syntax\css.vim line 14
cssFunctionComma xxx links to Delimiter
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\syntax\css.vim line 9
cssBraces xxx links to Delimiter
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\syntax\css.vim line 8
cssAttrRegion xxx links to DraculaPink
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\syntax\css.vim line 6
cssVendor xxx links to DraculaGreenItalic
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\syntax\css.vim line 15
cssNoise xxx links to DraculaPink
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\syntax\css.vim line 10
cssAttrComma xxx links to Delimiter
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\syntax\css.vim line 5
cssPseudoClassId xxx links to DraculaGreenItalic
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\syntax\css.vim line 13
cssPseudoClass xxx links to DraculaPink
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\syntax\css.vim line 12
cssProp xxx links to DraculaCyan
Last set from ~\AppData\Local\nvim-data\plugged\dracula\after\syntax\css.vim line 11
After:
TSNone xxx cleared
TSPunctSpecial xxx links to Delimiter
Last set from ~\AppData\Local\nvim-data\plugged\nvim-treesitter\plugin\nvim-treesitter.vim line 32
TSConstMacro xxx links to Define
Last set from ~\AppData\Local\nvim-data\plugged\nvim-treesitter\plugin\nvim-treesitter.vim line 36
TSStringEscape xxx links to SpecialChar
Last set from ~\AppData\Local\nvim-data\plugged\nvim-treesitter\plugin\nvim-treesitter.vim line 39
TSFuncBuiltin xxx links to Special
Last set from ~\AppData\Local\nvim-data\plugged\nvim-treesitter\plugin\nvim-treesitter.vim line 47
TSFuncMacro xxx links to Macro
Last set from ~\AppData\Local\nvim-data\plugged\nvim-treesitter\plugin\nvim-treesitter.vim line 48
TSParameter xxx links to Identifier
Last set from ~\AppData\Local\nvim-data\plugged\nvim-treesitter\plugin\nvim-treesitter.vim line 49
TSParameterReference xxx links to TSParameter
Last set from ~\AppData\Local\nvim-data\plugged\nvim-treesitter\plugin\nvim-treesitter.vim line 50
TSField xxx links to Identifier
Last set from ~\AppData\Local\nvim-data\plugged\nvim-treesitter\plugin\nvim-treesitter.vim line 52
TSConstructor xxx links to Special
Last set from ~\AppData\Local\nvim-data\plugged\nvim-treesitter\plugin\nvim-treesitter.vim line 54
TSAnnotation xxx links to PreProc
Last set from ~\AppData\Local\nvim-data\plugged\nvim-treesitter\plugin\nvim-treesitter.vim line 55
TSAttribute xxx links to PreProc
Last set from ~\AppData\Local\nvim-data\plugged\nvim-treesitter\plugin\nvim-treesitter.vim line 56
TSSymbol xxx links to Identifier
Last set from ~\AppData\Local\nvim-data\plugged\nvim-treesitter\plugin\nvim-treesitter.vim line 58
TSLabel xxx links to Label
Last set from ~\AppData\Local\nvim-data\plugged\nvim-treesitter\plugin\nvim-treesitter.vim line 62
TSVariableBuiltin xxx links to Special
Last set from ~\AppData\Local\nvim-data\plugged\nvim-treesitter\plugin\nvim-treesitter.vim line 74
TSStrong xxx cleared
TSEmphasis xxx cleared
TSUnderline xxx cleared
TSStrike xxx cleared
TSTitle xxx links to Title
Last set from ~\AppData\Local\nvim-data\plugged\nvim-treesitter\plugin\nvim-treesitter.vim line 85
TSLiteral xxx links to String
Last set from ~\AppData\Local\nvim-data\plugged\nvim-treesitter\plugin\nvim-treesitter.vim line 86
TSURI xxx links to Underlined
Last set from ~\AppData\Local\nvim-data\plugged\nvim-treesitter\plugin\nvim-treesitter.vim line 87
TSTagAttribute xxx links to TSProperty
Last set from ~\AppData\Local\nvim-data\plugged\nvim-treesitter\plugin\nvim-treesitter.vim line 96
javaScriptNumber xxx links to javaScriptValue
Last set from d:\tools\neovim\share\nvim\runtime\syntax\javascript.vim line 99
javaScriptNull xxx links to Keyword
Last set from d:\tools\neovim\share\nvim\runtime\syntax\javascript.vim line 110
javaScriptFunction xxx links to Function
Last set from d:\tools\neovim\share\nvim\runtime\syntax\javascript.vim line 106
javaScriptBraces xxx links to Function
Last set from d:\tools\neovim\share\nvim\runtime\syntax\javascript.vim line 107
jsArrowFunction xxx cleared
jsBuiltins xxx cleared
jsClassDefinition xxx cleared
jsClassMethodType xxx cleared
jsDestructuringAssignment xxx cleared
jsDocParam xxx cleared
jsDocTags xxx cleared
jsDocType xxx cleared
jsDocTypeBrackets xxx cleared
jsFuncArgOperator xxx cleared
jsFuncArgs xxx cleared
jsFunction xxx cleared
jsNull xxx cleared
jsObjectColon xxx cleared
jsSuper xxx cleared
jsTemplateBraces xxx cleared
jsThis xxx cleared
jsUndefined xxx cleared
jsxTag xxx cleared
jsxTagName xxx cleared
jsxComponentName xxx cleared
jsxCloseTag xxx cleared
jsxAttrib xxx cleared
jsxCloseString xxx cleared
jsxOpenPunct xxx cleared
htmlSpecialChar xxx links to Special
Last set from d:\tools\neovim\share\nvim\runtime\syntax\html.vim line 267
htmlArg xxx links to Type
Last set from d:\tools\neovim\share\nvim\runtime\syntax\html.vim line 263
htmlTag xxx links to Function
Last set from d:\tools\neovim\share\nvim\runtime\syntax\html.vim line 261
htmlStrike xxx cleared
htmlBoldUnderline xxx cleared
htmlBoldItalic xxx cleared
htmlBold xxx cleared
htmlBoldUnderlineItalic xxx cleared
htmlUnderlineItalic xxx cleared
htmlUnderline xxx cleared
htmlItalic xxx cleared
htmlH1 xxx links to Title
Last set from d:\tools\neovim\share\nvim\runtime\syntax\html.vim line 270
htmlTitle xxx links to Title
Last set from d:\tools\neovim\share\nvim\runtime\syntax\html.vim line 277
cssAttributeSelector xxx links to String
Last set from d:\tools\neovim\share\nvim\runtime\syntax\css.vim line 635
cssUnitDecorators xxx links to Number
Last set from d:\tools\neovim\share\nvim\runtime\syntax\css.vim line 653
cssFunctionComma xxx links to Function
Last set from d:\tools\neovim\share\nvim\runtime\syntax\css.vim line 622
cssBraces xxx links to Function
Last set from d:\tools\neovim\share\nvim\runtime\syntax\css.vim line 629
cssAttrRegion xxx cleared
cssVendor xxx links to Comment
Last set from d:\tools\neovim\share\nvim\runtime\syntax\css.vim line 533
cssNoise xxx links to Noise
Last set from d:\tools\neovim\share\nvim\runtime\syntax\css.vim line 654
cssAttrComma xxx links to Special
Last set from d:\tools\neovim\share\nvim\runtime\syntax\css.vim line 539
cssPseudoClassId xxx links to PreProc
Last set from d:\tools\neovim\share\nvim\runtime\syntax\css.vim line 611
cssPseudoClass xxx cleared
cssProp xxx links to StorageClass
Last set from d:\tools\neovim\share\nvim\runtime\syntax\css.vim line 651
Yep, looks like after/plugin/dracula.vim
is the issue—it sets the TS highlights, which are getting cleared by repeated use of :colorscheme
. You can :runtime after/plugin/dracula.vim
to resolve this manually.
@dsifford what's the best approach here? I'm not sure we should load the highlights any earlier, but this seems a little inconvenient. Is there anything we can hook into (maybe a custom TS event or something)?
Any luck with this? I have the same problem.
Any luck with this? I have the same problem.
@mvpopuk please see my comments in https://github.com/dracula/vim/issues/280#issuecomment-1059478385:
Yep, looks like
after/plugin/dracula.vim
is the issue—it sets the TS highlights, which are getting cleared by repeated use of:colorscheme
. You can:runtime after/plugin/dracula.vim
to resolve this manually.
@benknoble Missed your mention earlier. Yeah, I'm not sure I have a better solution than what you've proposed. The /after
was necessary because some plugins tend to overwrite things that are set in the main colors file.
@benknoble thanks. I have seen your comment and I've added that to my "sourcing" mapping so now I run that command right after I source everything:
nnoremap <leader>sv :source $MYVIMRC <bar> runtime after/plugin/dracula.vim<cr>
I was just wondering if there are any developments on the matter like a more "robust" fix.
Thanks.
You could possibly do this with an autocommand
augroup whatever
autocmd!
autocmd ColorScheme dracula runtime after/plugin/dracula.vim
augroup end
But I haven't tested it.
@benknoble yes, that works and I've added that in the augroup
that overwrites some of the themes defaults so that's great. Just a minor mention, I've also added syntax on
inside that augroup
because after sourcing, it seems that I loose the "syntax on" setting for html
files for instance.
I'm happy with this fix. Maybe update the readme and include this fix ? https://github.com/mvpopuk/dotfiles/blob/main/nvim/config/theme.vim#L64-L65
You might want to try :syntax enable
instead of :syntax on
.
We could add it to the docs under :help dracula
somewhere…
This issue is reproducible in plain Vim and I have encountered it quite a few times. I don't think it is unique to NeoVim, treesitter, or after/plugin/dracula.vim
, but rather has to do with the fact that there is colorscheme logic in /after at all. For example, to reproduce in Vim with vim file syntax highlighting:
minimal.vim
:
filetype plugin indent on
syntax enable
set termguicolors
colorscheme dracula
~/.vim/pack/plugins/start/dracula
.vim -N -u ./minimal.vim
.:e ./minimal.vim
.:colorscheme dracula
.I am running Vim 9.0.1300 on macOS 13.2 and Kitty. I can't reproduce the issue with builtin vim colorschemes. Here's a recording of the issue happening: https://user-images.githubusercontent.com/1218900/221093451-1e953d8f-f1b5-460a-a7f1-917806b2305e.mov
Before the colorscheme is loaded a second time, "termguicolors" has the vimOption -> Type (blue) highlighting linked in /after/syntax/vim.vim
: https://github.com/dracula/vim/blob/eb577d47b0cfc9191bf04c414b4042d5f1a980f8/after/syntax/vim.vim#L10.
After the colorscheme is loaded a second time, "termguicolors" has the vim default vimOption -> Preproc highlighting, which ends up being pink because PreProc is linked to pink in /colors/dracula.vim
: https://github.com/dracula/vim/blob/eb577d47b0cfc9191bf04c414b4042d5f1a980f8/colors/dracula.vim#L329
Based on this small experiment, it seems like the files in /after are not sourced when colorscheme dracula
is called again, either directly or when sourcing your vimrc again. Highlights set in /colors/dracula.vim
then overwrite those set in /after.
The /after was necessary because some plugins tend to overwrite things that are set in the main colors file.
Not sure what issues were raised about plugins overwriting highlight groups, but looking at other popular vim colorschemes (eg gruvbox or nord), I don't see any other put code in /after. I don't doubt using /after solved issues, but it seems to play a role in this one. I'll try to investigate more.
- Create the following minimal vimrc file. In my demo I have called it
minimal.vim
:filetype plugin indent on syntax enable set termguicolors colorscheme dracula
- Put the dracula theme files into the vim runtime path, for example
~/.vim/pack/plugins/start/vim/dracula
.- Open vim with
vim -N -u ./minimal.vim
.- Execute
:e ./minimal.vim
.- Verify that the text "termguicolors" is blue.
I cannot reproduce this. I followed your steps nearly exactly. I used vim -N --noplugin -u /path/to/min.vim
, and I have dracula in ~/.vim/pack/colors/start/dracula
. The extra vim
in in your path seems odd, to me.
I admit to being a little surprised that :colorscheme dracula
worked from -u
, but I see now that :help package
mentions that :colorscheme
and :autoload
search under 'packpath'
. I wonder if that's new and obviates the need for VimEnter
/plugin/
/packadd
tricks related to making the autoload
code work?
(To clarify: the step that didn't work for me was 5: termguicolors
was pink as expected.)
To answer my own questions: this commit from 4 months ago adjusts the documentation for :colorscheme
and autoload
in doc/repeat.txt
.
The extra vim in in your path seems odd, to me.
@benknoble Sorry, I made a typo. The path I used is ~/.vim/pack/plugins/start/dracula
without the extra vim
. Looks like you used a similar path.
Not sure why you didn't encounter the issue 🤷 . I'll keep digging when I get a chance.
For reproducibility's sake: vim --version
:
VIM - Vi IMproved 9.0 (2022 Jun 28, compilé Feb 2 2023 11:45:55)
Version macOS - x86_64
Rustines incluses : 1-1275
Compilé par benknoble
Énorme version sans interface graphique.
Fonctionnalités incluses (+) ou non (-) :
+acl +file_in_path +mouse_urxvt -tag_any_white
+arabic +find_in_path +mouse_xterm -tcl
+autocmd +float +multi_byte +termguicolors
+autochdir +folding +multi_lang +terminal
-autoservername -footer -mzscheme +terminfo
-balloon_eval +fork() +netbeans_intg +termresponse
+balloon_eval_term +gettext +num64 +textobjects
-browse -hangul_input +packages +textprop
++builtin_terms +iconv +path_extra +timers
+byte_offset +insert_expand -perl +title
+channel +ipv6 +persistent_undo -toolbar
+cindent +job +popupwin +user_commands
-clientserver +jumplist +postscript +vartabs
+clipboard +keymap +printer +vertsplit
+cmdline_compl +lambda +profile +vim9script
+cmdline_hist +langmap -python +viminfo
+cmdline_info +libcall +python3 +virtualedit
+comments +linebreak +quickfix +visual
+conceal +lispindent +reltime +visualextra
+cryptv +listcmds +rightleft +vreplace
+cscope +localmap -ruby +wildignore
+cursorbind -lua +scrollbind +wildmenu
+cursorshape +menu +signs +windows
+dialog_con +mksession +smartindent +writebackup
+diff +modify_fname -sodium -X11
+digraphs +mouse +sound -xfontset
-dnd -mouseshape +spell -xim
-ebcdic +mouse_dec +startuptime -xpm
+emacs_tags -mouse_gpm +statusline -xsmp
+eval -mouse_jsbterm -sun_workshop -xterm_clipboard
+ex_extra +mouse_netterm +syntax -xterm_save
+extra_search +mouse_sgr +tag_binary
-farsi -mouse_sysmouse -tag_old_static
fichier vimrc système : "$VIM/vimrc"
fichier vimrc utilisateur : "$HOME/.vimrc"
2e fichier vimrc utilisateur : "~/.vim/vimrc"
fichier exrc utilisateur : "$HOME/.exrc"
fichier de valeurs par défaut : "$VIMRUNTIME/defaults.vim"
$VIM par défaut : "/usr/local/share/vim"
Compilation : gcc -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X -DMACOS_X_DARWIN -g -O2 -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Édition de liens : gcc -L/usr/local/lib -o vim -lm -lncurses -liconv -lintl -framework AppKit -L/usr/local/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/lib/python3.11/config-3.11-darwin -lpython3.11 -framework CoreFoundation
@benknoble You could probably close this issue as a duplicate of https://github.com/dracula/vim/issues/303. I still run into the issue, but you outlined workarounds in that other issue.
(To clarify: the step that didn't work for me was 5: termguicolors was pink as expected.)
Pink is not expected for termguicolors as per my instructions. You are seeing pink instead of blue because you started vim with --noplugin
, which will skip loading all of the files in the /after
directory of this plugin. As covered here and elsewhere, the root cause of the issue is the files in /after
are not re-run when when a vimrc with just colorscheme dracula
is sourced again after startup.
I think I'm going to leave this open and tie it to #320 (as I linked it above)—this after business seems to have come around with a vengeance. The only thing I can think of to try to automatically fix it is the autocommand in #280 that calls runtime
, but gee, what a hack. If we could get rid of after
altogether we would probably in better shape, but there was a reason to introduce it (also mentioned in #280 several years ago)… ugh.
Greetings, I added Dracula to NVim and noticed that, when I source my vimrc the syntax highlighting changes. I'm still a new user, so constantly changing vimrc every now and then. Ended up with a minimal but the issue is still there, also read quite a bunch of solutions to no avail. The ideal would be to have the same structure as VSCode (is this possible, today? even if it's not done atm), but the main issue here is making it not lose/change the highlights after sourcing. Is there anything that can be done? Thanks a lot!
vim
/gvim
/neovim
): neovimTERM
environment variable: vtpcon