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

一曲冷凌霜 提交于 2019-12-18 07:14:34

问题


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.


回答1:


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




回答2:


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




回答3:


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



回答4:


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



来源:https://stackoverflow.com/questions/413208/how-can-i-indent-code-in-the-vim-editor-on-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!