Neovim 哪个键警告

问题描述 投票:0回答:1

我已经整理了自己的 neovim 配置,可以从我的 GitHub 存储库中获取和设置

https://github.com/tahseenjamal/tazvim

我一直在尝试找出

which-key
警告背后的问题,但到目前为止还无法解决。

我的Neovim使用

checkhealth
的警告日志如下

--

which-key: require("which-key.health").check()

- OK Most of these checks are for informational purposes only.
  WARNINGS should be treated as a warning, and don't necessarily indicate a problem with your config.
  Please |DON't| report these warnings as an issue.

Checking your config ~
- OK |mini.icons| is installed
- OK |nvim-web-devicons| is installed

Checking for issues with your mappings ~
- WARNING You're using an old version of the which-key spec.
  Your mappings will work, but it's recommended to update them to the new version.
  Please check the docs and suggested spec below for more info.
  Mappings: >
  {
    ["<leader>rn"] = { "<cmd>lua vim.lsp.buf.rename()<CR>", "Rename Symbol" },
    K = { "<cmd>lua vim.lsp.buf.hover()<CR>", "Hover Documentation" },
    g = {
      d = { "<cmd>lua vim.lsp.buf.definition()<CR>", "Go to Definition" },
      i = { "<cmd>lua vim.lsp.buf.implementation()<CR>", "Go to Implementation" },
      name = "Go"
    },
    gk = { "<cmd>lua vim.lsp.buf.signature_help()<CR>", "Signature Help" },
    noremap = true,
    silent = true
  }
  
  -- Suggested Spec:
  {
    { "<leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", desc = "Rename Symbol", remap = false },
    { "K", "<cmd>lua vim.lsp.buf.hover()<CR>", desc = "Hover Documentation", remap = false },
    { "g", group = "Go", remap = false },
    { "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", desc = "Go to Definition", remap = false },
    { "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", desc = "Go to Implementation", remap = false },
    { "gk", "<cmd>lua vim.lsp.buf.signature_help()<CR>", desc = "Signature Help", remap = false },
  }

checking for overlapping keymaps ~
- WARNING In mode `n`, <gc> overlaps with <gcc>:
  - <gc>: Toggle comment
  - <gcc>: Comment toggle current line
- WARNING In mode `n`, <yS> overlaps with <ySS>:
  - <yS>: Add a surrounding pair around a motion, on new lines (normal mode)
  - <ySS>: Add a surrounding pair around the current line, on new lines (normal mode)
- WARNING In mode `n`, <ys> overlaps with <yss>:
  - <ys>: Add a surrounding pair around a motion (normal mode)
  - <yss>: Add a surrounding pair around the current line (normal mode)
- OK Overlapping keymaps are only reported for informational purposes.
  This doesn't necessarily mean there is a problem with your config.

Checking for duplicate mappings ~
- OK No duplicate mappings found
neovim key-bindings neovim-plugin
1个回答
0
投票

正如警告所示:

{
    ["<leader>rn"] = { "<cmd>lua vim.lsp.buf.rename()<CR>", "Rename Symbol" },
    K = { "<cmd>lua vim.lsp.buf.hover()<CR>", "Hover Documentation" },
    g = {
      d = { "<cmd>lua vim.lsp.buf.definition()<CR>", "Go to Definition" },
      i = { "<cmd>lua vim.lsp.buf.implementation()<CR>", "Go to Implementation" },
      name = "Go"
    },
    gk = { "<cmd>lua vim.lsp.buf.signature_help()<CR>", "Signature Help" },
    noremap = true,
    silent = true
  }
  
  

您应该将 lua/core/plugin_config/which-key.lua 中的这些行替换为:

-- Suggested Spec:
  {
    { "<leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", desc = "Rename Symbol", remap = false },
    { "K", "<cmd>lua vim.lsp.buf.hover()<CR>", desc = "Hover Documentation", remap = false },
    { "g", group = "Go", remap = false },
    { "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", desc = "Go to Definition", remap = false },
    { "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", desc = "Go to Implementation", remap = false },
    { "gk", "<cmd>lua vim.lsp.buf.signature_help()<CR>", desc = "Signature Help", remap = false },
  }

另请参阅官方页面中的映射部分,因为他们也提到了这种格式。

另外,我想你的 wk.register 也已被弃用并被

取代
wk.add

这是此 github 线程的链接

© www.soinside.com 2019 - 2024. All rights reserved.