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
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.
relink_dotfiles_to_home to link
.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_headscript that updates all submodules and creates a commit for those updates
home/extras/macvim_with_current_ruby.patchpatches the homebrew formula for macvim to integrate the active ruby and python in MacVIM.
patch -p0 /usr/local/Library/Formula/macvim.rb home/extras/macvim_with_current_ruby.patchthen reinstall macvim with homebrew
Adds a function to add a line (eg. UTF-8 encoding for ruby < 2.0) to the top of a file
aftextobjects that match surrounding brackets.
Copy the search matches to the clipboard (source) with
Moves visually selected lines up/down
Pretty print (format) an XML file with
:Presentationmodewith larger font, "fullscreen" and
<ctrl-shift-down>to scale the fontsize manually
rr[MOTION]: Rename the text defined by MOTION in current scope. Currently knows the ruby filetype (see script file to define others).
<Leader>e[MOTION]: Replaces the MOTION text with the last yanked/deleted text
:Rkeyconverts old 1.8 hash syntax to new 1.9 syntax
:Rclsinitializes the module/class structure of a previously saved file
:Gpin a Gemfile line ("gem 'somegem'") adds a local path (:path => "../somegem") to the Gemfile
:Visand this script shows you the method visibilities (private/public/protected) in the gutter
Rails Locale lookup via
:Loc(try inside t("content.of.some.yaml.file"))
A modified version of this ruby textobject plugin which detects rspec syntax as block delimiters.
irtext-objects to VIM so you can for example delete a complete method (with the cursor somewhere in it) via
def .. .end) or
def .. .end).
:Unshouldifyto remove 'should' from an open rspec files
<Leader>ron a rspec describe/context/it and it will be executed in a named pipe (tmp/rspec-test-pipe).
<Leader>routside 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'
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.
Adds faster python based matcher s to ctrl-p
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.
Syntax highlighting for Dockerfiles
Support for EditorConfig.
Also do a
brew install editorconfig.
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!
: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!
Adds syntax support for HTML5 elements like "data-*" or
Filetype sensitive commenting and uncommenting of textblocks.
,c (thats ,c[space]) to toggle commenting in visual-mode.
The file-explorer for vim. Closed by default. Use
,d to open.
Auto-opens the directory of the current file (See
After you add or delete files use
:CtrlPClearCache (or press
F5 inside ctrl-p) to regenerate the ctrl-p cache.
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.
Adds all the rails.vim goodies to your plain old ruby files.
Allows to repeat (
.) plugin commands like they were edit-commands.
Better syntax highlighting for rspec files
Snippet expansion using the
tab key. Snippets are placed in
Replacement for Snipmate.vim which seems to be unmaintained.
Easily surround text with brackets, quotes or what have you.
Change an existing surrounding using
csOldNew (eg. "Hello" would become 'Hello' via
add surrounding with
ysTextobjectSurrounding (Hello would become "Hello" with
delete them with
dsSurrounding. With an active visual selection
SSurrounding will also work.
Actions are repeatable with
. via repeat.vim.
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
Adds tern support inside vim (eg.
TypeScript support using tsserver
Syntax highlighting support for typescript
Auto closes tags in HTML/XML files.
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
w. There is a nice tutorial.
Auto closes ruby structures with
end where appropriate
:Glog to scroll through the current files history
A (the) git wrapper for vim. Use
:Gc to commit,
:Gs for status. When you are in a conflicted file use
to copy the current hunk from left or right to the working copy.
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
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.
Adds support for SASS, SCSS and HAML files to VIM.
Improved highlighting and special JSON related functionality
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)
Adds "jobs" or parallel execution to vim. Used as a 3rd party lib by some plugins.
Manages the copy and paste registers for you. Restore a yanked text with
ctrl-n (previous and next).