2011-12-18 05:27:01 +08:00
_ _ _
| | | | | |
| |___| |_____ __ | | ____
|_____ (____ |/ _ |/ ___)
_____ | / ___ ( (_| | |
(_______\_____|\____|_|
2011-11-18 05:45:33 +08:00
2013-03-29 23:32:02 +08:00
# Yet Another Dotfile Repo v1.1
# Now with Prezto and Vundle!
2011-12-16 19:33:25 +08:00
2013-04-07 18:17:48 +08:00
sh -c "`curl -fsSL https://raw.github.com/skwp/dotfiles/master/install.sh`"
2011-12-18 05:27:01 +08:00
2013-03-29 23:32:02 +08:00
**Always be sure to run `rake update` after pulling to ensure plugins are updated**
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**
2013-12-16 10:00:30 +08:00
* YADR takes a curated set of the best of the best in plugins, dotfile repos and ties them all together into a cohesive system.
2013-12-16 12:10:57 +08:00
* More than 90 vim plugins, all under one roof, working together.
* Each plugin is researched and configured to be at its best and to work with other plugins. Often times, better keymaps are provided. See `.yadr/vim/settings` and `.yadr/zsh/` for some examples.
* All common shell and vim commands should be two and three character mnemonic aliases - less keystrokes, RSI reduction
2013-12-16 04:11:22 +08:00
* All things are vimized: irb, postres command line, etc.
2011-12-18 06:40:58 +08:00
* Optimized support for Solarized color scheme only, everything guaranteed to Look Good. Your eyes will thank you.
2011-12-07 13:57:45 +08:00
2013-12-16 06:09:36 +08:00
## Mailing List
Got questions, concerns, want to hear announcements? Join the [Google Group ](https://groups.google.com/forum/#!forum/yadr-users )
2013-12-16 12:10:57 +08:00
Please use GitHub Issues for pull requests or bug reports only.
2013-12-16 06:09:36 +08:00
2012-01-25 02:53:58 +08:00
## Screenshot
2013-12-16 04:11:22 +08:00
2012-11-17 02:07:52 +08:00
![screenshot ](http://i.imgur.com/3C1Ze.png )
2011-12-20 18:19:42 +08:00
2013-12-16 04:11:22 +08:00
## Installation
2012-01-25 02:53:58 +08:00
2013-12-05 22:33:55 +08:00
To get started please run:
2012-01-25 03:53:44 +08:00
```bash
2013-04-07 18:17:48 +08:00
sh -c "`curl -fsSL https://raw.github.com/skwp/dotfiles/master/install.sh`"
2012-01-25 03:53:44 +08:00
```
2012-10-25 23:09:24 +08:00
**Note:** YADR will automatically install all of its subcomponents. If you want to be asked
2013-04-07 18:17:48 +08:00
about each one, use:
```bash
sh -c "`curl -fsSL https://raw.github.com/skwp/dotfiles/master/install.sh`" -s ask
```
2012-01-25 03:53:44 +08:00
2013-12-16 04:11:22 +08:00
* Install iTerm Solarized Colors - YADR will install Solarized colorschemes into your iTerm. Go to Profiles => Colors => Load Presets to pick Solarized Dark.
* [Remap caps-lock to escape with PCKeyboardHack ](http://pqrs.org/macosx/keyremap4macbook/pckeyboardhack.html ) - The escape key is the single most used key in vim. Old keyboards used to have Escape where Tab is today. Apple keyboards are the worst with their tiny Esc keys. But all this is fixed by remapping Caps to Escape. If you're hitting a small target in the corner, you are slowing yourself down considerably, and probably damaging your hands with repetitive strain injuries.
* Remap your Alfred or Spotlight to `Ctrl-Cmd-Space` , so that you can use `Cmd-Space` to autocomplete in vim. This is much more friendly for your fingers than `Ctrl-n` .
2013-02-27 22:58:48 +08:00
2012-09-29 01:38:59 +08:00
### Upgrading
2012-01-25 03:53:44 +08:00
2012-09-29 01:38:59 +08:00
Upgrading is easy.
2012-06-07 13:14:09 +08:00
```bash
2012-09-29 01:38:59 +08:00
cd ~/.yadr
2013-12-16 04:11:22 +08:00
git pull --rebase
2012-10-09 12:38:21 +08:00
rake update
2012-06-07 13:14:09 +08:00
```
2013-12-16 04:11:22 +08:00
## What's included, and how to customize?
2012-01-25 03:53:44 +08:00
2012-09-29 01:38:59 +08:00
Read on to learn what YADR provides!
2012-01-25 03:53:44 +08:00
2012-09-29 01:38:59 +08:00
### [Homebrew](http://mxcl.github.com/homebrew/)
2012-03-19 12:15:37 +08:00
2012-09-29 01:38:59 +08:00
Homebrew is _the missing package manager for OSX_ . Installed automatically.
2012-08-10 00:09:50 +08:00
2013-04-18 21:40:04 +08:00
We automatically install a few useful packages including ctags, git, and hub, and the silver searcher ('ag')
2012-09-29 01:38:59 +08:00
You can install macvim from brew as well, or download it from their website.
2011-12-08 15:27:41 +08:00
2012-09-29 01:38:59 +08:00
### ZSH
2012-01-25 02:53:58 +08:00
2013-12-16 04:11:22 +08:00
Think of Zsh as a more awesome bash without having to learn anything new.
Automatic spell correction for your commands, syntax highlighting, and more.
We've also provided lots of enhancements:
2013-12-16 04:56:36 +08:00
* Vim mode and bash style `Ctrl-R` for reverse history finder
* `Ctrl-x,Ctrl-l` to insert output of last command
2013-12-16 04:11:22 +08:00
* Fuzzy matching - if you mistype a directory name, tab completion will fix it
* [fasd ](https://github.com/clvv/fasd ) integration - hit `z` and partial match for recently used directory. Tab completion enabled.
* [Prezto - the power behind YADR's zsh ](http://github.com/sorin-ionescu/prezto )
* [How to add your own ZSH theme ](doc/zsh/themes.md )
2011-12-07 13:57:45 +08:00
2013-12-16 04:11:22 +08:00
### Aliases
2011-12-18 06:11:05 +08:00
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-09-27 02:05:28 +08:00
2013-12-16 04:11:22 +08:00
### [Pry](http://pry.github.com/)
2012-03-24 02:02:58 +08:00
2012-09-29 01:38:59 +08:00
Pry offers a much better out of the box IRB experience with colors, tab completion, and lots of other tricks. You can also use it
2013-12-16 04:11:22 +08:00
as an actual debugger by installing [pry-nav ](https://github.com/nixme/pry-nav ).
2011-12-07 13:57:45 +08:00
2013-12-16 04:11:22 +08:00
[Learn more about YADR's pry customizations and how to install ](doc/pry.md )
2011-12-07 13:57:45 +08:00
2013-12-16 04:56:36 +08:00
### Git Customizations:
2012-01-25 02:53:58 +08:00
2013-12-16 04:56:36 +08:00
YADR will take over your `~/.gitconfig` , so if you want to store your usernames, please put them into `~/.gitconfig.user`
2012-01-25 02:53:58 +08:00
2013-03-24 18:44:19 +08:00
It is recommended to use this file to set your user info. Alternately, you can set the appropriate environment variables in your `~/.secrets` .
2012-01-25 02:53:58 +08:00
2013-12-05 22:33:55 +08:00
* `git l` or `gl` - a much more usable git log
* `git b` or `gb` - a list of branches with summary of last commit
2012-01-26 11:33:59 +08:00
* `git r` - a list of remotes with info
2013-12-05 22:33:55 +08:00
* `git t` or `gt` - a list of tags with info
* `git nb` or `gnb` - a (n)ew (b)ranch - like checkout -b
* `git cp` or `gcp` - cherry-pick -x (showing what was cherrypicked)
2012-01-26 11:33:59 +08:00
* `git changelog` - a nice format for creating changelogs
2013-12-05 22:33:55 +08:00
* `git recent-branches` - if you forgot what you've been working on
2013-12-16 04:11:22 +08:00
* `git unstage` / `guns` (remove from index) and `git uncommit` / `gunc` (revert to the time prior to the last commit - dangerous if already pushed) aliases
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
2012-04-17 04:27:53 +08:00
* Slightly improved colors for diff
2012-01-25 02:53:58 +08:00
2012-09-29 01:38:59 +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
2013-11-16 05:53:34 +08:00
### Tmux configuration
2013-12-15 00:27:32 +08:00
`tmux.conf` provides some sane defaults for tmux on Mac OS like a powerful status bar and vim keybindings.
2013-11-16 05:53:34 +08:00
You can customize the configuration in `~/.tmux.conf.user` .
2012-09-29 01:38:59 +08:00
### Vimization of everything
2012-05-19 05:08:46 +08:00
The provided inputrc and editrc will turn your various command line tools like mysql and irb into vim prompts. There's
2013-12-16 04:11:22 +08:00
also an included Ctrl-R reverse history search feature in editrc, very useful in irb, postgres command line, and etc.
2012-01-25 02:53:58 +08:00
2013-12-16 04:56:36 +08:00
### Github Issues: [ghi gem](https://github.com/stephencelis/ghi)
We include the `ghi` command. Try `ghi list` and have fun managing issues from command line!
2013-12-16 04:11:22 +08:00
## Vim - What's included?
2011-11-18 06:40:21 +08:00
2013-12-16 04:11:22 +08:00
* [Navigation - NERDTree, EasyMotion, CtrlP and more ](doc/vim/navigation.md )
* [Text Objects - manipulate ruby blocks, and more ](doc/vim/textobjects.md )
* [Code manipulation - rails support, comments, snippets, highlighting ](doc/vim/coding.md )
* [Utils - indents, paste buffer management, lots more ](doc/vim/utils.md )
* [General enhancements that don't add new commands ](doc/vim/enhancements.md )
2012-09-29 01:38:59 +08:00
2013-12-16 04:11:22 +08:00
A list of some of the most useful commands that YADR provides in vim are
included below. This is not a comprehensive list. To get deeper knowledge,
practice a few of these every day, and then start looking into the lists
of plugins above to learn more.
2012-09-29 01:38:59 +08:00
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
2013-12-15 06:42:47 +08:00
#### Rails & Ruby
2013-12-16 04:11:22 +08:00
2013-12-15 06:42:47 +08:00
* vim-ruby-refactoring - try `,rem` , `,rel` to extract methods or let statements
2013-12-05 22:33:55 +08:00
* `,vv` and `,cc` to switch between view and controller - these are maps to :Rcontroller and :Rview. Explore the :R< Tab > family of commands for more fun from rails.vim!
2013-12-16 12:02:47 +08:00
* `,rs` and `,rl` to run rspec or a spec line in iTerm (check iTerm window for results)
* `,ss` and `,sl` for the same using `spring rspec` which makes your Rails specs faster by caching the Rails env (must have spring gem installed)
2011-12-13 13:04:42 +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)
2012-10-09 12:45:40 +08:00
* `,F` - same as `,f` but in a vertical split
2012-09-28 02:12:09 +08:00
* `,gf` or `Ctrl-f` - same as vim normal gf (go to file), but in a vertical split (works with file.rb:123 line numbers also)
* `gF` - standard vim mapping, here for completeness (go to file at line number)
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
2013-12-17 00:24:32 +08:00
* `,ag` - Ag - silver searcher. Alternative to GitGrep that is as fast or faster.
* `,af` - AgFile - silver searcher for a filename
2012-01-26 11:33:59 +08:00
* `//` - clear the search
* `,T` - Tag list (list of methods in a class)
2012-04-26 10:39:31 +08:00
* `Ctrl-s` - Open related spec in a split. Similar to :A and :AV from rails.vim but is also aware of the fast_spec dir and faster to type
2012-05-15 21:50:32 +08:00
* `,,w` (alias `,<esc>` ) or `,,b` (alias `,<shift-esc>` ) - EasyMotion, a vimperator style tool that highlights jump-points on the screen and lets you type to get there.
2013-12-16 22:43:09 +08:00
* `,mc` - mark this word for MultiCursor (like sublime). Use `Ctrl-n` (next), `Ctrl-p` (prev), `Ctrl-x` (skip) to add more cursors, then do normal vim things like edit the word.
2011-12-13 13:04:42 +08:00
2012-01-26 11:15:03 +08:00
#### File Navigation
2012-01-26 11:33:59 +08:00
* `,t` - CtrlP fuzzy file selector
* `,b` - CtrlP buffer selector
2012-11-17 02:19:30 +08:00
* `Cmd-Shift-M` - jump to method - CtrlP tag search within current buffer
2012-01-26 11:33:59 +08:00
* `,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
2012-05-03 13:41:51 +08:00
* `Cmd-Shift-P` - Clear CtrlP cache
2012-05-03 13:47:34 +08:00
* `:Bopen [gem name]` to navigate to a gem (@tpope/vim-bundler)
2013-12-29 00:58:48 +08:00
* `Cmd-Shift-N` - NERDTree toggle
* `Ctrl-\` - Show current file in NERDTree
* `-` open the nerdtree in the current split, rather than popping out a project drawer (uses vim-vingar)
2011-12-24 06:13:59 +08:00
2013-12-16 12:27:00 +08:00
#### Better keystrokes for common editing commands
2012-01-03 04:27:36 +08:00
2012-05-15 21:43:49 +08:00
* Cmd-Space to autocomplete. Tab for snipmate snippets.
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
* `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-04-03 03:03:21 +08:00
* `,ci` to change inside any set of quotes/brackets/etc
2013-12-16 12:27:00 +08:00
* `,#` `,"` `,'` `,]` `,)` `,}` to surround a word in these common wrappers. the # does #{ruby interpolation}. works in visual mode (thanks @cj ). Normally these are done with something like `ysw#`
* `Cmd-'` , `Cmd-"` , `Cmd-]` , `Cmd-)` , etc to change content inside those surrounding marks. You don't have to be inside them.
2011-12-18 05:27:01 +08:00
2013-12-16 12:27:00 +08:00
#### Tabs, Windows, Splits
2011-12-18 05:27:01 +08:00
2013-12-16 12:27:00 +08:00
* Use `Cmd-1` thru `Cmd-9` to switch to a specific tab number (like iTerm and Chrome) - and tabs have been set up to show numbers
* `Ctrl-h,l,j,k` - to move left, right, down, up between splits
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.
* `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
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-10-02 08:16:15 +08:00
* `,orb` - outer ruby block. takes you one level up from nested blocks (great for rspec)
2012-09-27 06:51:38 +08:00
* `crs` , `crc` , `cru` via abolish.vim, coerce to snake_case, camelCase, and UPPERCASE. There are more `:help abolish`
2012-09-26 23:21:48 +08:00
* `:NR` - NarrowRgn - use this on a bit of selected text to create a new split with just that text. Do some work on it, then :wq it to get the results back.
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-04-26 10:39:31 +08:00
* `,vr` - (Vim Reload) source current file as a vim file
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
2012-04-27 15:35:48 +08:00
* `,ocf` - open changed files (stolen from @garybernhardt ). open all files with git changes in splits
2012-01-26 11:33:59 +08:00
* `,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-09-12 01:19:04 +08:00
* `,hp` - Html Preview (open in Safari)
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`
2012-06-23 00:24:15 +08:00
* `,yr` - view the yankring - a list of your previous copy commands. also you can paste and hit `ctrl-p` for cycling through previous copy commands
2013-01-11 00:25:02 +08:00
* `,gt` - Go Tidy - tidy up your html code (works on a visual selection)
2013-12-16 04:11:22 +08:00
* `Ctrl-p` after pasting - Use `p` to paste and `Ctrl-p` to cycle through previous pastes. Provided by YankRing.
* `:Wrap` - wrap long lines (e.g. when editing markdown files).
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
2013-12-16 04:11:22 +08:00
## Extending and overriding YADR settings
2012-01-25 02:53:58 +08:00
2013-12-16 04:11:22 +08:00
* [Debugging vim keymappings ](doc/vim/keymaps.md )
* [Overriding vim settings with ~/.vimrc.after and friends ](doc/vim/override.md )
* [Adding your own vim plugins ](doc/vim/manage_plugins.md )
2011-12-07 17:02:20 +08:00
2013-12-16 04:11:22 +08:00
## Misc
2011-11-18 06:50:58 +08:00
2013-12-16 04:11:22 +08:00
* [Credits & Thanks ](doc/credits.md )
* [Other recommended OSX productivity tools ](doc/osx_tools.md )
* [Yan's Blog ](http://yanpritzker.com )
2011-12-09 15:40:18 +08:00
2012-01-25 02:53:58 +08:00
### OSX Hacks
2013-12-16 04:11:22 +08:00
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)