Yan Pritzker photographer, entrepreneur, software engineer, musician, skier

Blog :: Git Workflows Book :: Dotfiles :: Photography :: About Me

TwitterCounter for @skwp

Get the news feed
Get updates by email
Follow me on twitter

hello, i'm yan

I am a photographer, entrepreneur, software engineer, guitarist, climber, and telemark skier

This blog is about startups, blogging, Ruby On Rails, virtualization and cloud computing, photography, customer service, marketing, ux and design, git, and lots more.

Enterprise intelligence with prediction markets

Find out what your team, colleagues and partners really know about the future — and leverage their knowledge to improve business decisions.

I'm the founder of Planypus, the place to share your plans!

Archives

Contact

Reach me at yan at pritzker.ws

Vim demystified: ten commands you can start using today

Posted 30 November 2011 @ 10am Tagged productivity, vim Comments: Be the first!

These commands are not only extremely useful but also mnemonic and easy to learn for a huge payoff in keystroke savings. These are the common compound commands I use every day, and I think it’s easier to dive in this way than to try to learn vim key by key.

Read Me First! Save your wrists, stop using ESC in vim
yaw yank around word – copy the current word, no matter where your cursor is inside the word

ci” change inside quote (or any other enclosure). Example: ci( to change something surrounded by parentheses. But what’s really cool is that you can invoke this from anywhere inside a line of code, so even if the string you want to change is far away, typing ci” will put your right inside the string, ready to change it.
ctX change till X (any character); and in general the use of tX where X is any character, to move to that character. You can combine the motion with another command such as dtX (delete till X), ytX (yank till X), or vtX (visually select till X).

gf

go to file – open the file under the cursor (useful for traversing file references inside codebases)

* (Shift-8) Takes you to the next occurrance of the word you’re currently looking at (often the best way to navigate to the definition of a method, if witin the same file)
Ctrl-6 Jumps you back to the previous file you were editing. I use this so often I remapped it to just the capital letter Z:
nnoremap <silent> Z <C-^>
Ctrl-]

Again, immensly useful for traversing codebases, this command relies on exuberant ctags (set up ctags) to take you to method and class definitions. I remap this to simply capital F:

nnoremap <silent> F <C-]>

I believe all highly used commands should be a single letter, as close as possible to home row.

mX
‘X

You can bookmark a file very quickly by using m plus any capital letter. Then to go back to the file at any time, hit and the same letter again.

The commands in this section are based on custom aliases. Please check that the alias doesn’t overload a key you’re used to.
K For super fast code navigation, nothing beats the git grep plugin combined with an alias to grep the Kurrent word under the cursor:

nnoremap <silent> K :GitGrep <cword><CR>

vv
ss
Splitting windows is a common and every day task, so you shouldn’t spend extra time typing to do so. Just double tap vv or ss:
nnoremap <silent> vv <C-w>v
nnoremap <silent> ss <C-w>s
Window navigation using J,K,I,M Bonus: A very common task for which the default key bindings involve way too many keystrokes. Use directional style keys to move between windows:
nnoremap <silent> H <C-w>h
nnoremap <silent> L <C-w>l
nnoremap <silent> I <C-w>k
nnoremap <silent> M <C-w>j

If you liked this post, you might want to watch my dotfiles repo on github. My dotfiles follow a keystroke minimizing principle where all common tools are only a few characters long, and are in the process of being cleaned up in order to release as a product targeting keystroke saving enthusiasts (this is especially important for those concerned with RSI prevention).


Rails plugin: view a tree of all your partials

Posted 21 November 2011 @ 10am Tagged RubyOnRails Comments: 1 Comment

Trying to refactor your views? Too many partials got you down? Let PartialMap help! Draws an ascii or html tree of all your views and the partials that they reference. The tool is very simple and has a plugin formatter architecture so you can create formatters for other views. Please fork and contribute, or just enjoy as is: PartialMap on github.


Dotfiles for insane productivity in bash, git, and vim

Posted 17 November 2011 @ 5pm Tagged git, rails, vim Comments: Be the first!

Following the principles of insane productivity that I blogged about earlier, I am releasing my dotfile repository, containing customizations for bash, git, and vim. The guiding principles are two letter mnemonics for everything bash and git related, and single letter capital letter actions for all common Vim commands. The selection of vim plugins is best of breed for navigation, color highlighting, and git integration. The vim setup is optimized for rails and git development. The vimrc contains my custom single-letter aliases and is pretty well commented, so that you can easily take or reject my modifications as you need. and I will continue to clean up the repo and move everything into tpope’s pathogen plugin format over time. Enjoy and please send feedback!


← Before After →