mirror of
				https://github.com/mhinz/vim-galore.git
				synced 2025-11-04 20:05:36 +08:00 
			
		
		
		
	Tips: saner behavior of n and N
This commit is contained in:
		@@ -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!
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										16
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								README.md
									
									
									
									
									
								
							@@ -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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user