Skip to content

Instantly share code, notes, and snippets.

@adelarsq
Forked from rainerborene/ctrlp.vim
Last active August 29, 2015 14:14
Show Gist options
  • Save adelarsq/a2190635dba0e2121881 to your computer and use it in GitHub Desktop.
Save adelarsq/a2190635dba0e2121881 to your computer and use it in GitHub Desktop.
Close buffer via <C-@> using CtrlP
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