commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
This alias is useful if you need to use some text often. Executing the alias will copy the text into your clipboard and then remove it after X seconds.
This command allows you to revert every modified file one-by-one in a while loop, but also after "echo $file;" you can do any sort of processing you might want to add before the revert happens.
In this case, we'll be editing every PHP file from the current location down the tree.
You can show all the files in the vim buffer with :buffers which outputs something like,
1 %a "./config/config.php" line 1
2 "./lib/ws-php-library.php" line 0
3 "./lib/css.php" line 0
4 "./lib/mysqldb.class.php" line 0
5 "./lib/config.class.php" line 0
6 "./lib/actions.php" line 0
Press ENTER or type command to continue
If you'd like to edit ./lib/mysqldb.class.php for example, enter :b4 anytime you're editing a file. You can switch back and forth.