Skip to content

Instantly share code, notes, and snippets.

@bmatheny
Created September 14, 2012 14:10
Show Gist options
  • Save bmatheny/3722111 to your computer and use it in GitHub Desktop.
Save bmatheny/3722111 to your computer and use it in GitHub Desktop.
Cheatsheet

zsh

  • !$ - Last argument of previous command

iterm2

  • CMD-shift-H - Paste history
  • CMD-; - Start typing word, will use history and show top 20 choices

Vim

Good to know

  • * - search for word under cursor
  • { - Move up a file by block
  • } - Move down a file by block
  • CTRL-W < - Decrease current window width by N
  • CTRL-W > - Increase current window width by N

Navigation

Every plugin seems to do navigation slightly differently. Some use j/k, some CTRL-n/CTRL-p, etc. Documenting which is which then going to see if we can get them all doing the same thing.

  • Command-T
    • CTRL-n/CTRL-p - next/previous
    • CTRL-v - open selection in new vertical split window
    • <CR>/<CTRL-CR> - open selection in new horizontal split window
  • Ack
    • CTRL-n/CTRL-p - next/previous
    • v - open selection in new vertical split window

Custom Aliases

  • mj - move down by method (remapped from m])
  • mk - move up by method (remapped from m[)
  • md - move to method definition (remaped from C-])
  • mb - move back to previous position (remaped from C-T/:pop. Note that C-[ is escape and can't easily be remapped)
  • ,aw - ack search for the word under the cursor using the current filetype as an argument to ack
  • ,nt - toggle nerdtree
  • ,q - open quickfix window (after :grep, etc)
  • ,qc - close quickfix window
  • ,pt - paste toggle
  • ,ll - long lines (set textwidth=large)
  • ,lj - active buffers
  • ,lj2b - split buffer 2 horizontally
    • ,lj->b - arrow right then b to split horizontally
  • ,lj1v - split buffer 1 vertically
  • ,b - search for buffers (command-t)
  • ,t - search for files (command-t)
  • ,T - tagbar browser

Git aliases

Aliases

  • g - git
  • gst - git status
  • gdv - git diff -w "$@" | view -
  • gca - git commit -v -a
  • gp - git push
  • gl - git pull
  • gco - git co
  • gup - git fetch && git rebase

Less frequently used aliases

  • gc - git commit -v
  • gb - git branch
  • gba - git branch -a
  • gcount - git count (shows by user commit counts)

Even less frequently used

  • gcp - git cherry-pick
  • glg - git log --stat --max-count=5
  • glgg - git log --graph --max-count=5

Branchy Aliases

  • ggpull - git pull origin $(currentbranch)
  • ggpush - git push origin $(currentbranch)
  • ggpnp - git pull origin $(currentbranch) &amp;&amp; git push origin $(currentbranch)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment