From 57d58172ef9689bc10dd324e774f98dc22b0f7ac Mon Sep 17 00:00:00 2001 From: Marco Hinz Date: Wed, 6 Jan 2016 02:57:50 +0100 Subject: [PATCH] Tips: saner behavior of n and N --- CHANGELOG.md | 4 ++++ README.md | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fcdcae0..ccbecf5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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! diff --git a/README.md b/README.md index 0716571..3a04f83 100644 --- a/README.md +++ b/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 n 'Nn'[v:searchforward].'zvzz' +nnoremap N 'nN'[v:searchforward].'zvzz' +``` + ## Debugging #### General tips