-
-
Notifications
You must be signed in to change notification settings - Fork 216
User Keybinds
core.keybinds
manages mappings for operations on or in .norg
files.
The core.keybinds
module configures an out-of-the-box Neovim experience by providing a default
set of keys.
To disable default keybinds, see the next section. To remap the existing keys, see here.
To find common problems, consult the FAQ.
By default when you load the core.keybinds
module all keybinds will be enabled. If you would like to change this, be sure to set default_keybinds
to false
:
["core.keybinds"] = {
config = {
default_keybinds = false,
},
}
To understand how to effectively remap keys, one must understand how keybinds are set.
Neorg binds actions to various <Plug>
mappings that look like so: <Plug>(neorg...
.
To remap a key, simply map an action somewhere in your configuration:
vim.keymap.set("n", "my-key-here", "<Plug>(neorg.pivot.list.toggle)", {})
Neorg will recognize that the key has been bound by you and not bind its own key.
This approach has a downside - all of Neorg's keybinds are set on a per-buffer basis so that keybinds don't "overflow" into buffers you don't want them active in.
When you map a key using vim.keymap.set
, you set a global key which is always active, even in non-norg
files. There are two ways to combat this:
- Create a file under
<your-configuration>/ftplugin/norg.lua
:vim.keymap.set("n", "my-key-here", "<Plug>(neorg.pivot.list.toggle)", { buffer = true })
- Create an autocommand using
vim.api.nvim_create_autocmd
:vim.api.nvim_create_autocmd("Filetype", { pattern = "norg", callback = function() vim.keymap.set("n", "my-key-here", "<Plug>(neorg.pivot.list.toggle)", { buffer = true }) end, })
Notice that in both situations a { buffer = true }
was supplied to the function.
This way, your remapped keys will never interfere with other files.
A comprehensive list of all keybinds can be found on this page!
Neorg refuses to bind keys when it knows they'll interfere with your configuration.
Run :checkhealth neorg
to see a full list of what keys Neorg has considered "conflicted"
or "rebound".
If you see that all of your keybinds are in conflict, you're likely using a plugin that is mapping to your
local leader key. This is a known issue with older versions of which-key.nvim
. Since version 3.0
of which-key the issue has been fixed - we
recommend updating to the latest version to resolve the errors.
core.autocommands
core.clipboard
core.clipboard.code-blocks
core.completion
core.concealer
core.defaults
core.dirman
core.dirman.utils
core.esupports.hop
core.esupports.indent
core.esupports.metagen
core.export
core.export.markdown
core.fs
core.highlights
core.integrations.coq_nvim
core.integrations.nvim-cmp
core.integrations.nvim-compe
core.integrations.treesitter
core.itero
core.journal
core.keybinds
core.latex.renderer
core.looking-glass
core.neorgcmd
core.neorgcmd.commands.return
core.pivot
core.presenter
core.promo
core.qol.toc
core.qol.todo_items
core.queries.native
core.scanner
core.storage
core.summary
core.syntax
core.tangle
core.tempus
core.text-objects
core.todo-introspector
core.ui
core.ui.calendar