aboutsummaryrefslogtreecommitdiff
path: root/doc/keep_position.txt
diff options
context:
space:
mode:
Diffstat (limited to 'doc/keep_position.txt')
-rw-r--r--doc/keep_position.txt18
1 files changed, 16 insertions, 2 deletions
diff --git a/doc/keep_position.txt b/doc/keep_position.txt
index 6f1d516..05f69bc 100644
--- a/doc/keep_position.txt
+++ b/doc/keep_position.txt
@@ -15,8 +15,22 @@ COMMANDS *keep_position-commands*
*:KeepPosition*
Run the given command while preserving the cursor position and window view.
-Works rather like |:keepalt| or |:keepjumps|.
-
+Works rather like |:keepalt| or |:keepjumps|. It's good for filters,
+especially ones that work on the entire buffer:
+>
+ :KeepPosition %!tidy
+<
+You will generally want to use this command as above, without a range.
+However, if you do specify a range, it will only preserve the view if the last
+change to the buffer--presumably made by your nominated command--entirely
+encompassed the given range. This is checked with the |'[| and |']| marks.
+
+The author uses the range functionality to make a "conditional jump"; only
+jump to the changes the given command makes if it didn't affect the entire
+buffer, e.g.:
+>
+ :nnoremap u :<C-U>%KeepPosition undo<CR>
+<
AUTHOR *keep_position-author*
Written and maintained by Tom Ryder <tom@sanctum.geek.nz>.