mikesmithgh / git-prompt-string-lualine.nvim

📍Add git-prompt-string to your Neovim statusline!
Apache License 2.0
22 stars 1 forks source link

Got this error on neovim nightly with archBTW #3

Closed olivertzeng closed 7 months ago

olivertzeng commented 7 months ago

 Error 22時25分00秒 msg_show.lua_error Error executing vim.schedule lua callback: ...share/nvim/lazy/lualine.nvim/lua/lualine/utils/utils.lua:211: lualine: Failed to refresh statusline: ...zeng/.local/share/nvim/lazy/lualine.nvim/lua/lualine.lua:429: Error executing lua: Vim:E475: Invalid value for argument cmd: 'git-prompt-string' is not executable stack traceback: [C]: in function 'jobstart' ...ring-lualine.nvim/lua/git-prompt-string-lualine/init.lua:49: in function 'git_prompt_string_json' ...ualine.nvim/lua/lualine/components/git_prompt_string.lua:57: in function 'update_status' ...l/share/nvim/lazy/lualine.nvim/lua/lualine/component.lua:273: in function 'draw' ...are/nvim/lazy/lualine.nvim/lua/lualine/utils/section.lua:26: in function 'draw_section' ...zeng/.local/share/nvim/lazy/lualine.nvim/lua/lualine.lua:170: in function 'statusline' ...zeng/.local/share/nvim/lazy/lualine.nvim/lua/lualine.lua:298: in function <...zeng/.local/share/nvim/lazy/lualine.nvim/lua/lualine.lua:279> [C]: in function 'nvim_win_call' ...zeng/.local/share/nvim/lazy/lualine.nvim/lua/lualine.lua:429: in function 'refresh' ...zeng/.local/share/nvim/lazy/lualine.nvim/lua/lualine.lua:524: in function <...zeng/.local/share/nvim/lazy/lualine.nvim/lua/lualine.lua:523> [C]: in function 'pcall' ...share/nvim/lazy/lualine.nvim/lua/lualine/utils/utils.lua:214: in function '' vim/_editor.lua: in function <vim/_editor.lua:0> stack traceback: [C]: in function 'error' ...share/nvim/lazy/lualine.nvim/lua/lualine/utils/utils.lua:211: in function '' vim/_editor.lua: in function <vim/_editor.lua:0>

mikesmithgh commented 7 months ago

Thanks for reporting. What OS are you using? Do you have git-prompt-string installed and available in the PATH?

olivertzeng commented 7 months ago

there isn't an aur package called git-prompt-string can you help me with that or maybe p10k doesn't work out of the box? i use arch btw

mikesmithgh commented 7 months ago

there isn't an aur package called git-prompt-string can you help me with that

or maybe p10k doesn't work out of the box?

i use arch btw

git-prompt-string is a separate tool. You'll have to follow the instructions here https://github.com/mikesmithgh/git-prompt-string.

olivertzeng commented 7 months ago

there isn't an aur package called git-prompt-string can you help me with that or maybe p10k doesn't work out of the box? i use arch btw

git-prompt-string is a separate tool. You'll have to follow the instructions here mikesmithgh/git-prompt-string.

it works but can i make p10k showing in lualine instead? that way i don't need to install two tools

and it shows error when i open a file that isn't in a git repository

mikesmithgh commented 7 months ago

there isn't an aur package called git-prompt-string can you help me with that

or maybe p10k doesn't work out of the box?

i use arch btw

git-prompt-string is a separate tool. You'll have to follow the instructions here mikesmithgh/git-prompt-string.

it works but can i make p10k showing in lualine instead? that way i don't need to install two tools

and it shows error when i open a file that isn't in a git repository

p10k is completely separate from this so you won't be able to incorporate that for this plugin.

Could you share your lualine config?

olivertzeng commented 7 months ago
local function diff_source()
    local gitsigns = vim.b.gitsigns_status_dict
    if gitsigns then
        return {
            added = gitsigns.added,
            modified = gitsigns.changed,
            removed = gitsigns.removed,
        }
    end
end

require("lualine").setup({
    options = {
        theme = "gruvbox-material",
        globalstatus = false,
        disabled_filetypes = { statusline = { "alpha" } },
    },
    sections = {
        lualine_a = { "mode" },
        -- lualine_b = { "git_prompt_string", "diagnostics" },
        lualine_b = { { "b:gitsigns_head", icon = "" }, "diagnostics" },
        lualine_c = {
            {
                "filename",
                symbols = {
                    modified = "󰐖 ", -- Text to show when the buffer is modified
                    readonly = "󰌾 ", -- Text to show when the file is non-modifiable or readonly.
                    unnamed = "󰜣 ", -- Text to show for unnamed buffers.
                    newfile = "󰎜 ", -- Text to show for newly created file before first write
                    alternate_file = "# ", -- Text to show to identify the alternate file
                    directory = " ", -- Text to show when the buffer is a directory
                },
            },
            {
                "diff",
                colored = true, -- Displays a colored diff status if set to true
                symbols = { added = "󰐖 ", modified = "󰦓 ", removed = " " }, -- Changes the symbols used by the diff.
                source = diff_source,
            },
        },

        lualine_x = {
            {
                "fileformat",
                symbols = {
                    unix = " ",
                    mac = " ",
                },
            },
            "filetype",
        },
        lualine_y = { { "progress", separator = " ", padding = { left = 1, right = 0 } } },
        lualine_z = {
            "location",
        },
    },

    inactive_sections = {
        lualine_a = {},
        lualine_b = { "filesize" },
        lualine_c = {},
        lualine_x = {},
        lualine_y = {},
        lualine_z = {},
    },
    extensions = { "lazy", "fugitive", "trouble" },
})
mikesmithgh commented 7 months ago

@olivertzeng thanks

  1. Are you still seeing the error 'git-prompt-string' is not executable?
  2. Are you still seeing an error when you are not in a git repo? Is that the same error as 'git-prompt-string' is not executable ?
olivertzeng commented 7 months ago

HmmI’ll try it later But no matter what that thing is executable in a git repo

mikesmithgh commented 7 months ago

FYI @olivertzeng I was able to reproduce the bug for errors in nongit directories in https://github.com/mikesmithgh/git-prompt-string-lualine.nvim/issues/6.

I'll close this issue as a duplicate and hope to have a fix sometime later today.

olivertzeng commented 7 months ago

Ok Sent from Proton Mail for iOS 於 週一, 4月 22, 2024 時間 22:47, Mike @.***> 寫道: FYI @olivertzeng I was able to reproduce the bug for errors in nongit directories in #6. I'll close this issue as a duplicate and hope to have a fix sometime later today.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>