Search code examples
windowsvimindentation

How to indent a selection in gVim (Win32)


I'd like to indent a block of text.

I am able to do this in the Linux build of gVim.

I do this in the state of gVim where I'm not in the insert or visual mode. The bar at the bottom is blank on the left, and the line number and percentage are showing on the right hand side.

Then I perform the following procedure: I select a block of text via click and drag. Then I hit Shift + .. After that, I hit Esc and the block of text will move over a tab.

If I do this in Windows however, it just replaces the block with >.

I am just running the stock Windows rc file and version 7.1 of gVim.


Solution

  • If you first enter SHIFT-V, and than shift+arrows to select the text, it will indent. You can also use SHIFT-V, and use 'hjkl' to select the block.

    If you use shift+arrows or the mouse to select a block of text, it does not work and the selection will be replaced with a '>'. This can be changed when you change selectmode;

    set selectmode=mouse,key

    • default setting after behave mswin

    set selectmode=key

    • now you can select with the mouse and press '>' to indent

    set selectmode=

    • now you can select both with the mouse and shifted arrow keys and press '>' to indent

    If you add this to your vimrc, do it after behave mswin