-
NeoVIM Version: 9.0 Almost complete in my migration from packer to lazy.nvim, and this appears to be the only issue that is preventing completion. Since, I am so new to neovim, especially in lua, I was a little lost on how I would move my migration over. I am not currently receiving any errors, except for the fact it isn't registering any of my mappings. So, for lazy.nvim, the file that manages my keymaps is as follows. (continued below) return {
-- {
-- "numToStr/Comment.nvim",
-- config = function()
-- require("Comment").setup({
-- mappings = {
-- extra = false,
-- },
-- pre_hook = function(ctx)
-- local U = require("Comment.utils")
-- local location = nil
-- if ctx.ctype == U.ctype.block then
-- location = require("ts_context_commentstring.utils").get_cursor_location()
-- elseif ctx.cmotion == U.cmotion.v or ctx.cmotion == U.cmotion.V then
-- location = require("ts_context_commentstring.utils").get_visual_start_location()
-- end
-- return require("ts_context_commentstring.internal").calculate_commentstring({
-- key = ctx.ctype == U.ctype.line and "__default" or "__multiline",
-- location = location,
-- })
-- end,
-- })
-- end,
-- },
{
"folke/which-key.nvim",
lazy = false,
dependencies = {
{
"mrjones2014/legendary.nvim",
dependencies = {
{ "kkharji/sqlite.lua" },
{ "stevearc/dressing.nvim" },
},
},
},
opts = {
window = {
border = "rounded", -- none, single, double, shadow
padding = { 2, 2, 2, 2 }, -- extra window padding [top, right, bottom, left]
winblend = 0,
},
},
config = function()
local wk = require("which-key")
require("legendary").setup({ which_key = { auto_register = true } })
wk.register({
opts = {
mode = "n", -- NORMAL mode
prefix = "<leader>",
buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings
silent = true, -- use `silent` when creating keymaps
noremap = true, -- use `noremap` when creating keymaps
nowait = true, -- use `nowait` when creating keymaps
},
mappings = {
-- ======================= with leader ============================================
["a"] = { "<cmd>Alpha<cr>", "Alpha" },
["b"] = {
"<cmd>lua require('telescope.builtin').buffers(require('telescope.themes').get_dropdown{previewer = false})<cr>",
"Buffers",
},
['"'] = { "<cmd>peekup_open<cr>", "Peekup Open" },
["e"] = { "<cmd>NvimTreeToggle<cr>", "Explorer" },
["W"] = { "<cmd>w!<CR>", "Save" },
["Q"] = { "<cmd>q!<CR>", "Quit" },
["C"] = { "<cmd>bdelete!<CR>", "Close Buffer" },
["h"] = { "<cmd>nohlsearch<CR>", "No Highlight" },
["S"] = {
"<cmd>lua require('telescope.builtin').find_files(require('telescope.themes').get_dropdown{previewer = false})<cr>",
"Find files",
},
["F"] = { "<cmd>Telescope live_grep theme=ivy<cr>", "Find Text" },
--[[ ["p"] = { "<cmd>lua require('telescope').extensions.projects.projects()<cr>", "Projects" }, ]]
["T"] = { "<cmd>:ASToggle<cr>", "Toggle auto save" },
["V"] = { "<cmd>:HSHighlight<cr>", "Highlight selection" },
["U"] = { "<cmd>:HSRmHighlight<cr>", "Remove highlight from selection" },
-- ========================= Groups ===================================================
A = {
name = "Align",
a = { "<cmd>lua require('align').align_to_char(1, true)<cr>", "align to 1 character left" },
s = { "<cmd>lua require('align').align_to_char(2, true, true)<cr>", "alignt to 2 characters left" },
w = { "<cmd>lua require('align').align_to_string(false, true, true)<cr>", "align to string left" },
r = {
"<cmd>lua require('align').align_to_string(true, true, true)<cr>",
"align to lua pattern left",
},
},
-- aclbox and accbox removed.
c = {
name = "Comment-Box",
f = {
name = "Fixed Size",
l = {
name = "Box: Left Aligned",
l = { "<cmd>lua require('comment-box').llbox()<cr>", "Left Aligned, Left Text" },
c = { "<cmd>lua require('comment-box').lcbox()<cr>", "Left Aligned, Center Text" },
r = { "<cmd>lua require('comment-box').lrbox()<cr>", "Left Aligned, Right Text" },
},
c = {
name = "Box: Center Aligned",
l = { "<cmd>lua require('comment-box').clbox()<cr>", "Center Aligned, Left Text" },
c = { "<cmd>lua require('comment-box').ccbox()<cr>", "Center Aligned, Center Text" },
r = { "<cmd>lua require('comment-box').crbox()<cr>", "Center Aligned, Right Text" },
},
r = {
name = "Box: Right Aligned",
l = { "<cmd>lua require('comment-box').rlbox()<cr>", "Right Aligned, Left Text" },
c = { "<cmd>lua require('comment-box').rcbox()<cr>", "Right Aligned, Center Text" },
r = { "<cmd>lua require('comment-box').rrbox()<cr>", "Right Aligned, Right Text" },
},
},
a = {
name = "Adaptive Size",
l = { "<cmd>lua require('comment-box').albox()<cr>", "Left Aligned, Adapted size" },
c = { "<cmd>lua require('comment-box').acbox()<cr>", "Center Aligned, Adapted size" },
r = { "<cmd>lua require('comment-box').arbox()<cr>", "Right Aligned, Adapted size" },
},
l = {
name = "Line",
l = { "<cmd>lua require('comment-box).line()<cr>", "Left Aligned Line" },
c = { "<cmd>lua require('comment-box').cline()<cr>", "Center Aligned Line" },
},
},
f = {
name = "Files",
w = { "<cmd>hide edit /home/vassilios/Sandbox/wiki/README.md<cr>", "Open Wiki" },
i = { "<cmd>hide edit /home/vassilios/.config/nvim/init.lua<cr>", "Open Nvim Init" },
},
-- i = {
-- name = "Pommodoro",
--[[ w = { "<cmd>lua require 'pom' <cr>", "" }, ]]
--[[ w = { pc('start("work")'), "Start Pommodoro" }, ]]
--[[ s = { pc('start("short_break")'), "Short Break" }, ]]
--[[ l = { pc('start("long_break")'), "Long Break" }, ]]
--[[ p = { pc("toggle_pause()"), "Toggle Pause" }, ]]
--[[ c = { pc("close()"), "Close" }, ]]
-- },
l = {
name = "LSP",
a = { "<cmd>lua vim.lsp.buf.code_action()<cr>", "Code Action" },
d = { "<cmd>Telescope lsp_document_diagnostics<cr>", "Document Diagnostics" },
w = { "<cmd>Telescope lsp_workspace_diagnostics<cr>", "Workspace Diagnostics" },
f = { "<cmd>lua vim.lsp.buf.format { async=true }<cr>", "Format" },
i = { "<cmd>LspInfo<cr>", "Info" },
I = { "<cmd>LspInstallInfo<cr>", "Installer Info" },
j = { "<cmd>lua vim.lsp.diagnostic.goto_next()<CR>", "Next Diagnostic" },
k = { "<cmd>lua vim.lsp.diagnostic.goto_prev()<cr>", "Prev Diagnostic" },
l = { "<cmd>lua vim.lsp.codelens.run()<cr>", "CodeLens Action" },
q = { "<cmd>lua vim.lsp.diagnostic.set_loclist()<cr>", "Quickfix" },
r = { "<cmd>lua vim.lsp.buf.rename()<cr>", "Rename" },
s = { "<cmd>Telescope lsp_document_symbols<cr>", "Document Symbols" },
S = { "<cmd>Telescope lsp_dynamic_workspace_symbols<cr>", "Workspace Symbols" },
},
m = {
name = "Markdown Table",
f = { "<cmd>lua require('tablemd').format()<cr>", "Format Table" },
c = { "<cmd>lua require('tablemd').insertColumn(false)<cr>", "Insert Column" },
d = { "<cmd>lua require('tablemd').deleteColumn()<cr>", "Delete Current Column" },
r = { "<cmd>lua require('tablemd').insertRow(false)<cr>", "Insert Row Below" },
R = { "<cmd>lua require('tablemd').insertRow(true)<cr>", "Insert Row Above" },
j = { "<cmd>lua require('tablemd').alignColumn('left')<cr>", "Align Left" },
k = { "<cmd>lua require('tablemd').alignColumn('center')<cr>", "Align Center" },
l = { "<cmd>lua require('tablemd').alignColumn('right')<cr>", "Alignt Right" },
},
N = {
name = "nnn",
n = { "<cmd>NnnExplorer<CR>", "Toggle nnn" },
p = { "<cmd>NnnPicker<CR>", "Toggle picker" },
},
o = {
name = "org",
a = { "<cmd>lua require('orgmode').org.agenda<cr>", "Org Agenda" },
c = { "<cmd>lua require('orgmode').org.capture<cr>", "Org Capture" },
},
r = {
name = "Substitute",
o = { "<cmd>lua require('substitute').operator()<cr>", "Substitute Operator" },
l = { "<cmd>lua require('substitute').line()<cr>", "Substitute Line" },
e = { "<cmd>lua require('substitute').eol()<cr>", "Substitute EOL" },
v = { "<cmd>lua require('substitute').visual()<cr>", "Substitute Visual" },
},
s = {
name = "Telescope",
B = { "<cmd>Telescope git_branches<cr>", "Checkout branch" },
c = { "<cmd>Telescope colorscheme<cr>", "Colorscheme" },
x = { "<cmd>Telescope file_browser<cr>", "File Browser" },
h = { "<cmd>Telescope help_tags<cr>", "Find Help" },
l = { "<cmd>Legendary<cr>", "Legendar" },
M = { "<cmd>Telescope man_pages<cr>", "Man Pages" },
p = { "<cmd>Telescope projects<cr>", "Projects" },
r = { "<cmd>Telescope oldfiles<cr>", "Open Recent File" },
R = { "<cmd>Telescope registers<cr>", "Registers" },
k = { "<cmd>Telescope keymaps<cr>", "Keymaps" },
C = { "<cmd>Telescope commands<cr>", "Commands" },
f = { "<cmd>lua require('telescope-builtin').find_files()<cr>", "Find Files" },
g = { "<cmd>lua require('telescope-builtin').live_grep()<cr>", "Live Grep" },
b = { "<cmd>lua require('telescope-builtin').buffers()<cr>", "Show Buffers" },
n = { "<cmd>lua require('telescope-builtin').help_tags()<cr>", "Help tags" },
},
t = {
name = "Nvim-tree",
t = { "<cmd>NvimTreeToggle<cr>", "Open or Close tree" },
f = { "<cmd>NvimTreeFocus<cr>", "Open and Focus" },
s = { "<cmd>NvimTreeFindFile<cr>", "Traverse to Open File" },
c = { "<cmd>NvimTreeCollapse<cr>", "Collapse all" },
},
x = {
name = "Terminal",
n = { "<cmd>lua _NODE_TOGGLE()<cr>", "Node" },
u = { "<cmd>lua _NCDU_TOGGLE()<cr>", "NCDU" },
t = { "<cmd>lua _HTOP_TOGGLE()<cr>", "Htop" },
p = { "<cmd>lua _PYTHON_TOGGLE()<cr>", "Python" },
f = { "<cmd>ToggleTerm direction=float<cr>", "Float" },
h = { "<cmd>ToggleTerm size=10 direction=horizontal<cr>", "Horizontal" },
v = { "<cmd>ToggleTerm size=80 direction=vertical<cr>", "Vertical" },
},
w = {
name = "Web Tools",
s = { "<cmd>BrowserSync<cr>", "Start BrowserSync Server" },
p = { "<cmd>BrowserOpen<cr>", "Preview file, start server" },
r = { "<cmd>BrowserPreview<cr>", "Preview file, no start" },
x = { "<cmd>BrowserStop<cr>", "Restart BrowserSync" },
t = { "<cmd>TagRename<cr>", "Rename html tag" },
},
z = {
name = "True Zen",
n = { "<cmd>TZNarrow<cr>", "True Zen Narrow" },
v = { "<cmd>'<,'>TZNarrow<cr>", "True Zen Fine Narrow" },
f = { "<cmd>TZFocus<cr>", "True Zen Focus" },
m = { "<cmd>TZMinimalist<cr>", "True Zen Minimalist" },
a = { "<cmd>TZAtaraxis<cr>", "True Zen Ataraxis" },
},
}
})
end,
},
}
Note: Uncommenting It appears pretty straight forward, and there is nothing evident that prevents it from loading. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Are you setting your |
Beta Was this translation helpful? Give feedback.
@folke Don't ask me why or how, but I resolved the issue. I noticed the leader key was not being used to prefix the commands, so I added
prefix = "<leader"
to the registration command. Viola.I had moved around the configuration a little, which now reads:
(Warning! The below example facilitates ascii text)