diff --git a/docs/configuration/keybindings.md b/docs/configuration/keybindings.md index d89572a1..50a6bba5 100644 --- a/docs/configuration/keybindings.md +++ b/docs/configuration/keybindings.md @@ -169,3 +169,47 @@ To change the terminal mapping: ```lua lvim.builtin.terminal.open_mapping = "" ``` + +Create custom terminal commands by extending the `lvim.builtin.terminal.terminals` table. +`size` is specified as a percentage of the buffer size, with `size = 1` equivalent to fullscreen. +The `desc` parameter will display in Whichkey for mappings starting with ``. Other values are passed to `toggleterm:new` + +The built-in terminals can be overridden or modified with the following code: + +```lua +lvim.builtin.terminal.terminals = { + { keymap = "", direction = "horizontal" }, + { keymap = "", direction = "vertical" }, + { keymap = "", direction = "float" }, + { keymap = "gg", cmd = "lazygit", size= 1 }, +} +``` +To create user-defined terminals, simply extend the `lvim.builtin.terminal.terminals` table, as shown in this example: + +```lua +local terminals = { + { keymap = "u", cmd = "sudo dmesg | less", desc = "Show Kernel Logs", size = 1 }, + { keymap = "h", cmd = "htop", desc = "Interactive System Monitor", size = 0.8 }, + { keymap = "", cmd = "neofetch", close_on_exit = false, direction = "horizontal", size = 0.6 }, + { + keymap = "os", + direction = "vertical", + cmd = "docker ps", + desc = "List Docker Containers", + close_on_exit = false, + persist_mode = false, + size = 0.3, + }, +} +vim.list_extend(lvim.builtin.terminal.terminals, terminals) +``` + +Default values for the terminals can be found in `lvim.builtin.terminal.terminals_defaults`: +```lua +lvim.builtin.terminal.terminals_defaults = { + -- `cmd` defaults to `lvim.builtin.terminal.shell` + direction = "horizontal", + horizontal_size = 0.3, + vertical_size = 0.4, +} +```