mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-03 13:00:05 +08:00
Add key bindings for list projects
This commit is contained in:
parent
ea732fae96
commit
861914d339
@ -16,6 +16,7 @@ function! SpaceVim#layers#core#config() abort
|
|||||||
call SpaceVim#layers#load('core#tabline')
|
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', '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', 'k'], 'call SpaceVim#plugins#projectmanager#kill_project()', 'kill all project buffers', 1)
|
||||||
|
call SpaceVim#mapping#space#def('nnoremap', ['p', 'p'], 'call SpaceVim#plugins#projectmanager#list()', 'List all projects', 1)
|
||||||
let lnum = expand('<slnum>') + s:lnum - 1
|
let lnum = expand('<slnum>') + s:lnum - 1
|
||||||
if has('python3')
|
if has('python3')
|
||||||
let cmd = 'Denite file_rec'
|
let cmd = 'Denite file_rec'
|
||||||
|
@ -20,12 +20,28 @@ let s:project_paths = {}
|
|||||||
function! s:cache_project(prj) abort
|
function! s:cache_project(prj) abort
|
||||||
if !has_key(s:project_paths, a:prj.path)
|
if !has_key(s:project_paths, a:prj.path)
|
||||||
let s:project_paths[a:prj.path] = a:prj
|
let s:project_paths[a:prj.path] = a:prj
|
||||||
|
let desc = '[' . a:prj.name . '] ' . a:prj.path
|
||||||
|
let cmd = 'call SpaceVim#plugins#projectmanager#open("' . a:prj.path . '")'
|
||||||
|
call add(g:unite_source_menu_menus.Projects.command_candidates, [desc,cmd])
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
let g:unite_source_menu_menus =
|
||||||
|
\ get(g:,'unite_source_menu_menus',{})
|
||||||
|
let g:unite_source_menu_menus.Projects = {'description':
|
||||||
|
\ 'Custom mapped keyboard shortcuts [SPC] p p'}
|
||||||
|
let g:unite_source_menu_menus.Projects.command_candidates =
|
||||||
|
\ get(g:unite_source_menu_menus.Projects,'command_candidates', [])
|
||||||
|
|
||||||
function! SpaceVim#plugins#projectmanager#list() abort
|
function! SpaceVim#plugins#projectmanager#list() abort
|
||||||
|
Unite menu:Projects
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! SpaceVim#plugins#projectmanager#open(project) abort
|
||||||
|
let path = s:project_paths[a:project]['path']
|
||||||
|
tabnew
|
||||||
|
exe 'lcd ' . path
|
||||||
|
Startify | VimFiler
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! SpaceVim#plugins#projectmanager#current_name() abort
|
function! SpaceVim#plugins#projectmanager#current_name() abort
|
||||||
|
Loading…
Reference in New Issue
Block a user