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

Merge branch 'dev' into feature/echodoc

This commit is contained in:
Wang Shidong 2017-10-22 10:11:00 -05:00 committed by GitHub
commit 9d15acdbf0
18 changed files with 364 additions and 12 deletions

96
.ci/install.ps1 Normal file
View File

@ -0,0 +1,96 @@
function install_vim($name)
{
$ver = $name -replace "^Official\s*", ""
if ($ver -eq "latest-32")
{
$url1 = 'ftp://ftp.vim.org/pub/vim/pc/vim80w32.zip'
}
elseif ($ver -eq "8.0.0069-32")
{
$url1 = 'ftp://ftp.vim.org/pub/vim/pc/vim80-069w32.zip'
}
$url2 = 'ftp://ftp.vim.org/pub/vim/pc/vim80rt.zip'
$zip1 = $Env:APPVEYOR_BUILD_FOLDER + '\vim.zip'
$zip2 = $Env:APPVEYOR_BUILD_FOLDER + '\vim-rt.zip'
(New-Object Net.WebClient).DownloadFile($url1, $zip1)
(New-Object Net.WebClient).DownloadFile($url2, $zip2)
[Reflection.Assembly]::LoadWithPartialName('System.IO.Compression.FileSystem') > $null
[System.IO.Compression.ZipFile]::ExtractToDirectory($zip1, $Env:APPVEYOR_BUILD_FOLDER)
[System.IO.Compression.ZipFile]::ExtractToDirectory($zip2, $Env:APPVEYOR_BUILD_FOLDER)
$Env:THEMIS_VIM = $Env:APPVEYOR_BUILD_FOLDER + '\vim\vim80\vim.exe'
}
function install_kaoriya_vim($name)
{
$ver = $name -replace "^Kaoriya\s*", ""
if ($ver -eq "latest-32")
{
$url = 'http://vim-jp.org/redirects/koron/vim-kaoriya/latest/win32/'
}
elseif ($ver -eq "latest-64")
{
$url = 'http://vim-jp.org/redirects/koron/vim-kaoriya/latest/win64/'
}
elseif ($ver -eq "8.0.0082-32")
{
$url = 'https://github.com/koron/vim-kaoriya/releases/download/v8.0.0082-20161113/vim80-kaoriya-win32-8.0.0082-20161113.zip'
}
elseif ($ver -eq "8.0.0082-64")
{
$url = 'https://github.com/koron/vim-kaoriya/releases/download/v8.0.0082-20161113/vim80-kaoriya-win64-8.0.0082-20161113.zip'
}
$zip = $Env:APPVEYOR_BUILD_FOLDER + '\kaoriya-vim.zip'
$out = $Env:APPVEYOR_BUILD_FOLDER + '\kaoriya-vim\'
if ($url.StartsWith('http://vim-jp.org/redirects/'))
{
$redirect = Invoke-WebRequest -URI $url
(New-Object Net.WebClient).DownloadFile($redirect.Links[0].href, $zip)
}
else
{
(New-Object Net.WebClient).DownloadFile($url, $zip)
}
[Reflection.Assembly]::LoadWithPartialName('System.IO.Compression.FileSystem') > $null
[System.IO.Compression.ZipFile]::ExtractToDirectory($zip, $out)
$Env:THEMIS_VIM = $out + (Get-ChildItem $out).Name + '\vim.exe'
}
function install_nvim($name)
{
$ver = $name -replace "^Neovim\s*", ""
if ($ver -eq "latest-32")
{
$url = 'https://ci.appveyor.com/api/projects/neovim/neovim/artifacts/build/Neovim.zip?branch=master&job=Configuration%3A%20MINGW_32'
}
elseif ($ver -eq "latest-64")
{
$url = 'https://ci.appveyor.com/api/projects/neovim/neovim/artifacts/build/Neovim.zip?branch=master&job=Configuration%3A%20MINGW_64'
}
elseif ($ver -eq "0.2.0-32")
{
$url = 'https://github.com/neovim/neovim/releases/download/v0.2.0/nvim-win32.zip'
}
elseif ($ver -eq "0.2.0-64")
{
$url = 'https://github.com/neovim/neovim/releases/download/v0.2.0/nvim-win64.zip'
}
$zip = $Env:APPVEYOR_BUILD_FOLDER + '\nvim.zip'
(New-Object Net.WebClient).DownloadFile($url, $zip)
[Reflection.Assembly]::LoadWithPartialName('System.IO.Compression.FileSystem') > $null
[System.IO.Compression.ZipFile]::ExtractToDirectory($zip, $Env:APPVEYOR_BUILD_FOLDER)
$Env:THEMIS_VIM = $Env:APPVEYOR_BUILD_FOLDER + '\Neovim\bin\nvim.exe'
$Env:THEMIS_ARGS = '-e -s --headless'
}
if ($Env:CONDITION.StartsWith("Neovim"))
{
install_nvim $Env:CONDITION
}
elseif ($Env:CONDITION.StartsWith("Official"))
{
install_vim $Env:CONDITION
}
else
{
install_kaoriya_vim $Env:CONDITION
}

View File

@ -56,7 +56,8 @@ curl -sLf https://spacevim.org/install.sh | bash -s -- -h
### Features
- **Great documentation:** access documentation in Vim with <kbd>:h SpaceVim</kbd>.
- **Great documentation:** access documentation in Vim with <kbd>SPC h SPC</kbd>.
![SPC h SPC](https://user-images.githubusercontent.com/13142418/31620230-48b53eea-b2c9-11e7-90d0-b717878875d4.gif)
- **Beautiful GUI:** you'll love the awesome UI and its useful features.
- **Mnemonic key bindings:** all key bindings have mnemonic prefixes.
![mapping guide](https://user-images.githubusercontent.com/13142418/31550099-c8173ff8-b062-11e7-967e-6378a9c3b467.gif)

View File

@ -1,9 +1,24 @@
version: 1.0.{build}
pull_requests:
do_not_increment_build_number: true
skip_tags: true
version: '{build}'
clone_depth: 1
environment:
matrix:
- CONDITION: Official latest-32
install:
- 'reg copy HKLM\SOFTWARE\Python\PythonCore\2.7 HKLM\SOFTWARE\Python\PythonCore\2.7-32 /s /reg:32'
- 'reg copy HKLM\SOFTWARE\Python\PythonCore\2.7 HKLM\SOFTWARE\Python\PythonCore\2.7-32 /s /reg:64'
- 'git config --global user.name "Appveyor"'
- 'git config --global user.email appveyor@example.com'
- 'git clone -q --depth 1 --single-branch https://github.com/junegunn/vader.vim.git build/vader'
- 'git clone -q --depth 1 --single-branch https://github.com/Shougo/dein.vim C:\Users\appveyor\.cache\vimfiles\repos\github.com\Shougo\dein.vim'
- 'set THEMIS_HOME=%TEMP%\vim-themis'
- 'set PATH=%THEMIS_HOME%\bin;%PATH%'
- ps: .ci/install.ps1
test_script:
- ps: make test
- 'echo %PATH%'
- 'echo %THEMIS_HOME%'
- 'echo %THEMIS_VIM%'
- 'echo %THEMIS_ARGS%'
- '%THEMIS_VIM% --version'
- '%THEMIS_VIM% -Nu test/vimrc -c "Vader! test/**"'
build: off
deploy: off

View File

@ -155,6 +155,13 @@ let g:spacevim_statusline_inactive_separator = 'arrow'
" Enable/Disable unicode symbols in statusline
let g:spacevim_statusline_unicode_symbols = 1
""
" Enable/Disable display mode. Default is 0, mode will be
" displayed in statusline. To enable this feature:
" >
" let g:spacevim_enable_statusline_display_mode = 1
" <
let g:spacevim_enable_statusline_display_mode = 0
""
" Enable/Disable cursorcolumn. Default is 0, cursorcolumn will be
" highlighted in normal mode. To enable this feature:
" >
@ -342,10 +349,10 @@ let g:spacevim_lint_on_the_fly = 0
" <
let g:spacevim_enable_vimfiler_welcome = 1
""
" Enable/Disable gitstatus colum in vimfiler buffer, default is 0.
" Enable/Disable gitstatus column in vimfiler buffer, default is 0.
let g:spacevim_enable_vimfiler_gitstatus = 0
""
" Enable/Disable filetypeicon colum in vimfiler buffer, default is 0.
" Enable/Disable filetypeicon column in vimfiler buffer, default is 0.
let g:spacevim_enable_vimfiler_filetypeicon = 0
let g:spacevim_smartcloseignorewin = ['__Tagbar__' , 'vimfiler:default']
let g:spacevim_smartcloseignoreft = ['help', 'tagbar', 'vimfiler', 'SpaceVimRunner']

View File

@ -8,6 +8,7 @@ let s:self.jobs = {}
let s:self.nvim_job = has('nvim')
let s:self.vim_job = !has('nvim') && has('job') && has('patch-8.0.0027')
let s:self.vim_co = SpaceVim#api#import('vim#compatible')
let s:self._message = []
if !s:self.nvim_job && !s:self.vim_job
augroup SpaceVim_job
@ -78,6 +79,12 @@ function! s:self.start(argv, ...) abort
if job > 0
let msg = ['process '. jobpid(job), ' run']
call extend(self.jobs, {job : msg})
else
if job == -1
call add(self._message, 'Failed to start job:' . (type(a:argv) == 3 ? a:argv[0] : a:argv) . ' is not executeable')
elseif job == 0
call add(self._message, 'Failed to start job: invalid arguments')
endif
endif
return job
elseif self.vim_job
@ -226,3 +233,7 @@ function! s:self.info(id) abort
call self.warn()
endif
endfunction
function! s:self.debug() abort
echo join(self._message, "\n")
endfunction

View File

@ -76,7 +76,14 @@ function! s:self.buf_set_lines(buffer, start, end, strict_indexing, replacement)
py3 lines = vim.eval("a:replacement")
py3 vim.buffers[bufnr][start_line:end_line] = lines
endif
elseif exists('*setbufline')
let line = a:start
for i in range(len(a:replacement))
call setbufline(bufname(a:buffer), line + i, a:replacement[i])
endfor
else
exe 'b' . a:buffer
call setline(a:start - 1, a:replacement)
endif
endfunction

View File

@ -0,0 +1,60 @@
let s:self = {}
let s:self.options = {}
" let s:options = {
" \ '-f' : {
" \ 'description' : '',
" \ 'complete' : ['text'],
" \ },
" \ '-d' : {
" \ 'description' : 'Root directory for sources',
" \ 'complete' : 'file',
" \ },
" \ }
let s:self._message = []
function! s:self._complete_opt(part, opt) abort
let complete = self.options[a:opt].complete
if type(complete) == type([])
return join(complete, "\n")
else
return join(getcompletion(a:part, complete), "\n")
endif
endfunction
function! s:self.complete(ArgLead, CmdLine, CursorPos) abort
let argvs = split(a:CmdLine)
let last_argv = split(a:CmdLine)[-1]
let msg = 'ArgLead: ' . a:ArgLead . ' CmdLine: ' . a:CmdLine . ' CursorPos: '
\ . a:CursorPos . ' LastArgv: ' . last_argv
call add(self._message, msg)
if a:ArgLead == '' && index(keys(self.options), last_argv) == -1
return join(keys(self.options), "\n")
elseif a:ArgLead == '' && index(keys(self.options), last_argv) != -1
return self._complete_opt(a:ArgLead, last_argv)
elseif !empty(a:ArgLead) && len(argvs) >= 3
\ && index(keys(self.options), argvs[-2]) != -1
return self._complete_opt(a:ArgLead, argvs[-2])
elseif !empty(a:ArgLead) && (
\ (len(argvs) >= 3 && index(keys(self.options), argvs[-2]) == -1)
\ ||
\ (len(argvs) ==2 )
\ )
return join(keys(self.options), "\n")
endif
endfunction
function! s:self.debug() abort
echo join(self._message, "\n")
endfunction
function! SpaceVim#api#vim#command#get()
return deepcopy(s:self)
endfunction
" vim:set et sw=2 cc=80:

View File

@ -147,7 +147,9 @@ function! s:winnr(...) abort
return ' ' . s:MESSLETTERS.circled_num(winnr(), g:spacevim_windows_index_type) . ' '
endif
else
if g:spacevim_windows_index_type == 3
if g:spacevim_enable_statusline_display_mode == 1
return '%{SpaceVim#layers#core#statusline#mode(mode())} %{SpaceVim#layers#core#statusline#mode_text(mode())}' . s:MESSLETTERS.circled_num(winnr(), g:spacevim_windows_index_type) . ' '
elseif g:spacevim_windows_index_type == 3
return '%{SpaceVim#layers#core#statusline#mode(mode())} ' . winnr() . ' '
else
return '%{SpaceVim#layers#core#statusline#mode(mode())} ' . s:MESSLETTERS.circled_num(winnr(), g:spacevim_windows_index_type) . ' '
@ -468,6 +470,20 @@ function! SpaceVim#layers#core#statusline#mode(mode)
return ''
endfunction
function! SpaceVim#layers#core#statusline#mode_text(mode)
let t = s:colors_template
if a:mode == 'n'
return 'NORMAL '
elseif a:mode == 'i'
return 'INSERT '
elseif a:mode == 'R'
return 'REPLACE '
elseif a:mode == 'v' || a:mode == 'V' || a:mode == '^V' || a:mode == 's' || a:mode == 'S' || a:mode == '^S'
return 'VISUAL '
endif
return ' '
endfunction
function! SpaceVim#layers#core#statusline#denite_mode()
let t = s:colors_template
let dmode = split(denite#get_status_mode())[1]

View File

@ -0,0 +1,108 @@
"=============================================================================
" pmd.vim --- Integrates PMD using Vim quickfix mode
" Copyright (c) 2016-2017 Shidong Wang & Contributors
" Author: Shidong Wang < wsdjeg at 163.com >
" URL: https://spacevim.org
" License: MIT license
"=============================================================================
" init plugin values
let s:options = {
\ '-R' : {
\ 'description' : 'Comma separated list of ruleset names to use',
\ 'complete' : [],
\ },
\ '-f' : {
\ 'description' : '',
\ 'complete' : ['text'],
\ },
\ '-d' : {
\ 'description' : 'Root directory for sources',
\ 'complete' : 'file',
\ },
\ '-cache' : {
\ 'description' : 'Set cache file',
\ 'complete' : 'file',
\ },
\ }
if !exists('Pmd_Cmd')
let g:Pmd_Cmd = ['pmd']
endif
if !exists('Pmd_Rulesets')
let g:Pmd_Rulesets = ["-R", "java-basic,java-design", "-property", "xsltFilename=my-own.xs"]
endif
if !exists('Pmd_silent_stderr')
let g:Pmd_silent_stderr = 1
endif
" load SpaceVim APIs
let s:JOB = SpaceVim#api#import('job')
let s:CMD = SpaceVim#api#import('vim#command')
" set APIs
let s:CMD.options = s:options
let s:rst = []
function! s:on_pmd_stdout(id, data, event) abort
for data in a:data
let info = split(data, '\:\d\+\:')
if len(info) == 2
let [fname, text] = info
let lnum = matchstr(data, '\:\d\+\:')[1:-2]
call add(s:rst, {
\ 'filename' : fnamemodify(fname, ':p'),
\ 'lnum' : lnum,
\ 'text' : text,
\ })
endif
endfor
endfunction
function! s:on_pmd_stderr(id, data, event) abort
let s:JOB._message += a:data
if g:Pmd_silent_stderr == 0
echom string(a:data)
endif
endfunction
function! s:on_pmd_exit(id, data, event) abort
call setqflist(s:rst)
let s:rst = []
copen
endfunction
function! SpaceVim#plugins#pmd#run(...)
let argv = g:Pmd_Cmd + a:000
if index(a:000, '-R') == -1
let argv += g:Pmd_Rulesets
endif
if index(argv, '-d') == -1
echohl ErrorMsg | echo 'you need to run PMD with -d option!'
return
endif
call s:JOB.start(argv,
\ {
\ 'on_stdout' : function('s:on_pmd_stdout'),
\ 'on_stderr' : function('s:on_pmd_stderr'),
\ 'on_exit' : function('s:on_pmd_exit'),
\ }
\ )
endfunction
function! SpaceVim#plugins#pmd#debug()
call s:CMD.debug()
call s:JOB.debug()
endfunction
function! SpaceVim#plugins#pmd#complete(ArgLead, CmdLine, CursorPos)
return s:CMD.complete(a:ArgLead, a:CmdLine, a:CursorPos)
endfunction

View File

@ -6,3 +6,5 @@ command! DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis
command! -nargs=* -complete=custom,zvim#util#complete_plugs Plugin :call zvim#util#Plugin(<f-args>)
"command for open project
command! -nargs=+ -complete=custom,zvim#util#complete_project OpenProject :call zvim#util#OpenProject(<f-args>)
command! -nargs=* -complete=custom,SpaceVim#plugins#pmd#complete PMD :call SpaceVim#plugins#pmd#run(<f-args>)

View File

@ -191,6 +191,13 @@ See more details in: http://spacevim.org/documentation/#statusline
*g:spacevim_statusline_unicode_symbols*
Enable/Disable unicode symbols in statusline
*g:spacevim_enable_statusline_display_mode*
Enable/Disable display mode. Default is 0, mode will be displayed in
statusline. To enable this feature:
>
let g:spacevim_enable_statusline_display_mode = 1
<
*g:spacevim_enable_cursorcolumn*
Enable/Disable cursorcolumn. Default is 0, cursorcolumn will be highlighted in
normal mode. To enable this feature:
@ -371,10 +378,10 @@ vim to start up slowly if there are too many files in the current directory.
<
*g:spacevim_enable_vimfiler_gitstatus*
Enable/Disable gitstatus colum in vimfiler buffer, default is 0.
Enable/Disable gitstatus column in vimfiler buffer, default is 0.
*g:spacevim_enable_vimfiler_filetypeicon*
Enable/Disable filetypeicon colum in vimfiler buffer, default is 0.
Enable/Disable filetypeicon column in vimfiler buffer, default is 0.
*g:spacevim_hosts_url*
The host file url. This option is for Chinese users who can not use Google and

View File

@ -396,6 +396,7 @@ The statusline and tabline are heavily customized with the following capabilitie
The `core#statusline` layer provide a heavily customized powerline with the following capabilities:, It is inspired by spacemacs's mode-line.
- show the window number
- show the current mode
- color code for current state
- show the number of search results
- toggle syntax checking info

View File

@ -4,5 +4,6 @@ let g:spacevim_statusline_separator = 'nil'
let g:spacevim_statusline_inactive_separator = 'bar'
let g:spacevim_buffer_index_type = 4
let g:spacevim_enable_tabline_filetype_icon = 0
let g:spacevim_enable_statusline_display_mode = 0

View File

@ -23,6 +23,7 @@ let g:spacevim_enable_vimfiler_welcome = 1
let g:spacevim_enable_debug = 1
let g:deoplete#auto_complete_delay = 150
let g:spacevim_enable_tabline_filetype_icon = 1
let g:spacevim_enable_statusline_display_mode = 0
let g:spacevim_enable_os_fileformat_icon = 1
let g:spacevim_buffer_index_type = 1
let g:neomake_vim_enabled_makers = []

View File

@ -1,5 +1,9 @@
Execute ( SpaceVim api: job ):
let job = SpaceVim#api#import('job')
let os = SpaceVim#api#import('system')
if os.isWindows
finish
endif
let argv = ['cat']
let g:stdout = ''
let stderr = ''

View File

@ -1,5 +1,6 @@
Execute ( SpaceVim api: unicode#box ):
new
let &encoding = 'utf-8'
let box = SpaceVim#api#import('unicode#box')
AssertEqual box.drawing_box([1,2,3] , 1, 3, 5),
\ ['╭─────┬─────┬─────╮', '│ 1 │ 2 │ 3 │', '╰─────┴─────┴─────╯']

View File

@ -6,8 +6,12 @@ Execute ( SpaceVim api: vim#buffer open ):
AssertEqual &buftype, 'nofile'
Execute ( SpaceVim api: vim#buffer buf_set_lines):
new
let buffer = SpaceVim#api#import('vim#buffer')
let os = SpaceVim#api#import('system')
if os.isWindows
finish
endif
new
let nr = bufnr('%')
new
call buffer.buf_set_lines(nr, 0, 1, 0, ['line 1', 'line 2', 'line 3'])

View File

@ -0,0 +1,10 @@
Execute ( SpaceVim api: data#command complete):
let cmd = SpaceVim#api#import('vim#command')
let cmd.options = {
\ '-d' : {
\ 'complete' : ['foo', 'baa'],
\ }
\ }
AssertEqual cmd.complete('', 'A ', 3), '-d'
AssertEqual cmd.complete('', 'A -d ', 6), "foo\nbaa"
AssertEqual cmd.complete('f', 'A -d f', 7), "foo\nbaa"