Ravines are better than plateaus

Posts Tagged ‘vim’

How to use vim and vi key bindings and shortcuts inside bash and zsh

In Uncategorized on March 3, 2012 at 22:19

During my last talk at the ruby underground last week, one of the biggest “aha” moments for the crowd was one I did not anticipate.

I switched to command line mode to explain something and mentioned how cool it was that I am using vim key bindings to edit the command line text. I simply press Esc to start moving around using b or w , then I can use “cow” to edit a current word on the command line etc..

Someone mentioned that was the one thing that made the talk worthy coming to for him.

To make this happen, I was using a .zshrc file from astrails.

but the magic is very simple to accomplish. by default you probably have emacs style key bindings in your command line. but if your’e a vim fan (as were the astrails guys I interned with for 6 months) you can change your .zshrc file to add this little line:

bindkey -v

if you’re in bash instead of zsh you can use

set -o vi

that’s it. next time you load a command shell you can Esc away and use vim key bindings.

My vim ppt from ruby underground

In resources on February 28, 2012 at 11:55

vim key practice kata #1 – cw

In Uncategorized on February 27, 2012 at 14:47
  • Load up piece of text
  • Use / to find instance of ‘the’
  • Use ‘cw’ to change ‘the’ to ‘your’
  • Use ‘esc’ and then ‘n’ to move to next find
  • Use ‘.’ to repeat
  • Use ‘n’ and ‘.’ to repeat as many times as possible
Follow

Get every new post delivered to your Inbox.

Join 25 other followers