dracula / vim

🧛🏻‍♂️ Dark theme for Vim

Home Page:https://draculatheme.com/vim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unexpected behavior when using Dracula theme with Neovim

helderberto opened this issue · comments

What happened

I installed the package following the README.md, but I have the following behavior when source my vim configs:

vim-dracula

What I expected to happen

I would like to have the correct theme, I think is the one that appears after source vim configs.

Machine Info

  • Vim type: neovim
  • Vim version: NVIM v0.5.0
  • OS: macOS
  • Terminal/Terminal Emulator/VTE: Alacritty
  • TERM environment variable: screen-256color

Additional Info

My theme configurations for Neovim:

UPDATE

After I set to load theme after plugins end call, such as:

call plug#end()

" Theme
let g:dracula_italic = 0
if (has("termguicolors"))
  set termguicolors
endif
colorscheme dracula

The colors look like in a TypeScript file:
Screenshot 2021-09-22 at 09 28 06

Is this right? I was checking with the repository screenshot and the methods colors don't match.

Repository screenshot:
VIM Dracula

VIM screenshot:
Screenshot 2021-09-22 at 10 10 54
:

VSCode screenshot:
Screenshot 2021-09-22 at 10 11 56


@zenorocha @benknoble @dsifford could you help me to understand these differences between editors?

2 things: I haven't had a chance to figure out what's going in your original post.

The rest is a bit unrelated. The short answer is vim syntax is not necessarily as robust as something like vscode. Vim's depends on someone writing a good syntax file, which is hard to do right and not quite the same as a parser with good error-recovery (although that's also hard). Expect some fairly minor differences. You can try typescript syntax plugins and see if that improves anything (I think @dsifford might have a recommendation?). See a number of other closed issues in this repo on that topic. Also, from the README

Screenshot taken with the pangloss/vim-javascript syntax plugin for javascript.

That being unrelated AFAICT, let's keep the conversation on the first post, which does look odd.

Thanks for the reply @benknoble, I really didn't know about that.
I'm using nvim-treesiter to the syntax support on Neovim.

I closed the other issues because it's related only to the Vim.

I'm not 100% sure what's going on, but it's possible the tree-sitter is interfering.

Other comments:

  • TERM=screen-256color seems odd to me. I have a tmux-256color profile that I use with tmux (and of course an alacritty profile for outside of that).
  • You shouldn't have to explicitly :source stuff in ~/.vim/plugin. See :help startup and :help load-plugins. There's also :runtime. cf. https://vi.stackexchange.com/q/9250/10604

Without more information about what's changing the colors, it's hard to do much. You could try the tips in How to debug my vimrc.

@benknoble I didn't catch the last comment:

You shouldn't have to explicitly :source stuff in ~/.vim/plugin. See :help startup and :help load-plugins. There's also :runtime. cf. vi.stackexchange.com/q/9250/10604

What did you mean? Just to understand and update my configs. I'll check how to debug my configs as well.

I was referring to parts of your vimrc (or init.vim or whatever it is). Anything in the plugin directories on the runtime path is automatically sourced after the vimrc.

I changed all my configs, everything loading from the init.vim, but still with the same behavior.

You can look at my config here.

cc @benknoble

Still not sure what's happening, but did you try that debug link? Essentially you want to binary search by cutting half away at a time. You can also use other things (e.g., vim --clean) to see if that reproduces the problem, though then you'll have to do more steps to actually load the colorscheme

If the error only shows up when you source the file, then why source the file? I honestly don't understand the problem here.

I, too, use neovim, alacritty, and tmux. No issue on my end.

I’ll try it @benknoble.

——

If the error only shows up when you source the file, then why source the file? I honestly don't understand the problem here.

I, too, use neovim, alacritty, and tmux. No issue on my end.

That’s what I’m been doing, but I just trying to figure out why it happens.

Could you share your dotfiles link? @dsifford

I also source my vimrc occasionally, but I actually have the :colorscheme bit in a plugin file, so it doesn't run more than once. Course, it's odd that it's not idempotent in some sense.

Do you split your theme into something like “plug-in/theme.vim” to load just one time? @benknoble

My theme is loaded like that but in a theme.lua file.

Thanks for all your help @benknoble and @dsifford!

I made some updates in my config, based on your dotfile's and now it works fine. :D

If you would like to give any feedback or tips for improvements, It's public here.

I'll close the issue, considering the problem has already been solved.