Small Vim Shortcut for PHP Tags
Wed, Sep 30, 2009
The short tags in PHP have been deprecated as of 5.3.0. Short tags provided a shorter alternative to the annoying-to-type <?php and <?php echo. Instead, you could use <? and <?= respectively. This was great but it caused problems when working with XML files, and the short_tags option was disabled in the PHP config by default on some implementations.
To make life easier, I created this vim mapping that will expand <? to <?php and <?? to <?php echo. You may change the abbreviation as you see fit. Simply place this in your .vimrc
inoremap <?? <?php echo ?><Left><Left><Left> inoremap <? <?php ?><Left><Left><Left>
Re-open vim or type use :source ~/.vimrc to reload the config. Now just type <? or <?? in insert mode.
Why not subscribe to the feed?. If you’re on a mobile device I suggest Viigo
Tags: ide, Productivity, Tips, vim
Leave a Reply