在我的init。我有:
require("base") -- general settings
require("highlights") -- colourscheme and other highlights
require("keymaps") -- keymaps
require("plugins") -- plugins
require("hop") -- hop
require("bootstrap") -- packer auto-installer
print("✔ nvim loaded")
print(vim.inspect(package.loaded['hop']))
在基地。我有:
local g = vim.g
local o = vim.o
local opt = vim.opt
-- Map <leader> to space
g.mapleader = ' '
g.maplocalleader = ' '
键盘映射。我有:
map("n", "<leader>w", ":HopWord<cr>")
map("n", "<leader>W", ":HopWordMW<cr>")
map("n", "f", ":HopChar1<cr>")
map("n", "F", ":HopChar1CurrentLine<cr>")
插件。我有:
-- ...packer setup
local status, packer = pcall(require, "packer")
if not status then
return
end
return packer.startup(function(use)
use {
'phaazon/hop.nvim',
branch = 'v2', -- optional but strongly recommended
-- config = [[require('hop')]],
-- config = function()
-- -- you can configure Hop the way you like here; see :h hop-config
-- require'hop'.setup {}
-- end
}
if packer_bootstrap then
require("packer").sync()
end
end)
最后,in hop。我有:
local setup, hop = pcall(require, "hop")
if not setup then
return
end
hop.setup { keys = "etovxqpdygfblzhckisuran" }
当我加载vscode时,我看到以下输出:
✔ nvim loaded
true
nil
true来自init。但是,当我按下<space>w
时,我得到了错误:
E492: Not an editor command: HopWord
这意味着跳命令没有加载?请帮助。我想要一个easymotion风格的导航流vscode neovim,它注释了按空格键后跳转到的地方。
看我这张票的反应。除了绑定keybind之外,它似乎不需要太多配置,因为hop在默认情况下不配置任何配置。