LWN.net Logo

vim does it...

vim does it...

Posted Oct 31, 2006 15:36 UTC (Tue) by mikov (subscriber, #33179)
In reply to: vim does it... by niner
Parent article: GNU emacs 22 goes into pretest

Thanks! That is close to want I want. It doesn't quite work in my version
of Vim (6.3) - moving the cursor is fine, but if I insert a character at
column 20 and press down arrow, the cursor still moves to the end of the
next line. I suppose this is a bug.


(Log in to post comments)

vim does it...

Posted Oct 31, 2006 18:30 UTC (Tue) by niner (subscriber, #26151) [Link]

Have the same behavior in 6.4.6
It only is after typing something. If I move the cursor one to the left after typing and pressing down it moves down. If not, it goes to the end of the line below. But if I press up and down again it's just one position down. Weird.

This could be because vim remembers the position in the line one moved to. In non-virtual mode if you press down and the next line is shorter, the cursor moves to that line's end. If the next after that is longer again, it moves to the position it were. This nice feature is the reason why I usually don't need virtual mode. But it could be handy for drawing ASCII art ;)

vim does it...

Posted Oct 31, 2006 18:52 UTC (Tue) by mikov (subscriber, #33179) [Link]

>This could be because vim remembers the position in the line one moved
to. In non-virtual mode if you press down and the next line is shorter,
the cursor moves to that line's end. If the next after that is longer
again, it moves to the position it were. This nice feature is the reason
why I usually don't need virtual mode.

But don't you find it just a little bit confusing, theoretically
speaking ? It remembers the position in the "longer" line and tries to
keep as close to it as it can. But for how long - what if you move the
cursor horizontally, or type something? Then it doesn't remember it
anymore. But what if you undo the operation ? You see, the desired
behavior is not obvious and I have noticed that editors have subtle
differences and are not entirely consistent in implementing it.

We can start adding improvements like remembering the position in the last
100 or 1000 lines, and a timeout after which we flush the remembered
position, etc. Ultimately, the logical conclusion leads to "virtual
space".

This is just pet peeve of mine, of course. I am speaking only
theoretically. I don't want to offend anyone or to claim that virtual
space is actually more convenient for editing source. Only that it seems
more logical theoretically.

Copyright © 2012, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds