2011-12-18 05:27:01 +08:00
_ _ _
| | | | | |
| |___| |_____ __ | | ____
|_____ (____ |/ _ |/ ___)
_____ | / ___ ( (_| | |
(_______\_____|\____|_|
2011-11-18 05:45:33 +08:00
2012-03-08 18:09:57 +08:00
# Yet Another Dotfile Repo v0.9
2011-12-18 05:27:01 +08:00
# Alpha Release Please Report Bugs
2011-12-16 19:33:25 +08:00
2012-01-25 15:21:33 +08:00
git clone https://github.com/skwp/dotfiles ~/.yadr
cd ~/.yadr & & rake install
2011-12-18 05:27:01 +08:00
# Your dotfiles are safe! YADR will not
# overwrite anything. Please read on for
# install directions!
2011-11-18 06:40:21 +08:00
2011-12-07 13:57:45 +08:00
This is a collection of best of breed tools from across the web,
from scouring other people's dotfile repos, blogs, and projects.
2012-01-25 02:53:58 +08:00
## What is YADR?
2011-12-18 06:40:58 +08:00
**YADR is an opinionated dotfile repo that will make your heart sing**
* OSX is the best OS. MacVim is the best editor. Zsh is the best shell. Pry is the best irb. Solarized is the best color scheme.
* Apple-style philosophy: make everything Just Work and Look Good. Don't worry about too many options.
2011-12-07 13:57:45 +08:00
* All common commands should be two and three character mnemonic aliases - less keystrokes, RSI reduction
2011-12-18 06:40:58 +08:00
* Avoid stressful hand motions, e.g. remap Esc to caps lock key, remap underscore to Alt-k in vim, make window management in vim easy.
2011-12-08 12:54:03 +08:00
* Easy to use plugin architecture, no config files to edit.
* Pick one tool and use it everywhere: vim-ize everything
2011-12-18 06:11:05 +08:00
* **NEW Beautiful, easy to read and small vimrc**
* **NEW No key overrides or custom hackery in vimrc, everything in well factored snippets in .vim/plugin/settings**
2011-12-08 12:54:03 +08:00
2012-01-25 02:53:58 +08:00
## Why is this not a fork of Janus?
2011-12-18 06:40:58 +08:00
Janus is an amazing _first effort_ to deliver a ready-to-use vim setup and is a huge inspiration to us all.
**However as any first effort, it paves the way to improvements:**
2011-12-08 12:54:03 +08:00
2011-12-18 06:40:58 +08:00
* Much larger list of vim plugins, specifically geared to Ruby/Rails/Git development.
* Optimized support for MacVim only means less things will break because we don't worry about linux or gvim.
* Optimized support for Solarized color scheme only, everything guaranteed to Look Good. Your eyes will thank you.
* All plugins tested with Solarized and custom color maps provided where needed to ensure your eyes will not bleed.
* No configuration file to maintain. YADR uses tiny ruby scripts to wrap git submodule maintenance.
2012-03-08 08:12:05 +08:00
* Much cleaner vimrc that keps keymaps isolated to a plugin file (not in the main vimrc).
2011-12-18 06:40:58 +08:00
* All keymaps and customization in small, easy to maintain files under .vim/plugin/settings
* More than just vim plugins - great shell aliases, osx, and irb/pry tweaks to make you more productive.
2011-12-07 13:57:45 +08:00
2012-01-25 02:53:58 +08:00
## Screenshot
2012-03-14 06:14:25 +08:00
![screenshot ](http://i.imgur.com/afzuR.png )
2011-12-20 18:19:42 +08:00
2012-01-25 02:53:58 +08:00
## Before you start
2011-12-07 13:57:45 +08:00
2011-12-18 06:40:58 +08:00
For the love of all that is holy, stop abusing your hands!
Remap caps-lock to escape: http://pqrs.org/macosx/keyremap4macbook/extra.html
2011-12-07 13:57:45 +08:00
2012-03-08 08:12:05 +08:00
## Debugging vim keymappings
This is so useful, it needs to be at the top. If you are having unexpected behavior, wondering why a particular key works the way it does,
2012-03-09 15:25:10 +08:00
use: `:map [keycombo]` (e.g. `:map <C-\>` ) to see what the key is mapped to. For bonus points, you can see where the mapping was set by using `:verbose map [keycombo]` .
2012-03-08 08:12:05 +08:00
If you omit the key combo, you'll get a list of all the maps. You can do the same thing with nmap, imap, vmap, etc.
2012-01-25 02:53:58 +08:00
2012-01-25 04:13:35 +08:00
## Dependencies
2012-01-25 03:53:44 +08:00
YADR is opinionated. To get the most out of using it, you should install
all the software it depends on.
2012-03-08 18:09:57 +08:00
### Patched fonts for Vim-Powerline
Please install fonts from fonts/ directory. These are used to give a really nice vim status line.
2012-01-25 04:15:23 +08:00
### [Homebrew](http://mxcl.github.com/homebrew/)
2012-01-25 03:53:44 +08:00
Homebrew is _the missing package manager for OSX_ . To install:
```bash
/usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"
```
With homebrew installed, install some packages:
```bash
2012-04-16 14:52:23 +08:00
brew install ack ctags git hub macvim
2012-01-25 03:53:44 +08:00
```
2012-01-25 04:15:23 +08:00
### [ctags](http://ctags.sourceforge.net/)
2012-01-25 03:53:44 +08:00
Vim will complain every time you save a file if you do not have ctags installed correctly. We
assume you have installed ctags via homebrew. If you have homebrew setup correctly running
`which ctags` should output `/usr/local/bin/ctags` . If you get something else do this:
Make sure `/usr/local/bin` is before `/usr/bin` in your PATH.
2012-04-05 14:11:17 +08:00
If that doesn't work, move the OSX supplied ctags [like so ](http://www.mattpolito.info/post/1648956809/ctags-got-you-down ):
2012-01-25 03:53:44 +08:00
```bash
sudo mv /usr/bin/ctags /usr/bin/ctags_original
```
2012-01-25 04:15:23 +08:00
### [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh)
2012-01-25 03:53:44 +08:00
```bash
curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh
```
2012-03-19 12:15:37 +08:00
### [fasd](https://github.com/clvv/fasd)
fasd gives you handy shell commands `f` ,`a`,`s`,`d`, and `z` to jump to recently used files.
Read more at the project's home page. Or just type `z` followed by a partial reference to
a recent directory to see how it works.
2012-01-25 02:53:58 +08:00
## Installation
2011-12-07 13:57:45 +08:00
2012-01-25 15:21:33 +08:00
Installation is automated via `rake` and the `yadr` command. To get
started please run:
2011-12-08 15:27:41 +08:00
2012-01-25 02:57:56 +08:00
```bash
2012-01-25 15:21:33 +08:00
git clone https://github.com/skwp/dotfiles ~/.yadr
cd ~/.yadr & & rake install
2012-01-25 02:57:56 +08:00
```
2011-11-19 00:19:31 +08:00
2012-03-09 15:25:10 +08:00
Open the fonts in fonts/ and click Install Font for every font that you want.
You must install Inconsolata to have YADR's powerline theme work correctly out of the box.
2012-01-25 15:21:33 +08:00
Note: YADR will not destroy any of your files unless you tell it to.
2011-11-19 00:19:31 +08:00
2012-01-25 15:21:33 +08:00
## Upgrading
Upgrading is easy.
2011-11-19 00:19:31 +08:00
2012-01-25 02:57:56 +08:00
```bash
2012-01-25 15:21:33 +08:00
cd ~/.yadr
git pull origin master
rake install
2012-01-25 02:57:56 +08:00
```
2011-12-08 15:27:41 +08:00
2011-11-19 00:19:31 +08:00
2012-01-31 09:34:50 +08:00
## ZSH
2012-01-25 02:53:58 +08:00
2011-12-08 15:27:41 +08:00
After a lifetime of bash, I am now using ZSH as my default shell because of its awesome globbing
2012-01-03 04:27:36 +08:00
and autocomplete features (the spelling fixer autocomplete is worth the money alone).
2011-12-07 13:57:45 +08:00
2011-12-08 15:27:41 +08:00
Migrating from bash to zsh is essentially pain free. The zshrc provided here
restores the only feature that I felt was 'broken' which is the Ctrl-R reverse history search.
While I am not going to support bash out of the box here, YADR _should_ work with bash if
2011-12-18 06:11:05 +08:00
you just source the _aliases_ file. However, you soul will sing if you install zsh. I promise.
2012-01-03 04:27:36 +08:00
Lots of things I do every day are done with two or three character
2011-12-19 05:08:35 +08:00
mnemonic aliases. Please feel free to edit them:
2011-11-18 05:45:33 +08:00
ae # alias edit
ar # alias reload
2012-01-31 09:34:50 +08:00
### ZSH Customizations
2011-12-07 13:57:45 +08:00
* Vim mode
* Bash style ctrl-R for reverse history finder
2011-12-08 15:27:41 +08:00
* Fuzzy matching - if you mistype a directory name, tab completion will fix it
2011-12-07 13:57:45 +08:00
2012-03-24 02:02:58 +08:00
### How To Customize ZSH
YADR allows you to completely customize your ZSH without having to fork and maintain the project. Here's how it works: YADR will
2012-04-06 02:49:43 +08:00
source (include) any files in `.yadr/custom/zsh/before/*` or `.yadr/custom/zsh/after/*` . The `before` files are
2012-03-24 02:02:58 +08:00
useful for setting the theme and plugins. `after` files allow you to override options set by YADR, define your own aliases, etc.
To make your life easier, create a `zsh` folder in your Dropbox (or as a git repo) and symlink it into `~/.yadr/custom` . Do it like this:
```bash
ln -s ~/Dropbox/path/to/zsh ~/.yadr/custom/zsh
```
2012-04-16 21:55:32 +08:00
Create as many `before/whatever.zsh` or `after/whatever.zsh` files as you need within the `zsh` directory. Please see `custom/zsh.sample` for
2012-03-24 02:02:58 +08:00
an example.
2012-01-25 02:53:58 +08:00
2012-01-31 09:34:50 +08:00
## Pry
2012-01-25 15:21:33 +08:00
2012-01-03 04:27:36 +08:00
Pry (http://pry.github.com/) offers a much better out of the box IRB experience
2011-12-06 16:40:44 +08:00
with colors, tab completion, and lots of other tricks. You should:
2012-01-31 09:34:50 +08:00
### Install the gem
2012-01-25 15:21:33 +08:00
2012-01-25 02:57:56 +08:00
```bash
gem install pry
gem install awesome_print
```
2011-12-06 16:40:44 +08:00
2012-01-31 09:34:50 +08:00
### Use pry
2011-12-07 13:57:45 +08:00
2012-01-25 15:21:33 +08:00
* as irb: `pry`
* as rails console: `script/console --irb=pry`
2011-12-07 13:57:45 +08:00
2012-01-31 09:34:50 +08:00
### Pry Customizations:
2011-12-07 13:57:45 +08:00
2012-01-25 15:21:33 +08:00
* `clear` command to clear screen
* `sql` command to execute something (within a rails console)
2011-12-07 13:57:45 +08:00
* all objects displayed in readable format (colorized, sorted hash keys) - via awesome_print
* a few color modifications to make it more useable
2012-01-25 15:21:33 +08:00
* type `help` to see all the commands
2012-01-25 02:53:58 +08:00
2012-01-31 09:34:50 +08:00
## Git
2012-01-25 02:53:58 +08:00
2012-01-31 09:34:50 +08:00
### User Info
2012-01-25 02:53:58 +08:00
2012-03-09 15:25:10 +08:00
Since the gitconfig doesn't contain the user info, I recommend using env variables. Put the following in
2012-01-25 15:21:33 +08:00
your `~/.secrets` file which is automatically referenced by the provided zshrc:
2012-01-25 02:53:58 +08:00
# Set your git user info
export GIT_AUTHOR_NAME='Your Name'
export GIT_AUTHOR_EMAIL='you@domain.com'
export GIT_COMMITTER_NAME='Your Name'
export GIT_COMMITTER_EMAIL='you@domain.com'
# Optionally, set your GitHub credentials
export GITHUB_USER='your_user_name'
export GITHUB_TOKEN='your_github_token'
2012-01-31 09:34:50 +08:00
### Git Customizations:
2012-01-25 02:53:58 +08:00
2012-01-26 11:33:59 +08:00
* `git l` - a much more usable git log
* `git b` - a list of branches with summary of last commit
* `git r` - a list of remotes with info
* `git t` - a list of tags with info
* `git nb` - a (n)ew (b)ranch - like checkout -b
* `git cp` - cherry-pick -x (showing what was cherrypicked)
* `git changelog` - a nice format for creating changelogs
2012-01-25 02:53:58 +08:00
* Some sensible default configs, such as improving merge messages, push only pushes the current branch, removing status hints, and using mnemonic prefixes in diff: (i)ndex, (w)ork tree, (c)ommit and (o)bject
* Slightly imrpoved colors for diff
2012-01-26 11:33:59 +08:00
* `git unstage` (remove from index) and `git uncommit` (revert to the time prior to the last commit - dangerous if already pushed) aliases
2012-01-25 02:53:58 +08:00
2012-01-31 09:34:50 +08:00
## RubyGems
2011-12-19 05:08:35 +08:00
2012-01-31 09:34:50 +08:00
A .gemrc is included. Never again type `gem install whatever --no-ri --no-rdoc` . `--no-ri --no-rdoc` is done by default.
2011-11-18 05:45:33 +08:00
2012-01-25 02:53:58 +08:00
## Vim Configuration
2012-01-31 09:34:50 +08:00
The .vimrc is well commented and broken up by settings. I encourage you
to take a look and learn some of my handy aliases, or comment them out
if you don't like them, or make your own.
2012-01-25 02:53:58 +08:00
2012-01-31 09:34:50 +08:00
### Vim Keymaps
2011-11-18 06:40:21 +08:00
2012-01-03 04:27:36 +08:00
The files in vim/plugin/settings are customizations stored on a per-plugin
2011-12-13 13:04:42 +08:00
basis. The main keymap is available in skwp-keymap.vim, but some of the vim
files contain key mappings as well (TODO: probably will move them out to skwp-keymap.vim)
2012-01-26 11:15:03 +08:00
#### Navigation
2011-12-13 13:04:42 +08:00
2012-02-11 06:59:48 +08:00
* `,z` - go to previous buffer (:bp)
* `,x` - go to next buffer (:bn)
2012-03-13 01:05:56 +08:00
* `Cmd-j` and `Cmd-k` to move up and down roughly by functions
2012-01-26 11:33:59 +08:00
* `Ctrl-o` - Old cursor position - this is a standard mapping but very useful, so included here
* `Ctrl-i` - opposite of Ctrl-O (again, this is standard)
2011-12-21 15:48:33 +08:00
2012-01-26 11:15:03 +08:00
#### LustyJuggler
2011-12-13 13:04:42 +08:00
2012-01-26 11:33:59 +08:00
* `,lj` - show buffers (LustyJuggler buffer search), just type to fuzzy match a buffer name
2012-04-04 17:19:11 +08:00
* `,lf` - file system browser
2011-12-13 13:04:42 +08:00
2012-01-26 11:15:03 +08:00
#### Rails
2011-12-13 13:04:42 +08:00
2012-01-26 11:33:59 +08:00
* `,ss` to run specs, `,ll` to run a given spec on a line - using my [vim-ruby-conque plugin ](https://github.com/skwp/vim-ruby-conque )
2012-03-09 15:25:10 +08:00
* `Cmd-Shift-R` to use vim-ruby-conque to run a spec file. `Cmd-Shift-L` to run from a line (individual it block)
2011-12-13 13:04:42 +08:00
2012-01-26 11:15:03 +08:00
#### Surround.vim customizations
2011-12-18 05:27:01 +08:00
* in plugin/settings/surround.vim (this folder contains all my customizations)
2012-01-26 11:33:59 +08:00
* the `#` key now surrounds with `#{}` , so `ysaw#` (surround around word) `#{foo}`
* `=` surrounds with `<%= erb tag %>` ; `-` for `<% this %>` . So, `yss=` or `yss-` to wrap code
2011-12-18 05:27:01 +08:00
2012-01-26 11:15:03 +08:00
#### Search/Code Navigation
2011-12-11 18:05:29 +08:00
2012-01-26 11:33:59 +08:00
* `,f` - instantly Find definition of class (must have exuberant ctags installed)
* `,F` - same as ,f but in a vertical split
2012-03-08 03:52:26 +08:00
* `,gf` - same as vim normal gf (go to file), but in a vertical split
2012-01-26 11:33:59 +08:00
* `K` - GitGrep the current word under the cursor and show results in quickfix window
* `,K` - GitGrep the current word up to next exclamation point (useful for ruby foo! methods)
* `Cmd-*` - highlight all occurrences of current word (similar to regular `*` except doesn't move)
* `,hl` - toggle search highlight on and off
2012-03-08 03:52:26 +08:00
* `,gg` - GitGrep command line, type between quotes
2012-02-06 04:50:35 +08:00
* `,gd` - GitGrep def (greps for 'def [function name]') when cursor is over the function name
2012-01-26 11:33:59 +08:00
* `,gcp` - GitGrep Current Partial to find references to the current view partial
2012-03-30 04:40:59 +08:00
* `,gcf` - GitGrep Current File to find references to the current file
2012-01-26 11:33:59 +08:00
* `//` - clear the search
* `,q/` - quickfix window with last search (stolen from Steve Losh)
* `,qa/` - quickfix Ack last search (Steve Losh)
* `,qg/` - quickfix GitGrep last search
* `,T` - Tag list (list of methods in a class)
2011-12-13 13:04:42 +08:00
2012-01-26 11:15:03 +08:00
#### File Navigation
2011-12-28 02:43:38 +08:00
2012-01-26 11:33:59 +08:00
* `,t` - CtrlP fuzzy file selector
* `,b` - CtrlP buffer selector
* `Cmd-Shift-P` - Clear CtrlP cache
* `,jm` jump (via CtrlP) to app/models
* `,jc` app/controllers
* `,jv` app/views
* `,jh` app/helpers
* `,jl` lib
* `,jp` public
* `,js` spec
* `,jf` fast_spec
* `,jt` test
* `,jd` db
* `,jC` config
* `,jV` vendor
* `,jF` factories
2011-12-24 06:13:59 +08:00
2012-01-26 11:15:03 +08:00
#### RSI-reduction
2012-01-03 04:27:36 +08:00
2012-01-26 11:33:59 +08:00
* `Cmd-k` and `Cmd-d` to type underscores and dashes (use Shift), since they are so common in code but so far away from home row
2012-04-16 03:31:56 +08:00
* `Cmd-k` and `Cmd-d` to type underscores and dashes (use Shift), since they are so common in code but so far away from home row
* `Ctrl-l` to insert a => hashrocket (thanks @garybernhardt )
* `,.` to go to last edit location (same as `'.` ) because the apostrophe is hard on the pinky
2012-01-26 11:33:59 +08:00
* `Cmd-'` and `Cmd-"` to change content inside quotes
2012-01-31 01:10:18 +08:00
* Cmd-Space to autocomplete. Tab for snipmate snippets.
2012-04-03 03:03:21 +08:00
* `,ci` to change inside any set of quotes/brackets/etc
2011-12-13 13:04:42 +08:00
2012-01-26 11:15:03 +08:00
#### Tab Navigation
2011-12-13 13:04:42 +08:00
2012-01-26 11:33:59 +08:00
* `Ctrl-H` and `Ctrl-L` - left an right on tabs
* Use `Cmd-1` thru `Cmd-9` to switch to a specific tab number (like iTerm) - and tabs have been set up to show numbers
2011-12-18 05:27:01 +08:00
2012-01-26 11:15:03 +08:00
#### Window Navigation
2011-12-18 05:27:01 +08:00
2012-03-13 01:05:56 +08:00
* `Ctrl-h,l,j,k` - to move left, right, down, up between windows
2012-01-26 11:33:59 +08:00
* `Q` - Intelligent Window Killer. Close window `wincmd c` if there are multiple windows to same buffer, or kill the buffer `bwipeout` if this is the last window into it.
2012-04-16 03:31:56 +08:00
* Arrow keys - resize windows (up/down for vertical, left=make smaller horizontally, right=make bigger horizontally)
2011-12-18 05:27:01 +08:00
2012-01-26 11:15:03 +08:00
#### Splits
2011-12-18 05:27:01 +08:00
2012-01-26 11:33:59 +08:00
* `vv` - vertical split (`Ctrl-w,v`)
* `ss` - horizontal split (`Ctrl-w,s`)
* `,qo` - open quickfix window (this is where output from GitGrep goes)
* `,qc` - close quickfix
* `,gz` - zoom a window to max size and again to unzoom it (ZoomWin plugin, usually `C-w,o` )
2011-12-21 15:48:33 +08:00
2012-01-26 11:15:03 +08:00
#### NERDTree Project Tree
2011-12-21 15:48:33 +08:00
2012-01-26 11:33:59 +08:00
* `Cmd-Shift-N` - NERDTree toggle
* `Ctrl-\` - Show current file tree
2011-12-16 14:20:51 +08:00
2012-01-26 11:15:03 +08:00
#### Utility
2011-12-13 13:04:42 +08:00
2012-01-26 11:33:59 +08:00
* `,ig` - toggle visual indentation guides
2012-04-15 07:40:50 +08:00
* `,cf` - Copy Filename of current file (full path) into system (not vi) paste buffer
* `,cn` - Copy Filename of current file (name only, no path)
2012-03-09 08:46:45 +08:00
* `,vc` - (Vim Command) copies the command under your cursor and executes it in vim. Great for testing single line changes to vimrc.
2012-01-26 11:33:59 +08:00
* `,yw` - yank a word from anywhere within the word (so you don't have to go to the beginning of it)
* `,ow` - overwrite a word with whatever is in your yank buffer - you can be anywhere on the word. saves having to visually select it
* `,w` - strip trailing whitespaces
* `sj` - split a line such as a hash {:foo => {:bar => :baz}} into a multiline hash (j = down)
* `sk` - unsplit a link (k = up)
2012-02-25 05:37:21 +08:00
* `,he` - Html Escape
* `,hu` - Html Unescape
2012-01-26 11:33:59 +08:00
* `Cmd-Shift-A` - align things (type a character/expression to align by, works in visual mode or by itself)
2012-04-06 01:27:29 +08:00
* `:ColorToggle` - turn on #abc123 color highlighting (useful for css)
2012-04-02 05:45:41 +08:00
* `:gitv` - Git log browsers
2012-04-04 17:21:19 +08:00
* `,hi` - show current Highlight group. if you don't like the color of something, use this, then use `hi! link [groupname] [anothergroupname]` in your vimrc.after to remap the color. You can see available colors using `:hi`
2011-11-18 06:50:58 +08:00
2012-01-26 11:15:03 +08:00
#### Comments
2011-12-16 16:30:43 +08:00
2012-01-26 11:33:59 +08:00
* `Cmd-/` - toggle comments (usually gcc from tComment)
* `gcp` (comment a paragraph)
2011-12-16 16:30:43 +08:00
2012-01-26 02:35:34 +08:00
**Wrapping**
* :Wrap - wrap long lines (e.g. when editing markdown files).
* Cmd-[j, k, $, 0, ^] - navigate display lines.
2012-01-25 02:53:58 +08:00
### Included vim plugins
2011-12-07 15:06:13 +08:00
2012-01-26 11:15:03 +08:00
#### Navigation
2011-12-07 17:02:20 +08:00
* NERDTree - everyone's favorite tree browser
* NERDTree-tabs - makes NERDTree play nice with MacVim tabs so that it's on every tab
2012-01-25 02:53:58 +08:00
* ShowMarks - creates a visual gutter to the left of the number column showing you your marks
2012-01-21 10:46:57 +08:00
* EasyMotion - hit ,,w (forward) or ,,b (back) and watch the magic happen. just type the letters and jump directly to your target - in the provided vimrc the keys are optimized for home and upper row, no pinkies
2011-12-07 17:40:44 +08:00
* LustyJuggler/Explorer - hit B, type buf name to match a buffer, or type S and use the home row keys to select a buffer
2012-01-25 02:38:33 +08:00
* TagBar - hit ,T to see a list of methods in a class (uses ctags)
2012-01-25 02:19:23 +08:00
* CtrlP - Ctrl-p or ,t to find a file
2011-12-07 17:02:20 +08:00
2012-01-26 11:15:03 +08:00
#### Git
2011-12-07 17:02:20 +08:00
2012-01-26 11:33:59 +08:00
* fugitive - "a git wrapper so awesome, it should be illegal...". Try Gstatus and hit `-` to toggle files. Git `d` to see a diff. Learn more: http://vimcasts.org/blog/2011/05/the-fugitive-series/
2012-04-02 05:45:41 +08:00
* gitv - use :gitv for a better git log browser
2011-12-07 15:06:13 +08:00
* GitGrep - much better than the grep provided with fugitive; use :GitGrep or hit K to grep current word
2011-12-07 17:02:20 +08:00
2012-01-26 11:15:03 +08:00
#### Colors
2011-12-07 17:02:20 +08:00
* AnsiEsc - inteprets ansi color codes inside log files. great for looking at Rails logs
* solarized - a color scheme scientifically calibrated for awesomeness (including skwp mods for ShowMarks)
* csapprox - helps colors to be represented correctly on terminals (even though we expect to use MacVim)
2012-03-08 18:09:57 +08:00
* Powerline - beautiful vim status bar. Requires patched fonts (install from fonts/ directory)
2011-12-07 17:02:20 +08:00
2012-01-26 11:15:03 +08:00
#### Coding
2011-12-07 17:02:20 +08:00
* tComment - gcc to comment a line, gcp to comment blocks, nuff said
2012-01-26 11:33:59 +08:00
* sparkup - div.foo#bar - hit `ctrl-e` , expands into `<div class="foo" id="bar"/>` , and that's just the beginning
2011-12-07 18:00:46 +08:00
* rails.vim - syntax highlighting, gf (goto file) enhancements, and lots more. should be required for any rails dev
2011-12-08 18:02:21 +08:00
* ruby.vim - lots of general enhancements for ruby dev
* necomplcache - intelligent and fast complete as you type, and added Command-Space to select a completion (same as Ctrl-N)
* snipMate - offers textmate-like snippet expansion + scrooloose-snippets . try hitting TAB after typing a snippet
2012-01-12 03:07:32 +08:00
* jasmine.vim - support for jasmine javascript unit testing, including snippets for it, before, etc..
2012-01-23 10:47:55 +08:00
* vim-coffeescript - support for coffeescript, highlighting
* vim-stylus - support for stylus css language
2011-12-20 17:58:23 +08:00
2012-01-26 11:15:03 +08:00
#### TextObjects
2011-12-20 17:58:23 +08:00
The things in this section provide new "objects" to work with your standard verbs such as yank/delete/change/=(codeformat), etc
2012-01-26 11:33:59 +08:00
* textobj-rubyblock - ruby blocks become vim textobjects denoted with `r` . try var/vir to select a ruby block, dar/dir for delete car/cir for change, =ar/=ir for formatting, etc
2011-12-20 17:58:23 +08:00
* vim-indentobject - manipulate chunks of code by indentation level (great for yaml) use vai/vii to select around an indent block, same as above applies
* argtextobj - manipulation of function arguments as an "a" object, so vaa/via, caa/cia, daa/dia, etc..
2012-01-26 11:33:59 +08:00
* textobj-datetime - gives you `da` (date), `df` (date full) and so on text objects. useable with all standard verbs
* vim-textobj-entire - gives you `e` for entire document. so vae (visual around entire document), and etc
* vim-textobj-rubysymbol - gives you `:` textobj. so va: to select a ruby symbol. da: to delete a symbol..etc
* vim-textobj-function - gives you `f` textobj. so vaf to select a function
* next-textobject - from Steve Losh, ability to use `n` such as vinb (visual inside (n)ext set of parens)
2011-12-07 17:02:20 +08:00
2012-01-26 11:15:03 +08:00
#### Utils
2011-12-07 17:02:20 +08:00
2012-01-03 04:27:36 +08:00
* SplitJoin - easily split up things like ruby hashes into multiple lines or join them back together. Try :SplitjoinJoin and :SplitjoinSplit or use the bindings sj(split) and sk(unsplit) - mnemonically j and k are directions down and up
2011-12-18 17:38:03 +08:00
* tabularize - align code effortlessly by using :Tabularize /[character] to align by a character, or try the keymaps
2011-12-18 05:27:01 +08:00
* yankring - effortless sanity for pasting. every time you yank something it goes into a buffer. after hitting p to paste, use ctrl-p or ctrl-n to cycle through the paste options. great for when you accidentally overwrite your yank with a delete
2011-12-08 18:02:21 +08:00
* surround - super easy quote and tag manipulation - ysiw" - sourround inner word with quotes. ci"' - change inner double quotes to single quotes, etc
2011-12-07 17:40:44 +08:00
* greplace - use :Gsearch to find across many files, replace inside the changes, then :Greplace to do a replace across all matches
2011-12-07 16:32:08 +08:00
* ConqueTerm - embedded fully colorful shell inside your vim
2012-03-09 15:25:10 +08:00
* vim-ruby-conque - helpers to run ruby,rspec,rake within ConqueTerm
2011-12-07 16:49:13 +08:00
* vim-markdown-preview - :Mm to view your README.md as html
2012-02-25 05:37:21 +08:00
* html-escape - ,he and ,hu to escape and unescape html
2011-12-07 17:02:20 +08:00
* ruby-debug-ide - not quite working for me, but maybe it will for you. supposedly a graphical debugger you can step through
2011-12-13 12:55:35 +08:00
* Gundo - visualize your undos - pretty amazing plugin. Hit ,u with my keymappings to trigger it, very user friendly
2011-12-16 15:09:50 +08:00
* slime - use ctrl-c,ctrl-c to send text to a running irb/pry/console. To start the console, you must use screen with a named session: "screen -S [name] [cmd]", ex: "screen -S pry pry"
2012-01-21 10:46:57 +08:00
* vim-indent-guides - visual indent guides, off by default
2012-03-13 05:24:26 +08:00
* color_highlight - use :ColorCodes to see hex colors highlighted
2012-04-03 03:03:21 +08:00
* change-inside-surroundings - change content inside delimiters like quotes/brackets
2011-12-07 17:02:20 +08:00
2012-01-26 11:15:03 +08:00
#### General enhancements that don't add new commands
2011-12-07 17:12:42 +08:00
2012-03-09 17:16:33 +08:00
* Arpeggio - allows you to define key-chord combinations
2011-12-18 05:27:01 +08:00
* IndexedSearch - when you do searches will show you "Match 2 of 4" in the status line
2012-01-03 04:27:36 +08:00
* delimitMate - automatically closes quotes
2011-12-07 17:12:42 +08:00
* syntastic - automatic syntax checking when you save the file
2012-01-26 11:33:59 +08:00
* repeat - adds `.` (repeat command) support for complex commands like surround.vim. i.e. if you perform a surround and hit `.` , it will Just Work (vim by default will only repeat the last piece of the complex command)
2011-12-08 18:02:21 +08:00
* endwise - automatically closes blocks (if/end)
* autotag - automatically creates tags for fast sourcecode browsing. use ctrl-[ over a symbol name to go to its definition
* matchit - helps with matching brackets, improves other plugins
2011-12-30 09:35:45 +08:00
* sass-status - decorates your status bar with full nesting of where you are in the sass file
2011-12-07 17:12:42 +08:00
2012-01-26 03:26:23 +08:00
### Overriding vim settings
You may use `~/.vimrc.before` for settings like the __leader__ setting. You may `~/.vimrc.after` for any additional overrides/settings.
2012-01-25 02:53:58 +08:00
### Adding your own vim plugins
2011-12-07 15:45:08 +08:00
2011-12-08 12:54:03 +08:00
YADR comes with a dead simple plugin manager that just uses git submodules, without any fancy config files.
2011-12-07 15:45:08 +08:00
2011-12-08 12:54:03 +08:00
yav -u https://github.com/airblade/vim-rooter
2011-12-07 15:45:08 +08:00
2011-12-08 12:54:03 +08:00
You can update all the plugins easily:
2011-12-07 15:45:08 +08:00
2011-12-18 05:27:01 +08:00
yuv
2011-12-08 14:49:58 +08:00
Delete a plugin (Coming Soon)
ydv -p airblade-vim-rooter
2011-12-07 15:45:08 +08:00
2011-12-08 12:54:03 +08:00
The aliases (yav=yadr vim-add-plugin) and (yuv=yadr vim-update-all-plugins) live in the aliases file.
2011-12-07 15:45:08 +08:00
You can then commit the change. It's good to have your own fork of this project to do that.
2011-12-07 15:06:13 +08:00
2011-11-18 06:50:58 +08:00
2012-01-25 02:53:58 +08:00
## Miscellaneous
2011-11-18 06:50:58 +08:00
2011-12-09 15:40:18 +08:00
2012-01-25 02:53:58 +08:00
### OSX Hacks
2011-11-18 06:50:58 +08:00
The osx file is a bash script that sets up sensible defaults for devs and power users
2011-11-19 00:10:06 +08:00
under osx. Read through it before running it. To use:
./osx
2011-12-07 13:57:45 +08:00
These hacks are Lion-centric. May not work for other OS'es. My favorite mods include:
2011-11-19 00:10:06 +08:00
2011-12-07 13:57:45 +08:00
* Ultra fast key repeat rate (now you can scroll super quick using j/k)
2012-01-03 04:27:36 +08:00
* No disk image verification (downloaded files open quicker)
2011-12-07 13:57:45 +08:00
* Display the ~/Library folder in finder (hidden in Lion)
2011-11-18 06:40:21 +08:00
2012-01-25 02:53:58 +08:00
### Other recommended OSX tools
2011-12-07 13:57:45 +08:00
* NValt - Notational Velocity alternative fork - http://brettterpstra.com/project/nvalt/ - syncs with SimpleNote
2012-01-26 11:33:59 +08:00
* Vimium for Chrome - vim style browsing. The `f` to type the two char alias of any link is worth it.
2011-12-07 13:57:45 +08:00
* QuickCursor - gives you Apple-Shift-E to edit any OSX text field in vim.
2012-01-26 11:33:59 +08:00
* brew install autojump - will track your commonly used directories and let you jump there. With the zsh plugin you can just type `j [dirspec]` , a few letters of the dir you want to go to.
2011-11-19 02:53:07 +08:00
2012-01-25 02:53:58 +08:00
### Credits
2011-12-16 14:41:56 +08:00
2011-11-18 05:45:33 +08:00
I can't take credit for all of this. The vim files are a combination of
work by tpope, scrooloose, and many hours of scouring blogs, vimscripts,
2011-12-16 14:41:56 +08:00
and other places for the cream of the crop of vim awesomeness.
2011-12-18 06:40:58 +08:00
* http://ethanschoonover.com/solarized - a scientifically calibrated color scheme
2011-12-16 14:41:56 +08:00
* https://github.com/astrails/dotvim
* https://github.com/carlhuda/janus
* https://github.com/tpope
* https://github.com/scrooloose
* https://github.com/kana
* https://github.com/robbyrussell
* https://github.com/nelstrom
And everything that's in the modules included in vim/bundle of course.
Please explore these people's work.
2011-11-18 05:45:33 +08:00
2012-01-25 02:53:58 +08:00
2012-01-25 06:47:30 +08:00
### Contributors
* Initial Version: @skwp
* Cleanup, auto installer: @kylewest
2012-01-25 02:53:58 +08:00
2012-01-25 15:21:33 +08:00
2012-01-25 02:53:58 +08:00
### For more tips and tricks
2011-11-18 06:40:21 +08:00
Follow my blog: http://yanpritzker.com
2012-01-25 02:34:34 +08:00