242 lines
5.1 KiB
VimL
242 lines
5.1 KiB
VimL
set nocompatible
|
|
|
|
" VUNDLE
|
|
" {
|
|
if filereadable(expand("$HOME/.vim/bundle/vundle/README.md"))
|
|
filetype off " required!
|
|
|
|
set rtp+=~/.vim/bundle/vundle/
|
|
call vundle#rc()
|
|
|
|
" let Vundle manage Vundle
|
|
" required!
|
|
Bundle 'gmarik/vundle'
|
|
|
|
Bundle 'xolox/vim-session'
|
|
Bundle 'vim-ruby/vim-ruby'
|
|
Bundle 'tpope/vim-rails'
|
|
Bundle 'tpope/vim-haml'
|
|
Bundle 'tpope/vim-markdown'
|
|
|
|
" snipMate dependencies
|
|
Bundle "MarcWeber/vim-addon-mw-utils"
|
|
Bundle "tomtom/tlib_vim"
|
|
Bundle "honza/vim-snippets"
|
|
|
|
"Bundle "garbas/vim-snipmate"
|
|
|
|
Bundle 'goldfeld/vim-seek'
|
|
Bundle 'Lokaltog/vim-easymotion'
|
|
Bundle 'ton/vim-bufsurf'
|
|
Bundle 'jeffkreeftmeijer/vim-numbertoggle'
|
|
Bundle 'Yggdroot/indentLine'
|
|
Bundle 'AndrewRadev/switch.vim'
|
|
|
|
Bundle 'airblade/vim-gitgutter'
|
|
Bundle 'tpope/vim-fugitive'
|
|
Bundle 'scrooloose/syntastic'
|
|
|
|
Bundle 'Gundo'
|
|
Bundle 'The-NERD-tree'
|
|
Bundle 'The-NERD-Commenter'
|
|
Bundle 'closetag.vim'
|
|
Bundle 'taglist.vim'
|
|
Bundle 'VisIncr'
|
|
endif
|
|
" }
|
|
|
|
filetype plugin indent on
|
|
syntax enable
|
|
|
|
set t_Co=256
|
|
|
|
set background=dark
|
|
colorscheme desert
|
|
|
|
set number
|
|
set relativenumber
|
|
set showmode
|
|
set expandtab
|
|
set shiftwidth=2
|
|
set smarttab
|
|
|
|
set autoindent
|
|
set nowrap
|
|
|
|
set hidden
|
|
set switchbuf=useopen,usetab
|
|
set ruler
|
|
set showcmd
|
|
set fileencoding=utf-8
|
|
set fileformats=unix,dos,mac
|
|
set cmdheight=2
|
|
set noerrorbells
|
|
set mouse=a
|
|
set nohls
|
|
set scrolloff=5
|
|
set sidescroll=20
|
|
set sidescrolloff=20
|
|
set noincsearch
|
|
set noshowmatch
|
|
set colorcolumn=80
|
|
|
|
set winwidth=100
|
|
|
|
set listchars=nbsp:·,tab:▸\ ,extends:>,precedes:<
|
|
set list
|
|
|
|
set formatoptions+=j
|
|
|
|
set splitright splitbelow
|
|
|
|
set wildmenu
|
|
set wildmode=longest:full,full
|
|
set wildignore=*~,*.o,*.obj,*.bak,*.exe,*.class,*.jpg,*.png,*.gif,*.mp3
|
|
|
|
set laststatus=2
|
|
set statusline=%f\ %m\ %Y\|%{&ff}\|%{&fileencoding}%=%vx%l\ [%03L]
|
|
|
|
set nocursorline
|
|
set nocursorcolumn
|
|
|
|
set pastetoggle=<F2>
|
|
|
|
set history=100
|
|
set undolevels=150
|
|
|
|
set ttimeoutlen=100
|
|
|
|
set undofile
|
|
|
|
if !filewritable(expand("~/.vim/tmp/undo"))
|
|
call mkdir(expand("~/.vim/tmp/undo"), "p")
|
|
endif
|
|
set undodir=~/.vim/tmp/undo
|
|
|
|
set backup
|
|
|
|
if !filewritable(expand("~/.vim/tmp/backup"))
|
|
call mkdir(expand("~/.vim/tmp/backup"), "p")
|
|
endif
|
|
set backupdir=~/.vim/tmp/backup
|
|
|
|
let mapleader = ","
|
|
|
|
" FOLDING
|
|
" {
|
|
set foldenable
|
|
set foldmethod=syntax
|
|
" Number of columns to the left of the window to display folds
|
|
set foldcolumn=0
|
|
" Fold level to close when opening a file
|
|
set foldlevelstart=100
|
|
|
|
" Don't open folds when searching or undoing into them
|
|
set foldopen-=search
|
|
set foldopen-=undo
|
|
" }
|
|
|
|
" MAPPING
|
|
" {
|
|
map <F1> <ESC>
|
|
imap <F1> <ESC>
|
|
|
|
map <F3> <ESC>:NERDTreeToggle<CR>
|
|
map <F4> <ESC>:Tlist<CR>
|
|
map <F5> <ESC>:GundoToggle<CR>
|
|
|
|
nnoremap <silent> gy :Switch<CR>
|
|
|
|
map <F11> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR>
|
|
" Rot13
|
|
map <F12> ggg?G
|
|
|
|
nnoremap <silent> ,bp :bprevious<CR>
|
|
nnoremap <silent> ,bf :bnext<CR>
|
|
nnoremap <silent> ,Bp :BufSurfBack<CR>
|
|
nnoremap <silent> ,Bf :BufSurfForward<CR>
|
|
|
|
" delete into the black hole register
|
|
nnoremap <leader>d "_d
|
|
" }
|
|
|
|
" PLUGINS
|
|
" {
|
|
" gitgutter
|
|
let g:gitgutter_on_bufenter = 0
|
|
let g:gitgutter_all_on_focusgained = 0
|
|
" numbertoggle
|
|
let g:NumberToggleTrigger = "<leader>r"
|
|
" Session
|
|
let g:session_autoload = 'no'
|
|
let g:session_autosave = 'no'
|
|
|
|
let g:session_directory=$HOME."/.vim/tmp/sessions"
|
|
if !filewritable(expand(g:session_directory))
|
|
call mkdir(expand(g:session_directory), "p")
|
|
endif
|
|
|
|
|
|
" closetag
|
|
autocmd FileType html,htmldjango,jinjahtml,eruby,mako let b:closetag_html_style=1
|
|
autocmd FileType html,xhtml,xml,htmldjango,jinjahtml,eruby,mako source ~/.vim/bundle/closetag.vim/plugin/closetag.vim
|
|
|
|
" TagList : http://vim-taglist.sourceforge.net/
|
|
" Need ctags
|
|
" :help taglist
|
|
let Tlist_Ctags_Cmd="ctags"
|
|
|
|
" Doxygen
|
|
let g:DoxygenToolkit_authorName="Guillaume DOTT"
|
|
" }
|
|
|
|
" FILETYPES
|
|
" {
|
|
" Open PDF files
|
|
" need xpdf and cups-pdf
|
|
autocmd BufReadPre *.pdf set ro nowrap
|
|
autocmd BufReadPost *.pdf silent %!pdftotext "%" -nopgbrk -layout -q -eol unix -
|
|
autocmd BufWritePost *.pdf silent !rm -rf ~/Documents/%
|
|
autocmd BufWritePost *.pdf silent !lp -s -d pdffg "%"
|
|
autocmd BufWritePost *.pdf silent !until [ -e ~/Documents/% ]; do sleep 1; done
|
|
autocmd BufWritePost *.pdf silent !mv ~/Documents/% %:p:h
|
|
|
|
" PHP
|
|
let php_sql_query = 1
|
|
let php_htmlInStrings = 1
|
|
|
|
au Filetype css vertical resize 50
|
|
|
|
" Don't screw up folds when inserting text that might affect them, until
|
|
" leaving insert mode. Foldmethod is local to the window.
|
|
autocmd InsertEnter * let w:last_fdm=&foldmethod | setlocal foldmethod=manual
|
|
autocmd InsertLeave * let &l:foldmethod=w:last_fdm
|
|
|
|
" chmod +x on the file if it starts with a shebang
|
|
function! ModeChange()
|
|
if getline(1) =~ "^#!"
|
|
if getline(1) =~ "/bin/"
|
|
silent !chmod a+x <afile>
|
|
endif
|
|
endif
|
|
endfunction
|
|
|
|
au BufWritePost * call ModeChange()
|
|
" }
|
|
|
|
" FUNCTIONS
|
|
" {
|
|
" }
|
|
|
|
" MISC
|
|
" {
|
|
" Required for vim-gitgutter signcolumn
|
|
highlight clear SignColumn
|
|
" Every spaces/tabs at the end of line will be highlighted.
|
|
au BufWinEnter * let w:m2=matchadd('ErrorMsg', '\s\+$', -1)
|
|
" autocmd BufWrite * silent! %s/[\r \t]\+$//
|
|
|
|
autocmd WinLeave * :call FocusLost()
|
|
autocmd WinEnter * :call FocusGained()
|
|
" }
|