David
David

Reputation: 19

Neovim colorscheme flickers momentarily in tmux when opening C/C++ files

The weird thing only happens when I open a C/C++ file. What I doing wrong here?

The moment when .cpp file open up.

enter image description here

About 0.1 sec later.

enter image description here

The version of related app and os.

nvim v0.10.0-dev
tmux 3.2a
alacritty 0.13.0-dev
Ubuntu 22.04

The theme and plugin what I used:

use 'morhetz/gruvbox'
use 'nvim-treesitter/nvim-treesitter'

This is what I have in my legacy.vim

" Colorscheme
set termguicolors
let g:gruvbox_contrast_dark='dark'  
let g:gruvbox_contrast_light='hard' 
colorscheme gruvbox   
hi LspCxxHlGroupMemberVariable guifg=#83a598

This is my $TERM

insdie tmux:

$ echo $TERM
screen-256color

and in alacritty:

$ echo $TERM
alacritty

What i've tried so far:

in my .tmux.conf I tried

set -g default-terminal "screen-256color"
set -ag terminal-overrides ",screen-256color:RGB"
set -sa terminal-overrides ",screen-256color:RGB"

and

set -g default-terminal "screen-256color"
set-option -sa terminal-features ',screen-256color:RGB'

These doesn't work.

If I tried this in .tmux.conf file. Some of the colors would change, but there would still be a momentary flickering.

set -g default-terminal "screen-256color"
set-option -sa terminal-features ',alacritty:RGB'

and

$ tmux source-file ~/.tmux.conf

The moment when .cpp file open up.

enter image description here

About 0.1 sec later.

enter image description here

Upvotes: 0

Views: 465

Answers (1)

David
David

Reputation: 19

Well, I found the solution.

The reason is that there is a legacy parser from before. I didn't not clean the settings properly.

Before reinstalling Neovim, I used the :checkhealth command to check out the status.

The Nvim runtime ABI version is 14, but Parser C is 13.

vim.treesitter: require("vim.treesitter.health").check()
========================================================================
- Nvim runtime ABI version: 14
- OK Parser: bash       ABI: 14, path: /home/david/.local/share/nvim/site/pack/packer/start/nvim-treesitter/parser/bash.so
- OK Parser: c          ABI: 13, path: /home/david/.local/share/nvim/site/pack/packer/start/nvim-treesitter/parser/c.so
- OK Parser: cpp        ABI: 14, path: /home/david/.local/share/nvim/site/pack/packer/start/nvim-treesitter/parser/cpp.so
- OK Parser: python     ABI: 14, path: /home/david/.local/share/nvim/site/pack/packer/start/nvim-treesitter/parser/python.so
- OK Parser: c          ABI: 13, path: /usr/lib/x86_64-linux-gnu/nvim/parser/c.so
- OK Parser: lua        ABI: 13, path: /usr/lib/x86_64-linux-gnu/nvim/parser/lua.so
- OK Parser: query      ABI: 14, path: /usr/lib/x86_64-linux-gnu/nvim/parser/query.so
- OK Parser: vim        ABI: 14, path: /usr/lib/x86_64-linux-gnu/nvim/parser/vim.so
- OK Parser: vimdoc     ABI: 14, path: /usr/lib/x86_64-linux-gnu/nvim/parser/vimdoc.so

So, I reinstall neovim, and clean all the settings in ~/.local/share/nvim. and checkout status again. And it works!

vim.treesitter: require("vim.treesitter.health").check()
========================================================================
  - INFO: Runtime ABI version : 14
  - OK: Loaded parser for bash: ABI version 14
  - OK: Loaded parser for c: ABI version 14
  - OK: Loaded parser for cpp: ABI version 14
  - OK: Loaded parser for lua: ABI version 14
  - OK: Loaded parser for python: ABI version 14
  - OK: Loaded parser for query: ABI version 14
  - OK: Loaded parser for vim: ABI version 14
  - OK: Loaded parser for vimdoc: ABI version 14
  - OK: Loaded parser for c: ABI version 14
  - OK: Loaded parser for help: ABI version 14
  - OK: Loaded parser for lua: ABI version 14
  - OK: Loaded parser for vim: ABI version 14

Upvotes: 1

Related Questions