Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected behavior when using Dracula theme with Neovim #263

Closed
helderberto opened this issue Sep 21, 2021 · 16 comments
Closed

Unexpected behavior when using Dracula theme with Neovim #263

helderberto opened this issue Sep 21, 2021 · 16 comments

Comments

@helderberto
Copy link
Member

helderberto commented Sep 21, 2021

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:

@helderberto helderberto changed the title Unexpected behavior when using Dracula theme with Neovim Unexpected behavior when using Dracula theme with Alacritty + Neovim + Tmux Sep 21, 2021
@helderberto
Copy link
Member Author

helderberto commented Sep 22, 2021

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

@helderberto
Copy link
Member Author

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?

@benknoble
Copy link
Member

benknoble commented Sep 22, 2021

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.

@helderberto
Copy link
Member Author

helderberto commented Sep 22, 2021

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.

@helderberto helderberto changed the title Unexpected behavior when using Dracula theme with Alacritty + Neovim + Tmux Unexpected behavior when using Dracula theme with Neovim Sep 22, 2021
@benknoble
Copy link
Member

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.

@helderberto
Copy link
Member Author

@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.

@benknoble
Copy link
Member

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.

@helderberto
Copy link
Member Author

helderberto commented Sep 23, 2021

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

@benknoble
Copy link
Member

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

@dsifford
Copy link
Member

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.

@helderberto
Copy link
Member Author

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

@dsifford
Copy link
Member

https://github.com/dsifford/.dotfiles

@benknoble
Copy link
Member

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.

@helderberto
Copy link
Member Author

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.

helderberto added a commit to helderberto/dotfiles that referenced this issue Sep 24, 2021
@helderberto
Copy link
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants