Credits in the comments.
File | Contents |
---|---|
.vimrc |
Move to $HOME/.vimrc in POSIX. In other os see the
vim wiki page on vimrc files. |
bundles.vim` |
Manifest of packages to install. Automatically installs neobundle.vim via git if it doesn't exist. |
keymappings.vim |
Keybindings all in one location. |
functions.vim |
Misc. vim functions. |
colors.vim |
Color scheme, highlighting. |
autocmd.vim |
Language-specific conditions, indentation, vim settings. |
ignore.vim |
Ignore file regex's for various plugins. |
settings.vim |
Global vim settings |
unite.vim |
unite.vim config settings. |
See keymappings.vim for more.
Keybinding | Action |
---|---|
<leader> |
Is , . Used before any shortcut with
<leader> . |
<leader> <tab> |
Toggle File Tree. |
<leader> 2 |
Open source code tags (classes, methods, functions). |
<space> |
unite.vim leader key. |
<space> + <space> |
Launch unite with Buffers, files. |
<space> + g |
Grep (file contents) in current file. |
<space> + G |
Grep (find inside file) all files in CWD. |
<space> + n |
Find files relative to CWD by file name. |
<space> + m |
Most recent files |
<space> + o |
Search tags (class, methods, functions) in current buffer. |
ctrl-h/j/k/l |
Move between window panes |
q (inside file tree, |
Close pane |
tagbar or unite) |
Modularization and decopling of vim configuration is based off 3 aspects:
Splitting config separate files (see
unite.vim
is separate from.vimrc
.Inside of
.vimrc
, I will do:source ~/.vim/bundles.vim
Plugin management
Automatically download and update vim plugins.
The history of vim configurations publicly speaking is based off observable practice, this is my best recollection of how plugin management has evolved over the recent years:
In the beginning, vimscripts would be kept inside of the
~/.vim/
directory. Learn Vimscript the Hard Way describes the layout stucture:~/.vim/colors/ ~/.vim/plugin/ ~/.vim/ftdetect/ ~/.vim/ftplugin/ ~/.vim/indent/ ~/.vim/compiler/ ~/.vim/after/ ~/.vim/autoload/ ~/.vim/doc/
Then there were vimball installers.
Then Pathogen would allow loading packages via custom directries, and the best practice would change to storing plugins in
./bundle
. Clever people would begin to use Pathogen with git submodules as a way to keep multiple packages in sync.Today, most vim plugins reside on github repositories as opposed to vim.org's script repository. Vundle and `NeoBundle`_ come in excellently here, since they install, update and load.
VCS to manage changes / store vim config
This vimrc is managed in a git repository. It serves as a way to make sure different machines can have a synchronized configurations, changes can be logged and most importantly, there is a backup.
Shougu/neobundle.vim is used for packagement. Advantages include support for asynchronous updating, etc.
Alternatives are gmarik/Vundle and tpope/Pathogen.
set nocompatible
filetype off
" Setting up Vundle - the vim plugin bundler
" Credit: http://www.erikzaadi.com/2012/03/19/auto-installing-vundle-from-your-vimrc/
let iCanHazVundle=1
let neobundle_readme=expand('~/.vim/bundle/neobundle.vim/README.md')
if !filereadable(neobundle_readme)
echo "Installing neobundle.vim."
echo ""
silent !mkdir -p ~/.vim/bundle
silent !git clone https://github.com/Shougo/neobundle.vim ~/.vim/bundle/neobundle.vim
let iCanHazVundle=0
endif
set rtp+=~/.vim/bundle/neobundle.vim/
call neobundle#rc(expand('~/.vim/bundle/'))
" Let NeoBundle manage NeoBundle
NeoBundleFetch 'Shougo/neobundle.vim'
https://github.com/ggreer/the_silver_searcher for directions on installation.
For Ubuntu:
$ apt-get install software-properties-common # (if required)
$ apt-add-repository ppa:mizuno-as/silversearcher-ag
$ apt-get update
$ apt-get install silversearcher-ag
在keymappings.vim文件的最后面增加了以t为开头的支持标签页导航的快捷键。