textmate >> vim for python - teething troubles: especially indenting
Question
I'm (attempting) to move from textmate to vim [macvim to be exact] as my primary editor. I have already installed snipmate - wondering if there are other plugins you would suggest I install?
In particular I seem to be having a lot of trouble with indenting (<<
seems to really do some very strange/unpredictable things), and I can't seem to find a solution for this - are there plugins I need for this to work properly?
Thanks!
Solution
For source code,
:h =
In a nutshell, in normal mode inside a block you wish to work with:
=a{
to re-indent a block.=a}
and=aB
work as well.=2a{
to re-indent this block and its outer block.- If you happen to stand on a brace then
=%
will re-indent up to the matching brace. >a{
to increase the indent of this block.<a{
to decrease the indent of this block..
repeats the last command, so<a{.
decreases the indent of this block twice.
Make sure you have filetype
set so Vim recognizes the filetype. Indenting is a function of the file type, after all.
For text,
:h gq
- gq{ will format this paragraph.
- gq( will format this sentence.
- gqgq will format this line.
- gggqG will format the entire document.
OTHER TIPS
Set the filetype setting in your vimrc file
filetype plugin indent on
That should enable filetype plugins and automatic indentation
I am not sure what you need exactly as I have not used textmate. But I do use these Plugins for VIM. They have helped me a lot.