Tips: don't lose selection when shifting sidewards

This commit is contained in:
Marco Hinz 2016-01-06 03:22:35 +01:00
parent feb724995f
commit 906a2f4344
2 changed files with 15 additions and 3 deletions

View File

@ -6,16 +6,14 @@ All notable changes to this project will be documented in this file.
### Added
- Basics: [Quickfix and location lists?](README.md#quickfix-and-location-lists)
- Quirks: [Newline used for NUL](README.md#newline-used-for-nul)
- Plugins: [New section "Commenters"](README.md#commenters)
- Plugins: [New section "Misc"](README.md#misc)
- Plugins: [New section "Tmux"](README.md#tmux)
- 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 add empty lines](README.md#quickly-add-empty-lines)
- Tips: [Don't lose selection when shifting sidewards](README.md#dont-lose-selection-when-shifting-sidewards)
## [1.0] - 2016-01-06
First release!

View File

@ -20,6 +20,7 @@
- [Saner behavior of n and N](#saner-behavior-of-n-and-n)
- [Quickly move current line](#quickly-move-current-line)
- [Quickly add empty lines](#quickly-add-empty-lines)
- [Don't lose selection when shifting sidewards](#dont-lose-selection-when-shifting-sidewards)
#### [Debugging](#debugging-1)
- [General tips](#general-tips)
@ -381,6 +382,19 @@ nnoremap [<space> :put! =''<cr>
nnoremap ]<space> :put =''<cr>
```
#### Don't lose selection when shifting sidewards
If you select one or more lines, you can use `<` and `>` for shifting them
sidewards. Unfortunately you immediately lose the selection afterwards.
You can use `gv` to reselect the last selection (see `:h gv`), thus you can work
around it like this:
```viml
xnoremap < <gv
xnoremap > >gv
```
Now you can use `>>>>>` on your visual selection without any problems.
## Debugging
#### General tips