rickhowe / diffchar.vim

Highlight the exact differences, based on characters and words
http://www.vim.org/scripts/script.php?script_id=4932
MIT License
217 stars 10 forks source link

[Bug] Highlights of the words marked as differences are not automatically shown at once #31

Closed pidgeon777 closed 1 year ago

pidgeon777 commented 2 years ago

Comparing two simple text files, this is what I obtain:

image

Instead, I would have expected the same result reported in the plugin readme. This means, all of the words marked as different should be highlighted.

But, when navigating between the changed words through the hotkey, then the highlight is shown, but only for the word where the cursor is placed:

image

I would like the plugin to display all of the words marked as differences between the two files being used as diff.

How could this be achieved? Is this a bug in the plugin?

I'm using the latest stable version of Neovim (0.8.0), the newest version of this plugin on Windows 10 Pro.

Best regards

rickhowe commented 2 years ago

Thank you for asking. I can not reproduce in my Windows 10. Which colorschme you are using? And let me know ':set' output.

pidgeon777 commented 2 years ago

Output of :set:

--- Opzioni ---
  autowriteall        columns=479         cursorline          filetype=result     foldnestmax=3       lines=61            mousefocus          pumheight=10        scroll=29           shiftwidth=2        sidescrolloff=8     smartindent       noswapfile            termguicolors       ttimeoutlen=10      window=60
  bufhidden=wipe      confirm           noequalalways         foldlevel=4         helplang=it         list                number              redrawtime=1500     scrolloff=8       noshowmode            signcolumn=yes      splitbelow          syntax=result       timeoutlen=250      updatetime=100    nowritebackup
  buftype=nofile      cursorcolumn        expandtab           foldmethod=expr     ignorecase          mouse=a             pumblend=10         relativenumber      secure              showtabline=2       smartcase           splitright          tabstop=4           title               virtualedit=all
  completeopt=menu,menuone,noselect
  diffopt=internal,filler,closeoff,hiddenoff,algorithm:minimal
  fileencoding=utf-8
  fillchars=diff:╱,eob: ,fold: ,foldclose:▸,foldopen:▾,foldsep:│,horiz:━,horizdown:┳,horizup:┻,msgsep:‾,vert:┃,verthoriz:╋,vertleft:┫,vertright:┣
  foldexpr=nvim_treesitter#foldexpr()
  foldtext=substitute(getline(v:foldstart),'\\t',repeat('\ ',&tabstop),'g').'...'.trim(getline(v:foldend)) . ' (' . (v:foldend - v:foldstart + 1) . ' lines)'
  formatoptions=qnjl1v2
  guifont=FiraCode NFM:h10
  listchars=extends:›,nbsp:␣,precedes:‹,space:·,tab:→\ ,trail:•
  packpath=~\MEGA\Configurations\Neovim\config\lvim,C:\Work\Temp\Neovim\data\lunarvim\site,~\MEGA\Portable\Neovim\share\nvim\runtime,~\MEGA\Portable\Neovim\lib\nvim,~\MEGA\Configurations\Neovim\config\lunarvim\lvim,C:\Work\Temp\Neovim\data\lunarvim\site\after,~\MEGA\Configurations\Neovim\config\lvim\after
  quickfixtextfunc={info -> v:lua._G.qftf(info)}
  runtimepath=~\MEGA\Configurations\Neovim\config\lvim,C:\Work\Temp\Neovim\data\lunarvim\site,C:\Work\Temp\Neovim\data\lunarvim\site\pack\packer\opt\markdown-preview.nvim,C:\Work\Temp\Neovim\data\lunarvim\site\pack\packer\opt\nvim-spectre,C:\Work\Temp\Neovim\data\lunarvim\site\pack\packer\opt\hop.nvim,C:\Work\Temp\Neovim\data\lunarvim\site\pack\packer\opt\gitsigns.nvim,C:\Work\Temp\Neovim\data\lunarvim\site\pack\packer\opt\todo-comments.nvim,C:\Work\Temp\Neovim\data\lunarvim\site\pack\packer\opt\Comment.nvim,C:\Work\Temp\Neovim\data\lunarvim\site\pack\packer\opt\twilight.nvim,C:\Work\Temp\Neovim\data\lunarvim\site\pack\packer\opt\zen-mode.nvim,C:\Work\Temp\Neovim\data\lunarvim\site\pack\packer\opt\asynctasks.vim,C:\Work\Temp\Neovim\data\lunarvim\site\pack\packer\opt\nvim-bqf,C:\Work\Temp\Neovim\data\lunarvim\site\pack\packer\opt\nvim-colorizer.lua,C:\Work\Temp\Neovim\data\lunarvim\site\pack\packer\opt\nvim-ts-context-commentstring,C:\Work\Temp\Neovim\data\lunarvim\site\pack\packer\opt\symbols-outline.nvim,C:\Work\Temp\Neovim\data\lunarvim\site\pack\packer\opt\vista.vim,C:\Work\Temp\Neovim\data\lunarvim\site\pack\packer\opt\persistence.nvim,C:\Work\Temp\Neovim\data\lunarvim\site\pack\packer\opt\neogen,C:\Work\Temp\Neovim\data\lunarvim\site\pack\packer\opt\typescript.nvim,C:\Work\Temp\Neovim\data\lunarvim\site\pack\packer\opt\lsp_signature.nvim,C:\Work\Temp\Neovim\data\lunarvim\site\pack\packer\opt\bufferline.nvim,C:\Work\Temp\Neovim\data\lunarvim\site\pack\packer\opt\which-key.nvim,C:\Work\Temp\Neovim\data\lunarvim\site\pack\packer\opt\remember.nvim,C:\Work\Temp\Neovim\data\lunarvim\site\pack\packer\opt\toggleterm.nvim,C:\Work\Temp\Neovim\data\lunarvim\site\pack\packer\opt\dressing.nvim,C:\Work\Temp\Neovim\data\lunarvim\site\pack\packer\opt\nvim-treesitter-textobjects,C:\Work\Temp\Neovim\data\lunarvim\site\pack\packer\opt\tabout.nvim,C:\Work\Temp\Neovim\data\lunarvim\site\pack\packer\opt\lua-dev.nvim,C:\Work\Temp\Neovim\data\lunarvim\site\pack\packer\opt\catppuccin,C:\Work\Temp\Neovim\data\lunarvim\site\pack\packer\start\packer.nvim,~\MEGA\Portable\Neovim\share\nvim\runtime,~\MEGA\Portable\Neovim\lib\nvim,~\MEGA\Configurations\Neovim\config\lunarvim\lvim,C:\Work\Temp\Neovim\data\lunarvim\site/pack/*/start/*,C:\Work\Temp\Neovim\data\lunarvim\site\pack\packer\opt\nvim-bqf\after,C:\Work\Temp\Neovim\data\lunarvim\site\pack\packer\opt\catppuccin\after,C:\Work\Temp\Neovim\data\lunarvim\site/pack/*/start/*\after,C:\Work\Temp\Neovim\data\lunarvim\site\after,~\MEGA\Configurations\Neovim\config\lvim\after
  scrollopt=ver,jump,hor
  sessionoptions=blank,buffers,folds,help,tabpages,winsize,winpos,terminal
  shadafile=C:\Work\Temp\Neovim\cache\lvim\lvim.shada
  shortmess=FTsfOtcWoA
  statusline=%#Normal#
  tabline=%!v:lua.nvim_bufferline()
  undodir=C:\Work\Temp\Neovim\cache\lvim\undo
  whichwrap=<,>,[,],b,h,l,s
  wildignore=*.aux,*.out,*.toc,*.o,*.obj,*.dll,*.jar,*.pyc,__pycache__,*.rbc,*.class,*.ai,*.bmp,*.gif,*.ico,*.jpg,*.jpeg,*.png,*.psd,*.webp,*.avi,*.m4a,*.mp3,*.oga,*.ogg,*.wav,*.webm,*.eot,*.otf,*.ttf,*.woff,*.doc,*.pdf,*.zip,*.tar.gz,*.tar.bz2,*.rar,*.tar.xz,*.*~,*~ ,*.swp,.lock,.DS_Store,._*,tags.lock,.git,.svn

Result of :colorschme:

github_dark

https://github.com/projekt0n/github-nvim-theme

rickhowe commented 2 years ago

I found that 'DiffText' is linked to 'DiffChange' in this colorschme. That means changed units and that line are colored with the same highlight, so those units are not be visible, Please try another colorschme, such as 'default', with your ':set'.

pidgeon777 commented 2 years ago

You are right, the culprit seems to be github-nvim-theme.

I'll ask the theme author to also add compatibility with your plugin.