aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/doc/usr_05.txt24
1 files changed, 18 insertions, 6 deletions
diff --git a/runtime/doc/usr_05.txt b/runtime/doc/usr_05.txt
index 8f7e393c02..076a50c582 100644
--- a/runtime/doc/usr_05.txt
+++ b/runtime/doc/usr_05.txt
@@ -118,15 +118,27 @@ This switches on three very clever mechanisms:
*restore-cursor* *last-position-jump* >
- autocmd BufRead * autocmd FileType <buffer> ++once
- \ if &ft !~# 'commit\|rebase' && line("'\"") > 1 && line("'\"") <= line("$") | exe 'normal! g`"' | endif
+ augroup RestoreCursor
+ autocmd!
+ autocmd BufRead * autocmd FileType <buffer> ++once
+ \ let s:line = line("'\"")
+ \ | if s:line >= 1 && s:line <= line("$") && &filetype !~# 'commit'
+ \ && index(['xxd', 'gitrebase'], &filetype) == -1
+ \ | execute "normal! g`\""
+ \ | endif
+ augroup END
Another autocommand. This time it is used after reading any file. The
complicated stuff after it checks if the '" mark is defined, and jumps to it
-if so. The backslash at the start of a line is used to continue the command
-from the previous line. That avoids a line getting very long.
-See |line-continuation|. This only works in a Vim script file, not when
-typing commands at the command-line.
+if so. It doesn't do that for a commit or rebase message, which are likely
+a different one than last time, and when using xxd(1) to filter and edit
+binary files, which transforms input files back and forth, causing them to
+have dual nature, so to speak. See also |using-xxd|.
+
+The backslash at the start of a line is used to continue the command from the
+previous line. That avoids a line getting very long. See |line-continuation|.
+This only works in a Vim script file, not when typing commands at the
+command line.
>
command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis