set shell=/bin/bash if $TERM == "xterm" set t_Co=256 " 256 colors endif set nocompatible " be iMproved let mapleader="," " change the leader to be a comma vs slash filetype off " required! set rtp+=~/.vim/bundle/vundle/ call vundle#rc() " let Vundle manage Vundle " required! Bundle 'gmarik/vundle' Bundle 'scrooloose/nerdtree' Bundle 'klen/python-mode' Bundle 'davidhalter/jedi-vim' Bundle 'tpope/vim-fugitive' Bundle 'Lokaltog/powerline', {'rtp': 'powerline/bindings/vim/'} Bundle 'wincent/Command-T' Bundle 'jnwhiteh/vim-golang' Bundle 'hynek/vim-python-pep8-indent' Bundle 'ervandew/supertab' Bundle 'kevinw/pyflakes-vim' Bundle 'yann2192/vim-colorschemes' Bundle 'yann2192/vim-vitamins' " Snipmate Bundle 'tomtom/tlib_vim' Bundle 'MarcWeber/vim-addon-mw-utils' Bundle 'garbas/vim-snipmate' filetype plugin indent on " required! " Python-mode " Activate rope " Keys: " K Show python docs " Rope autocomplete " g Rope goto definition " d Rope show documentation " f Rope find occurrences " b Set, unset breakpoint (g:pymode_breakpoint enabled) " [[ Jump on previous class or function (normal, visual, operator modes) " ]] Jump on next class or function (normal, visual, operator modes) " [M Jump on previous class or method (normal, visual, operator modes) " ]M Jump on next class or method (normal, visual, operator modes) let g:pymode_rope = 0 " Documentation let g:pymode_doc = 1 let g:pymode_doc_key = 'K' "Linting let g:pymode_lint = 1 let g:pymode_lint_checker = "pyflakes,pep8" " Auto check on save let g:pymode_lint_write = 0 " Support virtualenv let g:pymode_virtualenv = 1 " Enable breakpoints plugin let g:pymode_breakpoint = 1 let g:pymode_breakpoint_key = 'b' " syntax highlighting let g:pymode_syntax = 1 let g:pymode_syntax_all = 1 let g:pymode_syntax_indent_errors = g:pymode_syntax_all let g:pymode_syntax_space_errors = g:pymode_syntax_all " Don't autofold code let g:pymode_folding = 0 let g:pymode_indent = 0 " ========================================================== " Basic Settings " ========================================================== syntax on " syntax highlighing filetype on " try to detect filetypes filetype plugin indent on " enable loading indent file for filetype set number " Display line numbers set numberwidth=1 " using only 1 column (and 1 space) while possible set background=dark " We are using dark background in vim set title " show title in console title bar set wildmenu " Menu completion in command mode on set wildmode=full " cycles between all matching choices. " don't bell or blink set noerrorbells set vb t_vb= " Ignore these files when completing set wildignore+=*.o,*.obj,.git,*.pyc set wildignore+=eggs/** set wildignore+=*.egg-info/** set grepprg=ack " replace the default grep program with ack " Set working directory nnoremap . :lcd %:p:h " Disable the colorcolumn when switching modes. Make sure this is the " first autocmd for the filetype here "autocmd FileType * setlocal colorcolumn=0 """ Insert completion " don't select first item, follow typing in autocomplete set completeopt=menuone,longest,preview set pumheight=6 " Keep a small completion window """ Moving Around/Editing "set cursorline " have a line indicate the cursor location set ruler " show the cursor position all the time set nostartofline " Avoid moving cursor to BOL when jumping around set virtualedit=block " Let cursor move past the last char in mode set scrolloff=3 " Keep 3 context lines above and below the cursor set backspace=2 " Allow backspacing over autoindent, EOL, and BOL set showmatch " Briefly jump to a paren once it's balanced set nowrap " don't wrap text set linebreak " don't wrap textin the middle of a word set autoindent " always set autoindenting on set smartindent " use smart indent if there is no indent file set tabstop=4 " inserts 4 spaces set shiftwidth=4 " but an indent level is 2 spaces wide. set softtabstop=4 " over an autoindent deletes both spaces. set expandtab " Use spaces, not tabs, for autoindent/tab key. set shiftround " rounds indent to a multiple of shiftwidth set matchpairs+=<:> " show matching <> (html mainly) as well set foldmethod=indent " allow us to fold on indents set foldlevel=99 " don't fold by default " don't outdent hashes inoremap # # " close preview window automatically when we move around autocmd CursorMovedI * if pumvisible() == 0|pclose|endif autocmd InsertLeave * if pumvisible() == 0|pclose|endif """" Reading/Writing set noautowrite " Never write a file unless I request it. set noautowriteall " NEVER. set noautoread " Don't automatically re-read changed files. set modeline " Allow vim options to be embedded in files; set modelines=5 " they must be within the first or last 5 lines. set ffs=unix,dos,mac " Try recognizing dos, unix, and mac line endings. """" Messages, Info, Status set ls=2 " allways show status line set vb t_vb= " Disable all bells. I hate ringing/flashing. set confirm " Y-N-C prompt if closing with unsaved changes. set showcmd " Show incomplete normal mode commands as I type. set report=0 " : commands always print changed line count. set shortmess+=a " Use [+]/[RO]/[w] for modified/readonly/written. set ruler " Show some info, even without statuslines. set laststatus=2 " Always show statusline, even if only 1 window. set statusline=[%l,%v\ %P%M]\ %f\ %r%h%w\ (%{&ff})\ %{fugitive#statusline()} " displays tabs with :set list & displays when a line runs off-screen "set listchars=tab:>-,eol:$,trail:-,precedes:<,extends:> set listchars=tab:>-,trail:-,precedes:<,extends:> set list " caractere $ en fin de ligne """ Searching and Patterns set ignorecase " Default to using case insensitive searches, set smartcase " unless uppercase letters are used in the regex. set smarttab " Handle tabs more intelligently set hlsearch " Highlight searches by default. set incsearch " Incrementally search while typing a /regex set colorcolumn=79 :autocmd InsertEnter * set cul :autocmd InsertLeave * set nocul """" Display if has("gui_running") "colorscheme vitamins colorscheme mustang " Remove menu bar set guioptions-=m " Remove toolbar set guioptions-=T else if &t_Co >= 256 "colorscheme vitamins colorscheme mustang else colorscheme wargrey endif endif " Paste from clipboard map p "+p " Quit window on q nnoremap q :q! " " hide matches on space nnoremap :nohlsearch " Remove trailing whitespace on S nnoremap S :%s/\s\+$//:let @/='' " " Resize split nnoremap :vertical resize +5 nnoremap :vertical resize -5 nnoremap :resize +5 nnoremap :resize -5 " Select the item in the list with enter inoremap pumvisible() ? "\" : "\u\" " ========================================================== " Javascript " ========================================================== au BufRead *.js set makeprg=jslint\ % " Don't allow snipmate to take over tab "autocmd VimEnter * ino =snipMate#TriggerSnippet() " Use tab to scroll through autocomplete menus autocmd VimEnter * imap pumvisible() ? "" : "" autocmd VimEnter * imap pumvisible() ? "" : "" "snor i=snipMate#TriggerSnippet() let g:acp_completeoptPreview=1 autocmd VimEnter * ino =snipMate#TriggerSnippet() snor i=snipMate#TriggerSnippet() " =========================================================== " FileType specific changes " ============================================================ " Mako/HTML autocmd BufNewFile,BufRead *.mako,*.mak,*.jinja2 setlocal ft=html autocmd FileType html,xhtml,xml,css setlocal expandtab shiftwidth=2 tabstop=2 softtabstop=2 " Python "au BufRead *.py compiler nose au FileType python map ( [[ au FileType python map ) ]] au FileType python set omnifunc=pythoncomplete#Complete au FileType python setlocal expandtab shiftwidth=4 tabstop=8 softtabstop=4 smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class,with au BufRead *.py set efm=%C\ %.%#,%A\ \ File\ \"%f\"\\,\ line\ %l%.%#,%Z%[%^\ ]%\\@=%m " Don't let pyflakes use the quickfix window let g:pyflakes_use_quickfix = 0 " Add the virtualenv's site-packages to vim path py << EOF import os.path import sys import vim if 'VIRTUALENV' in os.environ: project_base_dir = os.environ['VIRTUAL_ENV'] sys.path.insert(0, project_base_dir) activate_this = os.path.join(project_base_dir, 'bin/activate_this.py') execfile(activate_this, dict(__file__=activate_this)) EOF " Load up virtualenv's vimrc if it exists if filereadable($VIRTUAL_ENV . '/.vimrc') source $VIRTUAL_ENV/.vimrc endif let python_highlight_all = 1 au FileType python syn keyword pythonDecorator True None False self " Go config au FileType go setlocal tabstop=8 shiftwidth=8 softtabstop=8 noexpandtab