Après une petite discussion sur IRC ce matin, je me suis dit que ca pourrait être sympa de regrouper les différents configuration de chacun pour VIM.
L'idée de base est de faire découvrir des plugins intéressants ou des configs pour VIM.
Hésitez pas à partager les plugins que vous utilisez !
Mon vimrc
Code :
set nocompatible " be iMproved
set hidden
filetype off " required!
execute pathogen#infect()
filetype plugin indent on
filetype plugin on
syntax on
set encoding=utf-8
set number
let mapleader=","
map <S-Right> :bnext<CR>
map <S-Left> :bprev<CR>
imap <S-Right> <Esc>:bnext<CR>
imap <S-Left> <Esc>:bprev<CR>
set whichwrap+=[
let mapleader = ","
set tabstop=4
set softtabstop=4
set expandtab
set showcmd
set cursorline
set wildmenu
set showmatch
set incsearch
set hlsearch
" Syntastic
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 1
let g:syntastic_c_compiler_options = ' -std=c11'
let g:syntastic_python_python_exec = '/usr/bin/python2.7'
" SingleCompile
autocmd Filetype c map <C-B> :SCCompileRunAF -std=c11 -Wall<CR>
autocmd Filetype c imap <C-B> :SCCompileRunAF -std=c11 <CR>
nmap <F9> :SCCompileRun<cr>
" Move line
inoremap <C-j> <Esc>:m .+1<CR>==gi
inoremap <C-k> <Esc>:m .-2<CR>==gi
vnoremap <C-j> :m '>+1<CR>gv=gv
vnoremap <C-k> :m '<-2<CR>gv=gv
" Move window
nnoremap <C-S-k> :wincmd k<CR>
nnoremap <C-S-j> :wincmd j<CR>
nnoremap <C-S-h> :wincmd h<CR>
nnoremap <C-S-l> :wincmd l<CR>
" When a line is cut, moving will jump over the second part
nnoremap j gj
nnoremap k gk
nnoremap gV `[v`]
" Airline buffer
" Enable the list of buffers
let g:airline#extensions#tabline#enabled = 1
" Show just the filename
let g:airline#extensions#tabline#fnamemod = ':t'
" Markdown
let g:instant_markdown_slow = 1
let g:instant_markdown_autostart = 0
set rtp+=$HOME/.local/lib/python2.7/site-packages/powerline/bindings/vim/
" Always show statusline
set laststatus=2
" Use 256 colours (Use this setting only if your terminal supports 256 colours)
set t_Co=256
set nofoldenable
set foldmethod=indent
set foldnestmax=10
set foldlevel=2
" CtrlP settings
let g:ctrlp_match_window = 'bottom,order:ttb'
let g:ctrlp_switch_buffer = 0
let g:ctrlp_working_path_mode = 0
let g:ctrlp_user_command = 'ag %s -l --nocolor --hidden -g ""'
augroup configgroup
autocmd!
autocmd VimEnter * highlight clear SignColumn
autocmd FileType java setlocal noexpandtab
autocmd FileType java setlocal list
autocmd FileType java setlocal listchars=tab:+\ ,eol:-
autocmd FileType java setlocal formatprg=par\ -w80\ -T4
autocmd FileType php setlocal expandtab
autocmd FileType php setlocal list
autocmd FileType php setlocal listchars=tab:+\ ,eol:-
autocmd FileType php setlocal formatprg=par\ -w80\ -T4
autocmd FileType ruby setlocal tabstop=2
autocmd FileType ruby setlocal shiftwidth=2
autocmd FileType ruby setlocal softtabstop=2
autocmd FileType ruby setlocal commentstring=#\ %s
autocmd FileType python setlocal commentstring=#\ %s
autocmd FileType js set tabstop=2|set shiftwidth=2|set expandtab
autocmd FileType ruby set tabstop=2|set shiftwidth=2|set expandtab
autocmd Filetype javascript,scala setlocal ts=2 sts=2 sw=2
autocmd FileType lua set tabstop=4|set shiftwidth=2|set expandtab
autocmd Filetype c set tabstop=4|set shiftwidth=4|set expandtab
autocmd Filetype c,cpp TlistOpen
autocmd BufEnter *.cls setlocal filetype=java
autocmd BufEnter *.zsh-theme setlocal filetype=zsh
autocmd BufEnter Makefile setlocal noexpandtab
autocmd BufEnter *.sh setlocal tabstop=2
autocmd BufEnter *.sh setlocal shiftwidth=2
autocmd BufEnter *.sh setlocal softtabstop=2
augroup END
" Change the location of the vim backup file (when crash)
set backup
set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
set backupskip=/tmp/*,/private/tmp/*
set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
set writebackup
" Markdown
let g:vim_markdown_math=1