- This neovim plugin let's you create keybindings with the following features:
- By default, each keybinding must be unique and subsequent mappings won't override current ones.
- Let's you search through all keybindings created using the plugin and jump to where it was created. If you want to view all keybindings, use
:map
- Neovim 0.8.0+ required
{
"cronJohn/keytex.nvim",
dependencies = { "nvim-lua/plenary.nvim" }
}
use {
"cronJohn/keytex.nvim"
requires = { {"nvim-lua/plenary.nvim"} }
}
- Setup is done automatically
require('keytex.keybindings').create_keybinding(<mode>, <key>, <action>, <vks_opt>, <usr_opt>)
creates a unique keybinding- You can also set
require('keytex.keybindings').create_keybinding
to something likem
and call it likem(...)
vks_opt
is an optional table ofvim.keymap.set
options (|:map-arguments|)usr_opt
is an optional table to control function behaviormark
(boolean): If true, add the keybinding to the global list without attempting to create it (default: false).output
(boolean): If true, print keybinding creation status to the console (default: false).
- You can also set
-
require('keytex.keybindings').create_keybinding('n', '<leader>ph', ':lua print("hey")<CR>')
- Prints
hey
in normal mode whenever<leader>ph
is pressed
- Prints
-
require('keytex.keybindings').create_keybinding({'n', 'v'}, '<leader>ph', ':lua print("hey")<CR>')
- Prints
hey
in both normal and visual mode whenever<leader>ph
is pressed
- Prints
-
require('keytex.keybindings').create_keybinding('n', '<leader>ao', someFunc)
- Runs
someFunc
whenever<leader>ao
is pressed in normal mode
- Runs
-
require('keytex.keybindings').create_keybinding('n', key, someFunc, {desc = 'Foo Bar'})
- Creates a normal mode keybinding with a description of
Foo Bar
- Creates a normal mode keybinding with a description of
-
require('keytex.keybindings').create_keybinding('n', key, someFunc, {}, {output=true})
- Attempts to create this keybinding and logs, i.e.,
print
s whether it was successful or not
- Attempts to create this keybinding and logs, i.e.,
-
require('keytex.keybindings').create_keybinding('n', key, someFunc, {unique = false})
- Creates a normal mode keybinding using
key
andsomeFunc
regardless if it exists or not
- Creates a normal mode keybinding using
require('keytex.finder').keybinding_picker(<filter>, <opts>)
opens a telescope window and filters using key by defaultfilter
changes the filtering method when set to the following strings:mode
: Filters by the mode it is in (e.g., normal, visual, insert).key
: Filters by the key combination (default).action
: Filters by what the keybinding maps to.description
: Filters by the description of the keybinding.source
: Filters by the file where the keybinding is defined.line
: Filters by the line number where the keybinding is located.
opts
is an optional table of additional options for telescope
require('keytex.finder').keybinding_picker('mode')
searches all keybindings based on the mode- Typing something like
n
would only show all normal mode keybindings
- Typing something like
- Add ability to specify format string to change how you want the finder to display values
- Allow changes to persist (via writing to config)
- Have keytex loaded before even the plugin manager is configured or asap