My Vim Directory
Vim script
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
after/syntax
autoload
bundle
colors
doc
ftplugin
plugin
spell
.gitignore
.gitmodules
.vimrc
README.markdown

README.markdown

My Personal Vim Settings

This is my personal git directory, under source control ready to be deployed across across all platforms.

Sessions

Sessions are automatically saved to ~/.vim/session and you will be asked if you want to restore from an existing session if you open vim without a file argument. Session names are created based on the --servername argument. The default for gvim is GVIM. If you want to create a unique session you can do:

:SessionName sessionname

Then launch vim with that session name to restore:

gvim --servername sessioname

Note that sessions preserve environment. If you updated .vimrc or plugins you will need to manually source them after launching. If your session just got weird, you can blow away everything other than the buffer and tab list by doing:

:SessionCleanSave

This is the same as setting:

:set sessionoptions=blank,buffers,curdir,tabpages

Then quit and re-launch to clean environment with the buffer list and arglist intact.

Persistent Undo

Persistent undo is enabled if you are running 7.3 or above. All the undo files are saved to ~/.vim/undo. This directory may get somewhat large if you don't blow it away every once in a while so watch for that.

Plugins

These are the custom plugins I use:

Custom Key Bindings

The <leader> key is bound to <space> because space is cool.

  • + and - - increment and decrement number under cursor
  • <C-BS> - ctrl+backspace deletes last word
  • <C-Del> - ctrl+Del deletes next word
  • <C-F> - opens the file under cursor in the 2nd split window if open
  • <C-L> - fix last typo
  • <C-P> - generate PHPDoc comments at cursor (defined in ftplugin/php.vim)
  • <C-R> - paste in contents of the unnamed register
  • <C-Tab> - toggle between splits
  • <C-_> - close html tag (closetag.vim) or tex environment (tex-autoclose.vim)
  • <Down> - search current directory for files with Unite
  • <F10> - insert current date at cursor
  • <F2> - toggle Tag List buffer
  • <F3> - toggle paste mode
  • <F5> - toggle relative and absolute line numbering
  • <F7> - toggle Gundo undo browser
  • <Left> and <Right> - browse through buffers
  • <S-Tab> - Auto expand and/or jump when using Emmet plugin
  • <Tab> - next buffer
  • <Up> - search/display open buffers with Unite
  • <leader><cr> - break line at cursor (normal mode)
  • <leader><space> - clear search highlights (double tap <space>)
  • <leader>H and <leader>h - markdown headings (defined in ftplugin/mkd.vim)
  • <leader>o - insert a blank line (normal mode) (also works with <leader>O)
  • <leader>y and <leader>p - copy and paste using system clipboard (also Y and P)
  • jj - bound to <Esc>
  • m<space> - delete all marks in the document

Custom Commands

  • :VIMRC - open .vimrc in current windows
  • :SOURCE - source .vimrc
  • :DOS - set file format to dos
  • :UNIX - set file format to unix
  • :MAC - set file format to mac
  • :FILEPATH - display the file path in the status line
  • :CTAGS - run ctags recursively on project directory
  • :SessionName - set session name for current session
  • :SessionSaveBuffersOnly - save only buffers on exit (same as set ssop=buffers,args)
  • :SPCLEAN - runs cleanup routine on spell-check files
  • :RemoveEm - remove the ^M symbols from the file

Deploying

On Linux and Mac:

rm -rf .vim
rm .vimrc
git clone git@github.com:maciakl/.vim.git
ln -s .vim/.vimrc .vimrc
cd .vim
git submodule init
git submodule update

On Windows:

rmdir /s /q vimfiles
del _vimrc
git clone git@github.com:maciakl/.vim.git
mklink /d vimfiles .vim
mklink /h _vimrc .vim\.vimrc
cd .vim
git submodule init
git submodule update

On Windows XP:

rmdir /s /q vimfiles
del _vimrc
git clone git@github.com:maciakl/.vim.git
junction vimfiles .vim
fsutil hardlink create _vimrc .vim\.vimrc
cd .vim
git submodule init
git submodule update

Note that you will need junction.exe from Sysinternals to create the symbolic link for the directory. The fsutil executable should be on your system by default.

Other Prerequisites

Your vim should be compiled with +dialog and +python.

You may also need these:

You could probably use unix ctags, but they don't have all the features.

####CTAGS Ain't Hard!

On debians and buntus of all shapes and sizes:

sudo apt-get install exuberant-ctags

On windows download ctags.exe from the link above and put somewhere in your path.

Mac is a little trickier:

  • Use Homebrew to install the package ctags.

Then add this to .basrc or .profile:

alias ctags="`brew --prefix`/bin/ctags"