Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add project manager #850

Merged
merged 4 commits into from Sep 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion autoload/SpaceVim/layers/core.vim
Expand Up @@ -2,7 +2,7 @@ function! SpaceVim#layers#core#plugins() abort
return [
\ ['Shougo/vimproc.vim', {'build' : ['make']}],
\ ['benizi/vim-automkdir'],
\ ['airblade/vim-rooter', {'on_cmd' : 'Rooter'}],
\ ['airblade/vim-rooter', {'merged' : 0}],
\ ]
endfunction

Expand All @@ -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
55 changes: 55 additions & 0 deletions autoload/SpaceVim/plugins/projectmanager.vim
@@ -0,0 +1,55 @@
"=============================================================================
" projectmanager.vim --- project manager for SpaceVim
" Copyright (c) 2016-2017 Shidong Wang & Contributors
" Author: Shidong Wang < wsdjeg at 163.com >
" URL: https://spacevim.org
" License: MIT license
"=============================================================================

" project item:
" {
" "path" : "path/to/root",
" "name" : "name of the project, by default it is name of root directory",
" "type" : "git maven or svn",
" }
"


let s:project_paths = {}

function! s:cache_project(prj) abort
if !has_key(s:project_paths, a:prj.path)
let s:project_paths[a:prj.path] = a:prj
endif
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



2 changes: 1 addition & 1 deletion test/api/web/html.vader
@@ -1,4 +1,4 @@
Execute (Test web#http api):
let g:test_api_web_html = SpaceVim#api#import('web#html')
let g:test_api_web_html_paser = g:test_api_web_html.parseURL('spacevim.org')
AssertEqual g:test_api_web_html_paser.child[1].find('title').child[0], 'Home - SpaceVim'
AssertEqual g:test_api_web_html_paser.child[1].find('title').child[0], 'Home | SpaceVim'