Move to next/previous line with same indentation
From Vim Tips Wiki
(Redirected from VimTip103)
[edit] Duplicate tip
This tip is very similar to the following:
These tips need to be merged – see the merge guidelines.
Tip 103 • Previous Tip • Next Tip
Created: August 22, 2001 Complexity: intermediate Author: Paul Wright Minimum version: 6.0 Karma: 89/31 Imported from: Tip#103
When working with Python and other languages which don't use braces, it's useful to be able to jump to and from lines which have the same indentation as the line you are currently on.
nn <M-,> k:call search ("^". matchstr (getline (line (".")+ 1), '\(\s*\)') ."\\S", 'b')<CR>^
nn <M-.> :call search ("^". matchstr (getline (line (".")), '\(\s*\)') ."\\S")<CR>^
will map Alt-< and Alt-> in Normal mode to upward and downward searching for lines with the same indent as the current line.
[edit] Comments
Categories: Duplicate | Review | VimTip | Indenting
