2012-10-13 01:02:44 +02:00
|
|
|
set nocompatible
|
|
|
|
|
|
|
|
" VUNDLE
|
|
|
|
" {
|
2012-11-30 15:37:40 +01:00
|
|
|
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'
|
2013-01-29 11:20:30 +01:00
|
|
|
Bundle 'vim-ruby/vim-ruby'
|
2013-01-31 13:22:29 +01:00
|
|
|
Bundle 'tpope/vim-rails'
|
|
|
|
Bundle 'tpope/vim-haml'
|
2012-11-30 15:37:40 +01:00
|
|
|
Bundle 'tpope/vim-markdown'
|
|
|
|
|
|
|
|
Bundle "garbas/vim-snipmate"
|
|
|
|
" snipMate dependencies
|
|
|
|
Bundle "MarcWeber/vim-addon-mw-utils"
|
|
|
|
Bundle "tomtom/tlib_vim"
|
|
|
|
Bundle "honza/snipmate-snippets"
|
|
|
|
|
2013-01-29 11:20:30 +01:00
|
|
|
Bundle 'goldfeld/vim-seek'
|
|
|
|
Bundle 'Lokaltog/vim-easymotion'
|
2013-02-06 17:38:45 +01:00
|
|
|
Bundle 'ton/vim-bufsurf'
|
2013-01-29 11:20:30 +01:00
|
|
|
|
2012-11-30 15:37:40 +01:00
|
|
|
Bundle 'Gundo'
|
|
|
|
Bundle 'The-NERD-tree'
|
|
|
|
Bundle 'The-NERD-Commenter'
|
|
|
|
Bundle 'closetag.vim'
|
2013-01-31 13:22:29 +01:00
|
|
|
Bundle 'taglist.vim'
|
2012-11-30 15:37:40 +01:00
|
|
|
Bundle 'VisIncr'
|
|
|
|
endif
|
2012-10-13 01:02:44 +02:00
|
|
|
" }
|
|
|
|
|
|
|
|
filetype plugin indent on
|
|
|
|
syntax enable
|
|
|
|
|
2013-02-06 17:40:03 +01:00
|
|
|
set t_Co=256
|
|
|
|
|
2012-10-13 01:02:44 +02:00
|
|
|
set background=dark
|
|
|
|
colorscheme desert
|
|
|
|
|
2012-12-14 15:22:26 +01:00
|
|
|
set relativenumber
|
2012-10-13 01:02:44 +02:00
|
|
|
set showmode
|
|
|
|
set expandtab
|
2013-01-29 11:20:30 +01:00
|
|
|
set shiftwidth=2
|
2012-10-13 01:02:44 +02:00
|
|
|
set smarttab
|
|
|
|
|
|
|
|
set autoindent
|
|
|
|
set nowrap
|
|
|
|
|
2013-02-06 17:38:45 +01:00
|
|
|
set hidden
|
2012-10-13 01:02:44 +02:00
|
|
|
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=4
|
|
|
|
set sidescrolloff=4
|
|
|
|
set noincsearch
|
|
|
|
set noshowmatch
|
|
|
|
|
|
|
|
set listchars=nbsp:·,tab:>-,extends:>,precedes:<
|
|
|
|
set list
|
|
|
|
|
|
|
|
set splitright
|
|
|
|
|
|
|
|
set wildmenu
|
|
|
|
set wildmode=longest:full,full
|
|
|
|
set wildignore=*~,*.o,*.obj,*.bak,*.exe,*.class,*.jpg,*.png,*.gif,*.mp3
|
|
|
|
|
2012-10-19 15:27:10 +02:00
|
|
|
set laststatus=2
|
2012-10-13 01:02:44 +02:00
|
|
|
set statusline=%f\ %m\ [%{&ff}]\ [%Y]\ [%{&fileencoding}]%=[%04l,\ %04v]\ [len=%04L]
|
|
|
|
|
|
|
|
set nocursorline
|
|
|
|
set nocursorcolumn
|
|
|
|
|
|
|
|
set pastetoggle=<F2>
|
|
|
|
|
|
|
|
set history=100
|
|
|
|
set undolevels=150
|
|
|
|
|
2012-11-06 17:06:57 +01:00
|
|
|
set undofile
|
|
|
|
|
2012-11-30 15:38:49 +01:00
|
|
|
if !filewritable(expand("~/.vim/tmp/undo"))
|
|
|
|
call mkdir(expand("~/.vim/tmp/undo"), "p")
|
2012-11-06 17:06:57 +01:00
|
|
|
endif
|
2012-11-30 15:38:49 +01:00
|
|
|
set undodir=~/.vim/tmp/undo
|
2012-11-06 17:06:57 +01:00
|
|
|
|
2012-10-13 01:02:44 +02:00
|
|
|
set backup
|
|
|
|
|
2012-11-30 15:38:49 +01:00
|
|
|
if !filewritable(expand("~/.vim/tmp/backup"))
|
|
|
|
call mkdir(expand("~/.vim/tmp/backup"), "p")
|
2012-10-13 01:02:44 +02:00
|
|
|
endif
|
2012-11-30 15:38:49 +01:00
|
|
|
set backupdir=~/.vim/tmp/backup
|
2012-10-13 01:02:44 +02:00
|
|
|
|
|
|
|
let mapleader = ","
|
|
|
|
|
|
|
|
" FOLDING
|
|
|
|
" {
|
2012-10-19 15:27:10 +02:00
|
|
|
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
|
2012-10-13 01:02:44 +02:00
|
|
|
" }
|
|
|
|
|
|
|
|
" MAPPING
|
|
|
|
" {
|
2012-10-19 15:29:41 +02:00
|
|
|
map <F1> <ESC>
|
|
|
|
imap <F1> <ESC>
|
2012-10-13 01:02:44 +02:00
|
|
|
|
|
|
|
noremap gy :call ToggleYesNo()<CR>
|
|
|
|
|
|
|
|
map <F3> <ESC>:NERDTreeToggle<CR>
|
|
|
|
map <F4> <ESC>:Tlist<CR>
|
|
|
|
map <F5> <ESC>:GundoToggle<CR>
|
|
|
|
|
|
|
|
map <F11> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR>
|
2012-10-19 15:27:10 +02:00
|
|
|
" Rot13
|
2012-10-13 01:02:44 +02:00
|
|
|
map <F12> ggVGg?
|
2012-12-14 15:22:26 +01:00
|
|
|
|
|
|
|
nnoremap <silent> <leader>r :call NumberToggle()<CR>
|
2013-02-06 17:38:45 +01:00
|
|
|
|
|
|
|
nnoremap <silent> ,bp :bprevious<CR>
|
|
|
|
nnoremap <silent> ,bf :bnext<CR>
|
|
|
|
nnoremap <silent> ,Bp :BufSurfBack<CR>
|
|
|
|
nnoremap <silent> ,Bf :BufSurfForward<CR>
|
2012-10-13 01:02:44 +02:00
|
|
|
" }
|
|
|
|
|
|
|
|
" PLUGINS
|
|
|
|
" {
|
|
|
|
" Session
|
|
|
|
let g:session_autoload = 'no'
|
|
|
|
let g:session_autosave = 'no'
|
|
|
|
|
2012-11-30 15:38:49 +01:00
|
|
|
let g:session_directory=$HOME."/.vim/tmp/sessions"
|
|
|
|
if !filewritable(expand(g:session_directory))
|
|
|
|
call mkdir(expand(g:session_directory), "p")
|
2012-11-27 17:26:06 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
|
2012-10-13 01:02:44 +02:00
|
|
|
" closetag
|
|
|
|
autocmd FileType html,htmldjango,jinjahtml,eruby,mako let b:closetag_html_style=1
|
2012-10-15 16:05:23 +02:00
|
|
|
autocmd FileType html,xhtml,xml,htmldjango,jinjahtml,eruby,mako source ~/.vim/bundle/closetag.vim/plugin/closetag.vim
|
2012-10-13 01:02:44 +02:00
|
|
|
|
|
|
|
" TagList : http://vim-taglist.sourceforge.net/
|
|
|
|
" Need ctags
|
|
|
|
" :help taglist
|
2012-10-19 15:27:10 +02:00
|
|
|
let Tlist_Ctags_Cmd="ctags"
|
2012-10-13 01:02:44 +02:00
|
|
|
|
|
|
|
" Doxygen
|
|
|
|
let g:DoxygenToolkit_authorName="Guillaume DOTT"
|
|
|
|
" }
|
|
|
|
|
|
|
|
" FILETYPES
|
|
|
|
" {
|
|
|
|
" Open PDF files
|
2012-10-19 15:27:10 +02:00
|
|
|
" need xpdf and cups-pdf
|
2012-10-13 01:02:44 +02:00
|
|
|
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
|
|
|
|
|
|
|
|
" 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
|
|
|
|
" {
|
|
|
|
function! ToggleYesNo()
|
2012-11-30 15:38:21 +01:00
|
|
|
let w=expand("<cword>")
|
|
|
|
if w=="yes" | let w="no"
|
|
|
|
elseif w=="no" | let w="yes"
|
|
|
|
elseif w=="on" | let w="off"
|
|
|
|
elseif w=="off" | let w="on"
|
|
|
|
elseif w=="True" | let w="False"
|
|
|
|
elseif w=="False" | let w="True"
|
|
|
|
elseif w=="true" | let w="false"
|
|
|
|
elseif w=="false" | let w="true"
|
|
|
|
elseif w=="manual" | let w="auto"
|
|
|
|
elseif w=="auto" | let w="manual"
|
|
|
|
elseif w=="public" | let w="private"
|
|
|
|
elseif w=="private" | let w="protected"
|
|
|
|
elseif w=="protected" | let w="public"
|
|
|
|
else | let w=""
|
|
|
|
endif
|
|
|
|
if w!=""
|
|
|
|
exec "normal! \"_ciw\<C-R>=w\<CR>\<Esc>b"
|
|
|
|
endif
|
2012-10-13 01:02:44 +02:00
|
|
|
endfunc
|
2012-12-14 15:22:26 +01:00
|
|
|
|
|
|
|
" NumberToggle toggles between relative and absolute line numbers
|
|
|
|
function! NumberToggle()
|
|
|
|
if(&relativenumber == 1)
|
|
|
|
set number
|
|
|
|
else
|
|
|
|
set relativenumber
|
|
|
|
endif
|
|
|
|
endfunc
|
2012-10-13 01:02:44 +02:00
|
|
|
" }
|
|
|
|
|
|
|
|
" MISC
|
|
|
|
" {
|
|
|
|
" 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]\+$//
|
2012-12-14 15:22:26 +01:00
|
|
|
|
|
|
|
autocmd WinLeave * set number
|
|
|
|
autocmd WinEnter * set relativenumber
|
|
|
|
autocmd InsertEnter * set number
|
|
|
|
autocmd InsertLeave * set relativenumber
|
2012-10-13 01:02:44 +02:00
|
|
|
" }
|