From d0cbb36a444e05fd147f2bdd6bd2572ef846c38b Mon Sep 17 00:00:00 2001 From: Fabrice Mouhartem Date: Wed, 11 Dec 2024 15:49:07 +0100 Subject: [PATCH] refactor(neorg): replace `vim.api.nvim_set_keymap` with `vim.keymap.set` `vim.keymap.set` is more lua-friendly --- lua/neorg-configure.lua | 46 ++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/lua/neorg-configure.lua b/lua/neorg-configure.lua index bcfa2d9..6ca3ef9 100644 --- a/lua/neorg-configure.lua +++ b/lua/neorg-configure.lua @@ -1,4 +1,4 @@ ---vim.api.nvim_set_keymap('', 'à', '', { noremap = true, silent = true }) +--vim.keymap.set('', 'à', '', { noremap = true, silent = true }) local neorgroup = vim.api.nvim_create_augroup("neorg", { clear = true }) vim.api.nvim_create_autocmd({ "FileType" }, { @@ -8,30 +8,30 @@ vim.api.nvim_create_autocmd({ "FileType" }, { vim.g.maplocalleader = ' ' vim.o.conceallevel = 2 vim.o.foldlevelstart = 99 - vim.api.nvim_set_keymap("n", "nr", ":Neorg return", + vim.keymap.set("n", "nr", ":Neorg return", { noremap = true, silent = true, desc = "[N]eorg [R]eturn" }) -- Neorg Telescope - vim.api.nvim_set_keymap("n", "nh", "(neorg.telescope.search_headings)", + vim.keymap.set("n", "nh", "(neorg.telescope.search_headings)", { noremap = true, silent = true, desc = "[N]eorg search [H]eading" }) - vim.api.nvim_set_keymap("n", "nb", "(neorg.telescope.backlinks.file_backlinks)", + vim.keymap.set("n", "nb", "(neorg.telescope.backlinks.file_backlinks)", { noremap = true, silent = true, desc = "[N]eorg file [B]acklinks" }) - vim.api.nvim_set_keymap("n", "", "(neorg.telescope.insert_link)", + vim.keymap.set("n", "", "(neorg.telescope.insert_link)", { noremap = true, silent = true, desc = "Neorg insert [L]ink" }) -- Tasks - vim.api.nvim_set_keymap("n", "td", "(neorg.qol.todo-items.todo.task-done)", + vim.keymap.set("n", "td", "(neorg.qol.todo-items.todo.task-done)", { noremap = true, silent = true, desc = "[T]ask [D]one" }) - vim.api.nvim_set_keymap("n", "tu", "(neorg.qol.todo-items.todo.task-undone)", + vim.keymap.set("n", "tu", "(neorg.qol.todo-items.todo.task-undone)", { noremap = true, silent = true, desc = "[T]ask [U]ndone" }) - vim.api.nvim_set_keymap("n", "tp", "(neorg.qol.todo-items.todo.task-pending)", + vim.keymap.set("n", "tp", "(neorg.qol.todo-items.todo.task-pending)", { noremap = true, silent = true, desc = "[T]ask [P]ending" }) - vim.api.nvim_set_keymap("n", "th", "(neorg.qol.todo-items.todo.task-on_hold)", + vim.keymap.set("n", "th", "(neorg.qol.todo-items.todo.task-on_hold)", { noremap = true, silent = true, desc = "[T]ask on [H]old" }) - vim.api.nvim_set_keymap("n", "tc", "(neorg.qol.todo-items.todo.task-cancelled)", + vim.keymap.set("n", "tc", "(neorg.qol.todo-items.todo.task-cancelled)", { noremap = true, silent = true, desc = "[T]ask on [C]ancelled" }) - vim.api.nvim_set_keymap("n", "tr", "(neorg.qol.todo-items.todo.task-recurring)", + vim.keymap.set("n", "tr", "(neorg.qol.todo-items.todo.task-recurring)", { noremap = true, silent = true, desc = "[T]ask on [R]ecurring" }) - vim.api.nvim_set_keymap("n", "ti", "(neorg.qol.todo-items.todo.task-important)", + vim.keymap.set("n", "ti", "(neorg.qol.todo-items.todo.task-important)", { noremap = true, silent = true, desc = "[T]ask on [I]mportant" }) end, }) @@ -54,27 +54,27 @@ require('which-key').add { { "ne_", hidden = true }, } -vim.api.nvim_set_keymap("n", "ni", ":Neorg index", +vim.keymap.set("n", "ni", ":Neorg index", { noremap = true, silent = true, desc = "[N]eorg [I]ndex" }) -vim.api.nvim_set_keymap("n", "nm", ":Neorg inject-metadata", +vim.keymap.set("n", "nm", ":Neorg inject-metadata", { noremap = true, silent = true, desc = "[N]eorg insert [M]etadata" }) -vim.api.nvim_set_keymap("n", "nj", ":Neorg journal toc open", +vim.keymap.set("n", "nj", ":Neorg journal toc open", { noremap = true, silent = true, desc = "[N]eorg [J]ournal" }) -vim.api.nvim_set_keymap("n", "nt", ":Neorg journal today", +vim.keymap.set("n", "nt", ":Neorg journal today", { noremap = true, silent = true, desc = "[N]eorg [T]oday" }) -vim.api.nvim_set_keymap("n", "ns", ":Neorg journal tomorrow", +vim.keymap.set("n", "ns", ":Neorg journal tomorrow", { noremap = true, silent = true, desc = "Neorg tomorrow" }) -vim.api.nvim_set_keymap("n", "ny", ":Neorg journal yesterday", +vim.keymap.set("n", "ny", ":Neorg journal yesterday", { noremap = true, silent = true, desc = "[N]eorg [Y]esterday" }) -vim.api.nvim_set_keymap("n", "neo", ":e /tmp/neorg-export.md", +vim.keymap.set("n", "neo", ":e /tmp/neorg-export.md", { noremap = true, silent = true, desc = "[N]eorg [E]xport [O]pen" }) -vim.api.nvim_set_keymap("n", "nee", ":Neorg export to-file /tmp/neorg-export.md", +vim.keymap.set("n", "nee", ":Neorg export to-file /tmp/neorg-export.md", { noremap = true, silent = true, desc = "[N]eorg [E]xport Predefined" }) -vim.api.nvim_set_keymap("n", "nef", ":Neorg export to-file ", +vim.keymap.set("n", "nef", ":Neorg export to-file ", { noremap = true, silent = true, desc = "[N]eorg [E]xport [F]ile" }) -vim.api.nvim_set_keymap("n", "nl", "(neorg.telescope.find_linkable)", +vim.keymap.set("n", "nl", "(neorg.telescope.find_linkable)", { noremap = true, silent = true, desc = "[N]eorg find [L]inkable" }) -vim.api.nvim_set_keymap("n", "nf", "(neorg.telescope.find_norg_files)", +vim.keymap.set("n", "nf", "(neorg.telescope.find_norg_files)", { noremap = true, silent = true, desc = "[N]eorg find [F]ile" }) vim.keymap.set("n", "n/", live_grep_neorg, { noremap = true, silent = true, desc = "[N]eorg Live Grep" })