Hi,
`:help restore-cursor` (in usr_05.txt) says:
autocmd BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
and `:help last-position-jump` (in eval.txt) says:
:au BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") && &ft !~# 'commit'
\ | exe "normal! g`\""
\ | endif
Both say almost the same thing. And the actual definition in the
defaults.vim is similar to the latter one but slightly different:
autocmd BufReadPost *
\ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit'
\ | exe "normal! g`\""
\ | endif
`line("'\"") > 1` is changed to `line("'\"") >= 1`.
My suggestion is updating `:h restore-cursor` to the actual definition and
remove the duplicated description from eval.txt.
Please check the attached patch.
Another concerning: `:help 05.2` explains each line in vimrc_example.vim,
however some of the part is now in the defaults.vim. The section needs to
be updated.
Regards,
Ken Takata
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
# HG changeset patch
# Parent f04235f716311cb049107df6a7c24cf87887c25b
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -6048,13 +6048,9 @@ line({expr}) The result is a Number, whi
line(".") line number of the cursor
line("'t") line number of mark t
line("'" . marker) line number of mark marker
-< *last-position-jump*
- This autocommand jumps to the last known position in a file
- just after opening it, if the '" mark is set: >
- :au BufReadPost *
- \ if line("'\"") > 1 && line("'\"") <= line("$") && &ft !~# 'commit'
- \ | exe "normal! g`\""
- \ | endif
+<
+ To jump to the last known position in a file just after
+ opening it, see |last-position-jump|.
line2byte({lnum}) *line2byte()*
Return the byte count from the start of the buffer for line
diff --git a/runtime/doc/usr_05.txt b/runtime/doc/usr_05.txt
--- a/runtime/doc/usr_05.txt
+++ b/runtime/doc/usr_05.txt
@@ -211,11 +211,11 @@ defines that when the file type is set t
automatically executed. "setlocal textwidth=78" sets the 'textwidth' option
to 78, but only locally in one file.
- *restore-cursor* >
- autocmd BufReadPost *
- \ if line("'\"") > 1 && line("'\"") <= line("$") |
- \ exe "normal! g`\"" |
- \ endif
+ *restore-cursor* *last-position-jump* >
+ autocmd BufReadPost *
+ \ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit'
+ \ | exe "normal! g`\""
+ \ | endif
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