Tips: saner behavior of n and N

This commit is contained in:
Marco Hinz 2016-01-06 02:57:50 +01:00
parent e7a8012675
commit 57d58172ef
2 changed files with 20 additions and 0 deletions

View File

@ -6,11 +6,15 @@ 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)
## [1.0] - 2016-01-06
First release!

View File

@ -16,6 +16,9 @@
- [Managing plugins](#managing-plugins)
- [Block insert](#block-insert)
#### [Tips](#tips-1)
- [Saner behavior of n and N](#saner-behavior-of-n-and-n)
#### [Debugging](#debugging-1)
- [General tips](#general-tips)
- [Profiling startup time](#profiling-startup-time)
@ -345,6 +348,19 @@ but quickly becomes second nature.
If you want to get real fancy, have a look at
[multiple-cursors](https://github.com/terryma/vim-multiple-cursors).
## Tips
#### Saner behavior of n and N
The direction of `n` and `N` depends on whether `/` or `?` was used for
searching forward or backward respectively. This is pretty confusing to me.
If you want `n` to always search forward and `N` backward, use this:
```viml
nnoremap <expr> n 'Nn'[v:searchforward].'zvzz'
nnoremap <expr> N 'nN'[v:searchforward].'zvzz'
```
## Debugging
#### General tips