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

bug: noice does not display regular messages in history #769

Closed
3 tasks done
ilan-schemoul opened this issue Apr 19, 2024 · 6 comments
Closed
3 tasks done

bug: noice does not display regular messages in history #769

ilan-schemoul opened this issue Apr 19, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@ilan-schemoul
Copy link

ilan-schemoul commented Apr 19, 2024

Did you check docs and existing issues?

  • I have read all the noice.nvim docs
  • I have searched the existing issues of noice.nvim
  • I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

0.9.5

Operating system/version

ubuntu 22.04

Describe the bug

When I type echo "test" then :Noice I don't see it in history despite the fact my filter is set to accept everything in the commands.history

Steps To Reproduce

:echo "test"
:echoerr "err"
:Noice
(you only see err not test)

Expected Behavior

test
err

Repro

-- DO NOT change the paths and don't remove the colorscheme
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", "https://github.com/folke/lazy.nvim.git", lazypath, })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  "folke/tokyonight.nvim",
  "folke/noice.nvim",
"MunifTanjim/nui.nvim",
  -- add any other plugins here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here
require('noice').setup(
{
    lsp = {
      progress = {
        enabled = false,
      },
      hover = {
        enabled = false,
      },
      signature = {
        enabled = false,
      },
    },
    messages = {
      view = "notify",
      view_error = "notify",
      enabled = true,
    },
    popupmenu = {
      enabled = false,
    },
    commands = {
      history = {
        -- options for the message history that you get with `:Noice`
        view = "split",
        opts = { enter = true, format = "details" },
        filter = {
            cond = function(_) return true end,
        },
      },
    },

    routes = {
      {
        filter = {
          event = "msg_show",
          kind = "",
          any = {

            { find = "no lines in buffer" },
            -- Edit
            { find = "%d+ less lines" },
            { find = "%d+ fewer lines" },
            { find = "%d+ more lines" },
            { find = "%d+ change;" },
            { find = "%d+ line less;" },
            { find = "%d+ more lines?;" },
            { find = "%d+ fewer lines;?" },
            { find = '".+" %d+L, %d+B' },
            { find = "%d+ lines yanked" },
            { find = "^Hunk %d+ of %d+$" },
            { find = "%d+L, %d+B$" },
            { find = "^[/?].*" }, -- Searching up/down
            { find = "E486: Pattern not found:" }, -- Searcingh not found
            { find = "%d+ changes?;" }, -- Undoing/redoing
            { find = "%d+ fewer lines" }, -- Deleting multiple lines
            { find = "%d+ more lines" }, -- Undoing deletion of multiple lines
            { find = "%d+ lines " }, -- Performing some other verb on multiple lines
            { find = "Already at newest change" }, -- Redoing
            { find = '"[^"]+" %d+L, %d+B' }, -- Saving

            -- Save
            { find = " bytes written" },

            -- Redo/Undo
            { find = " changes; before #" },
            { find = " changes; after #" },
            { find = "1 change; before #" },
            { find = "1 change; after #" },

            -- Yank
            { find = " lines yanked" },

            -- Move lines
            { find = " lines moved" },
            { find = " lines indented" },

            -- Bulk edit
            { find = " fewer lines" },
            { find = " more lines" },
            { find = "1 more line" },
            { find = "1 line less" },

            -- General messages
            { find = "Already at newest change" }, -- Redoing
            { find = "Already at oldest change" },
          },
        },
        opts = { skip = true },
      },
    },
}
)

Use case is for example if I git push I might have relevant information I need to copy paste (my git server gives me important URL I need to keep track of)

@ilan-schemoul ilan-schemoul added the bug Something isn't working label Apr 19, 2024
@ilan-schemoul
Copy link
Author

@folke this is a paint point at my current new job. I would really love if you can give me any help on that matter :) Maybe I just don't know how to config properly

@MatejBransky
Copy link

I have the same issue. Until then the :messages covers my needs. ☮️

@ilan-schemoul
Copy link
Author

I have the same issue. Until then the :messages covers my needs. ☮️

messages is when you echomsg I wish noice could save "echo" output too (as it already captures it to show it in nvim it could also add it to history)

@Sam-programs
Copy link
Contributor

Here is a workaround:

filter = {
    any = {
        { cond = function(_) return true end }
    },
},

The any table key is not cleared when cond is added, and I am not sure why.

@ilan-schemoul
Copy link
Author

```lua

      },
    },

    routes = {
      {
        filter = {
          event = "msg_show",
          kind = "",
          any = {

            { find = "no lines in buffer" },
            -- Edit
            { find = "%d+ less lines" },
            { find = "%d+ fewer lines" },
            { find = "%d+ more lines" },
            { find = "%d+ change;" },
            { find = "%d+ line less;" },
            { find = "%d+ more lines?;" },
            { find = "%d+ fewer lines;?" },
            { find = '".+" %d+L, %d+B' },
            { find = "%d+ lines yanked" },
            { find = "^Hunk %d+ of %d+$" },
            { find = "%d+L, %d+B$" },
            { find = "^[/?].*" }, -- Searching up/down
            { find = "E486: Pattern not found:" }, -- Searcingh not found
            { find = "%d+ changes?;" }, -- Undoing/redoing
            { find = "%d+ fewer lines" }, -- Deleting multiple lines
            { find = "%d+ more lines" }, -- Undoing deletion of multiple lines
            { find = "%d+ lines " }, -- Performing some other verb on multiple lines
            { find = "Already at newest change" }, -- Redoing
            { find = '"[^"]+" %d+L, %d+B' }, -- Saving

            -- Save
            { find = " bytes written" },

            -- Redo/Undo
            { find = " changes; before #" },
            { find = " changes; after #" },
            { find = "1 change; before #" },
            { find = "1 change; after #" },

            -- Yank
            { find = " lines yanked" },

            -- Move lines
            { find = " lines moved" },
            { find = " lines indented" },

            -- Bulk edit
            { find = " fewer lines" },
            { find = " more lines" },
            { find = "1 more line" },
            { find = "1 line less" },

            -- General messages
            { find = "Already at newest change" }, -- Redoing
            { find = "Already at oldest change" },
          },
        },
        opts = { skip = true },
      },
    },
}
)

Use case is for example if I git push I might have relevant information I need to copy paste (my git server gives me important URL I need to keep track of)

Oh yeah that dit the trick. When I do

filter = {
            cond = function(_) return true end,
        },

it didn't work but with

filter = {
    any = {
        { cond = function(_) return true end }
    },
},

it does work surprisingly

The any table key is not cleared when cond is added, and I am not sure why.

I am not sure to understand what you mean as I do not know the internals but without any it doesn't work but with any it does work

@folke
Copy link
Owner

folke commented May 15, 2024

The Noice default view mimics :messages. There you also wouldn't find the echos.

I just added another default command Noice all, to show all the things.

To show all messages always, this is indeed a good approach:

filter = {
    any = {
        { cond = function(_) return true end }
    },
},

@folke folke closed this as completed May 15, 2024
adoyle-h added a commit to adoyle-h/noice.nvim that referenced this issue May 15, 2024
* up/main:
  fix(messages): include any messages before Noice was started as one history_show message. Fixes folke#799
  feat(config): added `Noice all` to show ALL messages captured by Noice. See folke#769
  chore(main): release 2.0.3 (folke#800)
  chore(build): auto-generate vimdoc
  fix(nui): safely destroy any create window/buffers during E565 errors. Fixes command preview
  fix(hacks): use feedkeys instead of input to force redraw
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
Development

Successfully merging a pull request may close this issue.

4 participants