Merge pull request #10 from kylewest/simple-bug-fixes

Bugfixes from kylewest: reference to homebrew ctags, cleanup
This commit is contained in:
Yan Pritzker 2012-01-24 11:25:39 -08:00
commit 66bf2a8cce
5 changed files with 112 additions and 94 deletions

1
.rbenv-version Normal file
View File

@ -0,0 +1 @@
system

1
.rvmrc Normal file
View File

@ -0,0 +1 @@
rvm system

171
README.md
View File

@ -18,8 +18,8 @@
This is a collection of best of breed tools from across the web, This is a collection of best of breed tools from across the web,
from scouring other people's dotfile repos, blogs, and projects. from scouring other people's dotfile repos, blogs, and projects.
What is YADR?
--- ## What is YADR?
**YADR is an opinionated dotfile repo that will make your heart sing** **YADR is an opinionated dotfile repo that will make your heart sing**
@ -32,8 +32,8 @@ What is YADR?
* **NEW Beautiful, easy to read and small vimrc** * **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** * **NEW No key overrides or custom hackery in vimrc, everything in well factored snippets in .vim/plugin/settings**
Why is this not a fork of Janus?
--- ## Why is this not a fork of Janus?
Janus is an amazing _first effort_ to deliver a ready-to-use vim setup and is a huge inspiration to us all. 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:** **However as any first effort, it paves the way to improvements:**
@ -47,24 +47,26 @@ Janus is an amazing _first effort_ to deliver a ready-to-use vim setup and is a
* All keymaps and customization in small, easy to maintain files under .vim/plugin/settings * 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. * More than just vim plugins - great shell aliases, osx, and irb/pry tweaks to make you more productive.
Screenshot
--- ## Screenshot
![screenshot](http://i.imgur.com/lEFlF.png) ![screenshot](http://i.imgur.com/lEFlF.png)
Before you start
--- ## Before you start
For the love of all that is holy, stop abusing your hands! For the love of all that is holy, stop abusing your hands!
Remap caps-lock to escape: http://pqrs.org/macosx/keyremap4macbook/extra.html Remap caps-lock to escape: http://pqrs.org/macosx/keyremap4macbook/extra.html
Installation
--- ## Installation
This project uses git submodules for its plugins, but this is handled This project uses git submodules for its plugins, but this is handled
for you by the **yadr** command. Please run: for you by the **yadr** command. Please run:
git clone https://github.com/skwp/dotfiles ~/.dotfiles ```bash
~/.dotfiles/bin/yadr/yadr init-plugins git clone https://github.com/skwp/dotfiles ~/.dotfiles
~/.dotfiles/bin/yadr/yadr init-plugins
```
NOTE: by default, YADR will not touch any of your files. You have to manually NOTE: by default, YADR will not touch any of your files. You have to manually
activate each of its components, if you choose, by following the sections below. activate each of its components, if you choose, by following the sections below.
@ -72,12 +74,15 @@ Eventually these will be automated.
If you pull new changes, be sure to run this to init all the submodules: If you pull new changes, be sure to run this to init all the submodules:
yadr init-plugins ```bash
yadr init-plugins
```
After you install yadr shell aliases, you can use the *yip* alias to do the same. After you install yadr shell aliases, you can use the *yip* alias to do the same.
Setup for ZSH
--- ### Setup for ZSH
After a lifetime of bash, I am now using ZSH as my default shell because of its awesome globbing After a lifetime of bash, I am now using ZSH as my default shell because of its awesome globbing
and autocomplete features (the spelling fixer autocomplete is worth the money alone). and autocomplete features (the spelling fixer autocomplete is worth the money alone).
@ -89,7 +94,9 @@ you just source the _aliases_ file. However, you soul will sing if you install z
**Install zsh pain free, automatically:** **Install zsh pain free, automatically:**
wget --no-check-certificate https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh ```bash
curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh
```
Place this as the last line in your ~/.zshrc created by oh-my-zsh: Place this as the last line in your ~/.zshrc created by oh-my-zsh:
@ -98,7 +105,9 @@ Place this as the last line in your ~/.zshrc created by oh-my-zsh:
Or, to make things simpler you can just use the YADR-provided zsh/oh_my_zsh_zshrc Or, to make things simpler you can just use the YADR-provided zsh/oh_my_zsh_zshrc
Please note that this relies on the skwp fork of oh-my-zsh which contains skwp.theme Please note that this relies on the skwp fork of oh-my-zsh which contains skwp.theme
ln -sf ~/.dotfiles/zsh/oh_my_zsh_zshrc ~/.zshrc ```bash
ln -sf ~/.dotfiles/zsh/oh_my_zsh_zshrc ~/.zshrc
```
Lots of things I do every day are done with two or three character Lots of things I do every day are done with two or three character
mnemonic aliases. Please feel free to edit them: mnemonic aliases. Please feel free to edit them:
@ -112,15 +121,17 @@ mnemonic aliases. Please feel free to edit them:
* Bash style ctrl-R for reverse history finder * Bash style ctrl-R for reverse history finder
* Fuzzy matching - if you mistype a directory name, tab completion will fix it * Fuzzy matching - if you mistype a directory name, tab completion will fix it
Setup for Pry
--- ### Setup for Pry
Pry (http://pry.github.com/) offers a much better out of the box IRB experience Pry (http://pry.github.com/) offers a much better out of the box IRB experience
with colors, tab completion, and lots of other tricks. You should: with colors, tab completion, and lots of other tricks. You should:
gem install pry ```bash
gem install awesome_print gem install pry
ln -s ~/.dotfiles/irb/pryrc ~/.pryrc gem install awesome_print
ln -s ~/.dotfiles/irb/aprc ~/.aprc ln -s ~/.dotfiles/irb/pryrc ~/.pryrc
ln -s ~/.dotfiles/irb/aprc ~/.aprc
```
**Use pry** **Use pry**
@ -135,19 +146,61 @@ with colors, tab completion, and lots of other tricks. You should:
* a few color modifications to make it more useable * a few color modifications to make it more useable
* type 'help' to see all the commands * type 'help' to see all the commands
Setup for Vim
--- ### Setup for Git
**To use the gitconfig (some of the git bash aliases rely on my git aliases)**
```bash
ln -s ~/.dotfiles/gitconfig ~/.gitconfig
```
Since the gitconfig doesn't contain the user info, I recommend using env variables.
**Put the following in your ~/.secrets file which is automatically referenced by the provided zshrc:**
# 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'
**Some of the customizations provided include:**
* 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
* 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
* git unstage (remove from index) and git uncommit (revert to the time prior to the last commit - dangerous if already pushed) aliases
### Setup for Vim
To use the vim files: To use the vim files:
ln -s ~/.dotfiles/vimrc ~/.vimrc ```bash
ln -s ~/.dotfiles/vim ~/.vim ln -s ~/.dotfiles/vimrc ~/.vimrc
ln -s ~/.dotfiles/vim ~/.vim
```
The .vimrc is well commented and broken up by settings. I encourage you 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 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. if you don't like them, or make your own.
Vim Keymaps (in vim/plugin/settings)
--- ## Vim Configuration
### Vim Keymaps (in vim/plugin/settings)
The files in vim/plugin/settings are customizations stored on a per-plugin The files in vim/plugin/settings are customizations stored on a per-plugin
basis. The main keymap is available in skwp-keymap.vim, but some of the vim basis. The main keymap is available in skwp-keymap.vim, but some of the vim
@ -266,14 +319,14 @@ files contain key mappings as well (TODO: probably will move them out to skwp-ke
* Cmd-/ - toggle comments (usually gcc from tComment) * Cmd-/ - toggle comments (usually gcc from tComment)
* gcp (comment a paragraph) * gcp (comment a paragraph)
Included vim plugins
--- ### Included vim plugins
**Navigation** **Navigation**
* NERDTree - everyone's favorite tree browser * NERDTree - everyone's favorite tree browser
* NERDTree-tabs - makes NERDTree play nice with MacVim tabs so that it's on every tab * NERDTree-tabs - makes NERDTree play nice with MacVim tabs so that it's on every tab
* ShowMarks - creates a visual gutter to the left of the number column showing you your marks * ShowMarks - creates a visual gutter to the left of the number column showing you your marks
* 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 * 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
* LustyJuggler/Explorer - hit B, type buf name to match a buffer, or type S and use the home row keys to select a buffer * LustyJuggler/Explorer - hit B, type buf name to match a buffer, or type S and use the home row keys to select a buffer
* TagBar - hit ,T to see a list of methods in a class (uses ctags) * TagBar - hit ,T to see a list of methods in a class (uses ctags)
@ -316,7 +369,7 @@ Included vim plugins
* vim-textobj-entire - gives you 'e' for entire document. so vae (visual around entire document), and etc * 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-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 * 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) * next-textobject - from Steve Losh, ability to use 'n' such as vinb (visual inside (n)ext set of parens)
**Utils** **Utils**
@ -347,8 +400,7 @@ Included vim plugins
* sass-status - decorates your status bar with full nesting of where you are in the sass file * sass-status - decorates your status bar with full nesting of where you are in the sass file
Adding your own vim plugins ### Adding your own vim plugins
---
YADR comes with a dead simple plugin manager that just uses git submodules, without any fancy config files. YADR comes with a dead simple plugin manager that just uses git submodules, without any fancy config files.
@ -365,36 +417,11 @@ Delete a plugin (Coming Soon)
The aliases (yav=yadr vim-add-plugin) and (yuv=yadr vim-update-all-plugins) live in the aliases file. The aliases (yav=yadr vim-add-plugin) and (yuv=yadr vim-update-all-plugins) live in the aliases file.
You can then commit the change. It's good to have your own fork of this project to do that. You can then commit the change. It's good to have your own fork of this project to do that.
Setup for Git
---
**To use the gitconfig (some of the git bash aliases rely on my git aliases)**
ln -s ~/.dotfiles/gitconfig ~/.gitconfig ## Miscellaneous
Since the gitconfig doesn't contain the user info, I recommend using env variables.
**Put the following in your ~/.secrets file which is automatically referenced by the provided zshrc:** ### OSX Hacks
export GIT_AUTHOR_NAME=yourname
export GIT_AUTHOR_EMAIL=you@domain.com
export GIT_COMITTER_NAME=yourname
export GIT_COMITTER_EMAIL=you@domain.com
**Some of the customizations provided include:**
* 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
* 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
* git unstage (remove from index) and git uncommit (revert to the time prior to the last commit - dangerous if already pushed) aliases
OSX Hacks
---
The osx file is a bash script that sets up sensible defaults for devs and power users The osx file is a bash script that sets up sensible defaults for devs and power users
under osx. Read through it before running it. To use: under osx. Read through it before running it. To use:
@ -406,15 +433,16 @@ These hacks are Lion-centric. May not work for other OS'es. My favorite mods inc
* No disk image verification (downloaded files open quicker) * No disk image verification (downloaded files open quicker)
* Display the ~/Library folder in finder (hidden in Lion) * Display the ~/Library folder in finder (hidden in Lion)
Other recommended OSX tools
--- ### Other recommended OSX tools
* NValt - Notational Velocity alternative fork - http://brettterpstra.com/project/nvalt/ - syncs with SimpleNote * NValt - Notational Velocity alternative fork - http://brettterpstra.com/project/nvalt/ - syncs with SimpleNote
* Vimium for Chrome - vim style browsing. The 'f' to type the two char alias of any link is worth it. * Vimium for Chrome - vim style browsing. The 'f' to type the two char alias of any link is worth it.
* QuickCursor - gives you Apple-Shift-E to edit any OSX text field in vim. * QuickCursor - gives you Apple-Shift-E to edit any OSX text field in vim.
* 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.]' * 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.]'
Credits
--- ### Credits
I can't take credit for all of this. The vim files are a combination of 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, work by tpope, scrooloose, and many hours of scouring blogs, vimscripts,
@ -432,11 +460,14 @@ and other places for the cream of the crop of vim awesomeness.
And everything that's in the modules included in vim/bundle of course. And everything that's in the modules included in vim/bundle of course.
Please explore these people's work. Please explore these people's work.
COMING SOON
--- ### Comming Soon
* Better isolation of customizations in smaller chunks, maybe as plugins * Better isolation of customizations in smaller chunks, maybe as plugins
* Automatic setup script to symlink all dotfiles, or just some selectively * Automatic setup script to symlink all dotfiles, or just some selectively
For more tips and tricks
--- ### For more tips and tricks
Follow my blog: http://yanpritzker.com Follow my blog: http://yanpritzker.com

View File

@ -3,8 +3,12 @@
# A script to run ctags on all .rb files in a project. Can be run on # A script to run ctags on all .rb files in a project. Can be run on
# the current dir, called from a git callback, or install itself as a # the current dir, called from a git callback, or install itself as a
# git post-merge and post-commit callback. # git post-merge and post-commit callback.
# More info here: http://vimeo.com/3989493
#
# This fork will work with homebrew installed ctags on OS X ("brew install ctags")
# Source: https://gist.github.com/1564787
CTAGS = '/opt/local/bin/ctags' CTAGS = '/usr/local/bin/ctags'
HOOKS = %w{ post-merge post-commit post-checkout } HOOKS = %w{ post-merge post-commit post-checkout }
HOOKS_DIR = '.git/hooks' HOOKS_DIR = '.git/hooks'
@ -13,13 +17,13 @@ def install
$stderr.print "The install option [-i] can only be used within a git repo; exiting.\n" $stderr.print "The install option [-i] can only be used within a git repo; exiting.\n"
exit 1 exit 1
end end
HOOKS.each { |hook| install_hook("#{HOOKS_DIR}/#{hook}") } HOOKS.each { |hook| install_hook("#{HOOKS_DIR}/#{hook}") }
end end
def run_tags(dir) def run_tags(dir)
if File.executable?(CTAGS) and File.writable?(dir) if File.executable?(CTAGS) and File.writable?(dir)
%x{find #{dir} -name \\*.rb | #{CTAGS} -e -f #{dir}/TAGS -L - 2>>/dev/null} %x{find #{dir} -name \\*.rb | #{CTAGS} -f #{dir}/TAGS -L - 2>>/dev/null}
else else
$stderr.print "FAILED to write TAGS file to #{dir}\n" $stderr.print "FAILED to write TAGS file to #{dir}\n"
end end
@ -30,7 +34,7 @@ def install_hook(hook)
$stderr.print "A file already exists at #{hook}, and will NOT be replaced.\n" $stderr.print "A file already exists at #{hook}, and will NOT be replaced.\n"
return return
end end
print "Linking #{__FILE__} to #{hook}\n" print "Linking #{__FILE__} to #{hook}\n"
%x{ln -s #{__FILE__} #{hook}} %x{ln -s #{__FILE__} #{hook}}
end end
@ -40,4 +44,4 @@ if ARGV.first == '-i'
else else
# if GIT_DIR is set, we are being called from git # if GIT_DIR is set, we are being called from git
run_tags( ENV['GIT_DIR'] ? "#{ENV['GIT_DIR']}/.." : Dir.pwd ) run_tags( ENV['GIT_DIR'] ? "#{ENV['GIT_DIR']}/.." : Dir.pwd )
end end

View File

@ -1,19 +0,0 @@
" set up automatic ctags
let Tlist_Ctags_Cmd='/opt/local/bin/ctags'
" taglist defaults
let Tlist_Auto_Highlight_Tag=0
let Tlist_Auto_Open=0
let Tlist_Compact_Format = 1
let Tlist_Exist_OnlyWindow = 1
let Tlist_WinWidth = 40
let Tlist_GainFocus_On_ToggleOpen = 1
let Tlist_Show_Menu = 1
let Tlist_Use_Right_Window = 1
let Tlist_Use_Horiz_Window = 0
let Tlist_Close_On_Select = 1
let Tlist_Show_One_File = 1
let Tlist_Enable_Fold_Column = 0
let Tlist_Display_Prototype = 0
let Tlist_Use_SingleClick = 1