1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-24 05:50:05 +08:00

Add SPC p k to kill all project buffers

This commit is contained in:
wsdjeg 2017-09-25 20:55:46 +08:00
parent 0d45cdbd3a
commit 4092951db8
2 changed files with 23 additions and 2 deletions

View File

@ -12,6 +12,7 @@ function! SpaceVim#layers#core#config() abort
call SpaceVim#layers#load('core#statusline')
call SpaceVim#layers#load('core#tabline')
call SpaceVim#mapping#space#def('nnoremap', ['p', 't'], 'Rooter', 'find-project-root', 1)
call SpaceVim#mapping#space#def('nnoremap', ['p', 'k'], 'call SpaceVim#plugins#projectmanager#kill_project()', 'kill all project buffers', 1)
call SpaceVim#mapping#space#def('nnoremap', ['p', 'f'], 'CtrlP', 'find files in current project', 1)
call SpaceVim#mapping#space#def('nnoremap', ['p', '/'], 'Grepper', 'fuzzy search for text in current project', 1)
endfunction

View File

@ -15,7 +15,6 @@
"
let s:project_paths = {}
function! s:cache_project(prj) abort
@ -27,7 +26,28 @@ endfunction
function! SpaceVim#plugins#projectmanager#list() abort
endfunction
function! SpaceVim#plugins#projectmanager#current_()
return get(b:, '_spacevim_project_name', '')
endfunction
let s:BUFFER = SpaceVim#api#import('vim#buffer')
function! SpaceVim#plugins#projectmanager#kill_project() abort
let name = get(b:, '_spacevim_project_name', '')
if name != ''
call s:BUFFER.filter_do(
\ {
\ 'expr' : [
\ 'buflisted(v:val)',
\ 'index(tabpagebuflist(), v:val) == -1',
\ 'getbufvar(v:val, "_spacevim_project_name") == ' . name,
\ ],
\ 'do' : 'bd %d'
\ }
\ )
endif
endfunction