2015-05-29 20:48:20 +02:00
|
|
|
set nocompatible
|
2015-10-28 19:22:10 +01:00
|
|
|
filetype off
|
2015-05-29 20:48:20 +02:00
|
|
|
|
2015-10-31 00:03:54 +01:00
|
|
|
" --- init vundle
|
2015-10-28 19:22:10 +01:00
|
|
|
set rtp+=~/.vim/bundle/Vundle.vim
|
|
|
|
call vundle#begin()
|
2015-05-29 20:48:20 +02:00
|
|
|
|
2015-10-31 00:03:54 +01:00
|
|
|
" --- Let Vundle manage Vundle
|
2015-10-28 19:22:10 +01:00
|
|
|
Plugin 'VundleVim/Vundle.vim'
|
2015-07-10 17:49:49 +02:00
|
|
|
|
2015-10-31 00:03:54 +01:00
|
|
|
" --- My plugins
|
2015-10-28 19:22:10 +01:00
|
|
|
Plugin 'scrooloose/nerdtree' " FileBrowser on the left side
|
|
|
|
Plugin 'ervandew/supertab' "Auto completion
|
|
|
|
Plugin 'ap/vim-templates' "File templates
|
|
|
|
Plugin 'godlygeek/tabular' "Tabularize
|
2015-10-28 19:35:26 +01:00
|
|
|
Plugin 'MarcWeber/vim-addon-mw-utils' " Dependency for snipmate
|
|
|
|
Plugin 'tomtom/tlib_vim' "Dependency for snipmate
|
|
|
|
Plugin 'garbas/vim-snipmate' "Snippets
|
2015-10-28 20:18:24 +01:00
|
|
|
Plugin 'easymotion/vim-easymotion' "Easy Motion
|
2015-10-31 00:03:54 +01:00
|
|
|
Plugin 'kana/vim-textobj-user' "User defined text objects
|
|
|
|
Plugin 'kana/vim-textobj-indent' "Indent based text objects
|
|
|
|
Plugin 'benmills/vimux' "Tmux integration
|
2015-10-31 16:29:20 +01:00
|
|
|
Plugin 'vim-scripts/argtextobj.vim' "function argument textobj
|
2015-10-31 20:53:30 +01:00
|
|
|
Plugin 'rstacruz/sparkup' "quick html writing
|
2015-11-01 22:41:10 +01:00
|
|
|
Plugin 'fholgado/minibufexpl.vim' "Top bar for buffers
|
2015-05-29 20:48:20 +02:00
|
|
|
|
2015-10-31 00:03:54 +01:00
|
|
|
" --- End init vundle
|
2015-10-28 19:22:10 +01:00
|
|
|
call vundle#end()
|
|
|
|
filetype plugin indent on
|
2015-07-10 17:49:49 +02:00
|
|
|
|
2015-10-31 00:03:54 +01:00
|
|
|
" --- General configurations
|
2015-10-28 19:22:10 +01:00
|
|
|
set whichwrap+=<,>,[,]
|
|
|
|
set autoread "auto read file if changed
|
|
|
|
set wildmenu "Command completion
|
|
|
|
set gdefault " substitute all by default
|
2015-05-29 20:48:20 +02:00
|
|
|
set noruler
|
2015-10-28 19:22:10 +01:00
|
|
|
set laststatus=2 " Add Status line always
|
|
|
|
set number "Show linenumbers
|
|
|
|
set backspace=eol,start,indent "Make backspace behave like it's supposed to
|
|
|
|
set incsearch "Search while typing pattern
|
|
|
|
set lazyredraw "No redrawing while running macros
|
|
|
|
set magic "Allow magic modelines
|
2015-05-29 20:48:20 +02:00
|
|
|
set showmatch
|
|
|
|
set mat=2
|
2015-10-28 19:22:10 +01:00
|
|
|
set noerrorbells "No visual nuisance
|
2015-05-29 20:48:20 +02:00
|
|
|
set novisualbell
|
|
|
|
set t_vb=
|
|
|
|
set tm=500
|
2015-10-28 19:22:10 +01:00
|
|
|
set encoding=utf8 "Always use utf8
|
2015-11-01 22:41:10 +01:00
|
|
|
set ffs=unix,dos,mac " Auto use EOL according to file
|
2015-05-29 20:48:20 +02:00
|
|
|
set noswapfile
|
2015-10-28 19:22:10 +01:00
|
|
|
set expandtab "Tabbing
|
2015-11-01 22:41:10 +01:00
|
|
|
set smarttab " Deleting and creating spaces representing tabs
|
2015-10-28 19:22:10 +01:00
|
|
|
set ai "auto indent
|
|
|
|
set si "smart indent
|
|
|
|
set wrap "wrap lines
|
2015-05-29 20:48:20 +02:00
|
|
|
set shiftwidth=4
|
|
|
|
set tabstop=4
|
2015-11-01 22:41:10 +01:00
|
|
|
set lbr " Smart line breaking
|
2015-05-29 20:48:20 +02:00
|
|
|
set tw=500
|
2015-10-28 19:22:10 +01:00
|
|
|
set t_Co=256
|
2015-10-31 16:29:20 +01:00
|
|
|
set hidden
|
2015-11-01 22:41:10 +01:00
|
|
|
syntax enable "Syntax highlighting
|
|
|
|
colorscheme madtheme "Colorscheme
|
2015-05-29 20:48:20 +02:00
|
|
|
|
2015-11-01 01:23:41 +01:00
|
|
|
" Backups in different folder
|
|
|
|
set backup
|
|
|
|
set writebackup
|
|
|
|
set backupdir=~/.vim/backup//
|
|
|
|
set directory=~/.vim/backup//
|
|
|
|
|
|
|
|
" Abbreviations
|
2015-11-01 22:41:10 +01:00
|
|
|
iab _DATE <C-R>=strftime("%A, %d. %B %Y %H:%M")<CR>
|
2015-11-01 01:23:41 +01:00
|
|
|
|
2015-10-31 16:29:20 +01:00
|
|
|
" Autoload when saving vimrc
|
|
|
|
au! BufWritePost .vimrc source ~/.vimrc
|
2015-05-29 20:48:20 +02:00
|
|
|
|
2015-10-31 00:03:54 +01:00
|
|
|
" --- Own functions
|
|
|
|
function! AddSemicolon()
|
|
|
|
normal m'A;
|
|
|
|
normal `'
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! RunCmdVimux()
|
|
|
|
let l:cmd = input("Run: ")
|
|
|
|
if l:cmd !~ '\s\+'
|
|
|
|
call VimuxRunCommand("clear && " . l:cmd)
|
|
|
|
endif
|
|
|
|
endfunction
|
|
|
|
|
2015-10-31 16:29:20 +01:00
|
|
|
function! IsModified()
|
|
|
|
if &modified
|
|
|
|
return '* '
|
|
|
|
endif
|
|
|
|
return ''
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
" Show insert mode in statusbar
|
|
|
|
function! ModeColor(mode)
|
|
|
|
if a:mode == 'i'
|
|
|
|
if &paste
|
2015-11-01 22:41:10 +01:00
|
|
|
hi link ModeLine ModeLineInsertPaste
|
2015-10-31 16:29:20 +01:00
|
|
|
else
|
2015-11-01 22:41:10 +01:00
|
|
|
hi link ModeLine ModeLineInsert
|
2015-10-31 16:29:20 +01:00
|
|
|
endif
|
|
|
|
elseif a:mode == 'r'
|
2015-11-01 22:41:10 +01:00
|
|
|
hi link ModeLine ModeLineReplace
|
2015-10-31 16:29:20 +01:00
|
|
|
else
|
2015-11-01 22:41:10 +01:00
|
|
|
hi link ModeLine ModeLineNormal
|
2015-10-31 16:29:20 +01:00
|
|
|
endif
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
au InsertEnter * call ModeColor(v:insertmode)
|
|
|
|
au InsertChange * call ModeColor(v:insertmode)
|
|
|
|
au InsertLeave * call ModeColor('n')
|
|
|
|
call ModeColor('n')
|
|
|
|
|
2015-10-31 00:03:54 +01:00
|
|
|
" --- Bindings
|
2015-07-10 17:49:49 +02:00
|
|
|
let mapleader = ","
|
2015-11-01 22:41:10 +01:00
|
|
|
" Close and write buffers
|
2015-10-31 16:29:20 +01:00
|
|
|
nnoremap <silent> <leader>q :bd<cr>
|
2015-11-01 22:41:10 +01:00
|
|
|
nnoremap <silent> <leader>w :w<cr>
|
2015-10-31 16:29:20 +01:00
|
|
|
" Insert empty line before and after
|
|
|
|
nnoremap <silent> <C-o> o<ESC>k
|
|
|
|
" Goto next emptyline
|
|
|
|
nnoremap <silent> <space> /^$<cr>
|
|
|
|
" nnoremap <silent> <> ?^$<cr>
|
2015-10-31 00:03:54 +01:00
|
|
|
" evil spaces
|
|
|
|
nnoremap <silent> <leader>c m':%s/\s\+$//e<cr>`'
|
|
|
|
" double empty lines
|
|
|
|
nnoremap <silent> <leader>v m':%s/\n\{3,}/\r\r/e<cr>`'
|
|
|
|
" Toggle paste
|
2015-10-25 19:42:03 +01:00
|
|
|
nnoremap <silent> <leader>p :set invpaste paste?<cr>
|
2015-10-31 00:03:54 +01:00
|
|
|
" Quick tabularize
|
2015-10-27 14:46:13 +01:00
|
|
|
nnoremap <leader>a :Tabularize /
|
|
|
|
vnoremap <leader>a :'<,'>Tabularize /
|
2015-10-31 00:03:54 +01:00
|
|
|
" VimRC
|
|
|
|
nnoremap <leader>oc :e ~/.vimrc<cr>
|
|
|
|
nnoremap <leader>sc :so ~/.vimrc<cr>
|
|
|
|
" Vimux
|
|
|
|
nnoremap <leader>rr :call RunCmdVimux()<cr>
|
|
|
|
nnoremap <leader>rq :call VimuxCloseRunner()<cr>
|
|
|
|
nnoremap <silent> ; :call AddSemicolon()<cr>
|
2015-10-31 16:29:20 +01:00
|
|
|
nnoremap <silent> <leader>todo :g/TODO/<cr>
|
|
|
|
" 0 should find first non blank
|
|
|
|
nmap 0 ^
|
2015-11-01 22:41:10 +01:00
|
|
|
" Easy buffer switching
|
|
|
|
nnoremap <silent> <leader>b :MBEFocus<cr>
|
|
|
|
nnoremap <silent> <Tab> :bnext<cr>
|
2015-10-31 20:54:07 +01:00
|
|
|
" Moving through windows
|
|
|
|
nnoremap <C-l> <C-w>l
|
|
|
|
nnoremap <C-h> <C-w>h
|
|
|
|
nnoremap <C-j> <C-w>j
|
|
|
|
nnoremap <C-k> <C-w>k
|
|
|
|
|
|
|
|
" Quick macroing
|
|
|
|
:nnoremap + @wj
|
|
|
|
|
2015-10-31 00:03:54 +01:00
|
|
|
" --- Don't need a help
|
2015-07-10 17:49:49 +02:00
|
|
|
inoremap <F1> <nop>
|
|
|
|
nnoremap <F1> <nop>
|
|
|
|
vnoremap <F1> <nop>
|
|
|
|
|
2015-10-31 00:03:54 +01:00
|
|
|
" --- Just a nuisance
|
2015-10-26 11:58:41 +01:00
|
|
|
nnoremap q: <nop>
|
|
|
|
|
2015-10-31 00:03:54 +01:00
|
|
|
" --- No moving in insert mode allowed
|
2015-10-25 19:42:03 +01:00
|
|
|
ino <down> <Nop>
|
|
|
|
ino <up> <Nop>
|
|
|
|
ino <left> <Nop>
|
|
|
|
ino <right> <Nop>
|
2015-07-10 17:49:49 +02:00
|
|
|
|
2015-10-31 00:03:54 +01:00
|
|
|
" --- Different use of undo
|
2015-05-29 20:48:20 +02:00
|
|
|
nnoremap U <c-r>
|
|
|
|
|
2015-10-31 16:29:20 +01:00
|
|
|
" --- We don't need useless whitespace at the end of the line
|
2015-05-29 20:48:20 +02:00
|
|
|
highlight WhitespaceEOL ctermbg=Red guibg=Red
|
|
|
|
match WhitespaceEOL /\s\+$/
|
|
|
|
|
2015-10-31 00:03:54 +01:00
|
|
|
" --- Rice
|
2015-10-31 16:29:20 +01:00
|
|
|
set statusline=\ %#Modified#%{IsModified()}%*
|
|
|
|
set statusline+=%f
|
|
|
|
set statusline+=\ %#ModeLine#%=%*
|
|
|
|
set statusline+=\ L%l
|
|
|
|
set statusline+=\ C%c
|
|
|
|
hi Modified ctermfg=red
|
2015-10-15 20:48:01 +02:00
|
|
|
hi StatusLine cterm=None ctermfg=green ctermbg=none
|
2015-10-31 00:03:54 +01:00
|
|
|
hi Search cterm=NONE
|
2015-10-27 00:47:13 +01:00
|
|
|
hi IncSearch cterm=underline ctermbg=none ctermfg=green
|
2015-10-31 00:03:54 +01:00
|
|
|
hi VertSplit cterm=none ctermbg=none ctermfg=blue
|
2015-05-29 20:48:20 +02:00
|
|
|
|
2015-10-31 00:03:54 +01:00
|
|
|
" --- Supertab
|
2015-10-15 22:41:17 +02:00
|
|
|
hi Pmenu ctermfg=green ctermbg=black
|
|
|
|
hi PmenuSel ctermfg=white ctermbg=black
|
|
|
|
hi PmenuSbar ctermfg=white ctermbg=black cterm=none
|
|
|
|
let g:SuperTabNoCompleteAfter = ['^',',','\s']
|
2015-10-28 19:22:10 +01:00
|
|
|
|
2015-10-31 00:03:54 +01:00
|
|
|
" --- NERDTree tabs
|
2015-10-31 16:29:20 +01:00
|
|
|
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
|
2015-10-28 19:22:10 +01:00
|
|
|
nmap <silent> <leader>e :NERDTreeToggle<CR>
|
2015-10-28 20:24:52 +01:00
|
|
|
autocmd StdinReadPre * let s:std_in=1
|
|
|
|
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
|
2015-10-31 16:29:20 +01:00
|
|
|
" autocmd BufLeave * if (exists("b:NERDTreeType") && b:NERDTreeType == "primary") | normal :bd | endif
|
2015-10-31 00:03:54 +01:00
|
|
|
let NERDTreeWinSize = 30
|
|
|
|
let NERDChristmasTree = 0
|
|
|
|
let NERDTreeChDirMode = 2
|
|
|
|
let NERDTreeIgnore=['\~$','\.pyc$','\.swp$']
|
|
|
|
let NERDTreeWinPos="left"
|
2015-10-31 16:29:20 +01:00
|
|
|
let NERDTreeMinimalUI = 1
|
2015-10-31 00:03:54 +01:00
|
|
|
|
|
|
|
" --- EasyMotion
|
2015-10-28 20:18:24 +01:00
|
|
|
map / <Plug>(easymotion-sn)
|
|
|
|
omap / <Plug>(easymotion-tn)
|
2015-10-31 16:29:20 +01:00
|
|
|
map ? <Plug>(easymotion-bd-jk)
|
2015-10-28 20:18:24 +01:00
|
|
|
|
|
|
|
map n <Plug>(easymotion-next)
|
|
|
|
map N <Plug>(easymotion-prev)
|
2015-10-31 00:03:54 +01:00
|
|
|
|
|
|
|
" --- Auto pairs
|
|
|
|
|
2015-10-31 20:53:30 +01:00
|
|
|
" --- Sparkup
|