Giter Club home page Giter Club logo

vim-config-1's Introduction

Credits in the comments.

Modularized VIM Configuration

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.

Keymappings / Shortcuts

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).
<leader> 4 Toggle paste
<leader> 6 Toggle relative line numbers.
<leader> 7 Toggle all line numbers.
<leader> f Indent all code in buffer gg=G
<leader> g Go to Implementation or Declaration (split)
<leader> d Delete window + go to previous buffer
<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 or ctrl-c  
(inside file tree, Close pane
tagbar or unite)  
ctrl-x Explore files from CWD
ctrl-c Delete buffer (close file) go to last file a.k.a :BB.
ctrl-n Cycle forward through buffers (next)
ctrl-p Cycle backwards through buffers (previous)
ctrl-i CtrlP prompt
(visual)``<leader>-z`` Find and replace based upon selection

Vim config best practice

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.

VIM plugin manager

Shougu/neobundle.vim is used for packagement. Advantages include support for asynchronous updating, etc.

Alternatives are gmarik/Vundle and tpope/Pathogen.

Install Neobundle automatically

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'

Speed up Unite Grep

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.