-
Notifications
You must be signed in to change notification settings - Fork 4
Dotfiles
rcm is a terrific dotfile management system. It was created by the folks at Thoughtbot, who have their own standard set of dotfiles that I recommend as a starting point. Dotfiles are also called rc files. They're called dotfiles because they usually start with a dot, and they're called rc files because they offten end with rc (.vimrc
, for example). rcm makes it easy to manage your dotfiles, and this is really important because, while you don't want to write all of your dotfiles yourself, you also want to be able to keep track of your own settings. rcm lets you create a dotfiles/ folder (which you should use as your own personal dotfiles repo, and which I suggest you putting on github so you can simply pull it into your next computer environment, or even bring it in temporarily to other environments) where you can manage your own dotfiles. At the same time, it lets you bring in other dotfiles/ directories as well, so you can start with Thoughtbot's dotfiles, for example, and merge your own in as you go. You can read more about it at https://github.com/thoughtbot/rcm, but the basic idea is that instead of writing your dotfiles to your root folder the way you normally would, you write to dotfiles/ directories and rcm will merge your various dotfiles/ directories and then symlink the dotfiles in your root directory to these merged dotfiles.
For alternatives to rcm and more info/ideas about managing your dotfiles, read Managing your dotfiles
aliases
The aliases dotfile lists all of my aliases. Some key aliases are:
alias mkdir='mkdir -p' alias ...='../..' alias l='ls' alias ll='ls -al' "list all files and in long format" alias lh='ls -Alh' "list all in long format except . and .. and use unit suffixes for size (GB for Gigabyte)" alias -g G='| grep' "global grep alias" alias -g M='| less' "cat with forward and backward navigation" alias -g L='| wc -l' "word count with number of lines" alias -g ONE="| awk '{ print $1}'" alias e="$EDITOR" alias v="$VISUAL"
b for bundle. g with no arguments is git status and with arguments acts like git. git-churn to show churn for the files changed in the branch. m for rake db:migrate && rake db:rollback && rake db:migrate && rake db:test:prepare. mcd to make a directory and change into it. replace foo bar **/*.rb to find and replace within a given list of files. rk for rake. tat to attach to tmux session named the same as the current directory. v for $VISUAL.
Adds a create-branch alias to create feature branches. Adds a delete-branch alias to delete feature branches. Adds a merge-branch alias to merge feature branches into master. Adds an up alias to fetch and rebase origin/master into the feature branch. Use git up -i for interactive rebases. Adds post-{checkout,commit,merge} hooks to re-index your ctags. Adds pre-commit and prepare-commit-msg stubs that delegate to your local config.
Ctrl-P for fuzzy file/buffer/tag finding. Rails.vim for enhanced navigation of Rails file structure via gf and :A (alternate), :Rextract partials, :Rinvert migrations, etc. Run RSpec specs from vim. Set to a single space. Switch between the last two files with space-space. Syntax highlighting for CoffeeScript, Textile, Cucumber, Haml, Markdown, and HTML. Use Ag instead of Grep when available. Use Exuberant Ctags for tab completion. Use GitHub color scheme. Use vim-mkdir for automatically creating non-existing directories before writing the buffer. Use Vundle to manage plugins.
" Let Vundle manage Vundle Bundle 'gmarik/vundle'
" Define bundles via Github repos Bundle 'croaky/vim-colors-github' Bundle 'danro/rename.vim' Bundle 'kchmck/vim-coffee-script' Bundle 'kien/ctrlp.vim' Bundle 'scrooloose/syntastic' Bundle 'thoughtbot/vim-rspec' Bundle 'tpope/vim-bundler' Bundle 'tpope/vim-cucumber' Bundle 'tpope/vim-endwise' Bundle 'tpope/vim-fugitive' Bundle 'tpope/vim-rails' Bundle 'tpope/vim-surround' Bundle 'vim-scripts/matchit.zip' Bundle 'vim-scripts/ctags.vim' Bundle 'vim-scripts/tComment'
Bundle 'gcmt/wildfire.vim' Bundle 'mattn/emmet-vim' Bundle 'MarcWeber/vim-addon-mw-utils' Bundle 'tomtom/tlib_vim' Bundle 'garbas/vim-snipmate' Bundle 'honza/vim-snippets' Bundle 'fatih/vim-go' Bundle 'chriskempson/base16-vim'
For more JavaScript-releated (or unrelated but useful) vim plugins, check out https://github.com/joyent/node/wiki/Vim-Plugins
Also, I have the vim-fugitive plugin but haven't really had time to learn it: https://github.com/tpope/vim-fugitive
A special note on vim-surround
It's easiest to explain with examples. Press cs"'
inside "Hello world!" to change it to 'Hello world!'
Now press cs'<q>
to change it to
Hello world!
To go full circle, press cst"
to get
"Hello world!"
To remove the delimiters entirely, press ds"
.
The .
command will work with ds
, cs
, and yss
if you install
repeat.vim.
For more, check out https://github.com/tpope/vim-surround
Thoughtbot also has a great guide on how you should create your own dotfiles in their dotfiles README, which also provides a list of the most important configurations.
Install the plugin with Vundle (in your vimrc.bundles.local add Bundle 'Valloric/YouCompleteMe') brew install cmake cd ~/.vim/bundle/YouCompleteMe && ./install.sh install the tern_for_vim plugin through Vundle run npm install inside of tern_for_vim dir
If you want to use zsh, consider using antigen to manage zsh plugins. It's like Vundle for zsh: https://github.com/zsh-users/antigen