summera / yadr-alt

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

                             _                    _ _
                            | |                  | | |
             _   _  __ _  __| |_ __   ____   __ _| | |__
            | | | |/ _` |/ _` | '__| |____| / _` | | ___|
            | |_| | (_| | (_| | |          | (_| | | |__
             \__, |\__,_|\__,_|_|           \__,_|_|\___|
              __/ |
             |___/

    # YADR-alt
    # A YADR fork with a focus on terminal VIM and user customization.

    $ sh -c "`curl -fsSL https://raw.github.com/ianks/yadr-alt/master/install.sh`"

Always be sure to run rake update after pulling to ensure plugins are updated

What is YADR

YADR is an opinionated dotfile repo that will make your heart sing

  • The best bits of all the top dotfile repos, vim and zsh plugins curated in one place, into a simple and cohesive way of working.
  • More than 90 vim plugins, all under one roof, working together, each plugin researched and configured to be at its best, often with better shortcut keys.
  • Many zsh plugins, starting with the wonderful Prezto base, and adding a few niceties on top.
  • All things are vimized: irb, postres command line, etc.

Please use GitHub Issues for pull requests or bug reports only.

Installation

To get started please run:

sh -c "`curl -fsSL https://raw.github.com/ianks/yadr-alt/master/install.sh`"

Note: YADR will automatically install all of its subcomponents. If you want to be asked about each one, use:

sh -c "`curl -fsSL https://raw.github.com/ianks/yadr-alt/master/install.sh`" -s ask

Wait, you're not done! Do this

  • Set your iTerm colorscheme to Seoul256, or whatever you like.

  • Remap Caps-Lock to Ctrl.

  • Set up a system wide hotkey for iTerm.

  • In iTerm, uncheck "Use Lion-style full screen" on General; in MacVim, uncheck Prefer native fullscreen under Advanced settings. This will give you fast full screen windows that are switchable without switching to spaces.

  • If you want to use an alternate colorcheme , then in your ~/.vimrc.after do:

    colorcheme gruvbox

Upgrading

Upgrading is easy.

cd ~/.yadr
git pull --rebase
rake update

What's included, and how to customize

Read on to learn what YADR provides!

Homebrew

Homebrew is the missing package manager for OSX. Installed automatically.

We automatically install a few useful packages including ctags, git, vim, hub, and the_silver_searcher ('ag'). It also installs some Python, Ruby and Node plugings for style checking. Note that our autocomplete plugin requires a VIM that supports Lua. The installer knows how to install it, but if you had one installed before, you may need to manually remove your old VIM.

ZSH

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:

  • Vim mode and bash style Ctrl-R for reverse history finder
  • Ctrl-x,Ctrl-l to insert output of last command
  • Fuzzy matching - if you mistype a directory name, tab completion will fix it
  • fasd integration - hit z and partial match for recently used directory. Tab completion enabled.
  • Prezto - the power behind YADR's zsh
  • How to add your own ZSH theme

Aliases

Lots of things we do every day are done with two or three character mnemonic aliases. Please feel free to edit them:

ae # alias edit
ar # alias reload

Git Customizations

YADR will take over your ~/.gitconfig, so if you want to store your usernames, please put them into ~/.gitconfig.user

It is recommended to use this file to set your user info. Alternately, you can set the appropriate environment variables in your ~/.secrets.

  • git l or gl- a much more usable git log
  • git b or gb- a list of branches with summary of last commit
  • git r - a list of remotes with info
  • 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)
  • git simple - a clean format for creating changelogs
  • git recent-branches - if you forgot what you've been working on
  • git unstage / guns (remove from index) and git uncommit / gunc
  • (revert to the time prior to the last commit - dangerous if already pushed) aliases
  • 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 improved colors for diff

RubyGems

A .gemrc is included. Never again type gem install whatever --no-ri --no-rdoc. --no-ri --no-rdoc is done by default.

Tmux configuration

tmux.conf provides some sane defaults for tmux on Mac OS like a powerful status bar and vim keybindings. You can customize the configuration in ~/.tmux.conf.user.

Vimization of everything

The provided inputrc and editrc will turn your various command line tools like mysql and irb into vim prompts. There's

Vim - What's included

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.

Navigation

  • ,z - go to previous buffer (:bp)
  • ,x - go to next buffer (:bn)
  • Cmd-j and Cmd-k to move up and down roughly by functions (Alt in Linux)
  • 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)

Search/Code Navigation

  • ,f - instantly Find definition of class (must have exuberant ctags installed)
  • ,F - same as ,f but in a vertical split
  • ,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)
  • ,K - Grep 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
  • ,gg or ,ag - Grep command line, type between quotes. Uses Ag Silver Searcher.
  • ,gd - Grep def (greps for 'def function_name') when cursor is over the function name
  • ,gcf - Grep Current File to find references to the current file
  • // - clear the search
  • ,T - Tag list (list of methods in a class)
  • ,,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.
  • ,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.
  • gK - Opens the documentation for the word under the cursor.
  • Spacebar - Sneak - type two characters to move there in a line. Kind of like vim's f but more accurate.

File Navigation

  • ,t - CtrlP fuzzy file selector
  • ,b - CtrlP buffer selector - great for jumping to a file you already have open

Better keystrokes for common editing commands

  • SPACE-e to autocomplete. Tab for to scroll through snippets.
  • ,# ," ,' ,] ,) ,} 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 (Alt in Linux)
  • ,. to go to last edit location (same as '.) because the apostrophe is hard on the pinky
  • ,ci to change inside any set of quotes/brackets/etc

Tabs, Windows, Splits

  • 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 (Alt in Linux)
  • Ctrl-h,l,j,k - to move left, right, down, up between splits. This also works between vim and tmux splits thanks to vim-tmux-navigator.
  • 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 Grep goes)
  • ,qc - close quickfix

Utility

  • Ctrl-p after pasting - Use p to paste and Ctrl-p to cycle through previous pastes. Provided by YankRing.
  • ,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
  • crs, crc, cru via abolish.vim, coerce to snake_case, camelCase, and UPPERCASE. There are more :help abolish
  • :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.
  • ,ig - toggle visual indentation guides
  • ,cf - Copy Filename of current file (full path) into system (not vi) paste buffer
  • ,cn - Copy Filename of current file (name only, no path)
  • ,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
  • ,ocf - open changed files (stolen from @garybernhardt). open all files with git changes in splits
  • ,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)
  • ,he - Html Escape
  • ,hu - Html Unescape
  • ,hp - Html Preview (open in Safari)
  • :ColorToggle - turn on #abc123 color highlighting (useful for css)
  • ,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
  • gqq - wrap long lines (e.g. when editing markdown files)
  • gcp (comment a paragraph)

Rails & Ruby

  • ,vv and ,cc to switch between view and controller - these are maps to :Rcontroller and :Rview. Explore the :R family of commands for more fun from rails.vim!
  • vim-ruby-refactoring - try ,rem, ,rel to extract methods or let statements
  • :Bopen [gem name] to navigate to a gem (@tpope/vim-bundler)
  • ,gcp - Grep Current Partial to find references to the current view partial
  • ,orb - outer ruby block. takes you one level up from nested blocks (great for rspec)

Vim Dev

  • ,vc - (Vim Command) copies the command under your cursor and executes it in vim. Great for testing single line changes to vimrc.
  • ,vr - (Vim Reload) source current file as a vim file

Extending and overriding YADR settings

Misc

Vim troubles with Lua

brew install vim --with-lua --with-luajit

Pry

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 as an actual debugger by installing pry-byebug.

Learn more about YADR's pry customizations and how to install

Hammerspoon

note: Requires Hammerspoon to be installed.

Automate OSX tasks using Hammerspoon. For example, CMD ALT CTRL f will open a Firefox window from anywhere in the OS. CMD ALT CTRL h will snap a window to the left side of the screen and you guessed it, CMD ALT CTRL l will snap it to the right.

About

License:BSD 2-Clause "Simplified" License


Languages

Language:Ruby 66.4%Language:Vim Script 15.3%Language:Shell 14.4%Language:Lua 2.2%Language:ApacheConf 1.7%