lewis6991 / gitsigns.nvim

Git integration for buffers
MIT License
4.91k stars 187 forks source link

feat(signs): enable staged signs by default #1039

Closed lewis6991 closed 3 months ago

danielebra commented 2 months ago

I was updating my plugins and noticed a significant behavioural change in gitsigns that might be related to this pull request.

I started seeing staged commits that previously displayed nothing in the gutter, were now displaying icons I did I was not using, such as the pipes for add.

It would have been beneficial if this change was highlighted in the sample config, with an explanation about the new signs_staged feature.

For example:

require('gitsigns').setup {
  signs = {
    add          = { text = '┃' },
    change       = { text = '┃' },
    delete       = { text = '_' },
    topdelete    = { text = '‾' },
    changedelete = { text = '~' },
    untracked    = { text = '┆' },
  },
  -- [Missing Section]
  -- Icons can be configured separately for staged content
  -- signs_staged = {
  --   add          = { text = '┃' },
  --   change       = { text = '┃' },
  --   delete       = { text = '_' },
  --   topdelete    = { text = '‾' },
  --   changedelete = { text = '~' },
  --   untracked    = { text = '┆' },
  -- },
  signcolumn = true,  -- Toggle with `:Gitsigns toggle_signs`
  numhl      = false, -- Toggle with `:Gitsigns toggle_numhl`
  linehl     = false, -- Toggle with `:Gitsigns toggle_linehl`
  word_diff  = false, -- Toggle with `:Gitsigns toggle_word_diff`
  watch_gitdir = {
    follow_files = true
  },
  auto_attach = true,
  attach_to_untracked = false,
  current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame`
  current_line_blame_opts = {
    virt_text = true,
    virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align'
    delay = 1000,
    ignore_whitespace = false,
    virt_text_priority = 100,
  },
  current_line_blame_formatter = '<author>, <author_time:%R> - <summary>',
  sign_priority = 6,
  update_debounce = 100,
  status_formatter = nil, -- Use default
  max_file_length = 40000, -- Disable if file is longer than this (in lines)
  preview_config = {
    -- Options passed to nvim_open_win
    border = 'single',
    style = 'minimal',
    relative = 'cursor',
    row = 0,
    col = 1
  },
}

It might have been smoother if the signs_staged icons were defaulted to the initialized icons in signs for a more seamless transition for existing configurations.

Thanks for all your open source contributions, I added the default entry to the read me in https://github.com/lewis6991/gitsigns.nvim/pull/1077