News for hackers. Stuff that matters.
Re:Staying the hell out of insert mode (vi) by nailer on Monday April 26, 2010 @04:23PM (#1295875)
[code folding section deleted, I stand corrected]

Vim's indentation changes still require a mode change three obscure keys and an enter, and vim's discoverability still sucks.

Re:Staying the hell out of insert mode (vi) by novas0x2a on Monday April 26, 2010 @04:32PM (#1295904)
What do you mean "yet"?

vim has had code folding for years:

  :help fold.txt
If you want to indent code, < and > are your friends. (Really? Indenting code with search/replace? What are we, barbarians?)
Re:Staying the hell out of insert mode (vi) by philwelch on Monday April 26, 2010 @05:00PM (#1296032)
">" is the indent command. Repeat it ">>" to indent the current line. Use any other vim ranging construct (e.g. ">2j") to indent wider ranges--i.e. the current line plus two lines below.

"=" is the autoindent command. Vim recognizes many languages and you can give it plugins to understand more. Use "==" to autoindent the current line. My personal favorite, "gg=G", jumps to the top of the document and autoindents the entire thing. One time at work I was gently reminded how many spaces I was supposed to indent per the company's coding standard. I quickly set the relevant editor parameters and with four keystrokes my code was compliant.

I think there's a code-folding ability but I've never used it.

Re:Staying the hell out of insert mode (vi) by billybob on Monday April 26, 2010 @05:00PM (#1296035)
Indenting? Heck yes. '=' will indent for you. You just have to give it a movement. =j means 'indent this line and the next' =% means 'indent to the matching brace' =/foo mean 'indent to the next occurrence of foo' 1G=G means 'go to the first line and indent until the last one' If you want specific rules for indenting file types, you can put stuff in your .vim/indent/ folder to define them
Re:Staying the hell out of insert mode (vi) by Avshalom on Monday April 26, 2010 @04:33PM (#1295912)
At least for curly bracket languages. >iB indents the block <iB deindents dunno which languages it works for otherwise

http://vim.wikia.com/wiki/Category:Indenting

Re:Staying the hell out of insert mode (vi) by sophacles on Monday April 26, 2010 @09:45PM (#1296867)
Have you ever tried reading the manual? Seriously, the level of the documentation is pretty good for a free piece of software.

Edit: actually, its pretty good for any piece of software.

Re:Staying the hell out of insert mode (vi) by pyre on Monday April 26, 2010 @10:04PM (#1296920)
The problem comes when you don't know what the topic you're looking for is called in vim. I've only had that problem once or twice over the years, but it can be frustrating (esp. w/ no Internet connection).
Re:Staying the hell out of insert mode (vi) by sophacles on Monday April 26, 2010 @10:16PM (#1296952)
I agree. Fortunately however, :he has tab completion, which certainly reduces such. Also :he index is nice. And for those times with internet, #vim on freenode usually knows the correct :he keyword in seconds.
Re:Staying the hell out of insert mode (vi) by gfodor on Monday April 26, 2010 @04:33PM (#1295911)
Depending on the area you want to indent, you can use visual mode with % to select the block and then >> it over, or, for more specific regions, use visual block mode with ctrl-V to highlight the first column of the text you want to indent, hit I, indent the line by hitting space, and hit escape. When you move the cursor the other lines will indent.