scrolljump and paste ?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

scrolljump and paste ?

M Kelly
Hi,

I set scrolljump=-50, it works well for me.
But sometimes when I paste it is annoying when the cursor jumps.
I have experimented with:

au InsertEnter * let &scrolljump=1
au InsertLeave * let &scrolljump=-50

but this doesn't seem to affect pasting.
Does anyone know of or have a suggestion for this ?
Could I remap 'p' to set scrolljump=1 then p again ?

thx for all things vim,
-mark

--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/f45c1434-05e6-479f-aed5-6d5745ac5253%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: scrolljump and paste ?

Tony Mechelynck
On Sat, May 11, 2019 at 2:30 AM M Kelly <[hidden email]> wrote:

>
> Hi,
>
> I set scrolljump=-50, it works well for me.
> But sometimes when I paste it is annoying when the cursor jumps.
> I have experimented with:
>
> au InsertEnter * let &scrolljump=1
> au InsertLeave * let &scrolljump=-50
>
> but this doesn't seem to affect pasting.
> Does anyone know of or have a suggestion for this ?
> Could I remap 'p' to set scrolljump=1 then p again ?
>
> thx for all things vim,
> -mark

I suppose you could, but this would not solve the question of how to
come back, or of how to paste before the cursor.

I suggest the following (untested, assumes 'nocompatible'):

        :map <F5> :set scrolljump=1<CR>p
        :map <S-F5> :set scrolljump=1<CR>P
        :map <F6> :set scrolljump=-50<CR>

Best regards,
Tony.

--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAJkCKXsa2uCoQZzR%2BzJbZY4KaUXpzJPrZzTvTsS%3DgBqRxtCwvQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: scrolljump and paste ?

M Kelly
>         :map <F5> :set scrolljump=1<CR>p
>         :map <S-F5> :set scrolljump=1<CR>P
>         :map <F6> :set scrolljump=-50<CR>

Hi,

Thanks Tony.
Is there a way around the recursion of mapping p to call a function that
issues a p between setting scrolljump values ?  Perhaps with an alias ?

thx,
-mark

--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/39251b0e-80af-4e7a-be7f-38536b4971cf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: scrolljump and paste ?

M Kelly
> Thanks Tony.
> Is there a way around the recursion of mapping p to call a function that
> issues a p between setting scrolljump values ?  Perhaps with an alias ?

Hi,

Something weird, like this ???

function! MyPaste() abort
  nnoremap <silent> <buffer> p p
  let &scrolljump=1
  execute "normal p"
  let &scrolljump=-50
  nnoremap <silent> <buffer> p :call MyPaste()<CR>
endfunction

nnoremap <silent> <buffer> p :call MyPaste()<CR>

thx,
-m

--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/0579b9ba-3bf9-43c0-bd5e-a9cec6e3bb00%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: scrolljump and paste ?

Tony Mechelynck
In reply to this post by M Kelly
On Sat, May 11, 2019 at 3:08 AM M Kelly <[hidden email]> wrote:

>
> >         :map <F5> :set scrolljump=1<CR>p
> >         :map <S-F5> :set scrolljump=1<CR>P
> >         :map <F6> :set scrolljump=-50<CR>
>
> Hi,
>
> Thanks Tony.
> Is there a way around the recursion of mapping p to call a function that
> issues a p between setting scrolljump values ?  Perhaps with an alias ?
>
> thx,
> -mark

By using :noremap (and friends), the {rhs} is not inspected for
further mappings (i.e., even if it contains its own {lhs} or that of
another mapping, it remains unchanged).

--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAJkCKXtVVZxJRv0j4q6QC7br4%2B%2BxmgrqfX%3Dh2%3Dx%3DbfnRVNGU-g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.