Handy VIM keyboard shortcut

One of the things I missed about using UEStudio (in Windows) when I switched to Linux is a simple little keyboard shortcut it has for C programming.  The shortcut allows you to type .. (two periods) that will be automagically replaced with the arrow -> operator for calling class methods (PHP uses the arrow operator).

Try typing this (a CodeIgniter ActiveRecord db example):

$this->db->get('table_name')->row(0)->field_name;

Now type it using the shortcut from UEStudio:

$this..db..get('table_name')..row(0)..field_name;

MUCH faster when you have to use PHP methods a lot.

As it turns out, you can do the same thing in VIM with a simple insert-mode keyboard map in your .vimrc file:

inoremap .. ->

Pretty nice :)

About Jon Trelfa

I live in Detroit, Mi.
This entry was posted in Code, Linux and tagged . Bookmark the permalink.

One Response to Handy VIM keyboard shortcut

  1. Michael says:

    K, I am lovin this. Another GREAT Vim tip.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>