Friday, August 12, 2022

Re: New version of vim unsolicitedly sourcing defaults.vim?

On 2022-08-12, Christian Brabandt wrote:
> On Fr, 12 Aug 2022, Tim Chase wrote:

> > The other settings in defaults.vim don't usually give me much grief, but
> > having a non-0 'scrolloff' means my usual
> >
> > {count}H
> > {count}L
> >
> > no longer land {count} lines from the top/bottom of the screen,
> > but rather {count} + &scrolloff lines from the top/bottom.
>
> The 'scrolloff' setting is also my major issue with defaults.vim and it
> makes copy/pasting with a mouse from a terminal so much more harder.
>
> Sometimes I find it useful when searching and I need the context, but
> when I do, setting it explicitly is good enough.

I also want to move the cursor anywhere on the screen while also
wanting some context around search hits. I have this mapping and
function in my vimrc which enables 'scrolloff' briefly at the end
of n and N commands.

nnoremap <silent> n :call ScrolloffCmd('nzv')<cr>
nnoremap <silent> N :call ScrolloffCmd('Nzv')<cr>
function! ScrolloffCmd(cmd)
try
exe 'normal!' a:cmd
catch
echohl ErrorMsg
echomsg matchstr(v:exception, ':\zs.*')
echohl NONE
endtry
let l:scrolloff = &scrolloff
set scrolloff=2
redraw
let &scrolloff = l:scrolloff
endfunction

I've done similar corrections for tag jumps and quickfix jumps.
That doesn't cover every case where it would be nice to have context
following a jump, but it covers the most annoying ones.

Regards,
Gary

--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20220812135740.GN12539%40phoenix.

No comments: