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

get_hunks() doesnt output anything #762

Closed
I-Own-You opened this issue Mar 5, 2023 · 2 comments · Fixed by #764
Closed

get_hunks() doesnt output anything #762

I-Own-You opened this issue Mar 5, 2023 · 2 comments · Fixed by #764
Labels
bug Something isn't working

Comments

@I-Own-You
Copy link

I-Own-You commented Mar 5, 2023

Description

i open any buffer
make some changes
type :Gitsigns get_hunks
nothing shows

Neovim version

NVIM v0.9.0-dev

Operating system and version

Ubuntu 22.04.2 LTS (Xubuntu)

Expected behavior

to show all the hunks

Actual behavior

doesnt show the hunks

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
}

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('gitsigns').setup{
  debug_mode = true, -- You must add this to enable debug messages
    signs = {
        add = { hl = "GitSignsAdd", text = "", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" },
        change = { hl = "GitSignsChange", text = "", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" },
        delete = { hl = "GitSignsDelete", text = "", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" },
        topdelete = { hl = "GitSignsDelete", text = "", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" },
        changedelete = { hl = "GitSignsChange", text = "", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" },
    },
    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 = {
        interval = 1000,
        follow_files = true,
    },
    attach_to_untracked = true,
    current_line_blame = true, -- Toggle with `:Gitsigns toggle_current_line_blame`
    current_line_blame_opts = {
        virt_text = true,
        virt_text_pos = "eol", -- 'eol' | 'overlay' | 'right_align'
        delay = 100,
        ignore_whitespace = false,
    },
    current_line_blame_formatter_opts = {
        -- relative_time = false,
    },
    sign_priority = 6,
    update_debounce = 100,
    status_formatter = nil, -- Use default
    max_file_length = 40000,
    preview_config = {
        -- Options passed to nvim_open_win
        border = "single",
        style = "minimal",
        relative = "cursor",
        row = 0,
        col = 1,
    },
    yadm = {
        enable = false,
    },

  -- ADD GITSIGNS CONFIG THAT IS _NECESSARY_ FOR REPRODUCING THE ISSUE
}

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

Steps to reproduce

  1. nvim path-to-my-directory
  2. open any buffer
  3. make some changes
  4. type :Gitsigns get_hunks

Gitsigns debug messages

cli.run: Running action 'get_hunks' with arguments {}
cli.run: Running action 'debug_messages' with arguments {}

@I-Own-You I-Own-You added the bug Something isn't working label Mar 5, 2023
@lewis6991
Copy link
Owner

lewis6991 commented Mar 5, 2023

get_hunks won't work in the CLI because that function only returns data, it doesn't print it to the screen. Try:

:lua= require'gitsigns'.get_hunks()

@lewis6991 lewis6991 reopened this Mar 5, 2023
@lewis6991
Copy link
Owner

I'll make it so the cli version prints to the screen

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
2 participants