mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
runtime(doc): disable last-position-jump in diff mode
This has been bothering me quite for some time and I never knew why it happened. Just today it occurred to me this might have been because of the last-position-jump. So I figured, let's fix it for everybody, not just me. closes: #17092 Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
@@ -107,6 +107,7 @@ if 1
|
|||||||
\ let line = line("'\"")
|
\ let line = line("'\"")
|
||||||
\ | if line >= 1 && line <= line("$") && &filetype !~# 'commit'
|
\ | if line >= 1 && line <= line("$") && &filetype !~# 'commit'
|
||||||
\ && index(['xxd', 'gitrebase', 'tutor'], &filetype) == -1
|
\ && index(['xxd', 'gitrebase', 'tutor'], &filetype) == -1
|
||||||
|
\ && !&diff
|
||||||
\ | execute "normal! g`\""
|
\ | execute "normal! g`\""
|
||||||
\ | endif
|
\ | endif
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
*usr_05.txt* For Vim version 9.1. Last change: 2025 Mar 22
|
*usr_05.txt* For Vim version 9.1. Last change: 2025 Apr 10
|
||||||
|
|
||||||
VIM USER MANUAL - by Bram Moolenaar
|
VIM USER MANUAL - by Bram Moolenaar
|
||||||
|
|
||||||
@@ -307,23 +307,27 @@ This switches on three very clever mechanisms:
|
|||||||
filetypes. See |:filetype-indent-on| and 'indentexpr'.
|
filetypes. See |:filetype-indent-on| and 'indentexpr'.
|
||||||
|
|
||||||
|
|
||||||
*restore-cursor* *last-position-jump* >
|
*restore-cursor* *last-position-jump* >vim
|
||||||
augroup RestoreCursor
|
augroup RestoreCursor
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd BufReadPost *
|
autocmd BufReadPost *
|
||||||
\ let line = line("'\"")
|
\ let line = line("'\"")
|
||||||
\ | if line >= 1 && line <= line("$") && &filetype !~# 'commit'
|
\ | if line >= 1 && line <= line("$") && &filetype !~# 'commit'
|
||||||
\ && index(['xxd', 'gitrebase'], &filetype) == -1
|
\ && index(['xxd', 'gitrebase'], &filetype) == -1
|
||||||
|
\ && !&diff
|
||||||
\ | execute "normal! g`\""
|
\ | execute "normal! g`\""
|
||||||
\ | endif
|
\ | endif
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
Another autocommand. This time it is used after reading any file. The
|
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
|
complicated stuff after it checks if the '" mark is defined, and jumps to it
|
||||||
if so. It doesn't do that for a commit or rebase message, which are likely
|
if so. It doesn't do that when:
|
||||||
a different one than last time, and when using xxd(1) to filter and edit
|
- editing a commit or rebase message, which are likely a different one than
|
||||||
binary files, which transforms input files back and forth, causing them to
|
last time,
|
||||||
have dual nature, so to speak. See also |using-xxd|.
|
- 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|) and
|
||||||
|
- Vim is in diff mode
|
||||||
|
|
||||||
The backslash at the start of a line is used to continue the command from the
|
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|.
|
previous line. That avoids a line getting very long. See |line-continuation|.
|
||||||
|
Reference in New Issue
Block a user