1

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.

Community
  • 1
  • 1
Andrea Francia
  • 9,737
  • 16
  • 56
  • 70

4 Answers4

6

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

Luc Hermitte
  • 31,979
  • 7
  • 69
  • 83
  • This is the correct answer. mswin.vim is evil and causes a lot of basic vim functionality to change and/or act differently. – Zathrus Jan 06 '09 at 03:28
5

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

Andrea Francia
  • 9,737
  • 16
  • 56
  • 70
4

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
R. Martinho Fernandes
  • 228,013
  • 71
  • 433
  • 510
  • 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?" – mph Jul 08 '09 at 17:54
  • From what I see the question reads "How can I..." and was always in that spirit, not in the spirit of "Why ..." – R. Martinho Fernandes Jul 09 '09 at 17:50
0

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

Adriano Varoli Piazza
  • 7,297
  • 5
  • 39
  • 50