This post originated from an RSS feed registered with PHP Buzz
by Tobias Schlitt.
Original Post: Comfortable PHP editing with VIM
Feed Title: Tobias Schlitt - Weblog
Feed URL: http://php-applications.de/lists/listinfo/phpug-dortmundlists/listinfo/phpug-dortmundlists/listinfo/phpug-dortmundlists/listinfo/phpug-dortmundlists/listinfo/phpug-dortmundlists/listinfo/phpug-dortmundlists/listinfo/phpug-dortmundlists/listinfo/phpug-dortmundlists/listinfo/phpug-dortmundlists/listinfo/phpug-dortmundlists/listinfo/phpug-dortmundlists/listinfo/phpug-dortmundlists/listinfo/phpug-dortmundlists/listinfo/phpug-dortmundapplications/blog/rss.php?category=2_PHP&version=0.91
Feed Description: a passion for php
I've always been a vi-hater, until I really came to know it. As most Unix newbes I first did not know in a way how to deal with vi in general and therefore never even touched it for years (I guess in the very first weeks, I did not even know, it exists).
After some month on Linux, someone threw me into cold water and told me to use vi for editing files and I tried, what resulted in the usual process (I imagine):
"Damn, now I'm in here, but I cannot type anything!" *argh*
"Bloody shit, I cannot even exit it anymore" *grmpf*
By mid of this year some friends tried to evangelise me to use vi and, I bet you know, the were successful. Even that successful, that I bought "Learning the vi editor"* a few weeks after they convinced me to try out vim. This is now nearly 6 month ago and I slowly start really getting used to some of it's neat functions and have some fixed set of settings, I'd like to provide to others.
Beside the usual options like autoindent, smartindent, nowrap and number, I created some nice shortcuts (for checking PHP syntax and for running "pear package" directly from the editor. But the most important feature I really like is creating code skeletons on the fly, using key mappings.
So, what does that basically mean? There are quite some constructs in PHP which you really use often, like if-statements, foreach-loops, class/method/attribute-definitions and so on. Usually people write that most of these once in a file (mostly with those definition parts) and then copy and paste the stuff. What I do since a few month now, is just typing (e.g.) "=cla" in vim's editing mode and a class defintion (including comments) appears and leaves me on a place where I can comfortably start filling it. Same for the other named constructs and some more.
I guess I sped up my code-writing speed by about 15% with that and it's pretty comfortable. So, if you like, check my current .vimrc here and try it out! Feedback, additions and hints are pretty welcome! :)
*A big recommendation on that book to everyone out there who's new to vi or one of it's clones!