Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I would really like it if the VIM cursor in normal mode could act like it does in insert mode: a line between two characters. So for example:
- Typing vd would have no effect because nothing was selected
- p and P would be the same
- i and a would be the same

Has anything like this been done? I haven't been able to find it.

share|improve this question
5  
The idea that the cursor is always on a line and on a character position or column is inherent in Vim's design. If you were to try to change that, many of Vim's operations would behave differently or would not work at all. It's not a good idea. My advice would be that you learn and become accustomed to Vim's basic behavior and not try to make it behave like some other editor. –  garyjohn Feb 5 '11 at 23:55
    
What you want is not Vim, I'm afraid. –  romainl Feb 6 '11 at 7:15
    
"What you want is not Vim; I'm afraid" -- you're probably right about that. It's just I like having a "normal mode" where I can move around with l,j,k,h and yank/paste with single keypresses, and I don't know any other editor that does that. –  Owen Feb 6 '11 at 19:50
    
there are Vim keybindings available for a few editors/IDE (Komodo, Eclipse, VisualStudio, TextMate…) but I think they mimic Vim's cursor behaviour quite literally; which is the way to go, IMO. –  romainl Feb 7 '11 at 14:47
    
@romainl: can you explain why the vim way of handling cursors is better? To really qualify as better it should be better for a beginner who has not learned to be accustomed to one approach or the other, so arguing from users habits is not valid. Also, it should be better in a case where you were designing a new editor from scratch, so the fact that it would change vim's behavior doesn't carry weight. I can't see how it's better but I'm open to being shown how. –  iconoclast Aug 15 '12 at 20:40

2 Answers 2

up vote 2 down vote accepted

just for fun, here's how you could achieve your desired behaviour for the examples you provided:

set selection=exclusive
set virtualedit+=onemore
" this is just a crude proof of concept with theoretically addressable weak points
nnoremap vd <Nop>
noremap p P
noremap a i
" make i<Esc> not move the cursor
inoremap <Esc> <Right><Esc>

But I hardly see the point. Care to explain why you want this? E.g. how is vd relevant and why not just use i and never a?

share|improve this answer
    
Heh, no vd isn't terribly relevant ;) but it would be nice if some vim "sentences" could be reordered like dw -> vwd, etc, which won't work because vwd grabs one char too many. Also trying to visually select the space between { and } when } is in the first column is tricky. –  Owen Jun 18 '11 at 4:31
    
dw and vwd do the same for me within a line. On a line's last word they are different, which seems useful to me. There, you could replicate dw's behaviour with ved. cw act different to what one might expect (it acts like ce instead of dwi), but a fix is offered in :help cw. –  accolade Jun 18 '11 at 11:49
    
Regarding {…}, indeed even indentation is discarded with vi{. You could va{ instead, but that also consumes the braces. The J command may be your (post)fix of choice here. It performs a line Join. You could :map it into your preferred use[s] of i{/a{. –  accolade Jun 18 '11 at 11:50
    
Really, vwd and dw do the same thing for you? I just tested it again to make sure I wasn't making stuff up and no, dw deletes a word and the following whitespace, whereas vwd also grabs the first char of the next word. Do you have some mapping that changes that behavior? –  Owen Jun 19 '11 at 15:24
    
@Owen yup, definitely same thing. The behaviour you describe is odd and certainly not intended - have you checked your mappings? You can run a vim instance without any scripts with vim -u NONE –  accolade Jun 19 '11 at 15:38
:set guicursor+=n:ver1

will make the cursor one pixel thin, so you can still visually distinguish Normal from Insert mode by it. If you want it to look exactly like Insert mode:

:se gcr+=n:ver25


:help guicursor(link) gives you this:

This option tells Vim what the cursor should look like in different
modes.

http://vim.wikia.com/wiki/Configuring_the_cursor has a great tutorial on the topic.

sidenote: the cursor in vim is always at a char, not 'in-between'. it just looks 'in-between' since it is a small vertical bar, bound to the left side of the char.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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