iOS app/Ruby/Rails Developer & Instructor, 喜愛非主流的新玩具 :)

Ruby without Rails

這是在WebDev Party #3上分享的內容,主題是雖然Rails很威很好用,但如果沒有Rails的話,還可以拿Ruby做些什麼其它的事。

投影片: image View on Slideshare | Download PDF


[update] 我也把影片上傳一份到Youtube



如果畫面上的程式碼看不清楚的話,建議可以直接連結到Youtube網站切換到HD畫質,效果會好些。為什麼要連講的人一起錄進來? 因為這次並不是純操作的內容,我覺得有個人在旁邊動呀動的比較不會無聊。


  • Vim
  • Ruby
  • Rails
  • CoffeeScript
  • Git
  • Flash/ActionScript
  • and others..



Vim and Plugins




新手上路,還請多多指教 :)

[update] 有對岸的朋友說放在youtube會因為某些神奇的原因沒辦法看,所以我也順手上傳了一份到vimeo以及youku

Some Vim Tips and Learning Resources

I’m still pretty new to Vim and keep practicing Vim everyday, and also started to learn some VimScript by myself, I found some nice learning resources and some easy but AWESOME key combinations.

Learning Resources


Books and Articles


  • vimtutor is a great resource, you can type vimtutor in terminal directly to launch it. there’s also some translated version, ex: vimtutor zh would be the tranditional chinese version.
  • last but not the least, the best resource is the built-in HELP manual, just type :h something, and you SHOULD read them through at least one time.


  • dw : delete a word from current cursor position.
  • diw : delete the whold word which the cursor is parking.
  • dfSpace : delete everything until finding the next Space of the current line.
  • di( : as above, but delete all words within the nearest parenthesis, di[, di, and di also do pretty much the same thing.
  • gv : re-select last visual select.
  • ma to create a marker named a at the current cursor, then by hitting a to jump to the a marker. You can use a to z as the name of the marker.
  • :.![command] will dump the output of the command to your current editing window.
  • %!xxd turn vim to a hex editor, and %!xxd -r will change it back.
  • even you don’t manage your file within any version control system, :earlier 10m can help you to change the current file back to 10 minites ago, and :later 10m will jump back to 10 minites later.
  • :undo 5 will go back by 5 changes, and :undolist will show you undo tree.
  • you can grab web page source code into your editor directly, just like this vim http://www.eddie.com.tw

Some crazy/stupid things

I use Vim almost everyday now, but to be more sophisticated in it, I did some stupid or crazy things.

First, I removed my ESC key from my keyboard temporarily to force myself using Ctrl[, instead of hitting Esc to enter normal mode:


Why? actually there’s no good reason, just thought it might keep my fingers on main typing area in mode switching.

and second, I re-map the arrow keys to <NOP> to disable them, both in normal mode and insert mode:

map <UP> <NOP>
map <DOWN> <NOP>
map <LEFT> <NOP>
map <RIGHT> <NOP>
inoremap <UP> <NOP>
inoremap <DOWN> <NOP>
inoremap <LEFT> <NOP>
inoremap <RIGHt> <NOP>

You may think I’m crazy, but I think it’s a faster way to push those things into my muscle memory. I think there’s no shortcut to master Vim, just keep using it everyday.

At last, here is my yet another vimrc configuration. If you have any other tips which are also AWESOME, please let me know :)

Switch to Presentation Mode

I think I’m a show-off person, and usually do presentations to my friends. In this post I mentioned it’s cool to make slide with dark theme or something, but sometimes it won’t be clear enough while putting on projector, and I have to change various settings everytime, that looks not cool and not professional at all.

Thanks for Mike Skalnik, I stole this idea from his Vim config :)

I recorded this video to demonstrate how it looks like. (You might need to change the video to higher resolution if you wanna know what I typed.)

Just press <leader>z, I can toggle between working mode and presentation mode in a second.

It’s actually not a very big deal, you can check the source code to see how to do it. Althought it only works on GUI version Vim (cause I don’t know how to modify font size in terminal version Vim programmatically), but still quite convenient for myself.

I’m really SHOW-OFF, huh? :)

My Vimrc

About 3 months ago, I’ve mentioned I started to use Vim as my primary editor, and now I can only open Vim and Xcode in my daily job(my primary job is coding with Ruby and Rails, and Objective-C is just for fun).

Here is my current vim configuration, feel free to use it, and welcome to give me your suggestion(or criticism). I took some screenshots of my computer and laptop:

MacVim, on iMac with Mac OS X Lion, click to enlarge image

Non-GUI Vim, on iMac with Mac OS X Lion, click to enlarge image

Ubuntu 11.10, click to enlarge image the icons and fonts of the bottom are pretty nice, right? you can check on this, or download from here, and unzip them to ~/.font.

Windows XP, Vim on Windows? I know.. but it’s still working, right? click to enlarge image

Keep polishing

Vim is a pretty awesome and interesting editor, hope can keep polishing it in my daily jobs :)