jakewvincent / mkdnflow.nvim

Fluent navigation and management of markdown notebooks
GNU General Public License v3.0
683 stars 41 forks source link

Feature: Assign multiple bindings to a single command, depending on mode #210

Open diegovskytl opened 6 months ago

diegovskytl commented 6 months ago

It would be neat to be able to assigne two or three bindings to a single command, depending on neovim's mode; my attemped config is stated below, but the binding ends up disabled completely. Obviosuly, writing the binding in separate lines makes that only the last one is read.

    mappings = {
        MkdnFoldSection = { "n", "<M-f>" },
-- something like this
        MkdnToggleToDo = { { "i", "n" }, { "<M-ñ>", "ñ" } },
        MkdnTab = { "i", "<Tab>" },
    },

Also tried to implement a buffer-only keymap using on_attach but it did not work:

  on_attach = function(bufnr)
       local map = vim.keymap.set
      local opts = { buffer = bufnr }
      map("n", "<M-l>", "<Esc>I<Tab><Esc>A<Esc>", opts)
      map("n", "<M-h>", "<Esc>I<BS><Esc>A<Esc>", opts)
  end,