27 September, 2008

Happy Vimming again!

Vim has been my favorite editor for years. However, for Java related development I've switched to Eclipse. Vim is then only been used for general text editing (writing notes, scripts, etc).

Recently, I have to do fairly amount of coding in PL/SQL. After struggling for weeks to writing code in SQLDeveloper, I remember the lovely Vim.

Vim already bundled the syntax file for PLSQL and Oracle SQL,. However, Vim doesn't bundled with a good PL/SQL indentation setup, which can be found in here.

Another important setup is connecting sqlplus and vim and it is can be done by adding the line below into glogin.sql (sqlplus init file):

 DEFINE _EDITOR='vim -c "set filetype=plsql"'

Finally, to make the sqlplus usable, it is better to use rlwrap (which bring basic readline features like command history and hot key to the sqlplus).