這是在WebDev Party #3上分享的內容，主題是雖然Rails很威很好用，但如果沒有Rails的話，還可以拿Ruby做些什麼其它的事。
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.
vimtutoris a great resource, you can type
vimtutorin terminal directly to launch it. there’s also some translated version, ex:
vimtutor zhwould be the tranditional chinese version.
:h something, and you SHOULD read them through at least one time.
aat the current cursor, then by hitting ‘a to jump to the
amarker. You can use
zas the name of the marker.
:.![command]will dump the output of the command to your current editing window.
%!xxdturn vim to a hex editor, and
%!xxd -rwill change it back.
:earlier 10mcan help you to change the current file back to 10 minites ago, and
:later 10mwill jump back to 10 minites later.
:undo 5will go back by 5 changes, and
:undolistwill show you undo tree.
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 :)
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.)
<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? :)
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:
Vim is a pretty awesome and interesting editor, hope can keep polishing it in my daily jobs :)