diff runtime/doc/usr_50.txt @ 29269:0fdf36de4018

Update runtime files Commit: https://github.com/vim/vim/commit/8cc5b559f70041361612b8a6a87922503b33baa6 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jun 23 13:04:20 2022 +0100 Update runtime files
author Bram Moolenaar <Bram@vim.org>
date Thu, 23 Jun 2022 14:15:04 +0200
parents c58baa6d6dda
children dc4de65a7fb7
line wrap: on
line diff
--- a/runtime/doc/usr_50.txt
+++ b/runtime/doc/usr_50.txt
@@ -1,4 +1,4 @@
-*usr_50.txt*	For Vim version 8.2.  Last change: 2022 Jun 03
+*usr_50.txt*	For Vim version 8.2.  Last change: 2022 Jun 20
 
 		     VIM USER MANUAL - by Bram Moolenaar
 
@@ -116,26 +116,13 @@ we'll explain that further down.
 ==============================================================================
 *50.3*	Restoring the view
 
-Sometimes you want to make a change and go back to where the cursor was.
-Restoring the relative position would also be nice, so that the same line
-appears at the top of the window.
-
-This example yanks the current line, puts it above the first line in the file
-and then restores the view: >
-
-	map ,p ma"aYHmbgg"aP`bzt`a
+Sometimes you want to jump around, make a change and then go back to the same
+position and view.  For example to change something in the file header.  This
+can be done with two functions: >
 
-What this does: >
-	ma"aYHmbgg"aP`bzt`a
-<	ma			set mark a at cursor position
-	  "aY			yank current line into register a
-	     Hmb		go to top line in window and set mark b there
-		gg		go to first line in file
-		  "aP		put the yanked line above it
-		     `b		go back to top line in display
-		       zt	position the text in the window as before
-			 `a	go back to saved cursor position
-
+	var view = winsaveview()
+	# Move around, make changes
+	winrestview(view)
 
 ==============================================================================