which-key.nvim icon indicating copy to clipboard operation
which-key.nvim copied to clipboard

Question: Bindings Neorg

Open twoeightdev opened this issue 3 years ago • 3 comments

Hi first thanks for the awesome work. 😊

how can i bind neorg in which-key? here is the default mappings for neorg.

for example, i want this bind in which-key

{ leader .. "nn", "core.norg.dirman.new.note" },

i tried this but it's not working.

n = {
    name = "neorg",
    n = { "<cmd>core.norg.dirman.new.note", "new notes" },

twoeightdev avatar Feb 24 '22 23:02 twoeightdev

Don't really know how those should be called by I spot an error in the last line

n = { "<cmd>core.norg.dirman.new.note", "new notes" },

should be

n = { "<cmd>core.norg.dirman.new.note<cr>", "new notes" },

also if its a plugin/lua module maybe you wish to type something like this

n = { "<cmd>lua require('core.norg.dirman.new.note')<cr>", "new notes" },

Hope that helps

Looooopy avatar Feb 25 '22 19:02 Looooopy

@hoaxdream you should just add a label and not the mappings themselfs

max397574 avatar Apr 28 '22 09:04 max397574

I'm working through, trying to figure out the same thing right now... this is my current config.

            ["core.keybinds"] = {
                config = {
                    hook = function(keybinds)
                      local status_ok, which_key = pcall(require, "which-key")
                      if not status_ok then
                        return
                      end

                      which_key.register({
                        t = {
                          name = "GTD Base",
                          c = { "<Cmd>Neorg keybind norg core.gtd.base.capture<CR>", "Capture"},
                          v = { "<Cmd>Neorg keybind norg core.gtd.base.views<CR>", "Views"},
                          e = { "<Cmd>Neorg keybind norg core.gtd.base.edit<CR>", "Edit"},
                        },
                        m = {
                          name = "Neorg",
                          h = { ":Neorg mode traverse-heading<CR>", "Traverse Heading"},
                          n = { ":Neorg mode norg<CR>", "Neorg Mode"},
                          t = { "<Cmd>Neorg keybind norg core.norg.concealer.toggle-markup<CR>", "Toggle Markup"},
                        },
                        n = {
                          name = "Note",
                          n = { "<Cmd>Neorg keybind norg core.norg.dirman.new.note<CR>", "New Note"},
                        },
                      },
                        { prefix = "," }
                      )
                      which_key.register({
                          name = "Note",
                          l = { "<Cmd>Neorg keybind norg core.integrations.telescope.find_linkable<CR>", "Find Linkable"},
                          p = { ":Neorg presenter start<cr>", "Find Linkable"},
                      },
                      { prefix = "<Space>" }
                      )
                      which_key.register({
                          name = "Note",
                          ["<C-L>"] = { "<Cmd>Neorg keybind norg core.integrations.telescope.insert_link<CR>", "Insert Link"},
                          ["<C-s>"] = { ":w<CR>", "Save"},
                      })
                      which_key.register({
                          name = "Note",
                          t = {
                            name = "Neorg Task Motions",
                            r = { "<Cmd>Neorg keybind norg core.norg.qol.todo_items.todo.task_recurring<CR>", "Task Recurring"},
                            c = { "<Cmd>Neorg keybind norg core.norg.qol.todo_items.todo.task_cancelled<CR>", "Task Cancelled"},
                            i = { "<Cmd>Neorg keybind norg core.norg.qol.todo_items.todo.task_important<CR>", "Task Important"},
                            h = { "<Cmd>Neorg keybind norg core.norg.qol.todo_items.todo.task_on_hold<CR>", "Task On Hold"},
                            p = { "<Cmd>Neorg keybind norg core.norg.qol.todo_items.todo.task_pending<CR>", "Task Pending"},
                            u = { "<Cmd>Neorg keybind norg core.norg.qol.todo_items.todo.task_undone<CR>", "Task Pending"},
                            d = { "<Cmd>Neorg keybind norg core.norg.qol.todo_items.todo.task_done<CR>", "Task Done"},
                          }
                      },
                        { prefix = "g" }
                      )
                      keybinds.unmap("norg", "n", "<C-s>")
                    end,
                }
            },

It seems to work.. but I am running into an issue where I have a grouped at <leader>p else where in my config and I was hoping to override that in .norg files.. but running into problems with it now..

usmcamp0811 avatar Jul 31 '22 02:07 usmcamp0811