2

I just switched to a Mac and started using sublimetext 2 for coding because it has the command mode and the comfort of textmate.

When I was on Windows the e-texteditor has those two traits as well but the command mode on it, once activated, would be the kind where the cursor is always in between characters, the blinking bar | kind, not the kind that's always an underscore of a letter.

I am getting rather annoyed with the underscore kind, for example, when in command mode and I press $, that should have gone straight to the end of the line for me to add more to that line, but instead it arrives at the last character of the line and if I hit i to enter insert mode, now the bar cursor is to the left of the last character and I have to press the right arrow to get to the last position of the line.

I am sure vim gurus will tell me all about this is the design or something, thank you, but I just want a solution, I just want to use the bar type of cursor in everything I do in command mode or visual mode. Now I can't even find a setting to change that anywhere. So does anyone happen to have suffered the same problem and has found a way to alter it?

2 Answers 2

1

Vim's cursor is always on a character cell. As you surmised, that is by design. It can't really be changed, even as an option, because so much of Vim's behavior depends on that characteristic. The best approach is to accept it and adapt your editing habits accordingly.

For example, to add a character after the end of a line, type A.

That said, there is a setting that might help you. A new setting of the 'virtualedit' option was added in Vim 7: onemore. This allows the cursor to move to one position past the end of the line so that you can move past the end of the line and type i to insert a character at the end of the line. See

:help new-onemore
:help 'virtualedit'

The $ command still moves to the actual end of the line, however, so you may want to use this mapping as well:

:nnoremap $ $l

That last character is a lower-case L.

1
  • Hey there, thanks for the answer. I have no problem at all adapting to vim, I mean, so many are using it, I know I can trust the investment eventually will yield well. I guess, I will just adapt instead of changing the onemore edit mode thing, because well, i don't think the sublimetext editor has it configurable yet.
    – Nik So
    Nov 3, 2011 at 21:26
1

One doesn't need to be a "vim guru" to tell you that you simply need to learn the Vim way. That's what you need to do whenever you pick up a new tool, anyway. Don't you?

If you don't like Vim's default behaviour, why did you go through the (relative) pain of enabling Sublime Text 2's "vintage mode"? This feature is a honey pot for Vim users to lure them into trying ST2, not just another exotic way to use it.

Vim's power is partly derived from its very well designed commands and motions and text-objects. If you don't want to learn how to use these things what's the point of emulating it in the first place.

To solve your immediate problem with using $i<right> to enter insert mode after the end of a line: the right way to do it is to type A.

The right way to enter insert mode after a character is to type a.

From this and your previous knowledge of i and $ I suppose you can find the right way to enter insert mode before the first character of a line.

That's how Vim and Sublime Text 2's vintage mode work. The underscore (in vintage) and the rectangle (in vim) cursors are on a character and everything cascades from this basic rule. If you decide to replace this cursor by a blinking vertical bar the cursor will still be considered by ST2/vintage/vim to be on a character but its visual state will be different. I don't think such a situation is workable.

So yes, learn Vim if you want to use it (or an ersatz).

The best way to learn its basics (and ST2's vintage mode's basics with some limits) is to open Terminal.app and launch vimtutor. Give it a try, do it a couple of times and you will stop being annoyed by Vim's eccentricities.

And maybe drop ST2 in the process.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .