airblade / vim-gitgutter

A Vim plugin which shows git diff markers in the sign column and stages/previews/undoes hunks and partial hunks.
MIT License
8.37k stars 297 forks source link

Gutter turns opaque when changing/editing content #861

Closed thomasmerz closed 1 year ago

thomasmerz commented 1 year ago

What is the latest commit SHA in your installed vim-gitgutter?

e2056e54c50c6f3fbf386108eeb013e2a7f14ae3 <-- this version turns opaque when changing content 2ee95686c5944f99b42dd04fec005b30497006de <-- this is an older version on a different computer, but everything is ok

What vim/nvim version are you on?

"problematic" vim version:

VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Feb 07 2023 11:35:56) macOS version - x86_64 Included patches: 1-1276 Compiled by Homebrew Huge version with MacVim GUI. Features included (+) or not (-): +acl +find_in_path +mouse_xterm +tcl +arabic +float +multi_byte +termguicolors +autocmd +folding +multi_lang +terminal +autochdir -footer -mzscheme +terminfo -autoservername +fork() +netbeans_intg +termresponse +balloon_eval +fullscreen +num64 +textobjects +balloon_eval_term +gettext +odbeditor +textprop +browse -hangul_input +packages +timers ++builtin_terms +iconv +path_extra +title +byte_offset +insert_expand +perl +toolbar +channel +ipv6 +persistent_undo +transparency +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_gui +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 +file_in_path +mouse_urxvt -tag_any_white system vimrc file: "$VIM/vimrc" user vimrc file: "$HOME/.vimrc" 2nd user vimrc file: "~/.vim/vimrc" user exrc file: "$HOME/.exrc" system gvimrc file: "$VIM/gvimrc" user gvimrc file: "$HOME/.gvimrc" 2nd user gvimrc file: "~/.vim/gvimrc" defaults file: "$VIMRUNTIME/defaults.vim" system menu file: "$VIMRUNTIME/menu.vim" fall-back for $VIM: "/Applications/MacVim.app/Contents/Resources/vim" Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MACVIM -Wall -Wno-unknown-pragmas -pipe -DMACOS_X -DMACOS_X_DARWIN -g -O2 -arch x86_64 -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 Linking: clang -arch x86_64 -L/usr/local/lib -o Vim -lm -lncurses -liconv /usr/local/lib/libintl.a -framework AppKit -L/usr/local/opt/lua/lib -llua5.4 -L/System/Library/Perl/5.30/darwin-thread-multi-2level/CORE -lperl -L/usr/local/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/lib/python3.11/config-3.11-darwin -lpython3.11 -framework CoreFoundation -F/System/Library/Frameworks -framework Tcl -framework CoreFoundation -lruby.3.2 -L/usr/local/Cellar/ruby/3.2.0/lib

"ok vim version:

VIM - Vi IMproved 9.0 (2022 Jun 28) Included patches: 1-1443 Compiled by 'http://www.opensuse.org/' Huge version with GTK3 GUI. Features included (+) or not (-): +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/dyn +viminfo +cmdline_info +libcall +python3/dyn +virtualedit +comments +linebreak +quickfix +visual +conceal +lispindent +reltime +visualextra +cryptv +listcmds +rightleft +vreplace +cscope +localmap +ruby/dyn +wildignore +cursorbind +lua/dyn +scrollbind +wildmenu +cursorshape +menu +signs +windows +dialog_con_gui +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_interact +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 system vimrc file: "/etc/vimrc" user vimrc file: "$HOME/.vimrc" 2nd user vimrc file: "~/.vim/vimrc" user exrc file: "$HOME/.exrc" system gvimrc file: "/etc/gvimrc" user gvimrc file: "$HOME/.gvimrc" 2nd user gvimrc file: "~/.vim/gvimrc" defaults file: "$VIMRUNTIME/defaults.vim" system menu file: "$VIMRUNTIME/menu.vim" fall-back for $VIM: "/usr/share/vim" Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -pthread -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/libxkbcommon -I/usr/include/wayland -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libdrm -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g -Wall -pipe -fno-strict-aliasing -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 Linking: gcc -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.26.1/x86_64-linux-thread-multi/CORE -L/usr/local/lib -Wl,--as-needed -o vim -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lSM -lICE -lXt -lX11 -lSM -lICE -lm -ltinfo -lrt -lacl -lattr -lgpm -ldl -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.26.1/x86_64-linux-thread-multi/CORE -L/usr/local/lib64 -fstack-protector-strong -L/usr/lib/perl5/5.26.1/x86_64-linux-thread-multi/CORE -lperl -lm -ldl -lcrypt -lpthread

Screenshot before changing/inserting (above: new version, below: old version):

grafik

Screenshot after changing/inserting (above: new version, below: old version):

grafik

I don't know if this is related to this old (and solved) issue #596? But this didn't fix my problem:

let g:gitgutter_override_sign_column_highlight = 0
airblade commented 1 year ago

Is the problem that the buffer's background changes colour? (The sign column's background looks wrong to me, in that its colour doesn't match the buffer's background, but that's the same in every screenshot so I presume you issue is about the buffer's background.)

What colorscheme do you use? In fact, is your vimrc online anywhere?

Is there any chance you could try the different gitgutter versions on the same computer? Then we could separate vim's changes from gitgutter's.

airblade commented 1 year ago

I'm running the same versions of gitgutter (e2056e5) and vim (MacVim 9.0 p1-1276) as your problematic ones, without trouble, so there's something else going on.

thomasmerz commented 1 year ago

I updated vim-gitgutter on my Linux Desktop to https://github.com/airblade/vim-gitgutter/commit/e2056e54c50c6f3fbf386108eeb013e2a7f14ae3 - also no problem. I will investigate what's different/wrong with my vim on MacOS and vim-gitgutter and give feedback when I found something helpful for this… 🤔

airblade commented 1 year ago

Does :verbose highlight Normal tell you anything useful?

thomasmerz commented 1 year ago
:verbose highlight Normal
Normal         xxx ctermfg=231 ctermbg=236 guifg=#ffffff guibg=#333333
        Last set from /usr/local/Cellar/macvim/9.0.1276/MacVim.app/Contents/Resources/vim/runtime/colors/desert.vim line 104
thomasmerz commented 1 year ago

BTW:
I'm using colorscheme desert and this is my complete ~/.vimrc:

" ---
" nice docu/wiki/help:
" http://vimdoc.sourceforge.net/htmldoc/
" https://vim.fandom.com/wiki/Vim_Tips_Wiki
" ---

" ---
" local settings:
" ---
if exists('$SSHHOME')
  " this is needed for sshrc:
  source $SSHHOME/.sshrc.d/.vim/vim-pathogen/autoload/pathogen.vim
  " https://stackoverflow.com/questions/13080490/vim-pathogen-wont-load-e117-unknown-function-pathogeninfect
  "set runtimepath+=~/.dotfiles/vim/autoload (and all the other subdirs)
endif
execute pathogen#infect()
let g:airline#extensions#tabline#enabled = 1
let g:syntastic_yaml_checkers = ['yamllint']
" https://github.com/z0mbix/vim-shfmt
let g:shfmt_extra_args = '-i 2'
"let g:shfmt_fmt_on_save = 1
" ---
" https://github.com/eth-p/vim-it2-touchbar#setup
" https://github.com/eth-p/vim-it2-touchbar/issues/1
function TouchBar()
  TouchBarLabel F2 "koehler"
  map <F2> :colorscheme koehler<CR>
  map <F3> :colorscheme desert<CR>
  colorscheme desert
endfunction
map <F4> :colorscheme koehler<CR>
map <F5> :colorscheme desert<CR>
" ---

" ---
" shared with my linux hosts:
" ---
" color(rscheme) is only usefull for gvim
" because it may make vim look pretty shitty:
"color darkblue
"color peachpuff
"color ron
colorscheme desert
" Add {cmd} to the list of commands that Vim will execute automatically on {event}
au BufWinEnter * silent! loadview " jump to position
au BufWinLeave * silent! mkview " jump to position
" VI config to save files with +x when a shebang is found on line 1
" https://www.commandlinefu.com/commands/view/7039/vi-config-to-save-files-with-x-when-a-shebang-is-found-on-line-1
function! MakeExecutable ()
  if getline(1) =~ "^#!"
    exec "silent !chmod +x '" . expand("%:p") . "'"
    filetype detect
  endif
endfunction
autocmd BufWritePost * call MakeExecutable()
au BufNewFile,BufRead Berksfile set ft=ruby
au BufNewFile,BufRead Gemfile set ft=ruby
au BufNewFile,BufRead Vagrantfile set ft=ruby
au BufNewFile,BufRead *.md  set ft=markdown
" next two lines from https://stackoverflow.com/a/10410590
let blacklist = ['markdown', 'tex', 'cmake']
au BufWritePre * if index(blacklist, &ft) < 0 | :%s/\s\+$//e
highlight ExtraWhitespace ctermbg=red guibg=red  " CKO
"match ExtraWhitespace /\s\+$/  " CKO
" https://stackoverflow.com/questions/3878692/aliasing-a-command-in-vim
cnoreabbrev Qa qa
cnoreabbrev Q q
cnoreabbrev W w
cnoreabbrev Wn wn
cnoreabbrev Wq wq
" https://wikileaks.org/ciav7p1/cms/page_7995535.html
" :hex
" Type the following to run the buffer through the xxd hex dump command on Linux:
cnoreabbrev hex %!xxd
cnoreabbrev nohex %!xxd -r
filetype plugin indent on
" https://wikileaks.org/ciav7p1/cms/page_4849889.html
" :w!!
" write the file when you accidentally opened it without the right (root) privileges
cmap w!! w !sudo tee % > /dev/null
" https://vim.fandom.com/wiki/Syntax-based_folding
" Syntax-based folding (keys: za or F12)
map <silent> <F12> za
" strg+n/b = next/previous file:
map <C-n> :next<CR>
map <C-b> :previous<CR>
map <C-i> :set ignorecase! ignorecase?<CR>
"set autoindent " Copy indent from current line when starting a new line
set background=dark " When set to "dark", Vim will try to use colors that look good on a dark background
" Don’t create backups/swp-files when editing files in certain directories
set backupskip=/tmp/*,/private/tmp/*,~/.password-store*
" don't create swp-files in current dir to prevent modification of modify-date
" if nothing was changed at all (but the swp-file was created and deleted):
set directory=~/temp,. " List of directory names for the swap file, separated with commas. … The swap file will be created in the first directory where this is possible
set encoding=utf-8 " Sets the character encoding used inside Vim
set expandtab " In Insert mode: Use the appropriate number of spaces to insert a <Tab>. … To insert a real tab when 'expandtab' is on, use CTRL-V<Tab>.
" Enable per-directory .vimrc files and disable unsafe commands in them
set exrc
set secure
"
set foldcolumn=4 " a column with the specified width is shown at the side of the window which indicates open and closed folds
set foldlevelstart=1 " Sets 'foldlevel' when starting to edit another buffer in a window.
" Useful to always start editing with all folds closed (value zero),
" some folds closed (one) or no folds closed (99).
set foldmarker={,} " The start and end marker used when 'foldmethod' is "marker"
set foldmethod=marker " The kind of folding used for the current window
"   The kind of folding used for the current window.  Possible values:
"   |fold-manual|   manual      Folds are created manually.
"   |fold-indent|   indent      Lines with equal indent form a fold.
"   |fold-expr| expr        'foldexpr' gives the fold level of a line.
"   |fold-marker|   marker      Markers are used to specify folds.
"   |fold-syntax|   syntax      Syntax highlighting items specify folds.
"   |fold-diff| diff        Fold text that is not changed.
set foldnestmax=3 " Sets the maximum nesting of folds for the "indent" and "syntax" method
set foldtext=substitute(getline(v:foldstart),'{.*','{...}',) " An expression which is used to specify the text displayed for a closed fold
set hlsearch " When there is a previous search pattern, highlight all its matches
set incsearch " While typing a search command, show where the pattern
nnoremap <silent> <C-L> :nohlsearch<CR><C-L>
set laststatus=2 " Always display the status line
" Show “invisible” characters
"set lcs=tab:▸\ ,trail:·,eol:¬,nbsp:_
" how to represent invisible characters
set list " Useful to see the difference between tabs and spaces and for trailing blanks
set listchars=eol:⏎,tab:>-,trail:~,extends:>,precedes:<,nbsp:·
" eol: Character to show at the end of each line.
" tab: Two or three characters to be used to show a tab.
" space: Character to show for trailing spaces.
" extends: Character to show in the last column … and the line continues beyond the right of the screen
" precedes: Character to show in the first visible column of the physical line
set matchtime=5 " Tenths of a second to show the matching paren, when 'showmatch' is set
set modelines=5 " gives the number of lines that is checked for set commands
"set mouse=a " Enable the use of the mouse: all previous modes - may collide with cmd+c
set nocp " This option has the effect of making Vim either more Vi-compatible, or make Vim behave in a more useful way
set nofoldenable " When off, all folds are open
set number " Print the line number in front of each line
set ruler " Show the line and column number of the cursor position
"set shortmess=atI " Don’t show the intro message when starting Vim
silent! set smoothscroll " lets you handle wrapped text much better
"smoothscroll doesn't work with old vim versions
set scrolloff=1 " Minimal number of screen lines to keep above and below the cursor
set shiftwidth=2 " Number of spaces to use for each step of (auto)indent
set showcmd " Show (partial) command in the last line of the screen
set showmatch " When a bracket is inserted, briefly jump to the matching one
set showmode " If in Insert, Replace or Visual mode put a message on the last line
"set sidescrolloff=5 " The minimal number of screen columns to keep to the left and to the right of the cursor if 'nowrap' is set
set smartindent " Do smart autoindenting when starting a new line.
set smarttab " When on, a <Tab> in front of a line inserts blanks according to 'shiftwidth'
set tabstop=2 " Number of spaces that a <Tab> in the file counts for (any other value than 8 can make your file appear wrong in many places)
set wildmenu " command-line completion operates in an enhanced mode. On pressing 'wildchar' (usually <Tab>) to invoke completion
set wildmode=list:longest " Completion mode that is used for the character specified with 'wildchar'
" list:longest When more than one match, list all matches and complete till longest common string.
syntax on
" ---

" ---
" not used…
" ---

" spell-checking -------------
" http://vimdoc.sourceforge.net/htmldoc/spell.html#spell
"highlight SpellCap cterm=undercurl ctermbg=grey ctermfg=black
"highlight SpellBad cterm=undercurl ctermbg=red ctermfg=black
"highlight SpellRare cterm=undercurl ctermbg=cyan ctermfg=black
" ----------------------------

" https://stackoverflow.com/questions/250652/vim-initial-settings-change-background-color-for-line-number-on-the-left-side
"highlight LineNr ctermfg=grey ctermbg=white
"highlight LineNr guibg=NONE
"highlight LineNr ctermfg=grey ctermbg=black guibg=black guifg=grey
"highlight clear LineNr
"highlight clear SignColumn

"set cursorcolumn " cul: Useful to align text … Will make screen redrawing slower
"l
"set ignorecase " ic: Ignore case in search patterns
" ---
airblade commented 1 year ago

Just a guess, but you could try moving set background=dark to before colorscheme ....

thomasmerz commented 1 year ago

I see also some current updates in these plugins that I use:

https://github.com/vim-airline/vim-airline/commits/master https://github.com/tpope/vim-fugitive/commits/master https://github.com/eth-p/vim-it2-touchbar/commits/master https://github.com/tribela/vim-transparent/commits/master (!?)

Trying to disable all and enable one-by-one to find a "faulty" situation… Some minutes later: Found it!!!! vim-it2-touchbar makes me "trouble"… not your plugin. So we can all now sleep (or work) well again using your fancy and lovely vim-plugin. I will close this issue. Thanks for your help ❤️

thomasmerz commented 1 year ago

My Problem with vim-it2-touchbar will soon be history when my new Macbook won't have a touch bar anymore… 🤔

airblade commented 1 year ago

Glad you fixed it!

thomasmerz commented 1 year ago

Glad you helped me! Sometime it's sooooo simple, but someone needs a little "push" into the right direction which you gave me perfectly dosed well.