On 2023-08-09 10:46, 'Dragan Simic' via vim_dev wrote:
On 2023-08-08 20:55, Christian Brabandt wrote:
On Di, 08 Aug 2023, Dragan Simic wrote:

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.

Ah yes that is true. I remember when I added it :)

Actually, I remember I had a similar issue where a certain filetype did
not make sense for jumping to that last position, but do no longer
remember which one :/

Sure, we can add more file types there later, when you encounter them again.

Ah, I think I know another file type that shouldn't have the cursor position restored. :) It's "gitrebase", which is, quite similarly to "gitcommit", rather unlikely to be the same file as the last one edited.

Are you fine with adding "gitrebase" to the ignored file types list?

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

Perhaps it would be a good idea.

Would you like me to extend the patch and resend it, to cover
runtime/defaults.vim as well?

Best
Christian
--
Das wahrhaft größte Geschenk ist es, wenn man sein eigenes
Herz verschenken will.
                -- Benjamin Stramke

--

--

--
--
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/0be4f1e3e2e605473481c1bd3547bc27%40manjaro.org.

Raspunde prin e-mail lui