7

In my .vimrc I have set virtualedit=all and set nostartofline. I'd like to have these features in Emacs. Can it be done?

virtualedit allows the cursor to be positioned where there are no characters, not even whitespace. It allows you to scroll horizontally beyond any text. If you scroll vertically one row at a time then the cursor always goes up one row and does not change the column it is in, regardless of the contents of the row. If the cursor is beyond the characters in a row and you insert a character, spaces are filled in to the left of the inserted character.

With nostartofline also set, the cursor does not go to the start of the line if I use movements that jump by multiple rows, for example, jumping to the start or end of a file.

With both options set, I can place the cursor, possibly beyond any text in the file, and jump vertically without the column of the cursor changing. A command to move the cursor to the "end of the line" will jump to the last character. So if the cursor is way off in the middle of nowhere, $ will actually move the cursor left instead of right.

There is another question that mentions Vim's virtualedit but it is concerned with making rectangular selections. This question is concerned with the movement of the cursor and the behavior of inserting spaces to catch up to inserted characters.

  • FYI, this is a duplicate of stackoverflow.com/questions/7019131/… (Stefan's answer to that would seem like the most likely option, but I don't know if anyone has actually implemented that idea). – phils Jan 12 '15 at 3:29
  • Do you use evil? – PythonNut Feb 11 '16 at 15:36
  • @PythonNut When I asked the question, no. – Praxeolitic Feb 11 '16 at 22:58
2

You can use quarter-plane-mode from the quarter-plane package in GNU ELPA. It aims to provide this kind of functionality.

But note that it does it basically by reusing picture-mode's code, so it suffers from the same problem: it will add spaces/lines to your buffer when you move around (and then remove them when you leave the mode), so it will/may make changes to your files&buffers even if all you do is move around them without making any real modifications.

-1

Try using picture-mode. The solution here does what you want I think: https://stackoverflow.com/questions/13036465/emacs-mode-for-free-cursor-positioning

  • 6
    Welcome to Stack Exchange. This is a questions and answers site, not a link collection. Please do not post an answer that just says to look elsewhere. Include the essential parts of the solution in your post, and provide the link for reference. See How do I write a good answer? for more information. – Gilles Feb 16 '15 at 14:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.