Skip to content

How do you filter messages (not using noice) #329

@NullVoxPopuli

Description

@NullVoxPopuli

I'm using packer.nvim, and have this setup:

  local originalNotify = vim.notify
  use {
    'rcarriga/nvim-notify',
    config = function()
      vim.keymap.set('n', '<leader>m', '<cmd>lua require("telescope").extensions.notify.notify()<cr>',
        { silent = true, noremap = true })

      print('overriding vim.notify')

      vim.notify = function(msg, level, opts)
        if string.find(msg, "Neo") and string.find(msg, "tree") then
          print('ya')
          return originalNotify(msg, level, opts)
        end
        print('no')

        require("notify")(msg, level, opts)
      end
      require('notify').setup()
    end

  }

and when booting, I see that "overriding vim.notify" prints, but then doesn't get called.

To test I've been doing :lua vim.notify('[Neo-tree]'), and success is when I don't see an nvim-notify toast message -- but this has yet to happen.

sometimes the conents of the custom function print, and other times they don't.

feels like a race condition between me setting vim.notify and nvim-notify setting it.

what is the proper way to filter messages?

Related: nvim-neo-tree/neo-tree.nvim#1790

This is a silly default
image

See also:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions