can Vim jump line by screen-line?

20 views
Skip to first unread message

StarWing

unread,
Jun 7, 2009, 1:54:21 PM6/7/09
to vim_use
when open wrap, the long lines will be break in short one in screen.
so, you can use gj and gk to jump between screen lines.

but, you can't jump-one-screen-line when scroll screen. e.g. when you
edit a file:

blablablablablablabla<
blablablablablablabla<
blablablablablablabla<
blabla
blablablablablablabla<
blablablablablablabla<
blabla

("<" means a logical line, so there are two lines in this file)
and now the window is:
------------------------
|blablablablablablabla<|
|blablablablablablabla<|
|blablablablablablabla<|
|blabla# |
|blablablablablablabla<|
------------------------

(# means cursor)
now you press gj, it changed to:
------------------------
|blablablablablablabla<|
|blabla |
|blabla#lablablablabla<|
|blablablablablablabla<|
|blabla |
------------------------

notice that the whole line of second line is one the screen. how to
only scroll one screen line? just like:
------------------------
|blablablablablablabla<|
|blablablablablablabla<|
|blablablablablablabla<|
|blabla |
|blabla#lablablablabla<|
------------------------

and then (press gj):

------------------------
|blablablablablablabla<|
|blablablablablablabla<|
|blabla |
|blablablablablablabla<|
|blabla#lablablablabla<|
------------------------

how can I did it? (and C-E and C-Y did the same thing)?

Tony Mechelynck

unread,
Jun 13, 2009, 8:51:45 AM6/13/09
to vim...@googlegroups.com
On 07/06/09 19:54, StarWing wrote:
>
> when open wrap, the long lines will be break in short one in screen.
> so, you can use gj and gk to jump between screen lines.
>
> but, you can't jump-one-screen-line when scroll screen. e.g. when you
> edit a file:
[...]

> how can I did it? (and C-E and C-Y did the same thing)?

You can't.

In Vim, all "file-lines" onscreen, especially including the one with the
cursor, and with the possible exception of the bottom file-line in the
window, MUST be displayed in their entirety, with the single exception
that if the current file-line (the one with the cursor) is larger than
the window, it may overflow it on both top and bottom depending on where
the cursor is in the line.

If the top line in the window is longer than the 'columns' setting, and
you have 'wrap' set, then if you scroll (e.g. by Ctrl-E, or by moving
the cursor downwards), that top line will disappear completely in one
step, and the next (file-)line will become the new top line.

If you absolutely want to scroll by single screen lines, you can set
'nowrap' (which is the default), but then long lines may overflow the
screen left and/or right, which is probably not what you want.


Best regards,
Tony.
--
Really heard in court in the U.S.A.:
Q.: How did your first marriage end?
A.: By death.
Q.: And by whose death did it end?
A.: You guess.

StarWing

unread,
Jun 23, 2009, 8:27:52 AM6/23/09
to vim_use


On Jun 13, 8:51 pm, Tony Mechelynck <antoine.mechely...@gmail.com>
wrote:
thank you for your reply!!!

and, can make it possible? i mean, if (just if) mostly people need
this function, can we add it into Vim easily?

Tony Mechelynck

unread,
Jun 24, 2009, 1:37:10 AM6/24/09
to vim...@googlegroups.com

I don't believe it will ever become part of "mainline Vim". Now, if
someone wants to program it as an "unofficial patch", good luck...


Best regards,
Tony.
--
"One thing they don't tell you about doing experimental physics is that
sometimes you must work under adverse conditions ... like a state of
sheer terror."
-- W. K. Hartmann

StarWing

unread,
Jun 24, 2009, 12:16:51 PM6/24/09
to vim_use


On Jun 24, 1:37 pm, Tony Mechelynck <antoine.mechely...@gmail.com>
but why? is it because of the conflict with Vi maintain design
philosophy?

Tony Mechelynck

unread,
Jun 24, 2009, 12:41:01 PM6/24/09
to vim...@googlegroups.com

Call it a hunch. Only Bram could decide about it, and not all of my
hunches were right.

Best regards,
Tony.
--
hundred-and-one symptoms of being an internet addict:
57. You begin to wonder how on earth your service provider is allowed to
call
200 hours per month "unlimited."

Teemu Likonen

unread,
Jun 24, 2009, 1:08:27 PM6/24/09
to vim...@googlegroups.com
On 2009-06-24 09:16 (-0700), StarWing wrote:

> On Jun 24, 1:37 pm, Tony Mechelynck <antoine.mechely...@gmail.com>
> wrote:
>> I don't believe it will ever become part of "mainline Vim". Now, if
>> someone wants to program it as an "unofficial patch", good luck...

> but why? is it because of the conflict with Vi maintain design
> philosophy?

One reason is probably that a feature has to have clear benefits for
anybody to bother implementing it. Vim is not perfect but for many
people it's good enough. Another reason might be that everything in Vim
development goes through Bram Moolenaar and one man (though very capable
one) doesn't scale to everything. If someone else writes the feature it
is likely merged to vim_extended repository[1] quite soon and then
reviewing the patch will probably go to Bram's to-do list at position
1382 or something like that. :-)

Of course this is not the official answer. Only thoughts of an individual.

---------------
1. http://groups.google.com/group/vim_dev/web/vim-patches

Christian Brabandt

unread,
Jun 24, 2009, 1:38:10 PM6/24/09
to vim...@googlegroups.com
Hi Teemu!

On Mi, 24 Jun 2009, Teemu Likonen wrote:

>
> One reason is probably that a feature has to have clear benefits for
> anybody to bother implementing it. Vim is not perfect but for many

This might actually be useful, when scrollbind windows to read several
pages on screen. Otherwise the scrolling offset changes slightly.

regards,
Christian
--
:wq!

Reply all
Reply to author
Forward
0 new messages