Code Monkey home page Code Monkey logo

vim-config's Introduction

An awesome Vim config for development, slow roasted with a Ruby twist and a shot of web-dev.

Installing

Assuming you already have vim, just run:

    git clone https://github.com/AdamWhittingham/vim-config.git ~/.vim && ~/.vim/install

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

If you are using zsh there may be an issue running tests with ,t (it can't find the bundle). If you don't already have an /etc/zprofile file it can be fixed by doing the following:

    sudo mv /etc/zshenv /etc/zprofile

more details here: http://vim.1045645.n5.nabble.com/MacVim-and-PATH-td3388705.html#a3392363

External Dependencies

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

Updating

    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.

Personalisation

We all like things a little differently, so there are a couple of ways to easily tweak and add to the config.

Add more plugins

Simply write normal Bundle plugin lines to ~/.vim.plugins.local

Set up options and add more functions

Changes like using a different font or colour scheme can be made by writing Vim config into ~/.vimrc.local

Using the config

The Leader Key

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 <space>

Plugins - all the goodies!

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.

Ack

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.

Ag

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

Autotag

Automatically update tags when saving files (more)

bufexplorer

Buffer explorer/browser (more)

Keys Function
<space> . Show buffer explorer

### Coffeescript Adds support for CoffeeScript. It handles syntax, indenting, and compiling (more)

color_highlight

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
<space> cC Toggle colour highlighting
<space> cF Toggle text or background colouring

CtrlP

Fast file navigation for VIM (more)

Keys Function
Ctrl + p Open the CtrlP fuzzy search
<space> f Refresh the cache and open the CtrlP fuzzy search
<space> 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.

Endwise

Auto completion of 'end' in Ruby (more)

Elixir

Elixir language support (more)

Gundo

Gundo is a Vim plugin for visualizing your undo tree to make it usable (more)

Keys Function
<space> u Toggle Gundo tree

markdown

Syntax highlighting for Markdown (more)

matchit

Allows % to be changed to match more than single characters; often more up-to-date than the version which ships with Vim. (more)

matchtag

Adds bracket-like highlighting to HTML and XML tags. Helpful in finding that damn missing closing tag when you have to edit raw HTML like the ancient Romans.

nerdcommenter

A plugin that allows for easy commenting of code for many filetypes (more)

Keys Function
<space> c{space} Comment/Uncomment this line

nerdtree

A tree explorer plugin for navigating the filesystem (more)

Keys Function
<space> m Show/hide NERDTree
<space> 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

projector mode

Toggle 'projector mode': larger font and high contrast colour scheme (more)

Keys Function
<leader> = Toggle 'projector mode' (large font, high contrast)

Projectionist

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

repeat

Use the repeat command (.) with supported plugins (more)

ruby-xmpfilter

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.

speeddating

Fix up C-a and C-x when dealing with dates. (more)

SplitJoin

Split and join code lines, such as Ruby ifs or CSS hashes (more)

Keys Function
<space> s Split the current line
<space> S Join the current lines

SuperTab

Do all your insert-mode completion with Tab (more)

surround

Delete/change/add parentheses/quotes/XML-tags/much more with ease (more)

syntastic

Automatic syntax checking (more)

Tabular

Configurable, flexible, intuitive text aligning (more)

Keys Function
<space> a= Align on =
<space> a=> Align on =>
<space> a, Align on ,
<space> a: Align on :
<space> a{ Align on {
<space> `a `
<space> a<space> Align on spaces

Tagbar

Sidebar for showing and navigating the tags in current file (more)

Keys Function
<space> ] toggle the sidebar

unimpaired

Pairs of handy bracket maps (more)

vim-abolish

Better abbreviations, substitution and search with Bash like {a,b} style expansions

vim-airline

Powerline like behaviour, but without the heavy Python (more)

vim-easy-align

Easy and versatile alignments (more) Align left, center or right on =, :, <space>, |, other sensible defaults or a regex.

Seriously, take 5 minutes to look at the official docs for this, it'll pay off!

Keys Function
a Start alignment of visually selected lines
ga<scope> Start alignment of the specified scope (eg. gaip starts inside paragraph)

vim-gitgutter

Show the changes made since the last commit in the gutter (more)

Keys Function
<space> g Skip to the next changed chunk
<space> G Skip to the previous changed chunk
<space> gt Toggle the git change gutter
<space> gh Highlight all changed lines

vim-indent-guidelines

Show indent guidelines - very useful when editing Haml! (more)

Keys Function
<space> ig Toggle indentation guidelines

vim-javascript

Adds syntax checking and better highlighting for Javascript files. (more)

vim-haml

Add haml, sass and SCSS syntax support (more)

vim-less

Less syntax highlighting (more)

### vim-ruby Ruby support (newer than the version released with vim). (more)

vim-ruby-refactoring

Refactoring tool for Ruby in vim! (more)

See relish documentation for examples.

vim-textobj-rubyblock

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
<space> t Run current test/spec/feature, or previous if in another file
<space> T Run nearest test/spec/feature to the cursor

Yankstack

Keeps a stack of your recent yanked lines so you can paste all of them quickly. (more)

Keys Function
<space> p Swap the last paste for the next item in the yank stack
<space> P Swap the last paste for the previous item in the yank stack

ZoomWin

Zoom in/out of windows and panes (toggle between one window and multi-window) (more)

Keys Function
<space> z Zoom

Other Keybindings

Keys Function
space space Toggle between the previously opened buffer
ctrl-] Jump to definition (needs exuberant ctags installed)
ctrl-n Toggle between absolute and relative numbering
space h Hide search highlighting
space H Show/hide hidden characters
space rt Run ctags -R .
space sp Show/hide spelling errors
space sw Strip trailing whitespace
space w s Split the current window vertically
space w S Split the current window horizontally
space w w Jump into the next split
space $ Toggle line wrapping
U Redo (easier than C-r but replaces default 'undo last line')
:Lorem Generate 'lorem ipsum' text
:Hipster Generate 'hipster ipsum' text

vim-config's People

Contributors

adamwhittingham avatar kerryb avatar bt-pinger avatar sinjo avatar alkesh avatar halorgium avatar cassiomarques avatar darlinj avatar roovo avatar

Watchers

James Cloos avatar lehaha avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.