folke / noice.nvim

💥 Highly experimental plugin that completely replaces the UI for messages, cmdline and the popupmenu.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bug: redirected/captured `:map` output is missing new lines

ashb opened this issue · comments

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 release

Operating system/version

macOS 14.4.1

Describe the bug

When noice captures the output of :map command it isn't as readable as normal -- it's missing a lot of line breaks.

Steps To Reproduce

  1. nvim -u minimal.lua
  2. Run :map
  3. See if the output is readable.

I'm not sure if it's relevant or not, but running this lua snippet maintains the newlines etc: :lua= vim.api.nvim_exec2(':map', {output=true}).output

Expected Behavior

Normal output of :map command with nvim -u NONE:

x  #           * y?\V<C-R>"<CR>
                 Nvim builtin
n  &           * :&&<CR>
                 Nvim builtin
x  *           * y/\V<C-R>"<CR>
                 Nvim builtin
n  Y           * y$
                 Nvim builtin
n  <C-L>       * <Cmd>nohlsearch|diffupdate|normal! <C-L><CR>
                 Nvim builtin

Actual output is missing the linebreaks (There are more maps here cos this has the minimal example config from below):

10:21:47 msg_show   map x  #           * y?\V<C-R>"<CR>
                 Nvim builtino  %             <Plug>(MatchitOperationForward)x  %             <Plug>(MatchitVisualForward)n  %             <Plug>(MatchitNormalForward)n  &           * :&&<CR>
                 Nvim builtinx  *           * y/\V<C-R>"<CR>
                 Nvim builtinn  Y           * y$
                 Nvim builtino  [%            <Plug>(MatchitOperationMultiBackward)x  [%            <Plug>(MatchitVisualMultiBackward)n  [%            <Plug>(MatchitNormalMultiBackward)o  ]%            <Plug>(MatchitOperationMultiForward)x  ]%            <Plug>(MatchitVisualMultiForward)n  ]%            <Plug>(MatchitNormalMultiForward)x  a%            <Plug>(MatchitVisualTextObject)x  gx            <Plug>NetrwBrowseXVisn  gx            <Plug>NetrwBrowseXo  g%            <Plug>(MatchitOperationBackward)x  g%            <Plug>(MatchitVisualBackward)n  g%            <Plug>(MatchitNormalBackward)x  <Plug>NetrwBrowseXVis * :<C-U>call netrw#BrowseXVis()<CR>n  <Plug>NetrwBrowseX * :call netrw#BrowseX(netrw#GX(),netrw#CheckIfRemote(netrw#GX()))<CR>x  <Plug>(MatchitVisualTextObject)   <Plug>(MatchitVisualMultiBackward)o<Plug>(MatchitVisualMultiForward)o  <Plug>(MatchitOperationMultiForward) * :<C-U>call matchit#MultiMatch("W",  "o")<CR>o  <Plug>(MatchitOperationMultiBackward) * :<C-U>call matchit#MultiMatch("bW", "o")<CR>x  <Plug>(MatchitVisualMultiForward) * :<C-U>call matchit#MultiMatch("W",  "n")<CR>m'gv``x  <Plug>(MatchitVisualMultiBackward) * :<C-U>call matchit#MultiMatch("bW", "n")<CR>m'gv``n  <Plug>(MatchitNormalMultiForward) * :<C-U>call matchit#MultiMatch("W",  "n")<CR>n  <Plug>(MatchitNormalMultiBackward) * :<C-U>call matchit#MultiMatch("bW", "n")<CR>o  <Plug>(MatchitOperationBackward) * :<C-U>call matchit#Match_wrapper('',0,'o')<CR>o  <Plug>(MatchitOperationForward) * :<C-U>call matchit#Match_wrapper('',1,'o')<CR>x  <Plug>(MatchitVisualBackward) * :<C-U>call matchit#Match_wrapper('',0,'v')<CR>m'gv``x  <Plug>(MatchitVisualForward) * :<C-U>call matchit#Match_wrapper('',1,'v')<CR>:if col("''") != col("$") | exe ":normal! m'" | endif<CR>gv``n  <Plug>(MatchitNormalBackward) * :<C-U>call matchit#Match_wrapper('',0,'n')<CR>n  <Plug>(MatchitNormalForward) * :<C-U>call matchit#Match_wrapper('',1,'n')<CR>n  <C-L>       * <Cmd>nohlsearch|diffupdate|normal! <C-L><CR>
Screenshot 2024-04-30 at 10 22 06

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", -- Just to rule out vim-notify as the problem
    },
  },
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

-- add anything else here
vim.opt.termguicolors = true
vim.cmd([[colorscheme tokyonight]])
require("noice").setup({
      presets = {
        bottom_search = true, -- 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 = true, -- enables an input dialog for inc-rename.nvim
        lsp_doc_border = true, -- add a border to hover docs and signature help
      },
    }
)
commented

This issue was fixed in nightly, NVIM v0.10.0.

Cool, guess I'll just live with it for now then