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:
parent
0d45cdbd3a
commit
4092951db8
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user