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

No longer have colors on hunk preview #534

Closed
sandangel opened this issue Apr 18, 2022 · 0 comments
Closed

No longer have colors on hunk preview #534

sandangel opened this issue Apr 18, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@sandangel
Copy link

sandangel commented Apr 18, 2022

Description

After recent commit, I no longer see colors in my preview hunk

Neovim version

0.7

Operating system and version

macos 12

Expected behavior

should see colors in preview hunk like before

Actual behavior

don't see colors

image

Minimal config

vim.o.packpath = '/tmp/nvim/site'

local plugins = {
  gitsigns = 'https://github.com/lewis6991/gitsigns.nvim',
  -- ADD OTHER PLUGINS _NECESSARY_ TO REPRODUCE THE ISSUE
  onedark = 'https://github.com/navarasu/onedark.nvim',
}

for name, url in pairs(plugins) do
  local install_path = '/tmp/nvim/site/pack/test/start/'..name
  if vim.fn.isdirectory(install_path) == 0 then
    vim.fn.system { 'git', 'clone', '--depth=1', url, install_path }
  end
end

require('onedark').setup {
  style = 'dark',
  code_style = {
    comments = 'italic',
    keywords = 'italic',
    functions = 'italic',
    strings = 'none',
    variables = 'italic',
  },
}
require('onedark').load()

require('gitsigns').setup {
  on_attach = function(bufnr)
    local gs = package.loaded.gitsigns

    local function map(mode, l, r, opts)
      opts = opts or {}
      opts.buffer = bufnr
      vim.keymap.set(mode, l, r, opts)
    end

    -- Navigation
    map('n', ']c', function()
      if vim.wo.diff then
        return ']c'
      end
      vim.schedule(function()
        gs.next_hunk({ preview = true })
      end)
      return '<Ignore>'
    end, {
      expr = true,
    })

    map('n', '[c', function()
      if vim.wo.diff then
        return '[c'
      end
      vim.schedule(function()
        gs.prev_hunk({ preview = true })
      end)
      return '<Ignore>'
    end, {
      expr = true,
    })

    -- Actions
    map({ 'n', 'x' }, '<leader>cs', gs.stage_hunk)
    map({ 'n', 'x' }, '<leader>cr', gs.reset_hunk)
    map('n', '<leader>cS', gs.stage_buffer)
    map('n', '<leader>cu', gs.undo_stage_hunk)
    map('n', '<leader>cR', gs.reset_buffer)
    map('n', '<leader>cp', gs.preview_hunk)
    map('n', '<leader>cb', function()
      gs.blame_line { full = true }
    end)
    map('n', '<leader>cb', gs.toggle_current_line_blame)
    map('n', '<leader>cd', gs.diffthis)
    map('n', '<leader>cD', function()
      gs.diffthis '~'
    end)
    map('n', '<leader>cd', gs.toggle_deleted)

    -- Text object
    map({ 'o', 'x' }, 'ih', '<cmd>Gitsigns select_hunk<cr>')
  end,
}


-- ADD INIT.LUA SETTINGS THAT IS _NECESSARY_ FOR REPRODUCING THE ISSUE

Steps to reproduce

  1. nvim --clean -u minimal.lua
  2. change something
  3. type ]` (will auto show preview)

Gitsigns debug messages

signs.init: Using vimfn signs
run_job: git --no-pager --literal-pathspecs --version
fn: Highlight GitSignsAdd is already defined
fn: Highlight GitSignsChange is already defined
fn: Highlight GitSignsDelete is already defined
fn: Highlight GitSignsAddNr is already defined
fn: Highlight GitSignsChangeNr is already defined
fn: Highlight GitSignsDeleteNr is already defined
fn: Highlight GitSignsAddLn is already defined
fn: Highlight GitSignsChangeLn is already defined
fn: Highlight GitSignsDeleteLn is already defined
fn: Deriving GitSignsCurrentLineBlame from NonText
fn: Deriving GitSignsAddInline from TermCursor
fn: Deriving GitSignsDeleteInline from TermCursor
fn: Deriving GitSignsChangeInline from TermCursor
fn: Deriving GitSignsAddLnInline from GitSignsAddInline
fn: Deriving GitSignsChangeLnInline from GitSignsChangeInline
fn: Deriving GitSignsDeleteLnInline from GitSignsDeleteInline
fn: Deriving GitSignsAddLnVirtLn from GitSignsAddLn
fn: Deriving GitSignsChangeVirtLn from GitSignsChangeLn
fn: Deriving GitSignsDeleteVirtLn from GitSignsDeleteLn
fn: Deriving GitSignsAddLnVirtLnInLine from GitSignsAddLnInline
fn: Deriving GitSignsChangeVirtLnInLine from GitSignsChangeLnInline
fn: Deriving GitSignsDeleteVirtLnInLine from GitSignsDeleteLnInline
attach(13): Attaching (trigger=setup)
run_job: git --no-pager --literal-pathspecs config user.name
run_job: git --no-pager --literal-pathspecs rev-parse --show-toplevel --absolute-git-dir --abbrev-ref HEAD
run_job: git --no-pager --literal-pathspecs --git-dir=/Users/username/.dotfiles/.git -c core.quotepath=off ls-files --stage --others --exclude-standard --eol /Users/san.nguyen/.dotfiles/nvim-lua/lua/plugins/configs/gitsig
ns.lua
watch_gitdir(13): Watching git dir
run_job: git --no-pager --literal-pathspecs --git-dir=/Users/username/.dotfiles/.git show :0:nvim-lua/lua/plugins/configs/gitsigns.lua
update(13): updates: 1, jobs: 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant