On 2023-08-08 20:15, Christian Brabandt wrote:
On Di, 08 Aug 2023, 'Dragan Simic' via vim_dev wrote:

diff --git a/runtime/doc/usr_05.txt b/runtime/doc/usr_05.txt
index bc68e61b8..acc0f0c6b 100644
--- a/runtime/doc/usr_05.txt
+++ b/runtime/doc/usr_05.txt
@@ -308,10 +308,14 @@ This switches on three very clever mechanisms:


                                *restore-cursor* *last-position-jump*  >
-    autocmd BufReadPost *
- \ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit'
-      \ |   exe "normal! g`\""
-      \ | endif
+    augroup RestoreCursor
+      autocmd!
+      autocmd BufReadPost *
+        \ let line = line("'\"")
+ \ | if line >= 1 && line <= line("$") && &ft !~# 'commit' && &ft !=# 'xxd'
+        \ |   execute "normal! g`\""
+        \ | endif
+    augroup END

How about this version instead? This should make it easier to add more
filetypes to it.

+ \ | if line >= 1 && line <= line("$") && index(['commit', 'xxd'], &ft) = -1
+        \ |   execute "normal! g`\""
+        \ | endif

This looks great, but I'm afraid it won't work as expected. AFAICT, the "&ft !~# 'commit'" part is there as a negative regexp match to catch the "gitcommit" file type and any other similar file type names.

Shall we also change this in runtime/defaults.vim accordingly?

Perhaps it would be a good idea.


Best,
Christian
--
Es hat in der ganzen Geschichte noch keinen Krieg zwischen zwei Ländern
gegeben, in deren beider Hauptstädte sich McDonald's Filialen befinden.
                -- Frank Lüdecke (Zum Krieg in Afghanistan 2002)

--

--
--
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/4582eb182e491e1c4e97e47bbd1b9412%40manjaro.org.

Raspunde prin e-mail lui