A Solid Vim Configuration
This is an ever evolving VIM config, which incorperates several plugins, color
schemes, and custom functions. The
.vimrc if heavily commented, and there are
a few notes in this file, about some of the handier plugins and quicktips.
Part of the beauty of vim is how modular and configurable it is. I invite you to use this repo as a starting point, or a guide for your own. This is also very handy as a place to sync such information between machines. Pretty much any machine I work on can be quickly bootstrapped to have a text editor that I know and love up and running in seconds. It's magic.
I also recommend you check out the my dotfiles
repo as it includes some binaries
that this depends on like,
eshint. If you use that repo,
it will include this one, and you can skip installation.
Move to your homedir
Clone the Repo
This will end up in your home directory.
git clone git://github.com/counterbeing/Vim-Configuration.git ~/.vim
Create a symlink in your homedir from .vimrc to the .vimrc inside this .vim
ln -s .vim/.vimrc
Run The Script To Grab All Vim Bundles
cd .vim vim +PlugInstall +qall
Here's a cheatsheet of handy things, for reference.
Git integration within VIM. I know I really don't use this enough. I use this plugin in a few key ways, so I will outline them in workflows.
Making changes, and commiting them.
After making changes to a file, you can use
:Gstatus to stage files for
commit. A list will pop up, and you can select from the list of unstaged file
by hitting the
- key. Each time you do this, a file will be staged for
commit. You can move them the other way as well. Then, in the same window you
:Gcommit to commit and write a message,
:wq and you're done. Here's
a video demo.
||Toggles the commenting of a block on or off|
There are a few minor tweaks to make this work a bit more naturally with markdown, as that's what I use it for primarily.
||Toggles table mode on or off.|
This offers some great integration for git, showing the current status of changes in a file. It really helps you remember what you were working on, and be aware of what changes you've made. Even more cool. If you were workig on two different changes by mistake, you can easily stage just some of them for commiting.
||Stage a hunk for commit|
||Unstage a hunk|
Sometimes in any language you want to break a statement up into multiple lines as it gets too long to be easily readable. This great little plugin helps you do most of the dirty work without thinking about it. My only gripe at the moment is that it still prefers the older Ruby hash syntax. But, it's great, take it for a spin.
||Split a one line into multiple lines.|
||Merge a multi line hash or method or whatnot into a single line|
||Paste mode removes line numbers, and vertical alignment lines for easy system copying.|
||Reveals a particular file in the finder.|
||Pretty formats selected json.|
||Yanks selected text to system clipboard.|
||Runs rubocop autocorrect on current file.|
General Vim Reminders
Some of my favorite and most used shortcuts.
||Make a new tab|
||Toggle between tabs|
||Open current file in new tab|
||Toggles a code block of folding.|
||Fold everything in a file|
||Fold everything at a particular level|
||Unfold everything in a file|
||Unfold everything at a particular level|
Rails.vim adds some syntax highlighint along with some other nicities
||Open associated spec or file|
||Open associated spec or file in vertical split|
||Open associated spec or file in split|
Splits and Tabs
Super useful feature of vim for laying out different files next to each other, so that you can see everything you want to see at one time.
||Creates a vertical split|
||Creates a horizontal split|
||Creates a new tab|
||Move left to different window, in a split scenario. This also works with all of the direction keys
||Creates a new tab|
||Toggle to next tab|
Sessions are a quick way of saving window layouts, including spits, tabs, and
even even set variables. I use it in a very simple way, which is just to output
Session.vim file in the current directory. I often need to drop what I'm
working on to check out something on another git branch, which can cause issues
with which files I want open. Usually I have things arranged in such a way that
I have tests in one tab, and related code in another, or test/code pairs in
each tab. It just depends on what I'm working on. With sessions, I can quickly
save the state of the windows I was working on.
||makes a simple
||Makes the session file where you tell it.|
||Same as above except forces overwrite.|
||Open a VIM session file and open all of the tabs and splits.|
Things To Improve
- Remove trailing line from copy to clipboard commands
- Fix highlight color of vertical rule on indented lines
- Add vertical rule to mark 80 char line lenght for select languages
- Get output from rspec to easily go to broken test