noice.nvim icon indicating copy to clipboard operation
noice.nvim copied to clipboard

bug: Cannot get stdout while running !commands

Open ricardoseriani opened this issue 9 months ago • 21 comments

Did you check docs and existing issues?

  • [x] I have read all the noice.nvim docs
  • [x] I have updated the plugin to the latest version before submitting this issue
  • [x] I have searched the existing issues of noice.nvim
  • [x] I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

v0.11.0

Operating system/version

Ubuntu 24.04

Describe the bug

Hi How are you?

While running :!commands (like :!date) I cannot get the stdout of the command while using nvim v0.11.0 Image The checkhealth noice show the following output: Image

If I use the same config, but using nvim v0.10.0, I get the message notification normally. Image

Thanks in advance. Best Regards

Steps To Reproduce

Open nvim v0.11.0 In normal mode, use the following "command" :!date

Expected Behavior

Show notification with command stdout

Repro

local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "--single-branch",
    "https://github.com/folke/lazy.nvim.git",
    lazypath,
  })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  "folke/tokyonight.nvim",
  {
    "folke/noice.nvim",
    dependencies = {
      "MunifTanjim/nui.nvim",
      "rcarriga/nvim-notify",
    },
  },
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

ricardoseriani avatar Apr 15 '25 18:04 ricardoseriani

I am experiencing the same problem, stdout doesnt show in the notification.

require("noice").setup({
    lsp = {
        override = {
            ["vim.lsp.util.convert_input_to_markdown_lines"] = true,
            ["vim.lsp.util.stylize_markdown"] = true,
            ["cmp.entry.get_documentation"] = true, -- requires hrsh7th/nvim-cmp
        },
    },
    presets = {
        bottom_search = false, -- use a classic bottom cmdline for search
        command_palette = true, -- position the cmdline and popupmenu together
        long_message_to_split = true, -- long messages will be sent to a split
        inc_rename = false, -- (i dont have inc rename plugin so dont care)
        lsp_doc_border = true, -- this is nice
    },
})
` ``

Long messages of type `show_msg.shell_out` show by running :Noice ... but appart from that all the stdout of short commands that you want to see the output of get filtered 

LuckyToaster avatar Apr 20 '25 20:04 LuckyToaster

Same issue here

sabattle avatar Apr 29 '25 19:04 sabattle

I'm also experience this issue.

false-vacuum avatar May 02 '25 01:05 false-vacuum

Got the same bug, running Mint (ubuntu 24.04/noble), at least there's progress with the PR

Braxion06 avatar May 12 '25 22:05 Braxion06

Same issue. The only way to get it output was to

  1. write some custom logic to capture it in a notification, or
  2. disable noice in order to get the old behavior.

Here's what I did to get the output into a notification, although I don't like this at all -

-- ensure you have carriga/nvim-notify

local function capture_command_output(command)
  local output = vim.fn.systemlist(command)
  local output_str = table.concat(output, "\n")

  require("notify")(output_str, "info", {
    title = "Command Output",
    timeout = 5000,
  })
end

vim.api.nvim_create_autocmd("CmdlineLeave", {
  callback = function()
    local cmd = vim.fn.getcmdline()
    capture_command_output(cmd)
  end,
})

tylerCaineRhodes avatar May 15 '25 22:05 tylerCaineRhodes

Same here, hope there will be a solution to this soon.

EralpCelebi avatar Jun 21 '25 15:06 EralpCelebi

Also getting this issue. All shell commands return as a success even if they don't exist. No terminal output is returned

Image

Avsilver avatar Jul 06 '25 21:07 Avsilver

        routes = {
            {
                filter = { event = "msg_show", },
                view = "notify",
                opts = {
                    level = "info",
                    skip = false,
                    replace = false,
                }
            }

This seems to be a more direct temporary fix. Unless I am missing something, it doesn't seem possible to filter directly by msg_show.shell_out/err. It seems like the problem is that the msg_show.shell outputs dont have a level assigned to them. Assigning them a level here shows them similar to how they would be shown in :Noice all.

Definitely does not feel intentional.

Avsilver avatar Jul 06 '25 23:07 Avsilver

@Avsilver Thanks for the workaround. I was able to filter the !cmd output using kind:

{
  filter = { event = 'msg_show', kind = { 'shell_out', 'shell_err' } },
  view = 'split',
  opts = {
    level = 'info',
    skip = false,
    replace = false,
  },
}

iul1an avatar Jul 07 '25 10:07 iul1an

i have this issue too

aflaag avatar Aug 04 '25 07:08 aflaag

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Sep 04 '25 02:09 github-actions[bot]

Still an issue

gaston-haro avatar Sep 04 '25 12:09 gaston-haro

same error

NanShanFish avatar Sep 19 '25 04:09 NanShanFish

Anyone tested if after #1098 This is fixed?

niksingh710 avatar Oct 01 '25 10:10 niksingh710

Still an issue

Sorry, got it working after

routes = {
	{
		view = "notify",
		filter = {
			event = "msg_show",
			kind = "shell_out",
		},
	},
}

harogaston avatar Oct 05 '25 05:10 harogaston

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Nov 05 '25 02:11 github-actions[bot]

I'm getting the same behavior (no stdout shown on most commands, such as :!ls) but with an added behavior where :NoiceAll shows the following: 09:10:00 PM msg_show.shell_out ls Desktop (notice the appended "Desktop" which would be the first directory in my ~).

If I do :!ls / it'll show this: 09:14:32 PM msg_show.shell_out ls / bin, with bin also being the first directory in /.

Also, :!ls doesn't trigger the notification but :!ls / does as if a newline is required from the command output to trigger the notification.

ncoder-1 avatar Nov 11 '25 02:11 ncoder-1

Same issue, too.

Same issue.

egidijusz avatar Nov 21 '25 16:11 egidijusz

Same issue here.

tbish967 avatar Dec 06 '25 21:12 tbish967

Just try using this config, it should work:

routes = {
	{
		view = "notify",
		filter = {
			event = "msg_show",
			kind = {
				"shell_out",
				"shell_err",
		},
	},
}

harogaston avatar Dec 08 '25 00:12 harogaston