scroll by screen line ?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

scroll by screen line ?

mckel...@gmail.com
Hi,

Is it possible to scroll like <C-e> but have it be virtual/screen line and not whole line ?
I want to have wrap on, but also want to scroll by screen line when I have long lines.
Does anyone know if that is possible ?
Sort of like: j -> gj ; <C-e> -> ???
I suppose I could do the math in a function and go to bottom of screen and gj X times then go back to previous line, col - but does anyone know of a better way ?

thanks for everything vim,
-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/c0f2c542-3084-4749-b29c-792a2f272030n%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: scroll by screen line ?

Tony Mechelynck
On Wed, Aug 5, 2020 at 5:53 AM [hidden email] <[hidden email]> wrote:

>
> Hi,
>
> Is it possible to scroll like <C-e> but have it be virtual/screen line and not whole line ?
> I want to have wrap on, but also want to scroll by screen line when I have long lines.
> Does anyone know if that is possible ?
> Sort of like: j -> gj ; <C-e> -> ???
> I suppose I could do the math in a function and go to bottom of screen and gj X times then go back to previous line, col - but does anyone know of a better way ?
>
> thanks for everything vim,
> -m

I don't think it is, because the first character at the top of a Vim
window is either the first character of a (file) line, or some
character in a line which is too long for the window. So unless the
current line is too long for the window, Ctrl-Y will show one more
full file line at the top of the window, and Ctrl-E will make one full
file line disappear at the top of the window. Similarly, scrolling by
mouse will always make an integer number of file lines appear or
disappear at the top (again unless the current line is too long for
the window). I believe that this is as much part of the philosophy of
Vim as the fact that all displayable Latin, Greek, Cyrillic, Hebrew,
etc. characters (other than tabs) always occupy exactly the same
amount of height and width no matter the character in all the windows
of a single instance of Vim, including gvim and macvim, and that a
single fullwidth CJK character (no matter which one) always takes up
exactly twice as much space as two "narrow" characters (e.g. Latin,
etc. characters), except that if there is only one character-width
left at the end of a screen line (with 'wrap' on) it will be thrown
off to the next screen line.

AFAIK, to make sure than Vim always scrolls only a single screen line
at a time you would need to set 'nowrap' but of course any line longer
than 'columns' would then be only partly displayed. Me too, I prefer
'wrap' being on except in (g)vimdiff, and sometimes I am surprised
when going to the next line at bottom makes the display jump up by
several lines because a long line has disappeared at top, but I
believe that "Vim is like that".

Oh, there _is_ a possibility (of sorts): by setting 'lines' to 1 (plus
1 for the status line plus 'cmdheight' for the command-line area) you
could always wrap by screen lines, but OTOH it would nullify the
advantage of ":set wrap" so I don't think you would like it. :-P

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/CAJkCKXt-0vcG4XaBV4Rw7W3cnFb9mivL8t%2B1J_j2Zj38d3duCQ%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: scroll by screen line ?

Christian Brabandt
In reply to this post by mckel...@gmail.com

On Di, 04 Aug 2020, [hidden email] wrote:

> Hi,
>
> Is it possible to scroll like <C-e> but have it be virtual/screen line and not whole line ?
> I want to have wrap on, but also want to scroll by screen line when I have long lines.
> Does anyone know if that is possible ?
> Sort of like: j -> gj ; <C-e> -> ???
> I suppose I could do the math in a function and go to bottom of screen and gj X times then go back to previous line, col - but does anyone know of a better way ?

Not really possible. I believe there are some plugins that improve this
behaviour like https://github.com/lukelbd/vim-scrollwrapped but it might
be still a bit hacky.

It's been on my list to look into it, but I never came to it.

Best,
Christian
--
Ein erfolgreicher Mann ist ein Mann, der mehr Geld verdient, als seine
Frau ausgeben kann. Eine erfolgreiche Frau ist eine, die einen solchen
Mann findet.

--
--
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/20200806074237.GG4701%40256bit.org.
Reply | Threaded
Open this post in threaded view
|

Re: scroll by screen line ?

mckel...@gmail.com
Hi,

ok, thank you both for the info.

take care,
-m

On Thursday, August 6, 2020 at 3:42:46 AM UTC-4 [hidden email] wrote:

On Di, 04 Aug 2020, [hidden email] wrote:

> Hi,
>
> Is it possible to scroll like <C-e> but have it be virtual/screen line and not whole line ?
> I want to have wrap on, but also want to scroll by screen line when I have long lines.
> Does anyone know if that is possible ?
> Sort of like: j -> gj ; <C-e> -> ???
> I suppose I could do the math in a function and go to bottom of screen and gj X times then go back to previous line, col - but does anyone know of a better way ?

Not really possible. I believe there are some plugins that improve this
behaviour like https://github.com/lukelbd/vim-scrollwrapped but it might
be still a bit hacky.

It's been on my list to look into it, but I never came to it.

Best,
Christian
--
Ein erfolgreicher Mann ist ein Mann, der mehr Geld verdient, als seine
Frau ausgeben kann. Eine erfolgreiche Frau ist eine, die einen solchen
Mann findet.

--
--
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/22f38dce-e434-43ec-a46e-92976c81a8abn%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: scroll by screen line ?

Anton Shepelev
In reply to this post by mckel...@gmail.com
mckel...:

> Is it possible to scroll like <C-e> but have it be
> virtual/screen line and not whole line ?   I  want
> to have wrap on, but also want to scroll by screen
> line when I have long lines.

The replies of Tony and Christian show that  Vim  is
designed for true plain-text files, which means hard
line breaks, and I, for one, fully  approve  of  the
idea.   We  already  have too much pseudo-plain-text
with line per paraphraph:  in  Usenet,  e-mail,  and
even  certain  markup languages including WikiMarkup
and DokuWiki.

May I ask what kind of soft-wrapped text you want to
edit  in Vim?  In my opinion, comfortable editing of
soft-wrapped text in Vim would require serions modi-
fions -- in  order  to  make  it virtually indistin-
guishable from editing hard-wrapped text. As  things
stand,  I  prefer  another editor whenever I need to
word with line-per-paragraph text files...

--
Please, do not forward replies to my e-mail.

--
--
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/20200807001104.498db60339b522c1b791d0f3%40gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: scroll by screen line ?

porphyry5
I use vim exclusively on wrapped text, often up to 5000 characters per line, and find these 3 mappings useful to produce the effect you want.

nmap <DOWN> gj
nmap <UP> gk
nnoremap ^F ^F jjzt

The nmaps  accept leading counts for the number of screen lines you wish to move.  Both ^F are produced by typing ctrl-v ctrl-f, the intent being to move the text down 1 complete page, as vim normally retains the last 2 lines of the previous screen on the new screen with standard ^F

On Thu, Aug 6, 2020 at 2:11 PM Anton Shepelev <[hidden email]> wrote:
mckel...:

> Is it possible to scroll like <C-e> but have it be
> virtual/screen line and not whole line ?   I  want
> to have wrap on, but also want to scroll by screen
> line when I have long lines.

The replies of Tony and Christian show that  Vim  is
designed for true plain-text files, which means hard
line breaks, and I, for one, fully  approve  of  the
idea.   We  already  have too much pseudo-plain-text
with line per paraphraph:  in  Usenet,  e-mail,  and
even  certain  markup languages including WikiMarkup
and DokuWiki.

May I ask what kind of soft-wrapped text you want to
edit  in Vim?  In my opinion, comfortable editing of
soft-wrapped text in Vim would require serions modi-
fions -- in  order  to  make  it virtually indistin-
guishable from editing hard-wrapped text. As  things
stand,  I  prefer  another editor whenever I need to
word with line-per-paragraph text files...

--
Please, do not forward replies to my e-mail.

--
--
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/20200807001104.498db60339b522c1b791d0f3%40gmail.com.


--
Graham Lawrence

--
--
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/CA%2BE5mK4rvEa7UN6o55Ph4Cp1ivtx16EZ%3DZeUMAMn4R%3DbAGG37g%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: scroll by screen line ?

Anton Shepelev
Graham Lawrence:

> I use vim exclusively on wrapped text, often up to
> 5000 characters per line, and find  these  3  map-
> pings useful to produce the effect you want.
>
> nmap <DOWN> gj
> nmap <UP> gk
> nnoremap ^F ^F jjzt

I  know  and use gj and jk, remapped to j and k, but
didn't know about jjzt.  Thanks.

Antoher problem with wrapped text in Vim is that  it
tries  to  display entire lines, leaving part of the
screen lines empty, prefixed with `@'. It annoys me,
too.

--
Please, do not forward replies to my e-mail.

--
--
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/20200808153713.d76f6b486b0739057132917a%40gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: scroll by screen line ?

Gary Johnson-4
On 2020-08-08, Anton Shepelev wrote:

> Antoher problem with wrapped text in Vim is that  it
> tries  to  display entire lines, leaving part of the
> screen lines empty, prefixed with `@'. It annoys me,
> too.

I'm not sure, but I think this setting will fix that problem.

    set display=lastline

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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20200808165436.GA18746%40phoenix.
Reply | Threaded
Open this post in threaded view
|

Re: scroll by screen line ?

porphyry5
@Anton Shepelev, the Ctrl-F variant I gave you has a fault, if the lines it jj's over are more than 1/2 the screen length each, it in effect skips a page of text. Instead map Ctrl-F to Ljzt instead.

[hidden email]  many thanks for the 'set display+=lastline' tip, those lines of @s have bugged me for years.

On Sat, Aug 8, 2020 at 9:56 AM Gary Johnson <[hidden email]> wrote:
On 2020-08-08, Anton Shepelev wrote:

> Antoher problem with wrapped text in Vim is that  it
> tries  to  display entire lines, leaving part of the
> screen lines empty, prefixed with `@'. It annoys me,
> too.

I'm not sure, but I think this setting will fix that problem.

    set display=lastline

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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20200808165436.GA18746%40phoenix.


--
Graham Lawrence

--
--
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/CA%2BE5mK7qOJw5Zx%2B0PBQV%3Dcz8KfixYwQB7e5d2FtZav5xMixv8Q%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: scroll by screen line ?

mckel...@gmail.com
Hi,

Thanks.  display+=lastline does help.
I've been using a mapping for <Up>/<Down> to gk/gj for a while and this works well.
I also map <C-f>/<C-b> to winheight(0)/2 gj/gk.  I'll look at <C-f>jjzt.

I set these things when editing a type of log files.

take care,
-m

On Saturday, August 8, 2020 at 1:15:52 PM UTC-4 [hidden email] wrote:
@Anton Shepelev, the Ctrl-F variant I gave you has a fault, if the lines it jj's over are more than 1/2 the screen length each, it in effect skips a page of text. Instead map Ctrl-F to Ljzt instead.

@gary clinton  many thanks for the 'set display+=lastline' tip, those lines of @s have bugged me for years.

On Sat, Aug 8, 2020 at 9:56 AM Gary Johnson <[hidden email]> wrote:
On 2020-08-08, Anton Shepelev wrote:

> Antoher problem with wrapped text in Vim is that  it
> tries  to  display entire lines, leaving part of the
> screen lines empty, prefixed with `@'. It annoys me,
> too.

I'm not sure, but I think this setting will fix that problem.

    set display=lastline

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 [hidden email].


--
Graham Lawrence

--
--
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/8161fa36-beca-42e3-bfc2-933ecfc863e0n%40googlegroups.com.