dracula / vim

🧛🏻‍♂️ Dark theme for Vim
https://draculatheme.com/vim
MIT License
1.34k stars 454 forks source link

Sourcing vimrc changes theme #303

Closed hvsouza closed 1 year ago

hvsouza commented 1 year ago

What happened

Whenever I source the .vimrc file again, it change the theme and lose the configuration of a few characters. Please, although the screenshot was done in a tmux session, the problem persist in a clean terminal with xterm-256color

What I expected to happen

No change in the colors after executing ":so %" on .vimrc file

Screenshot

Screenshot from 2023-04-06 13-12-43

image

Machine Info

-Vim type (vim/gvim/neovim): vim

Additional Info

If needed I can post my tmux info, but the behavior was noticed also without using tmux

benknoble commented 1 year ago

I can't remember the exact reasons, but I think it has to do with :syntax reset and some after/syntax files here. Try :edit or :edit! (the latter only if you are ok losing unsaved changes, or after :writeing the file) to re-trigger syntax loading. Possibly :syntax enable would also work.

benknoble commented 1 year ago

Alternatively, guard against re-executing :colorscheme by checking g:colors_name.

hvsouza commented 1 year ago

Thanks @benknoble!

Using syntax on after loading the theme solved the problem. Sorry for the very silly question

benknoble commented 1 year ago

Using syntax on after loading the theme solved the problem.

Glad to hear! Consider :syntax enable instead, which will do the right thing with your custom highlights:

                            *:syn-on* *:syntax-on*
The `:syntax enable` command will keep most of your current color settings.
This allows using `:highlight` commands to set your preferred colors before or
after using this command.  If you want Vim to overrule your settings with the
defaults, use: >
    :syntax on
<

Sorry for the very silly question

It's not silly; don't be sorry!

hvsouza commented 1 year ago

Done, thanks again :)