mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-24 05:30:07 +08:00
Merge branch 'dev' into lang/json
This commit is contained in:
commit
d161af2838
@ -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
|
||||
|
||||
@ -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
autoload/SpaceVim/plugins/projectmanager.vim
Normal file
55
autoload/SpaceVim/plugins/projectmanager.vim
Normal file
@ -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
|
||||
|
||||
|
||||
|
@ -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'
|
||||
|
Loading…
Reference in New Issue
Block a user