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 :/ > > Shall we also change this in runtime/defaults.vim accordingly? > > Perhaps it would be a good idea. 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 vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/ZNKPrt082SdxBVvC%40256bit.org.