Tag Archives: ide

Small Vim Shortcut for PHP Tags

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.

I Can’t Live Without My vim Config

I have updated the vim page with my vimrc/gvimrc configs. Instead of repeating myself, I will quote some parts of the page ..

More details and the vim config itself here

I recommend turning backups on if you have them off. I personally hate having the ~ files all over my OS, so I keep them along with the .swp files in 1 backup dir in ~/.vim/

The programming language skeleton stuff will detect what files you are editing and change options in vim by inheriting the specified files which I put in ~/.vim/skeletons and ~/.vim/inherit.

The skeletons are automatically inserted in new files that vim is aware of. For example, in my own config, I have ~/.vim/inherit/c which has all the usual includes and int main() code. When I make a new C file (“gvim hello.c”), the new file begins with the skeleton code already present. Neat huh?

The inherit files can be used to set specific options for each language. This can mean different bindings, whitespace options, themes, etc depending on what language you’re working with, automatically.

See the vim page

What options have helped you the most?

Easily Installing Vim 7.2 From Source

Vim 7.2 beta was released last month, and 7.2 is now stable. First check to see if your distro offers a package, and if not, follow these simple instructions on how to install it from source, from the vim7.2 subversion branch.

cd /tmp/
svn co https://vim.svn.sourceforge.net/svnroot/vim/branches/vim7.2
cd vim7.2/
./configure --with-features=huge --enable-gui=gnome2 --enable-cscope --enable-pythoninterp

Now you can use sudo make install and you’re done,…but

I suggest using checkinstall (sudo apt-get install checkinstall) to keep track of the installed files, create a package, and have the option of easily removing whatever you installed easily (i.e., dpkg -r vim7.2).

sudo checkinstall -D

If the above command doesn’t work, you aren’t alone. It recently began giving me these errors:

cp vim /usr/local/bin/vim
chmod 755 /usr/local/bin/vim: setting permissions for `/usr/local/bin/vim': No such file or directory
make[1]: Leaving directory
… etc …
**** Installation failed. Aborting package creation.

I dug up some info about the problem, along with a solution:

There seems to be a bug in the filesystem translation code which has been
biting people using newer versions of glibc found in most recent linux
distributions. It is being worked on. If you find weird install errors
when running checkinstall but your software installs fine without
checkinstall then you can work around the bug by disabling the fs
translation code and forcing checkinstall to install the package. Use the
–fstrans=no and –install=yes command line options:

checkinstall <options> –fstrans=no –install=yes <install_command>

Source: http://oclug.on.ca/archives/oclug/2004-May/038916.html

From the man page:

–install Toggle installation of the created package.
–fstrans Enable/disable filesystem translation. Filesystem translation
enabled causes the install to proceed in a  temporary  directory, thus not actually touching your system.

sudo checkinstall --fstrans=no --install=yes

You can also have checkinstall create a package by passing in one of these flags:

–type  Choose packaging system. Can be one of ’slackware’,  ’debian’ or ’rpm’.
-D        Create a Debian package.
-R        Create a RPM package.
-S        Create a Slackware Package.

For example, to create a Debian package, I would do this:

sudo checkinstall --fstrans=no --install=yes -D:

Done. The new package has been installed and saved to

To see the changes from 7.1, use :help version-7.2

Using Vim as a Complete Ruby on Rails IDE

vi traced with an optical mouse

NOTE: If you are experiencing segmentation faults with vim and rails.vim, see this post.

When coding in Ruby on Rails, you’ll usually be switching between files and running scripts a lot. It can be time-consuming and frustrating coding Rails using a traditional text editor designed for working on big files individually. Vim lets you hop around within a file with enough speed to activate the cosmic treadmill – but without a plethora of hacks and custom key mappings, it’s weak as a Rails IDE. Fortunately, for those of us who are reluctant to kick the vim habit, Tim Pope comes to the rescue with rails.vim; A plugin that makes working with Rails in vim painless and efficient. In this guide, I will explain how to install and use rails.vim, along with a few other plugins you’ll find useful when writing Rails applications.
Continue reading Using Vim as a Complete Ruby on Rails IDE