Andrea Francia
Andrea Francia

Reputation: 9997

How can I indent code in the Vim editor on Windows?

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:

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

Upvotes: 1

Views: 3107

Answers (4)

Luc Hermitte
Luc Hermitte

Reputation: 32976

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

Upvotes: 6

Adriano Varoli Piazza
Adriano Varoli Piazza

Reputation: 7429

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

Upvotes: 0

R. Martinho Fernandes
R. Martinho Fernandes

Reputation: 234654

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

Upvotes: 4

Andrea Francia
Andrea Francia

Reputation: 9997

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

Upvotes: 5

Related Questions