views:

1301

answers:

4

Duplicate:

How to indent a selection in gvim (win32)?

How do I indent multiple lines quickly in vi?

Using vim under linux I can indent a block of code using the VISUAL mode and pressing ">". In vim under Windows this does not happen.

This is what happens:

  • Press V, the VIM enter in the VISUAL mode
  • Press 'Down', the VIM exit for the VISUAL mode. I can't select anything in VISUAL mode.

Alternatively, if I use the SELECT mode for selecting code the ">" does not indent it.

+4  A: 

Ok, I got it. In Windows I should press Shift+Down to remain in the VISUAL mode.

Andrea Francia
this is the correct answer. press v then hold shift and press down to select the text.
nightingale2k1
+4  A: 

If you use V (uppercase) you enter VISUAL LINE mode. For VISUAL mode you should use v (lowercase).

And if you use the standard movement keys (hjkl) everything works fine.

If you dislike the default movement keys, use these mappings:

:map <Up> k
:map <Down> j
:map <Left> h
:map <Right> l
Martinho Fernandes
Why the downvote? What did I do wrong?
Martinho Fernandes
Hi Martinho -- I downvoted too: this answer doesn't address the main issue in the original question, which is "why do the arrow keys exit visual mode?"
mikeh
From what I see the question reads "How can I..." and was always in that spirit, not in the spirit of "Why ..."
Martinho Fernandes
A: 

Weird, I don't experience this behavior on Vim 7.1 on Win XP. Perhaps setting nocompatible will help you?

Adriano Varoli Piazza
+5  A: 

Haven't you keep mswin.vim ? If you want the same behaviour on both OSes, get rid of this file.

Luc Hermitte
This is the correct answer. mswin.vim is evil and causes a lot of basic vim functionality to change and/or act differently.
Zathrus