8000 mini.nvim/doc/mini-basics.txt at main · W4RH4WK/mini.nvim · GitHub
[go: up one dir, main page]

Skip to content

Latest commit

 

History

History
356 lines (282 loc) · 12.1 KB

mini-basics.txt

File metadata and controls

356 lines (282 loc) · 12.1 KB
*MiniBasics.config.mappings*
# Mappings ~
Usage example: >lua
require('mini.basics').setup({
mappings = {
basic = true,
option_toggle_prefix = [[\]],
windows = true,
move_with_alt = true,
}
})
<
If you don't want only some mappings to be made at all, use |vim.keymap.del()|
after calling |MiniBasics.setup()|.
## mappings.basic ~
The `config.mappings.basic` creates mappings for certain commonly mapped actions
(judging by study of available Neovim pre-configurations and public dotfiles).
Some of the mappings override built-in ones to either improve their
behavior or override its default not very useful action.
It will only add a mapping if it wasn't manually created before.
Here is a table with created mappings : >
|Keys | Modes | Description |
|-------|-----------------|-----------------------------------------------|
| j | Normal, Visual | Move down by visible lines with no [count] |
| k | Normal, Visual | Move up by visible lines with no [count] |
| go | Normal | Add [count] empty lines after cursor |
| gO | Normal | Add [count] empty lines before cursor |
| gy | Normal, Visual | Copy to system clipboard |
| gp | Normal, Visual | Paste from system clipboard |
| gV | Normal | Visually select latest changed or yanked text |
| g/ | Visual | Search inside current visual selection |
| * | Visual | Search forward for current visual selection |
| # | Visual | Search backward for current visual selection |
| <C-s> | Normal, Visual, | Save and go to Normal mode |
| | Insert | |
<
Notes:
- See |[count]| for its meaning.
- On Neovim>=0.10 mappings for `#` and `*` are not created as their
enhanced variants are made built-in. See |v_star-default| and |v_#-default|.
## mappings.option_toggle_prefix ~
The `config.mappings.option_toggle_prefix` defines a prefix used for
creating mappings that toggle common options. The result mappings will be
`<prefix> + <suffix>`. For example, with default value, `\w` will toggle |wrap|.
Other viable choices for prefix are
- `,` (as a mnemonic for several values to toggle).
- `|` (as a same mnemonic).
- `yo` (used in 'tpope/vim-unimpaired')
- Something with |<Leader>| key, like `<Leader>t` (`t` for "toggle"). Note:
if your prefix contains `<Leader>` key, make sure to set it before
calling |MiniBasics.setup()| (as is done with default `basic` field of
|MiniBasics.config.options|).
After toggling, there will be a feedback about the current option value if
prior to `require('mini.basics').setup()` module wasn't silenced (see
"Silencing" section in |mini.basics|).
It will only add a mapping if it wasn't manually created before.
Here is a list of suffixes for created toggling mappings (all in Normal mode):
- `b` - |'background'|.
- `c` - |'cursorline'|.
- `C` - |'cursorcolumn'|.
- `d` - diagnostic (via |vim.diagnostic| functions).
- `h` - |'hlsearch'| (or |v:hlsearch| to be precise).
- `i` - |'ignorecase'|.
- `l` - |'list'|.
- `n` - |'number'|.
- `r` - |'relativenumber'|.
- `s` - |'spell'|.
- `w` - |'wrap'|.
## mappings.windows ~
The `config.mappings.windows` creates mappings for easiere window manipulation.
It will only add a mapping if it wasn't manually created before.
Here is a list with created Normal mode mappings (all mappings respect |[count]|):
- Window navigation:
- `<C-h>` - focus on left window (see |CTRL-W_H|).
- `<C-j>` - focus on below window (see |CTRL-W_J|).
- `<C-k>` - focus on above window (see |CTRL-W_K|).
- `<C-l>` - focus on right window (see |CTRL-W_L|).
- Window resize (all use arrow keys; variants of |resize|; all respect |[count]|):
- `<C-left>` - decrease window width.
- `<C-down>` - decrease window height.
- `<C-up>` - increase window height.
- `<C-right>` - increase window width.
## mappings.move_with_alt
The `config.mappings.move_with_alt` creates mappings for a more consistent
cursor move in Insert, Command, and Terminal modes. For example, it proves
useful in combination of autopair plugin (like |MiniPairs|) to move right
outside of inserted pairs (no matter what the pair is).
It will only add a mapping if it wasn't manually created before.
Here is a list of created mappings (`<M-x>` means `Alt`/`Meta` plus `x`):
- `<M-h>` - move cursor left. Modes: Insert, Terminal, Command.
- `<M-j>` - move cursor down. Modes: Insert, Terminal.
- `<M-k>` - move cursor up. Modes: Insert, Terminal.
- `<M-l>` - move cursor right. Modes: Insert, Terminal, Command.
*MiniBasics.config.autocommands*
# Autocommands ~
Usage example: >lua
require('mini.basics').setup({
autocommands = {
basic = true,
relnum_in_visual_mode = true,
}
})
<
## autocommands.basic ~
The `config.autocommands.basic` creates some common autocommands:
- Starts insert mode when opening terminal (see |startinsert| and |TermOpen|).
- Highlights yanked text for a brief period of time (see
|vim.highlight.on_yank()| and |TextYankPost|).
## autocommands.relnum_in_visual_mode ~
The `config.autocommands.relnum_in_visual_mode` creates autocommands that
enable |relativenumber| in linewise and blockwise Visual modes and disable
otherwise. See |ModeChanged|.
------------------------------------------------------------------------------
*MiniBasics.toggle_diagnostic()*
`MiniBasics.toggle_diagnostic`()
Toggle diagnostic for current buffer
This uses |vim.diagnostic| functions per buffer.
Return ~
`(string)` String indicator for new state. Similar to what |:set| `{option}?` shows.
vim:tw=78:ts=8:noet:ft=help:norl:
0