mirror of
https://github.com/mhinz/vim-galore.git
synced 2025-02-24 01:59:28 +08:00
Mappings: improve description
This commit is contained in:
parent
59d09df076
commit
17a0474ba0
33
README.md
33
README.md
@ -285,17 +285,18 @@ buffer.
|
||||
#### Mappings?
|
||||
|
||||
You can define your own mappings with the `:map` family of commands. Each
|
||||
command of that family defines a mapping for a certain set of modes.
|
||||
Technically Vim comes with a whopping 12 modes, 6 of them can be mapped:
|
||||
command of that family defines a mapping for a certain set of modes. Technically
|
||||
Vim comes with a whopping 12 modes, 6 of them can be mapped. Additionally, some
|
||||
commands act on multiple modes at once.
|
||||
|
||||
| Recursive | Non-recursive | Modes |
|
||||
|-----------|---------------|----------------------------------|
|
||||
| `:map` | `:noremap` | normal, visual, operator-pending |
|
||||
| `:nmap` | `:nnoremap` | normal |
|
||||
| `:xmap` | `:xnoremap` | visual |
|
||||
| `:cmap` | `:cnoremap` | command-line |
|
||||
| `:omap` | `:onoremap` | operator-pending |
|
||||
| `:imap` | `:inoremap` | insert |
|
||||
| Recursive | Non-recursive | Unmap | Modes |
|
||||
|-----------|---------------|-----------|----------------------------------|
|
||||
| `:map` | `:noremap` | `:unmap` | normal, visual, operator-pending |
|
||||
| `:nmap` | `:nnoremap` | `:nunmap` | normal |
|
||||
| `:xmap` | `:xnoremap` | `:xunmap` | visual |
|
||||
| `:cmap` | `:cnoremap` | `:cunmap` | command-line |
|
||||
| `:omap` | `:onoremap` | `:ounmap` | operator-pending |
|
||||
| `:imap` | `:inoremap` | `:iunmap` | insert |
|
||||
|
||||
E.g. this defines the mapping for normal mode only:
|
||||
|
||||
@ -303,6 +304,11 @@ E.g. this defines the mapping for normal mode only:
|
||||
:nmap <space> :echo "foo"<cr>
|
||||
```
|
||||
|
||||
Unmap it again by using `:nunmap <space>`.
|
||||
|
||||
For a few more but rather uncommon modes (or combinations of them), see `:h
|
||||
map-modes`.
|
||||
|
||||
So far, so good. There's only one problem that can be pretty confusing to
|
||||
beginners: `:nmap` is _recursive_! That is, the right-hand side takes other
|
||||
mappings into account.
|
||||
@ -334,6 +340,13 @@ instead:
|
||||
Rule of thumb: Always use non-recursive mappings unless recursing is actually
|
||||
desired.
|
||||
|
||||
Look up your mappings by not giving a right-hand side. E.g. `:nmap` shows all
|
||||
normal mappings and `:nmap <leader>` shows all normal mappings that start with
|
||||
the mapleader.
|
||||
|
||||
If you want to disable a standard mapping, map them to the special `<nop>`
|
||||
character, e.g. `:noremap <left> <nop>`.
|
||||
|
||||
#### Mapleader?
|
||||
|
||||
The mapleader is simply a placeholder than can be used with custom mappings and
|
||||
|
Loading…
x
Reference in New Issue
Block a user