LAMP How To – Open Source At Work

Only Passion Matters

Entries Tagged ‘vim’

vim – quick navigation

Other than using ‘w’ or ‘b’ to navigate between words, another quick way to navigate between sentences is to use the ‘(‘ and ‘)’ keys.

Share and Enjoy:

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • StumbleUpon
  • Technorati
  • LinkedIn
  • MySpace
  • Slashdot
  • TwitThis
  • Yahoo! Buzz

Windows file in Unix. Careful of ^M and how to replace them

I thought many people know this but sometimes, it is taken for granted and can cause hours of misery.
If you save a text file in windows, you get ^M as new line. In unix, this can cause problems. I was running a script to dump a query into csv and couldn’t quite work out why [...]

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • StumbleUpon
  • Technorati
  • LinkedIn
  • MySpace
  • Slashdot
  • TwitThis
  • Yahoo! Buzz

Control S in vim hangs

Another vim tip,
In vim, if you press control s and the screen freezes, press control q to unlock the screen. This is an xterm thinggy.
cheers.

Share and Enjoy:

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • StumbleUpon
  • Technorati
  • LinkedIn
  • MySpace
  • Slashdot
  • TwitThis
  • Yahoo! Buzz

Arrow Keys In Vim

When you navigate using the arrow keys in vim, you might get some funny characters like A, B, C…etc. In .vimrc, add this line:
:set nocompatible
This should do the trick.

Share and Enjoy:

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • StumbleUpon
  • Technorati
  • LinkedIn
  • MySpace
  • Slashdot
  • TwitThis
  • Yahoo! Buzz

copy and paste between vim windows – stupid indentation

if you are using vim and tries to copy and paste between windows or shells, you may find that vim adds some extra spaces / identations to your code. Irritation? yes. The quick solution is to do a
:set noautoident
or add this in the vimrc file to make it a default.

Share and Enjoy:

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • StumbleUpon
  • Technorati
  • LinkedIn
  • MySpace
  • Slashdot
  • TwitThis
  • Yahoo! Buzz