Some fixes with NERDTree and the buffer closing

This commit is contained in:
madmaurice 2015-11-04 14:42:54 +01:00
parent 918d6c3fe4
commit 078f9b2e7a

View file

@ -62,9 +62,10 @@ set lbr " Smart line breaking
set tw=500
set t_Co=256
set hidden
set scrolloff=1000
set shortmess+=I
syntax enable "Syntax highlighting
colorscheme madtheme "Colorscheme
" Backups in different folder
set backup
set writebackup
@ -112,6 +113,11 @@ function! ModeColor(mode)
endif
endfunction
" Remove current buffer
function! BufferClose()
endfunction
au InsertEnter * call ModeColor(v:insertmode)
au InsertChange * call ModeColor(v:insertmode)
au InsertLeave * call ModeColor('n')
@ -119,15 +125,16 @@ call ModeColor('n')
" --- Bindings
let mapleader = ","
" word movement with tab
nnoremap <Tab> W
nnoremap <S-Tab> B
" Close and write buffers
nnoremap <silent> <leader>q :bd<cr>
nnoremap <silent> <leader>q :b#<bar>bd#<CR>
nnoremap <silent> <leader>w :w<cr>
" Insert empty line before and after
nnoremap <silent> <C-o> o<ESC>kO
" Fuzzy Finder
nnoremap <silent> <leader>f :FufFile<cr>
" Goto next emptyline
nnoremap <silent> <space> /^$<cr>
" nnoremap <silent> <> ?^$<cr>
" evil spaces
nnoremap <silent> <leader>c m':%s/\s\+$//e<cr>`'
@ -141,6 +148,8 @@ vnoremap <leader>a :'<,'>Tabularize /
" VimRC
nnoremap <leader>oc :e ~/.vimrc<cr>
nnoremap <leader>sc :so ~/.vimrc<cr>
" Toggle invisble chars
nnoremap <silent> <leader>i :set list!<cr>
" Vimux
nnoremap <leader>rr :call RunCmdVimux()<cr>
nnoremap <leader>rq :call VimuxCloseRunner()<cr>
@ -149,22 +158,23 @@ nnoremap <silent> <leader>todo :g/TODO/<cr>
" 0 should find first non blank
nmap 0 ^
" Easy buffer switching
nnoremap <silent> <leader>m :bnext<cr>
nnoremap <silent> <leader>n :bprev<cr>
nnoremap <silent> <C-m> :bnext<cr>
nnoremap <silent> <C-n> :bprev<cr>
" 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
" --- Don't need a help
inoremap <F1> <nop>
nnoremap <F1> <nop>
vnoremap <F1> <nop>
" Sudo to write
cnoremap w!! w !sudo tee % >/dev/null
" --- Just a nuisance
nnoremap q: <nop>
@ -174,6 +184,7 @@ ino <up> <Nop>
ino <left> <Nop>
ino <right> <Nop>
" --- Different use of undo
nnoremap U <c-r>
@ -196,17 +207,16 @@ hi IncSearch cterm=underline ctermbg=none ctermfg=green
let g:SuperTabNoCompleteAfter = ['^',',','\s']
" --- NERDTree tabs
autocmd bufenter * if (winnr("$") == 1 && bufnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
nmap <silent> <leader>e :NERDTreeToggle<CR>
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
" autocmd BufLeave * if (exists("b:NERDTreeType") && b:NERDTreeType == "primary") | normal :bd | endif
let NERDTreeWinSize = 30
let NERDChristmasTree = 0
let NERDTreeChDirMode = 2
let NERDTreeIgnore=['\~$','\.pyc$','\.swp$']
let NERDTreeWinPos="left"
let NERDTreeMinimalUI = 1
let NERDTreeQuitOnOpen = 1
" --- EasyMotion
map / <Plug>(easymotion-sn)