2

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.

7
  • 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
    Commented Feb 5, 2011 at 23:55
  • What you want is not Vim, I'm afraid.
    – romainl
    Commented Feb 6, 2011 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
    Commented Feb 6, 2011 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
    Commented Feb 7, 2011 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
    Commented Aug 15, 2012 at 20:40

3 Answers 3

2

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?

10
  • 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
    Commented Jun 18, 2011 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. Commented Jun 18, 2011 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{. Commented Jun 18, 2011 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
    Commented Jun 19, 2011 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 Commented Jun 19, 2011 at 15:38
4
: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.

0

For gnome version>3.15
Add this to your ~/.vimrc.

if has("autocmd")
  au VimEnter,InsertLeave * silent execute '!echo -ne "\e[2 q"' | redraw!
  au InsertEnter,InsertChange *
\ if v:insertmode == 'i' | 
\   silent execute '!echo -ne "\e[6 q"' | redraw! |
\ elseif v:insertmode == 'r' |
\   silent execute '!echo -ne "\e[4 q"' | redraw! |
\ endif
au VimLeave * silent execute '!echo -ne "\e[ q"' | redraw!
endif

You will get a block cursor in normal mode and a thin one in insert mode.

You must log in to answer this question.

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