-
-
Save adelarsq/a2190635dba0e2121881 to your computer and use it in GitHub Desktop.
Close buffer via <C-@> using CtrlP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let g:ctrlp_buffer_func = { 'enter': 'CtrlPMappings' } | |
function! CtrlPMappings() | |
nnoremap <buffer> <silent> <C-@> :call <sid>DeleteBuffer()<cr> | |
endfunction | |
function! s:DeleteBuffer() | |
let path = fnamemodify(getline('.')[2:], ':p') | |
let bufn = matchstr(path, '\v\d+\ze\*No Name') | |
exec "bd" bufn ==# "" ? path : bufn | |
exec "norm \<F5>" | |
endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment