My vim configuration
Vim script Makefile Shell JavaScript
Switch branches/tags
Pull request Compare This branch is 1079 commits ahead, 108 commits behind wellbredgrapefruit:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
home
.gitignore
.gitmodules
README.markdown
relink_dotfiles_to_home
update_all_submodules_to_head

README.markdown

My personal VIM-config

This is my personal configuration for everybodies favorite editor VIM.
I use it mainly for ruby development.

This config should be gVIM (Windows) compatible.
Place all files in your user-directory and rename .vimrc to _vimrc and .vim to vimfiles.

My configuration is based on duwanis work.

Clone this repository to your HD and don't forget to git submodule init && git submodule update to make it work.
Call relink_dotfiles_to_home to link .vim and .vimrc to your home directory.

Added non-plugin features

  • my own "mvim" script (extras/mvim) that makes all passed cmdargs available to vim ($VIM_CMDARGS) This is used to enable you to call "mvim -d" with two directories (normally only two files). If you call "mvim -d" with two directories, the DirDiff Plugin will automatically be called to diff the directories.
  • A modified version of the railscasts theme as default theme
  • My favorite font Inconsolata-dz in extras
  • update_all_submodules_to_head script that updates all submodules and creates a commit for those updates
  • home/extras/macvim_with_current_ruby.patch patches the homebrew formula for macvim to integrate the active ruby and python in MacVIM.
    Apply via patch -p0 /usr/local/Library/Formula/macvim.rb home/extras/macvim_with_current_ruby.patch then reinstall macvim with homebrew

Assorted scripts:

  • add_text_if_missing.vim:
    Adds a function to add a line (eg. UTF-8 encoding for ruby < 2.0) to the top of a file

  • bracket-textobject.vim:
    Adds id and af textobjects that match surrounding brackets.

  • copy_matches.vim:
    Copy the search matches to the clipboard (source) with :CopyMatches

  • move-lines.vim:
    Moves visually selected lines up/down

  • pretty_print_xml.vim:
    Pretty print (format) an XML file with :Pretty

  • presentationmode.vim:
    Enter :Presentationmode with larger font, "fullscreen" and <ctrl-shift-up> and <ctrl-shift-down> to scale the fontsize manually

  • refactor_rename.vim:
    rr[MOTION]: Rename the text defined by MOTION in current scope. Currently knows the ruby filetype (see script file to define others).

  • replace_with_register.vim:
    <Leader>e[MOTION]: Replaces the MOTION text with the last yanked/deleted text

  • ruby_19hash_syntax.vim:
    :Rkey converts old 1.8 hash syntax to new 1.9 syntax

  • ruby_class_initialize.vim:
    :Rcls initializes the module/class structure of a previously saved file

  • ruby_local_gemfile.vim:
    :Gp in a Gemfile line ("gem 'somegem'") adds a local path (:path => "../somegem") to the Gemfile

  • ruby_method_visibility.vim:
    Enter :Vis and this script shows you the method visibilities (private/public/protected) in the gutter

  • ruby_rails_locale_lookup.vim:
    Rails Locale lookup via :Loc (try inside t("content.of.some.yaml.file"))

  • ruby_spec_textobject.vim:
    A modified version of this ruby textobject plugin which detects rspec syntax as block delimiters.
    Adds the ar and ir text-objects to VIM so you can for example delete a complete method (with the cursor somewhere in it) via dir (deletes without def .. .end) or dar (deletes incl. def .. .end).

  • ruby_unshouldify_rspec.vim:
    Use :Unshouldify to remove 'should' from an open rspec files

  • run_current_rspec_test_via_pipe.vim:
    Press <Leader>r on a rspec describe/context/it and it will be executed in a named pipe (tmp/rspec-test-pipe).
    Press <Leader>r outside of an rspec file and the last run spec will be re-executed
    Create pipe like this:
    mkdir -p tmp && if [ ! -p tmp/rspec-test-pipe ]; then mkfifo tmp/rspec-test-pipe; fi && echo "Now listening to tmp/rspec-test-pipe" && while true; do sh -c "$(cat tmp/rspec-test-pipe)"; done'

Plugins:

Ctrl-P

The revelation when it comes to file-finding. Alternative to fuzzyfinder and Command-T. Far superior to those two in my opinion. Use ,m to open the finder in file-mode. If you add files to your project run :ClearCtrlPCache (or press <f5> when ctrl-p is open) so the plugin can find those new files.

ctrlp-py-matcher

Adds faster python based matcher s to ctrl-p

dirdiff

Enables the comparison of directories in addition to files. If you use my mvim shell script instead of the MacVim supplied one you can use mvim -d dir1 dir2 and vim will automatically jump into DirDiff mode. Manually usage is DirDiff SourceDir1 SourceDir2. After the comparison window is open use the commands described in the DirDiff readme.

Dockerfile.vim

Syntax highlighting for Dockerfiles

editorconfig-vim

Support for EditorConfig.
Also do a brew install editorconfig.

greplace

Ever wanted to search/replace in all/some of the files in your project? That's an absolute nightmare using vimgrep. Fret not! :Gsearch has you covered! Use :Gsearch to search project-wide. The results will be opened in a buffer for you to edit in place. After editing (don't save that buffer) use :Greplace to integrate your changes back into the original files. This thing so rocks!

html5.vim

Adds syntax support for HTML5 elements like "data-*" or

NERDCommenter

Filetype sensitive commenting and uncommenting of textblocks. Mapped to ,c (thats ,c[space]) to toggle commenting in visual-mode.

NERDTree

The file-explorer for vim. Closed by default. Use ,d to open.
Auto-opens the directory of the current file (See config/plugins/nerdtree.vim).
After you add or delete files use :CtrlPClearCache (or press F5 inside ctrl-p) to regenerate the ctrl-p cache.

Rails.vim

This does so much good for you I can't even find a feature to start with. If you are in a rails file (eg. controller) you can use :Test to open the corresponding test-file in a horizontal-split.

Rake.vim

Adds all the rails.vim goodies to your plain old ruby files.

Repeat.vim

Allows to repeat (.) plugin commands like they were edit-commands.

rspec.vim

Better syntax highlighting for rspec files

ultisnips

Snippet expansion using the tab key. Snippets are placed in home/.vim/config/private_snippets.
Replacement for Snipmate.vim which seems to be unmaintained.

Surround.vim

Easily surround text with brackets, quotes or what have you. Change an existing surrounding using csOldNew (eg. "Hello" would become 'Hello' via cs"'), add surrounding with ysTextobjectSurrounding (Hello would become "Hello" with ysiw") or delete them with dsSurrounding. With an active visual selection SSurrounding will also work. Actions are repeatable with . via repeat.vim.

Syntastic

On the fly (actually "on the save" :)) syntax checking for a lot of languages. A locationlist will open if you have an error in your file. Deactivated filetypes (changeable in home/.vim/config/plugins/syntastic.vim):

  • html
  • coffee
  • haml
  • sass

tern_for_vim

Adds tern support inside vim (eg. :TernDef, :TernDoc)

tsuquyami

TypeScript support using tsserver

typescript-vim

Syntax highlighting support for typescript

vim-closetag

Auto closes tags in HTML/XML files.

vim-easymotion

Jump to characters the easy way: ,,tCharacter and easymotion will show letters for every hit it got. Type those letters and easymotion jumps to that point. Also works with f or w. There is a nice tutorial.

vim-endwise

Auto closes ruby structures with end where appropriate

vim-extradite

Adds :Glog to scroll through the current files history

vim-fugitive

A (the) git wrapper for vim. Use :Gc to commit, :Gs for status. When you are in a conflicted file use :Dl and :Dr to copy the current hunk from left or right to the working copy.

vim-go

The universal and best go support for vim. Supports UltiSnips. Go development is best when used with direnv to setup the GOPATH like this: echo "export GOPATH=`pwd`" > .envrc and then starting vim and doing a :GoInstallBinaries

vim-grepper

Interface to a lot of grep tools like eg. the-silver-searcher. Use :Ag to search for a term or gs<motion> to search for any motion.

vim-haml

Adds support for SASS, SCSS and HAML files to VIM.

vim-json

Improved highlighting and special JSON related functionality

vim-ruby

The Standard ruby support plugin. Configured in home/.vim/config/plugins/vim-ruby.vim to highlight trailing whitespace and for best OmniComplete support without booting rails inside vim (see the official docs on how this works)

vim-proc

Adds "jobs" or parallel execution to vim. Used as a 3rd party lib by some plugins.

YankStack

Manages the copy and paste registers for you. Restore a yanked text with ctrl-p or ctrl-n (previous and next).

yajs.vim

Improvements to javascript indention and syntax highlighting in VIM.