This is a tweaked copy of the excellent Vi/Vim dev setup Kerryb
If necessary, backup and remove your /.vim directory and /.vimrc file:
mv $HOME/.vim{,.original-$(date +%Y.%m.%d-%H.%M.%S)}
mv $HOME/.vimrc{,.original-$(date +%Y.%m.%d-%H.%M.%S)}
Clone this repository to ~/.vim:
git clone git://github.com/AdamWhittingham/vim-config.git ~/.vim
(If you're behind a firewall that blocks port 9418, replace git: with https: in the above URL.)
Alternatively, if for some bizarre reason you don't have git installed, you can download a zip or tar file using the link on GitHub.
Finally, symlink .vimrc so the config is loaded when Vim starts:
ln -s ~/.vim/vimrc ~/.vimrc
cd ~/.vim
git pull
There are a couple of things you might want to install to get the best out of this config:
- ctags - enables tags support when workingn with code
- Ack - enables grepping through the current directories
Local changes (eg if you prefer a different font or colour scheme) can either be made in a branch, or in ~/.vimrc.local.
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.
Plugins are installed in their own directories under bundle, thanks to Pathogen.
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]
Requires ack (aka ack-grep) to be installed.
Help folks to align text, eqns, declarations, tables, etc (more)
Keybindings
- ,a=
- Align on =
- ,a=>
- Align on =>
- ,a,
- Align on ,
- ,a{
- Align on {
- ,a|
- Align on |
- ,a
- Align on spaces
Automatically update tags when saving files (more)
Buffer explorer/browser (more)
Keybindings
- ,.
- Show buffer explorer
## Coffeescript (fd170cb - 13 June 2011)
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))
Keybindings
- ,cC
- Toggle colour highlighting
- ,cF
- Toggle text or background colouring
Fast file navigation for VIM (more)
Keybindings
- C-p
- Open the CtrlP fuzzy search
- ,t
- Refresh the cache and open the CtrlP fuzzy search
Gundo is a Vim plugin for visualizing your undo tree to make it usable (more)
Keybindings
- ,u
- Toggle Gundo tree
Adds support for HTML 5 keyword highlightings (more)
Quickly switch between buffers using the home row or number keys (more)
- ,lj
- Show buffer list
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)
A tree explorer plugin for navigating the filesystem (more)
Keybindings
- ,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)
- ,p
- Toggle 'projector mode' (large font, high contrast)
A set of mappings for HTML, XML, PHP, ASP, eRuby, JSP, and more (more)
If you have already typed 'foo', the following shortcuts apply (with the cursor position marked by ^):
- <C-X>=
- foo<%= ^ %>
- <C-X>+
- <%= foo^ %>
- <C-X>-
- foo<% ^ %>
- <C-X>_
- <% foo^ %>
- <C-X>'
- foo<%# ^ %>
- <C-X>"
- <%# foo^ %>
- <C-X><Space>
- <foo>^</foo>
- <C-X><CR>
- <foo>
^
</foo> - <C-X>/
- Last HTML tag closed
- <C-X>!
- <!DOCTYPE...>/<?xml ...?> (menu)
- <C-X>@
- <link rel="stylesheet" ...>
- <C-X>#
- <meta http-equiv="Content-Type" ... /> ragtag-CTRL-X_#
- <C-X>$
- <script src="/javascripts/^.js"></script> ragtag-CTRL-X_$
Ruby on Rails: easy file navigation, enhanced syntax highlighting, and more (more)
Keybindings
- ,r
- run rake
It's like rails.vim without the rails (more)
Use the repeat command (.) with supported plugins (more)
Do all your insert-mode completion with Tab (more)
Delete/change/add parentheses/quotes/XML-tags/much more with ease (more)
Switch between predefined code blocks (eg. Ruby 1.8 to 1.9 hash syntax) (more)
Automatic syntax checking (more)
Configurable, flexible, intuitive text aligning (more)
Keybindings
- ,tt
- (when text is selected) format tables made with pipes (|)
Sidebar for showing and navigating the tags in current file (more)
Keybindings
- ,]
- toggle the sidebar
Pairs of handy bracket maps (more)
Better abbreviations, substitution and search with Bash like {a,b} style expansions
## vim-bundler (3f1e6e9f, 22 Aug 2011)
Lightweight bag Vim goodies for Bundler (more)
The well-known solarized colorscheme (more)
Show the changes made since the last commit in the gutter (more)
- ,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)
- ,ig
- Toggle indentation guidelines
Add haml, sass and SCSS syntax support (more)
Less syntax highlighting (more)
Colourful and neat status bar without the need for font patching
Quick navigation around rails projects (more)
- :A
- Alternate file- switch between specs and production code
- :R
- Related file- switch between modles, controllers and views
- :Emodel
- Switch to the model
- :Eview
- Switch to the view
- :Econtroller
- Switch to the controller
## vim-ruby (b10adca - 17 Aug 2012)
Ruby support (newer than the version released with vim). (more)
Refactoring tool for Ruby in vim! (more)
See relish documentation for examples.
Allow previous search to act as a text object (a little more)
eg va/ to visually sepect previous match, or ca/ to change it.
## vroom (00f0d4d - 27 May 2013)
A plugin for running your Ruby tests, specs, and features. (more)
- ,r
- Run current test/spec/feature, or previous if in another file
- ,R
- Run nearest test/spec/feature
Zoom in/out of windows (toggle between one window and multi-window) (more)
Keybindings
- ,z
- Zoom
- alt-c
- In visual modes, copy the selected to the system clipboard
- alt-v
- Paste from the system clipboard
- ctrl-]
- Jump to definition (needs exuberant ctags installed
- ctrl-n
- Toggle between absolute and relative numbering
- ,c
- Show/hide hidden characters
- ,h
- Hide search highlighting
- ,rr
- Run ruby file
- ,rt
- Run `ctags -R .`
- ,s
- Show/hide spelling errors
- ,sw
- Strip trailing whitespace
- ,tsp
- Align on whitespace
- ,tlt
- Align LaTEX tables (to avoid clashing with our existing ,tt mapping)
- ,w
- Toggle word wrapping
- RB
- Open Ruby docs in browser for word under cursor
- RR
- Open Rails docs in browser for word under cursor
- :Lorem
- Generate 'lorem ipsum' text