Skip to content

Keymaps

Guennadi Maximov C edited this page Jul 2, 2026 · 13 revisions

With so many User Commands and extra stuff I think having keymaps to call them would be very convenient for some.


My Own Examples

In my own Neovim config I have the following keymaps:

local Project = require('project')

---@param maps table<'n'|'i'|'v'|'V'|'t'|'o'|'x', table<string, { [1]: string|function, [2]: vim.keymap.set.Opts }>>
local function map(maps)
  for mode, mapping in pairs(maps) do
    for lhs, spec in pairs(mapping) do
      vim.keymap.set(mode, lhs, spec[1], spec[2])
    end
  end
end


map({
  n = {
    ['<leader>ph'] = {
      function()
        vim.cmd.checkhealth('project')
      end,
      { desc = 'Attempt to run `:checkhealth project`' },
    },
    ['<leader>pC'] = { ':Project config<CR>', { desc = 'Print Project Config', ... } },
    ['<leader>pr'] = { ':Project recents<CR>', { desc = 'Print Recent Projects', ...} },
    ['<leader>pf'] = { ':Project fzf-lua<CR>', { desc = 'Run Fzf-Lua', ... } },
  },
})

<== Previous Entry | Index | Next Entry ==>

Clone this wiki locally