this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Cleanup .vimrc

+77 -79
+1 -1
gvimrc
··· 29 29 nmap <S-ESC> :close<CR> 30 30 31 31 " Buffers 32 - noremap <silent> <C-D> :Bclose<CR> 32 + noremap <silent> <C-D> :Bclose<CR>
+72
vim/plugin/bclose.vim
··· 1 + " Delete buffer while keeping window layout (don't close buffer's windows). 2 + " Version 2008-11-18 from http://vim.wikia.com/wiki/VimTip165 3 + if v:version < 700 || exists('loaded_bclose') || &cp 4 + finish 5 + endif 6 + let loaded_bclose = 1 7 + if !exists('bclose_multiple') 8 + let bclose_multiple = 1 9 + endif 10 + 11 + " Display an error message. 12 + function! s:Warn(msg) 13 + echohl ErrorMsg 14 + echomsg a:msg 15 + echohl NONE 16 + endfunction 17 + 18 + " Command ':Bclose' executes ':bd' to delete buffer in current window. 19 + " The window will show the alternate buffer (Ctrl-^) if it exists, 20 + " or the previous buffer (:bp), or a blank buffer if no previous. 21 + " Command ':Bclose!' is the same, but executes ':bd!' (discard changes). 22 + " An optional argument can specify which buffer to close (name or number). 23 + function! s:Bclose(bang, buffer) 24 + if empty(a:buffer) 25 + let btarget = bufnr('%') 26 + elseif a:buffer =~ '^\d\+$' 27 + let btarget = bufnr(str2nr(a:buffer)) 28 + else 29 + let btarget = bufnr(a:buffer) 30 + endif 31 + if btarget < 0 32 + call s:Warn('No matching buffer for '.a:buffer) 33 + return 34 + endif 35 + if empty(a:bang) && getbufvar(btarget, '&modified') 36 + call s:Warn('No write since last change for buffer '.btarget.' (use :Bclose!)') 37 + return 38 + endif 39 + " Numbers of windows that view target buffer which we will delete. 40 + let wnums = filter(range(1, winnr('$')), 'winbufnr(v:val) == btarget') 41 + if !g:bclose_multiple && len(wnums) > 1 42 + call s:Warn('Buffer is in multiple windows (use ":let bclose_multiple=1")') 43 + return 44 + endif 45 + let wcurrent = winnr() 46 + for w in wnums 47 + execute w.'wincmd w' 48 + let prevbuf = bufnr('#') 49 + if prevbuf > 0 && buflisted(prevbuf) && prevbuf != w 50 + buffer # 51 + else 52 + bprevious 53 + endif 54 + if btarget == bufnr('%') 55 + " Numbers of listed buffers which are not the target to be deleted. 56 + let blisted = filter(range(1, bufnr('$')), 'buflisted(v:val) && v:val != btarget') 57 + " Listed, not target, and not displayed. 58 + let bhidden = filter(copy(blisted), 'bufwinnr(v:val) < 0') 59 + " Take the first buffer, if any (could be more intelligent). 60 + let bjump = (bhidden + blisted + [-1])[0] 61 + if bjump > 0 62 + execute 'buffer '.bjump 63 + else 64 + execute 'enew'.a:bang 65 + endif 66 + endif 67 + endfor 68 + execute 'bdelete'.a:bang.' '.btarget 69 + execute wcurrent.'wincmd w' 70 + endfunction 71 + 72 + command! -bang -complete=buffer -nargs=? Bclose call s:Bclose('<bang>', '<args>')
+4 -78
vimrc
··· 205 205 map <silent> <leader><space> :nohlsearch<CR> 206 206 nmap <C-M> :nohlsearch<CR> 207 207 208 - " Formatting 209 - map <leader>ffa mzgg=G`z<CR> 208 + " Formatting and cleaning 209 + map <leader>ff mzgg=G`z<CR> 210 + map <leader>fc :Clean<CR> 210 211 211 212 " Split window 212 213 nmap <leader>wsh :topleft vnew<CR> ··· 277 278 highlight Pmenu ctermbg=238 gui=bold 278 279 279 280 let g:SuperTabDefaultCompletionType = "context" 281 + let g:SuperTabDefaultCompletionType = "<c-n>" 280 282 let g:SuperTabMappingForward = '<C-Tab>' 281 283 let g:SuperTabMappingBackward = '<S-Tab>' 282 284 ··· 315 317 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 316 318 cmap w!! %!sudo tee > /dev/null % 317 319 318 - command! Todo noautocmd vimgrep /TODO\|FIXME/j **/*.{py,rb,css,js,coffee,c,cpp,c++,cxx,h,hpp,h++,hxx,scss,sass} | cw 319 - 320 320 command! Clean %s/\s\+$//e | nohlsearch 321 321 322 322 command! W w !sudo tee % > /dev/null 323 - 324 - " Cheat! 325 - command! -complete=file -nargs=+ Cheat call s:cheat(<f-args>) 326 - function! s:cheat(command) 327 - botright new 328 - setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile nowrap 329 - execute 'silent $read !cheat '.escape(a:command,'%#') 330 - setlocal nomodifiable 331 - 1 332 - endfunction 333 - 334 - if !exists(":DiffOrig") 335 - command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis | wincmd p | diffthis 336 - endif 337 - 338 - "delete the buffer; keep windows; create a scratch buffer if no buffers left 339 - function! s:Kwbd(kwbdStage) 340 - if(a:kwbdStage == 1) 341 - if(!buflisted(winbufnr(0))) 342 - bd! 343 - return 344 - endif 345 - let s:kwbdBufNum = bufnr("%") 346 - let s:kwbdWinNum = winnr() 347 - windo call s:Kwbd(2) 348 - execute s:kwbdWinNum . 'wincmd w' 349 - let s:buflistedLeft = 0 350 - let s:bufFinalJump = 0 351 - let l:nBufs = bufnr("$") 352 - let l:i = 1 353 - while(l:i <= l:nBufs) 354 - if(l:i != s:kwbdBufNum) 355 - if(buflisted(l:i)) 356 - let s:buflistedLeft = s:buflistedLeft + 1 357 - else 358 - if(bufexists(l:i) && !strlen(bufname(l:i)) && !s:bufFinalJump) 359 - let s:bufFinalJump = l:i 360 - endif 361 - endif 362 - endif 363 - let l:i = l:i + 1 364 - endwhile 365 - if(!s:buflistedLeft) 366 - if(s:bufFinalJump) 367 - windo if(buflisted(winbufnr(0))) | execute "b! " . s:bufFinalJump | endif 368 - else 369 - enew 370 - let l:newBuf = bufnr("%") 371 - windo if(buflisted(winbufnr(0))) | execute "b! " . l:newBuf | endif 372 - endif 373 - execute s:kwbdWinNum . 'wincmd w' 374 - endif 375 - if(buflisted(s:kwbdBufNum) || s:kwbdBufNum == bufnr("%")) 376 - execute "bd! " . s:kwbdBufNum 377 - endif 378 - if(!s:buflistedLeft) 379 - set buflisted 380 - set bufhidden=delete 381 - set buftype= 382 - setlocal noswapfile 383 - endif 384 - else 385 - if(bufnr("%") == s:kwbdBufNum) 386 - let prevbufvar = bufnr("#") 387 - if(prevbufvar > 0 && buflisted(prevbufvar) && prevbufvar != s:kwbdBufNum) 388 - b # 389 - else 390 - bn 391 - endif 392 - endif 393 - endif 394 - endfunction 395 - 396 - command! Bclose call s:Kwbd(1)