An awesome Vim config for development, slow roasted with a Ruby twist and a shot of web-dev.
Assuming you already have vim, just run:
git clone https://github.com/AdamWhittingham/vim-config.git ~/.vim
ln -s ~/.vim/vimrc ~/.vimrc
vim +:PluginUpdate +:PluginClean +qall
Should this not leave you with a nice working vim (certain vims are a bit iffy about the last line) then launch vim and run :PluginUpdate
You can make updating easier by installing the update hook with ~/vim/install-plugin-update-hook.sh
There are a couple of things you might want to install to get the best out of this config:
- ctags - enables tags support when working with code
- Ag - enables grepping through the current directories with the_silver_searcher
- Ack - enables grepping through the current directories with Ack-grep. Only needed if you can't (or won't) install Ag.
- rcodetools - enables execution of ruby in-editor, run
gem install rcodetools
cd ~/.vim
git pull
If you've installed the auto-update hook, the git pull should trigger Vim to update and you're done!
Manually update by opening Vim and running :PluginUpdate
and :PluginClean
.
We all like things a little differently, so there are a couple of ways to easily tweak and add to the config.
Simply write normal Bundle plugin lines to ~/.vim.plugins.local
Changes like using a different font or colour scheme can be made by writing Vim config into ~/.vimrc.local
A large number of the useful commands in Vim start with the 'leader' key, so Vim knows something cool is about to happen.
For this config, the leader is the comma button. This is shown in the following notes as ,
See the plugins' web pages for more information. The keybindings listed are mostly just those defined or overridden locally, not the ones provided by default.
This plugin is a front for the Perl module App::Ack. Ack can be used as a replacement for 99% of the uses of grep. (more)[http://www.vim.org/scripts/script.php?script_id=2572]
Important: Requires ack (aka ack-grep) to be installed.
This plugin is a front for Ag. Ag can be used as a replacement for 153% of the uses of Ack.
Important: Requires the_silver_surfer to be installed
Automatically update tags when saving files (more)
Buffer explorer/browser (more)
Keys | Function |
---|---|
, . |
Show buffer explorer |
### Coffeescript Adds support for CoffeeScript. It handles syntax, indenting, and compiling (more)
Highlight color names and codes in the same color that they represent ([more] (http://www.vim.org/scripts/script.php?script_id=3963))
Keys | Function |
---|---|
, cC |
Toggle colour highlighting |
, cF |
Toggle text or background colouring |
Fast file navigation for VIM (more)
Keys | Function |
---|---|
Ctrl + p |
Open the CtrlP fuzzy search |
, f |
Refresh the cache and open the CtrlP fuzzy search |
, F |
Open CtrlP searching for files in the same directory as the current file |
Once the search window is open, you can use the following:
Keys | Function |
---|---|
F5 |
Purge the cache for the current directory to get new files, remove deleted files and apply new ignore options. |
Ctrl +f |
Cycle between things to search (files, buffers, recently used files) |
Ctrl +d |
Switch to filename only search instead of full path. |
Ctrl +r |
Switch to regexp mode. |
Ctrl +j , <c-k> or the arrow keys |
Navigate the result list. |
Ctrl +t or <c-v> , <c-x> |
Open the selected entry in a new tab or in a new split. |
Auto completion of 'end' in Ruby (more)
Elixir language support (more)
Gundo is a Vim plugin for visualizing your undo tree to make it usable (more)
Keys | Function |
---|---|
, u |
Toggle Gundo tree |
Syntax highlighting for Markdown (more)
Allows % to be changed to match more than single characters; often more up-to-date than the version which ships with Vim. (more)
A plugin that allows for easy commenting of code for many filetypes (more)
Keys | Function |
---|---|
, c{space} |
Comment/Uncomment this line |
A tree explorer plugin for navigating the filesystem (more)
Keys | Function |
---|---|
, m |
Show/hide NERDTree |
, f |
Show current file in tree |
C |
Set the current folder to be the root of the tree |
p |
Go to parent of selected item |
? |
Toggle the help list |
Toggle 'projector mode': larger font and high contrast colour scheme (more)
Keys | Function |
---|---|
, v |
Toggle 'projector mode' (large font, high contrast) |
Map different files and folders to groups (more) If you want to be a Vim legend, you really should brush up on what this excellent plugin does!
Keys | Function |
---|---|
: A |
Toggle between Ruby production code and spec |
Use the repeat command (.) with supported plugins (more)
Helper for ruby's xmpfilter (more)
Annotate ruby code with the result of running it, Ruby Tapas style. Press ,X to append a '# =>' to a line, then ,x to execute the file and insert all results.
Important: You need to install the rcodetools
gem for this to work.
Fix up C-a and C-x when dealing with dates. (more)
Split and join code lines, such as Ruby ifs or CSS hashes (more)
Keys | Function |
---|---|
, s |
Split the current line |
, S |
Join the current lines |
Do all your insert-mode completion with Tab (more)
Delete/change/add parentheses/quotes/XML-tags/much more with ease (more)
Automatic syntax checking (more)
Configurable, flexible, intuitive text aligning (more)
Keys | Function |
---|---|
, a= |
Align on = |
, a=> |
Align on => |
, a, |
Align on , |
, a: |
Align on : |
, a{ |
Align on { |
, `a |
` |
, a<space> |
Align on spaces |
Sidebar for showing and navigating the tags in current file (more)
Keys | Function |
---|---|
, ] |
toggle the sidebar |
Pairs of handy bracket maps (more)
Better abbreviations, substitution and search with Bash like {a,b} style expansions
Powerline like behaviour, but without the heavy Python (more)
Show the changes made since the last commit in the gutter (more)
Keys | Function |
---|---|
, g |
Skip to the next changed chunk |
, G |
Skip to the previous changed chunk |
, gt |
Toggle the git change gutter |
, gh |
Highlight all changed lines |
Show indent guidelines - very useful when editing Haml! (more)
Keys | Function |
---|---|
, ig |
Toggle indentation guidelines |
Add haml, sass and SCSS syntax support (more)
Less syntax highlighting (more)
### vim-ruby Ruby support (newer than the version released with vim). (more)
Refactoring tool for Ruby in vim! (more)
See relish documentation for examples.
Allow Ruby-aware text manipulation (more)
Keys | Function |
---|---|
v``a``r |
Visually select the current Ruby scope, including the boundary lines |
v``i``r |
Visually select the inside of the current Ruby scope (exludes the boundary lines) |
When visually selecting something, the following can be used:
Keys | Function |
---|---|
a``r |
Extend the selection out one scope level |
i``r |
Contact the selection in one scope level |
### vroom A plugin for running your Ruby tests, specs, and features. (more)
Keys | Function |
---|---|
, t |
Run current test/spec/feature, or previous if in another file |
, T |
Run nearest test/spec/feature to the cursor |
Zoom in/out of windows and panes (toggle between one window and multi-window) (more)
Keys | Function |
---|---|
, z |
Zoom |
Keys | Function |
---|---|
, , |
Toggle between the previously opened buffer |
ctrl-] |
Jump to definition (needs exuberant ctags installed) |
ctrl-n |
Toggle between absolute and relative numbering |
, h |
Hide search highlighting |
, H |
Show/hide hidden characters |
, rt |
Run ctags -R . |
, sp |
Show/hide spelling errors |
, sw |
Strip trailing whitespace |
, w |
Toggle word wrapping |
:Lorem |
Generate 'lorem ipsum' text |
:Hipster |
Generate 'hipster ipsum' text |