Tips: quickly edit your macros

This commit is contained in:
Marco Hinz 2016-01-06 03:34:48 +01:00
parent 906a2f4344
commit 98c42ddb77
2 changed files with 14 additions and 0 deletions

View File

@ -13,6 +13,7 @@ All notable changes to this project will be documented in this file.
- Tips: [Saner behavior of n and N](README.md#saner-behavior-of-n-and-n) - Tips: [Saner behavior of n and N](README.md#saner-behavior-of-n-and-n)
- Tips: [Quickly move current line](README.md#quickly-move-current-line) - Tips: [Quickly move current line](README.md#quickly-move-current-line)
- Tips: [Quickly add empty lines](README.md#quickly-add-empty-lines) - Tips: [Quickly add empty lines](README.md#quickly-add-empty-lines)
- Tips: [Quickly edit your macros](README.md#quickly-edit-your-macros)
- Tips: [Don't lose selection when shifting sidewards](README.md#dont-lose-selection-when-shifting-sidewards) - Tips: [Don't lose selection when shifting sidewards](README.md#dont-lose-selection-when-shifting-sidewards)
## [1.0] - 2016-01-06 ## [1.0] - 2016-01-06

View File

@ -20,6 +20,7 @@
- [Saner behavior of n and N](#saner-behavior-of-n-and-n) - [Saner behavior of n and N](#saner-behavior-of-n-and-n)
- [Quickly move current line](#quickly-move-current-line) - [Quickly move current line](#quickly-move-current-line)
- [Quickly add empty lines](#quickly-add-empty-lines) - [Quickly add empty lines](#quickly-add-empty-lines)
- [Quickly edit your macros](#quickly-edit-your-macros)
- [Don't lose selection when shifting sidewards](#dont-lose-selection-when-shifting-sidewards) - [Don't lose selection when shifting sidewards](#dont-lose-selection-when-shifting-sidewards)
#### [Debugging](#debugging-1) #### [Debugging](#debugging-1)
@ -382,6 +383,18 @@ nnoremap [<space> :put! =''<cr>
nnoremap ]<space> :put =''<cr> nnoremap ]<space> :put =''<cr>
``` ```
#### Quickly edit your macros
This is a real gem! The mapping takes a register (or `*` by default) and opens
it in the cmdline-window. Hit `<cr>` when you're done editing for setting the
register.
I often use this to correct typos I did while recording a macro.
```viml
nnoremap <leader>m :<c-u><c-r>='let @'. v:register .' = '. string(getreg(v:register))<cr><c-f><left>
```
Use it like this `<leader>m` or `"q<leader>m`.
#### Don't lose selection when shifting sidewards #### Don't lose selection when shifting sidewards
If you select one or more lines, you can use `<` and `>` for shifting them If you select one or more lines, you can use `<` and `>` for shifting them