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.

Praxeolitic
  • 387
  • 2
  • 9
  • FYI, this is a duplicate of http://stackoverflow.com/questions/7019131/how-can-i-draw-to-an-xy-position-in-emacs/18995901 (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 03: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 Answers2

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.

Stefan
  • 26,154
  • 3
  • 46
  • 84
-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

kotakotakota
  • 191
  • 1
  • 7
  • 6
    Welcome to Stack Exchange. This is a [questions and answers site](/tour), 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?](http://emacs.stackexchange.com/help/how-to-answer) for more information. – Gilles 'SO- stop being evil' Feb 16 '15 at 14:34