An open API service indexing awesome lists of open source software.

https://github.com/briangershon/dotvim

My Vim configuration, how to use it, and resources I've run across along the way...
https://github.com/briangershon/dotvim

Last synced: about 2 months ago
JSON representation

My Vim configuration, how to use it, and resources I've run across along the way...

Awesome Lists containing this project

README

        

README
======
If new to Vim, I'd recommend pulling pieces from other people's Vim configuration (such as this one) into your own `.vimrc` instead of wholesale using other people's `.vimrc` so you learn as you go.

I'm using both MacVim 7.3 and terminal Vim, so have configs for both.

Install MacVim 7.3
------------------

# install Homebrew from http://mxcl.github.com/homebrew/
brew install macvim

# if homebrew can't find xcode (since it's no longer in /Developer)
sudo xcode-select -switch /Applications/Xcode.app
xcode-select -print-path # to double check
# rerun brew install macvim

Setting up my Vim configuration on a new machine
------------------------------------------------

# bring down code in ~/.vim
# make sure ~/.vim doesn't already exist
cd ~
git clone [email protected]:briangershon/dotvim.git ~/.vim

# bring down all modules
cd ~/.vim
git submodule init
git submodule update

# link config files
ln -s ~//vimrc ~/.vimrc # vim configuration
ln -s ~/dotvim/gvimrc ~/.gvimrc # graphical vim configuration (for MacVim)

Setup and Configuration
-----------------------

### For Python development:

MacVim should have a version of Python that pyflakes.vim needs which is Python 2.5+

Which version of Python is MacVim currently using?

In MacVim, type this: `:python import sys; print sys.version`

If less than Python 2.5, you need to custom compile in Python. See below.

### For JavaScript development:

#### Install dependencies:

JSHint

npm install -g jshint

#### Helpful websites:

* [Recommended Vim plugins for JavaScript coding?](http://stackoverflow.com/questions/4777366/recommended-vim-plugins-for-javascript-coding)

### Managing Vim Plugins with Pathogen

See also [Synchronizing plugins with git submodules and pathogen](http://vimcasts.org/episodes/synchronizing-plugins-with-git-submodules-and-pathogen/)

Adding new plugins via git submodules:

mkdir ~/.vim/bundle # if it doesn't already exist

cd ~/.vim
git submodule add http://github.com/tpope/vim-fugitive.git bundle/vim-fugitive
git add .
git commit -m "Install Fugitive.vim bundle as a submodule."

Updating existing plugins:

cd ~/.vim/bundle/fugitive
git pull

Removing existing plugins:

# from http://stackoverflow.com/questions/1260748/how-do-i-remove-a-git-submodule
# Delete the relevant section from the .gitmodules file.
# Delete the relevant section from .git/config.
# Run git rm --cached path_to_submodule (no trailing slash).
# Commit and delete the now untracked submodule files.

### How to custom compile MacVim if you want to

On SnowLeopard, this is how I compiled it:

Read Building MacVim (from: http://code.google.com/p/macvim/wiki/Building)

# Make sure xcodebuild is symlinked from /usr/bin to xcodebuilddebuild in /Developer/usr/bin
# Clone the MacVim.git repo: git clone git://repo.or.cz/MacVim.git vim7
# Configure and build Vim:
cd vim7/src
./configure --with-features=huge --enable-pythoninterp --enable-rubyinterp --enable-gui-macvim
make

To try it:

# open MacVim/build/Release/MacVim.app

How I'm Using
=============

Navigating Files and Buffers
----------------------------
* Navigating and editing files: My preference is using built in `:cd`, `:pwd`, `:e` to navigate and load files. I had tried NERDTree and MiniBufExplorer to navigate and view open files visually, but still felt like too many keystrokes and too much managing of those windows. (Though I did like the Bookmark feature of NerdTree, but `:cd` still pretty easy) See wild* options in .vimrc

* Navigating buffers: `:b` for navigating open buffers. `:sb` for open buffer into a new split window.

Code Editing
------------
* `=` auto indents

* Toggle comments by visually selecting lines and typing `gc` (via NERDCommenter)

Custom Key Mappings
-------------------
* `:map` to see all of them

* `,v` to load .vimrc and auto-reload when saved. `,r` to load this README.mdown

MacVim settings (gvimrc)
------------------------
* Setup some nice fonts for MacVim.

* Using solarized color theme.

History
=======
* c. 2002 -- Using Vim primarily to maintain configuration on Unix servers

* March 2010 -- Using as primary Python and Django editor. Inspired to switch to Vim at PyCon 2010 by Python colleagues using Vim as their primary editor. [My old configuration tuned for Python](http://github.com/briangershon/dotfiles)

* January 2011 -- Start from bare metal with initial focus on upgrading to pathogen. See [Synchronizing plugins with git submodules and pathogen](http://vimcasts.org/episodes/synchronizing-plugins-with-git-submodules-and-pathogen/)

* April 2012 -- Inspired to jump back into Vim after a year hiatus. Giving Solarized theme a try.

A few personal sources of Vim Configuration Ideas
-------------------------------------------------
* Drew Neil [VimCasts.org](http://www.vimcasts.org/) [http://github.com/nelstrom/dotfiles](http://github.com/nelstrom/dotfiles)

* Clayton Parker [@claytron](http://www.twitter.com/claytron) for his initial configs with a focus on Python [http://github.com/claytron/dotfiles](http://github.com/claytron/dotfiles)

* [Ultimate Vim config](http://spf13.com/post/ultimate-vim-config) and [The Perfect .vimrc vim config file](http://spf13.com/post/perfect-vimrc-vim-config-file)

* Some nice general options: [http://maryhola.com/misc/vimrc/vimrc.vimrc.html](http://maryhola.com/misc/vimrc/vimrc.vimrc.html)

* Johann Heller [https://github.com/empanda/dotfiles](https://github.com/empanda/dotfiles)

* Aaron Vanderlip [@AaronVanderlip](http://www.twitter.com/AaronVanderlip)

* Godefroid Chapelle [@__gotcha](http://www.twitter.com/__gotcha) [https://svn.plone.org/svn/collective/vimplone/branches/plippers-vim](https://svn.plone.org/svn/collective/vimplone/branches/plippers-vim)