mirror of
https://github.com/ksyasuda/dotfiles.git
synced 2025-12-05 02:53:38 -08:00
update docstrings
This commit is contained in:
@@ -13,6 +13,10 @@ vim.g.mapleader = " "
|
|||||||
vim.g.maplocalleader = ","
|
vim.g.maplocalleader = ","
|
||||||
|
|
||||||
-- Create a custom command with the given trigger, command, and description
|
-- Create a custom command with the given trigger, command, and description
|
||||||
|
--- @param trigger string The command trigger
|
||||||
|
--- @param command string The command to execute
|
||||||
|
--- @param description string Description of the command
|
||||||
|
--- @return nil
|
||||||
function create_custom_command(trigger, command, description)
|
function create_custom_command(trigger, command, description)
|
||||||
vim.api.nvim_create_user_command(trigger, command, { desc = description })
|
vim.api.nvim_create_user_command(trigger, command, { desc = description })
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,6 +2,13 @@ local M = {}
|
|||||||
local map = vim.keymap.set
|
local map = vim.keymap.set
|
||||||
local opts = { noremap = true, silent = true }
|
local opts = { noremap = true, silent = true }
|
||||||
|
|
||||||
|
--- Set keybindings from a table of mappings.
|
||||||
|
--- @param bindings table A list of keybinding mappings.
|
||||||
|
--- Each mapping should be a table with the following keys:
|
||||||
|
--- - mode: string, the mode in which the keybinding applies (e.g., 'n', 'i', 'v').
|
||||||
|
--- - key: string, the key to bind.
|
||||||
|
--- - cmd: string, the command to execute when the key is pressed.
|
||||||
|
--- - opts: table, optional, additional options for the keybinding (default:
|
||||||
function M.set_keybindings(bindings)
|
function M.set_keybindings(bindings)
|
||||||
for _, binding in ipairs(bindings) do
|
for _, binding in ipairs(bindings) do
|
||||||
map(binding.mode, binding.key, binding.cmd, binding.opts or opts)
|
map(binding.mode, binding.key, binding.cmd, binding.opts or opts)
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ local whichkey = require("which-key")
|
|||||||
vim.notify = require("notify")
|
vim.notify = require("notify")
|
||||||
|
|
||||||
---Helper function to add mappings to which-key
|
---Helper function to add mappings to which-key
|
||||||
---@parm mappings table : List of mappings to add to which-key
|
---@param mappings table List of mappings to add
|
||||||
---@parm group table : Group to add mappings to (optional)
|
---@param group table Group to add mappings to (optional)
|
||||||
---@return nil
|
---@return nil
|
||||||
---@usage addToWhichKey(mappings, group)
|
---@usage addToWhichKey(mappings, group)
|
||||||
---@example addToWhichKey({{key = "n", cmd = "next", mode = "n", desc = "Next Line", group = "Navigation"}, {key = "t", group = "example"})
|
---@example addToWhichKey({{key = "n", cmd = "next", mode = "n", desc = "Next Line", group = "Navigation"}, {key = "t", group = "example"})
|
||||||
|
|||||||
Reference in New Issue
Block a user