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

error notice when using hot key #208

Closed
fan-xing opened this issue Nov 9, 2022 · 2 comments · Fixed by #639
Closed

error notice when using hot key #208

fan-xing opened this issue Nov 9, 2022 · 2 comments · Fixed by #639
Labels
bug Something isn't working

Comments

@fan-xing
Copy link

fan-xing commented Nov 9, 2022

Describe the bug
when i use hot key to save my file,i get an error notice and the command was executed

Which version of Neovim are you using?
Nightly

To Reproduce
hot key like this

noremap <C-s> :<C-U><C-R>=printf("w")<CR><CR>

if i use the cmdline to input :w, there's no error

Config

lua << EOF
local noice = require("noice")
noice.setup({
  cmdline = {
    format = {
      cmdline = { pattern = "^:", icon = "💬 ", lang = "vim" },
      search_down = { kind = "search", pattern = "^/", icon = "🔍 ", lang = "regex" },
      search_up = { kind = "search", pattern = "^%?", icon = "🔍 ", lang = "regex" },
    }
  },
})
EOF

Screenshots

image

Noice Log
image

@fan-xing fan-xing added the bug Something isn't working label Nov 9, 2022
@folke folke closed this as completed in a8402e8 Nov 9, 2022
@folke
Copy link
Owner

folke commented Nov 9, 2022

The issue was cause by quickly opening and closing the cmdline. It's fixed now, but better to use the following mappings instead:

vim.keymap.set("i", "<C-s>", "<cmd>:w<cr><esc>")
vim.keymap.set("n", "<C-s>", "<cmd>:w<cr><esc>")

The <cmd> is specially made to prevent opening the cmdline

image

@fan-xing
Copy link
Author

fan-xing commented Nov 9, 2022

Thank you, i'll try it

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.

2 participants