Fixed a bug with nerdtree + some rice for statusline + removed autopairs

This commit is contained in:
madmaurice 2015-10-31 16:29:20 +01:00
parent d23b36ce14
commit d0bc16162c

View file

@ -1,4 +1,5 @@
set nocompatible set nocompatible
filetype off filetype off
" --- init vundle " --- init vundle
@ -18,10 +19,10 @@ Plugin 'MarcWeber/vim-addon-mw-utils' " Dependency for snipmate
Plugin 'tomtom/tlib_vim' "Dependency for snipmate Plugin 'tomtom/tlib_vim' "Dependency for snipmate
Plugin 'garbas/vim-snipmate' "Snippets Plugin 'garbas/vim-snipmate' "Snippets
Plugin 'easymotion/vim-easymotion' "Easy Motion Plugin 'easymotion/vim-easymotion' "Easy Motion
Plugin 'jiangmiao/auto-pairs' "Auto pairs brackets, parenthesis, etc.
Plugin 'kana/vim-textobj-user' "User defined text objects Plugin 'kana/vim-textobj-user' "User defined text objects
Plugin 'kana/vim-textobj-indent' "Indent based text objects Plugin 'kana/vim-textobj-indent' "Indent based text objects
Plugin 'benmills/vimux' "Tmux integration Plugin 'benmills/vimux' "Tmux integration
Plugin 'vim-scripts/argtextobj.vim' "function argument textobj
" --- End init vundle " --- End init vundle
call vundle#end() call vundle#end()
@ -60,10 +61,13 @@ set tabstop=4
set lbr set lbr
set tw=500 set tw=500
set t_Co=256 set t_Co=256
set hidden "Hidden buffers may exist set hidden
set switchbuf=vsplit
syntax enable syntax enable
colorscheme desert colorscheme desert
" Autoload when saving vimrc
au! BufWritePost .vimrc source ~/.vimrc
" --- Own functions " --- Own functions
function! AddSemicolon() function! AddSemicolon()
@ -78,9 +82,42 @@ function! RunCmdVimux()
endif endif
endfunction endfunction
function! IsModified()
if &modified
return '* '
endif
return ''
endfunction
" Show insert mode in statusbar
function! ModeColor(mode)
if a:mode == 'i'
if &paste
hi ModeLine ctermbg=blue
else
hi ModeLine ctermbg=green
endif
elseif a:mode == 'r'
hi ModeLine ctermbg=red
else
hi ModeLine ctermbg=none
endif
endfunction
au InsertEnter * call ModeColor(v:insertmode)
au InsertChange * call ModeColor(v:insertmode)
au InsertLeave * call ModeColor('n')
call ModeColor('n')
" --- Bindings " --- Bindings
let mapleader = "," let mapleader = ","
" Close buffers
nnoremap <silent> <leader>q :bd<cr>
" Insert empty line before and after
nnoremap <silent> <C-o> o<ESC>k
" Goto next emptyline
nnoremap <silent> <space> /^$<cr>
" nnoremap <silent> <> ?^$<cr>
" evil spaces " evil spaces
nnoremap <silent> <leader>c m':%s/\s\+$//e<cr>`' nnoremap <silent> <leader>c m':%s/\s\+$//e<cr>`'
" double empty lines " double empty lines
@ -97,7 +134,9 @@ nnoremap <leader>sc :so ~/.vimrc<cr>
nnoremap <leader>rr :call RunCmdVimux()<cr> nnoremap <leader>rr :call RunCmdVimux()<cr>
nnoremap <leader>rq :call VimuxCloseRunner()<cr> nnoremap <leader>rq :call VimuxCloseRunner()<cr>
nnoremap <silent> ; :call AddSemicolon()<cr> nnoremap <silent> ; :call AddSemicolon()<cr>
nnoremap <silent> <leader>todo :g/TODO/<cr>
" 0 should find first non blank
nmap 0 ^
" --- Don't need a help " --- Don't need a help
inoremap <F1> <nop> inoremap <F1> <nop>
nnoremap <F1> <nop> nnoremap <F1> <nop>
@ -115,16 +154,17 @@ ino <right> <Nop>
" --- Different use of undo " --- Different use of undo
nnoremap U <c-r> nnoremap U <c-r>
" --- We don't need useless whitespace at the of the line " --- We don't need useless whitespace at the end of the line
highlight WhitespaceEOL ctermbg=Red guibg=Red highlight WhitespaceEOL ctermbg=Red guibg=Red
match WhitespaceEOL /\s\+$/ match WhitespaceEOL /\s\+$/
" --- Rice " --- Rice
set statusline=%m set statusline=\ %#Modified#%{IsModified()}%*
set statusline+=\ %f set statusline+=%f
set statusline+=%= set statusline+=\ %#ModeLine#%=%*
set statusline+=%l set statusline+=\ L%l
set statusline+=\ %c set statusline+=\ C%c
hi Modified ctermfg=red
hi StatusLine cterm=None ctermfg=green ctermbg=none hi StatusLine cterm=None ctermfg=green ctermbg=none
hi Search cterm=NONE hi Search cterm=NONE
hi IncSearch cterm=underline ctermbg=none ctermfg=green hi IncSearch cterm=underline ctermbg=none ctermfg=green
@ -137,19 +177,22 @@ hi PmenuSbar ctermfg=white ctermbg=black cterm=none
let g:SuperTabNoCompleteAfter = ['^',',','\s'] let g:SuperTabNoCompleteAfter = ['^',',','\s']
" --- NERDTree tabs " --- NERDTree tabs
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
nmap <silent> <leader>e :NERDTreeToggle<CR> nmap <silent> <leader>e :NERDTreeToggle<CR>
autocmd StdinReadPre * let s:std_in=1 autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
autocmd bufenter * if !exists("b:NERDTreeType") | NERDTreeClose | endif " autocmd BufLeave * if (exists("b:NERDTreeType") && b:NERDTreeType == "primary") | normal :bd | endif
let NERDTreeWinSize = 30 let NERDTreeWinSize = 30
let NERDChristmasTree = 0 let NERDChristmasTree = 0
let NERDTreeChDirMode = 2 let NERDTreeChDirMode = 2
let NERDTreeIgnore=['\~$','\.pyc$','\.swp$'] let NERDTreeIgnore=['\~$','\.pyc$','\.swp$']
let NERDTreeWinPos="left" let NERDTreeWinPos="left"
let NERDTreeMinimalUI = 1
" --- EasyMotion " --- EasyMotion
map / <Plug>(easymotion-sn) map / <Plug>(easymotion-sn)
omap / <Plug>(easymotion-tn) omap / <Plug>(easymotion-tn)
map ? <Plug>(easymotion-bd-jk)
map n <Plug>(easymotion-next) map n <Plug>(easymotion-next)
map N <Plug>(easymotion-prev) map N <Plug>(easymotion-prev)