-
|
The link mentioned in wiki is not working - https://github.com/nvim-neorg/neorg/wiki/User-Keybinds I pretty much want to use default keybinds, but one of them is in conflict with my bindings. How to unset it? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
|
Oh goodness, our automatic wiki generation removed our manually written entries. We'll have to restore them and make the docgen not remove them hah. Sorry about that! We'll try fixing the problem when we can (I can't guarantee it'll be today tho, sorry) Unsetting a keybind is complex, simply because Neorg's keybind system is heavily due for a rewrite. It wasn't designed particularly well from a user configuration standpoint. You would quite literally have to create a callback where you rebind all keys and remove that single key from the entire list. If you really need that rebind then here are the steps:
require("neorg.callbacks").on_event("core.keybinds.events.enable_keybinds", function(_, keybinds)
-- Map all the below keybinds only when the "norg" mode is active
keybinds.map_event_to_mode("norg", {
n = { -- Bind keys in normal mode
-- Keys for managing TODO items and setting their states
{ "gtu", "core.norg.qol.todo_items.todo.task_undone" },
{ "gtp", "core.norg.qol.todo_items.todo.task_pending" },
{ "gtd", "core.norg.qol.todo_items.todo.task_done" },
{ "gth", "core.norg.qol.todo_items.todo.task_on_hold" },
{ "gtc", "core.norg.qol.todo_items.todo.task_cancelled" },
{ "gtr", "core.norg.qol.todo_items.todo.task_recurring" },
{ "gti", "core.norg.qol.todo_items.todo.task_important" },
{ "<C-Space>", "core.norg.qol.todo_items.todo.task_cycle" },
-- Keys for managing GTD
{ neorg_leader .. "tc", "core.gtd.base.capture" },
{ neorg_leader .. "tv", "core.gtd.base.views" },
{ neorg_leader .. "te", "core.gtd.base.edit" },
-- Keys for managing notes
{ neorg_leader .. "nn", "core.norg.dirman.new.note" },
{ "<CR>", "core.norg.esupports.hop.hop-link" },
{ "<M-CR>", "core.norg.esupports.hop.hop-link", "vsplit" },
{ "<M-k>", "core.norg.manoeuvre.item_up" },
{ "<M-j>", "core.norg.manoeuvre.item_down" },
-- mnemonic: markup toggle
{ neorg_leader .. "mt", "core.norg.concealer.toggle-markup" },
{ "<C-s>", "core.integrations.telescope.find_linkable" },
},
o = {
{ "ah", "core.norg.manoeuvre.textobject.around-heading" },
{ "ih", "core.norg.manoeuvre.textobject.inner-heading" },
{ "at", "core.norg.manoeuvre.textobject.around-tag" },
{ "it", "core.norg.manoeuvre.textobject.inner-tag" },
{ "al", "core.norg.manoeuvre.textobject.around-whole-list" },
},
i = {
{ "<C-l>", "core.integrations.telescope.insert_link" },
},
}, {
silent = true,
noremap = true,
})
-- Map the below keys only when traverse-heading mode is active
keybinds.map_event_to_mode("traverse-heading", {
n = {
-- Rebind j and k to move between headings in traverse-heading mode
{ "j", "core.integrations.treesitter.next.heading" },
{ "k", "core.integrations.treesitter.previous.heading" },
},
}, {
silent = true,
noremap = true,
})
keybinds.map_event_to_mode("toc-split", {
n = {
{ "<CR>", "core.norg.qol.toc.hop-toc-link" },
-- Keys for closing the current display
{ "q", "core.norg.qol.toc.close" },
{ "<Esc>", "core.norg.qol.toc.close" },
},
}, {
silent = true,
noremap = true,
nowait = true,
})
-- Map the below keys on gtd displays
keybinds.map_event_to_mode("gtd-displays", {
n = {
{ "<CR>", "core.gtd.ui.goto_task" },
-- Keys for closing the current display
{ "q", "core.gtd.ui.close" },
{ "<Esc>", "core.gtd.ui.close" },
{ "e", "core.gtd.ui.edit_task" },
{ "<Tab>", "core.gtd.ui.details" },
},
}, {
silent = true,
noremap = true,
nowait = true,
})
-- Map the below keys on presenter mode
keybinds.map_event_to_mode("presenter", {
n = {
{ "<CR>", "core.presenter.next_page" },
{ "l", "core.presenter.next_page" },
{ "h", "core.presenter.previous_page" },
-- Keys for closing the current display
{ "q", "core.presenter.close" },
{ "<Esc>", "core.presenter.close" },
},
}, {
silent = true,
noremap = true,
nowait = true,
})
-- Apply the below keys to all modes
keybinds.map_to_mode("all", {
n = {
{ neorg_leader .. "mn", ":Neorg mode norg<CR>" },
{ neorg_leader .. "mh", ":Neorg mode traverse-heading<CR>" },
},
}, {
silent = true,
noremap = true,
})
end)From here you can remove the keybind that's being problematic. Soz again for the inconvenience, we are gonna fix it soon! |
Beta Was this translation helpful? Give feedback.
-
local prefix_norg_bind = "Neorg keybind norg core.norg.qol.todo_items.todo.task_"
vim.keymap.set("n", "<space>gtu", function()
vim.cmd(([[%s%s]]):format(prefix_norg_bind, "undone"))
end, {
buffer = true,
silent = true,
desc = "toggle undone",
})
|
Beta Was this translation helpful? Give feedback.

Oh goodness, our automatic wiki generation removed our manually written entries. We'll have to restore them and make the docgen not remove them hah. Sorry about that! We'll try fixing the problem when we can (I can't guarantee it'll be today tho, sorry)
Unsetting a keybind is complex, simply because Neorg's keybind system is heavily due for a rewrite. It wasn't designed particularly well from a user configuration standpoint. You would quite literally have to create a callback where you rebind all keys and remove that single key from the entire list.
If you really need that rebind then here are the steps:
d…