Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
624 lines (496 sloc) 19.8 KB
set nocompatible " be iMproved
filetype off " required!
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" let Vundle manage Vundle
" required!
Bundle 'gmarik/vundle'
" My Bundles here:
" original repos on github
Bundle 'tpope/vim-fugitive'
Bundle 'rstacruz/sparkup', {'rtp': 'vim/'}
" vim-scripts dependency
Bundle 'Conque-Shell'
Bundle 'L9'
" Utilities
Bundle 'mhz/vim-matchit.git'
Bundle 'vim-scripts/tComment'
Bundle 'Raimondi/delimitMate'
Bundle 'tpope/vim-surround'
"Files manager
Bundle 'majutsushi/tagbar'
Bundle 'scrooloose/nerdtree'
Bundle 'FuzzyFinder'
Bundle 'vim-scripts/mru.vim'
"Color scheme
Bundle 'cschlueter/vim-mustang'
Bundle 'godlygeek/csapprox.git'
Bundle 'msanders/snipmate.vim'
Bundle 'vim-scripts/snipmate-snippets'
Bundle "Shougo/neocomplcache"
" Python development
Bundle 'vim-scripts/Pydiction'
Bundle 'kevinw/pyflakes-vim'
Bundle 'vim-scripts/django.vim'
"Javascript "
Bundle 'kchmck/vim-coffee-script'
Bundle 'digitaltoad/vim-jade'
Bundle 'wavded/vim-stylus'
Bundle 'lukaszb/vim-web-indent'
Bundle 'mattn/zencoding-vim'
Bundle 'godlygeek/tabular'
Bundle 'jamescarr/snipmate-nodejs'
Bundle 'lunaru/vim-less'
"Bundle 'joestelmach/javaScriptLint.vim'
Bundle 'pangloss/vim-javascript'
" Syntax checking
Bundle 'scrooloose/syntastic'
Bundle 'tpope/vim-markdown.git'
Bundle "briangershon/html5.vim"
Bundle "sukima/xmledit"
Bundle "indentpython.vim"
filetype plugin indent on " required!
" Brief help
" :BundleInstall - install bundles (won't update installed)
" :BundleInstall! - update if installed
" :Bundles foo - search for foo
" :Bundles! foo - refresh cached list and search for foo
" :BundleClean - confirm removal of unused bundles
" :BundleClean! - remove without confirmation
" see :h vundle for more details
" or wiki for FAQ
" Note: comments after Bundle command are not allowed..
" HOWTO Installation
" 1. Delete bundle/snipmate.vim/snippets because we will use another updated snippets
" reference :
" 2. Change Tab as your behaviour between Snipmate and Pydiction :
" 3. Fugitive for Github easy connection :
" 4. NERDTree for file explorer from
" Also, i install Python Debugger like pyflakes, pylint and pep8
" Here are related articles :
" For installing Python debugger :
" sudo pip install pylint
" sudo pip install pyflakes
" sudo pip install pep8
" There are some well documentation here according into several plugin used :
" sudo apt-get install vim-scripts
" This configuration taken mixed from many resource and some customed by me :
" ( Founder Plurk )
" This is from : "
" => General
" Sets how many lines of history VIM has to remember
set history=1000
" Ignore some file
set wildignore=*.swp,*.bak,*.pyc,*.class
" Set to auto read when a file is changed from the outside
set autowrite
" With a map leader it's possible to do extra key combinations
" like <leader>w saves the current file
let mapleader=","
let g:mapleader=","
" Fast saving
nmap <leader>w :w!<cr>
" Fast editing of the .vimrc
map <leader>e :e! ~/.vimrc<cr>
" When vimrc is edited, reload it
autocmd! bufwritepost vimrc source ~/.vimrc
" => Text, tab and indent related
set expandtab
set shiftwidth=4
set tabstop=4
set smarttab
set lbr
set tw=500
set ai "Auto indent
set si "Smart indet
set wrap "Wrap lines
" => VIM user interface
set so=7 " Set 7 lines to the curors - when moving vertical..
set ruler "Always show current position
set hid "Change buffer - without saving
set nohidden
" Set backspace config
set backspace=eol,start,indent
set whichwrap+=<,>,h,l
set nolazyredraw "Don't redraw while executing macros
set magic "Set magic on, for regular expressions
set showmatch "Show matching bracets when text indicator is over them
" No sound on errors
set noerrorbells
set novisualbell
set tm=500
" => Colors and Fonts
syntax enable "Enable syntax hl
set shell=/bin/bash
set guioptions-=T
set background=dark
let g:CSApprox_attr_map = { 'bold' : 'bold', 'italic' : '', 'sp' : '' }
colorscheme mustang
set nonu
set gfn=Monospace\ 8.7
set encoding=utf8
lang en_US
" => Files, backups and undo
" Turn backup off, since most stuff is in SVN, git anyway...
set nobackup
set nowb
set noswapfile
set undodir=~/.vim/undodir
set undofile
set undolevels=1000 "maximum number of changes that can be undone
set undoreload=10000 "maximum number lines to save for undo on a buffer reload
" => Moving around, tabs and buffers
"Useful when moving accross long lines
map j gj
map k gk
map <silent> <leader><cr> :nohlsearch<cr>
" Close the current buffer
map <leader>bd :Bclose<cr>
" Close all the buffers
map <leader>ba :1,300 bd!<cr>
" Moving tab using CTRL+ the arrows
map <C-right> :bn<CR>
map <C-left> :bp<CR>
" Tab configuration
map <leader>tn :tabnew! %<cr>
map <leader>te :tabedit
map <leader>tc :tabclose<cr>
map <leader>tm :tabmove
" When pressing <leader>cd switch to the directory of the open buffer
map <leader>cd :cd %:p:h<cr>
set cmdheight=1 " Explicitly set the height of the command line
set number " Display line numbers
set numberwidth=1 " using only 1 column (and 1 space) while possible
set title " show title in console title bar
set wildmenu " Menu completion in command mode on <Tab>
set pastetoggle=<F3> " Press F3 for toggle paste mode
" Paste using ,v in normal mode
nnoremap <leader>v "+gP
" Set default environment based on current edited files
autocmd BufEnter * silent! lcd %:p:h
" The best thing here!
" In insert mode, you can paste from clipboard using CTRL+v
inoremap <C-v> <ESC>:set paste<CR>"+gp<ESC>:set nopaste<ENTER>i<RIGHT>
" have command-line completion <tab> (for filenames, help topics, option names)
" first list the available options and complete the longest common part, then
" have further <tab>s cycle through the possibilities:
set wildmode=list:longest,full
set nowrap " no line wrapping;
set guioptions+=b " add a horizontal scrollbar to the bottom
"--- search options ------------
set incsearch " show 'best match so far' as you type
set hlsearch " hilight the items found by the search
set ignorecase " ignores case of letters on searches
set smartcase " Override the 'ignorecase' option if the search pattern contains upper case characters
" Search and error color highlights
hi Search guifg=#ffffff guibg=#0000ff gui=none ctermfg=white ctermbg=darkblue
hi IncSearch guifg=#ffffff guibg=#8888ff gui=none ctermfg=white
highlight SpellBad guifg=#ffffff guibg=#8888ff gui=none ctermfg=black ctermbg=darkred
" Use UTF-8 as the default buffer encoding
set enc=utf-8
" Always show status line, even for one window
set laststatus=2
" Scroll when cursor gets within 3 characters of top/bottom edge
set scrolloff=3
" Round indent to multiple of 'shiftwidth' for > and < commands
set shiftround
" Show (partial) commands (or size of selection in Visual mode) in the status line
set showcmd
" Don't request terminal version string (for xterm)
set t_RV=
"--- Keystrokes ----------------
" h and l wrap between lines, cursor keys wrap in insertion mode
set whichwrap=h,l,~,[,]
" page down with <SPACE>, pageup with - or <BkSpc>
noremap <Space> <PageDown>
noremap <BS> <PageUp>
" allow <BkSpc> to delete line breaks, start of insertion, and indents
set backspace=eol,start,indent
"---- PHP executing shortcut --"
" Execute PHP file being edited with <Shift> + p:
nnoremap P w:<CR>:!/usr/bin/php5 % <CR>
" This is from :
" Toggle line numbers and fold column for easy copying by Pressing F3
nnoremap <F3> :set nonumber!<CR>:set foldcolumn=0<CR>
" Execute Python file being edited with <Shift> + e:
nnoremap E w:<CR>:!python % <CR>
" Execute NodeJS file being edited with <Shift> + n:
nnoremap N w:<CR>:!node %<CR>
" Execute javascriptLint on no-JS files like PHP, python, Html with <Shift> + j :
command! JavaScriptLintChecker call JavascriptLint()
nnoremap J w:<CR>:JavaScriptLintChecker<CR><ENTER><CR>
" Change jsl.conf in ~/.vim/jsl.conf for customization
let jslint_command_options = '-conf ~/.vim/jsl.conf -nofilelisting -nocontext -nosummary -nologo -process'
" Shortcut to Close quickfix window with leader+c
nnoremap <leader>c <CR>:cclose<CR>
" Set autocomplete form
set completeopt=menuone,longest,preview
" Enabling Django :
autocmd FileType python set ft=python.django " For SnipMate
autocmd FileType html set ft=htmldjango.html " For SnipMate
" Django Tips from
au BufNewFile,BufRead setlocal nowrap
au BufNewFile,BufRead normal! zR
au BufNewFile,BufRead normal! zR
au BufNewFile,BufRead setlocal filetype=python.django
au BufNewFile,BufRead setlocal filetype=python.django
au BufNewFile,BufRead setlocal filetype=python.django
au BufNewFile,BufRead setlocal filetype=python.django
au BufNewFile,BufRead setlocal filetype=python.django
au BufNewFile,BufRead setlocal foldmethod=marker
au BufNewFile,BufRead setlocal filetype=python.django
au BufNewFile,BufRead setlocal filetype=python.django
au BufNewFile,BufRead setlocal foldmethod=marker
" Django Surround
" 'sb' for block
" 'si' for an if statement
" 'sw' for a with statement
" 'sc' for a comment
" 'sf' for a for statement
"autocmd VimEnter * xunmap s
let g:surround_{char2nr("b")} = "{% block\1 \r..*\r &\1%}\r{% endblock %}"
let g:surround_{char2nr("i")} = "{% if\1 \r..*\r &\1%}\r{% endif %}"
let g:surround_{char2nr("w")} = "{% with\1 \r..*\r &\1%}\r{% endwith %}"
let g:surround_{char2nr("c")} = "{% comment\1 \r..*\r &\1%}\r{% endcomment %}"
let g:surround_{char2nr("f")} = "{% for\1 \r..*\r &\1%}\r{% endfor %}"
" HTML (tab width 2 chr, no wrapping)
autocmd FileType html set sw=2
autocmd FileType html set ts=2
autocmd FileType html set sts=2
autocmd FileType html set textwidth=0
" XHTML (tab width 2 chr, no wrapping)
autocmd FileType xhtml set sw=2
autocmd FileType xhtml set ts=2
autocmd FileType xhtml set sts=2
autocmd FileType xhtml set textwidth=0
" CSS (tab width 2 chr, wrap at 79th char)
autocmd FileType css set sw=2
autocmd FileType css set ts=2
autocmd FileType css set sts=2
" If you prefer the Omni-Completion tip window to close when a selection is
" made, these lines close it on movement in insert mode or when leaving
" insert mode
autocmd CursorMovedI * if pumvisible() == 0|pclose|endif
autocmd InsertLeave * if pumvisible() == 0|pclose|endif
" You might also find this useful
" PHP Generated Code Highlights (HTML & SQL)
let php_sql_query=1
let php_htmlInStrings=1
" Folding
" auto save folding :
au BufWinLeave * silent! mkview
au BufWinEnter * silent! loadview
autocmd BufWinLeave .* mkview
autocmd BufWinEnter .* silent loadview
autocmd Syntax c,cpp,vim,xml,html,xhtml,js,php,py,python setlocal foldmethod=manual
autocmd Syntax c,cpp,vim,xml,html,xhtml,perl normal zR
" NerdTree and Tagbar using by <F8>
function! ToggleNERDTreeAndTagbar()
let w:jumpbacktohere = 1
" Detect which plugins are open
if exists('t:NERDTreeBufName')
let nerdtree_open = bufwinnr(t:NERDTreeBufName) != -1
let nerdtree_open = 0
let tagbar_open = bufwinnr('__Tagbar__') != -1
" Perform the appropriate action
if nerdtree_open && tagbar_open
elseif nerdtree_open
elseif tagbar_open
" Jump back to the original window
for window in range(1, winnr('$'))
execute window . 'wincmd w'
if exists('w:jumpbacktohere')
unlet w:jumpbacktohere
" now you can open NERDTree and Tagbar using F8
nmap <F8> :call ToggleNERDTreeAndTagbar()<CR>
" TagBar Configuration
let g:tagbar_usearrows=1
let g:tagbar_width=30
nnoremap <leader>l :TagbarToggle<CR>
" FuzzFinder Shorcuts. Using F2 for opening FuzzyFinderTextMate
map <leader>f :FufFileWithCurrentBufferDir<CR>
map <F2> :FufFileWithFullCwd<CR>
map <leader>b :FufBuffer<CR>
" MRU shorcuts
map <leader><space> :MRU<CR>
" NERDTree :
" how to using NERDTree :
" Enable this for make NERDTree load every opening files
" autocmd VimEnter * NERDTree " Make Always Load NERDTree every opening files
" autocmd VimEnter * wincmd p " Automatically go to buffer every time open files
" FIXING NERDTree, automatically close if there no file edited
autocmd WinEnter * call s:CloseIfOnlyNerdTreeLeft()
map <leader>t :NERDTreeToggle<CR>
" Close all open buffers on entering a window if the only
" buffer that's left is the NERDTree buffer
function! s:CloseIfOnlyNerdTreeLeft()
if exists("t:NERDTreeBufName")
if bufwinnr(t:NERDTreeBufName) != -1
if winnr("$") == 1
if exists(":Tabularize")
nmap <Leader>a= :Tabularize /=<CR>
vmap <Leader>a= :Tabularize /=<CR>
nmap <Leader>a: :Tabularize /:\zs<CR>
vmap <Leader>a: :Tabularize /:\zs<CR>
let g:pydiction_location='~/.vim/bundle/Pydiction/complete-dict'
"""" PYTHON STYLE """"
let python_highlight_all=1 " Enable all plugin's highlighting.
let python_slow_sync=1 " For fast machines.
let python_print_as_function=1 " Color 'print' function.
"" PYTHON auto completion from
"--- python formatting help ---
autocmd BufRead *.py set smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class
let g:pyflakes_use_quickfix = 1 " Enable Pyflakes
" Pep8 from :
let g:pep8_map='<leader>8'
highlight Pmenu gui=bold
" Configure neocomplcache
let g:neocomplcache_enable_at_startup = 1
let g:neocomplcache_enable_camel_case_completion = 1
let g:neocomplcache_enable_auto_select = 1
let g:neocomplcache_min_syntax_length = 4
" Enable omni completion.
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
autocmd FileType html,markdown,ctp setlocal omnifunc=htmlcomplete#CompleteTags
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
autocmd FileType php,ctp setlocal omnifunc=phpcomplete#CompletePHP
autocmd FileType vim set omnifunc=syntaxcomplete#Complete
" cakephp
autocmd BufEnter,BufRead {controllers,models,views,plugins,lib}/* set ft=php.cakephp
autocmd BufEnter,BufRead {Controller,Model,View,Plugin,Lib}/* set ft=php.cakephp
autocmd FileType php,php.cakephp set commentstring=//\%s
autocmd FileType html set commentstring=<!--%s-->
" autocmd BufWritePost,FileWritePost *.html call JavascriptLint()
" autocmd BufWritePost,FileWritePost *.jade call JavascriptLint()
" autocmd BufWritePost,FileWritePost *.ctp call JavascriptLint()
" markdown
au BufEnter,Bufread *.mkd,*.md,*.mdown,*.markdown setlocal tw=0
" Enable heavy omni completion.
if !exists('g:neocomplcache_omni_patterns')
let g:neocomplcache_omni_patterns = {}
let g:neocomplcache_omni_patterns.ruby = '[^. *\t]\.\w*\|\h\w*::'
let g:neocomplcache_omni_patterns.php = '[^. \t]->\h\w*\|\h\w*::'
if has("gui_running")
highlight SpellBad term=underline gui=undercurl guisp=Orange
" for Syntastic
let g:syntastic_auto_loc_list=1 "Auto open errors window upon detection
let g:syntastic_enable_signs=1
let g:syntastic_auto_jump=1
let g:syntastic_stl_format = '[%E{Err: %fe #%e}%B{, }%W{Warn: %fw #%w}]'
let g:syntastic_enable_balloons=1
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
"remove trailing whitespace
autocmd BufWritePre *.c :%s/\s\+$//e
autocmd BufWritePre *.cpp :%s/\s\+$//e
autocmd BufWritePre *.c++ :%s/\s\+$//e
autocmd BufWritePre *.h :%s/\s\+$//e
autocmd BufWritePre *.java :%s/\s\+$//e
autocmd BufWritePre *.php :%s/\s\+$//e
autocmd BufWritePre *.pl :%s/\s\+$//e
autocmd BufWritePre *.py :%s/\s\+$//e
" tabs, not spaces for php, ctp
au BufEnter,BufRead *.php,*.ctp setlocal noexpandtab
" Autoclose quickfix windows when quit
aug QFClose
au WinEnter * if winnr('$') == 1 && getbufvar(winbufnr(winnr()), "&buftype") == "quickfix"|q|endif
aug END
" "
" Change share keys between pydiction and snipmate
if has("gui_running")
" Vimdiff colorscheme
highlight DiffAdd cterm=none ctermfg=bg ctermbg=Green gui=none guifg=bg guibg=Green
highlight DiffDelete cterm=none ctermfg=bg ctermbg=Red gui=none guifg=bg guibg=Red
highlight DiffChange cterm=none ctermfg=bg ctermbg=Yellow gui=none guifg=bg guibg=Yellow
highlight DiffText cterm=none ctermfg=bg ctermbg=Magenta gui=none guifg=bg guibg=Magenta