In my init.lua I have:
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']))
In base.lua, I have:
local g = vim.g
local o = vim.o
local opt = vim.opt
-- Map <leader> to space
g.mapleader = ' '
g.maplocalleader = ' '
In keymaps.lua, I have:
map("n", "<leader>w", ":HopWord<cr>")
map("n", "<leader>W", ":HopWordMW<cr>")
map("n", "f", ":HopChar1<cr>")
map("n", "F", ":HopChar1CurrentLine<cr>")
In plugins.lua, I have:
-- ...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)
And finally, in hop.lua I have:
local setup, hop = pcall(require, "hop")
if not setup then
return
end
hop.setup { keys = "etovxqpdygfblzhckisuran" }
When I load vscode, I see the following output:
✔ nvim loaded
true
nil
The true is from the init.lua and means that hop was loaded, however, when I then press <space>w
, I get the error:
E492: Not an editor command: HopWord
which means the hop commands did not load? Please help. I would like an easymotion style navigation flow for vscode neovim where it annotates places to jump to after pressing the spacebar.