From a3da73592db5da1baad89adb5a2d2c2000285526 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Mon, 16 Oct 2017 23:22:48 +0800 Subject: [PATCH 01/28] Add help gif --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 85aa0dd69..47a32168f 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,8 @@ curl -sLf https://spacevim.org/install.sh | bash -s -- -h ### Features -- **Great documentation:** access documentation in Vim with :h SpaceVim. +- **Great documentation:** access documentation in Vim with SPC h SPC. + ![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) From 422369a072296725598aa3e251c8d449c2c17552 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Tue, 17 Oct 2017 00:11:21 +0800 Subject: [PATCH 02/28] Add PMD command --- autoload/SpaceVim/plugins/pmd.vim | 23 +++++++++++++++++++++++ config/commands.vim | 2 ++ 2 files changed, 25 insertions(+) create mode 100644 autoload/SpaceVim/plugins/pmd.vim diff --git a/autoload/SpaceVim/plugins/pmd.vim b/autoload/SpaceVim/plugins/pmd.vim new file mode 100644 index 000000000..cf703b494 --- /dev/null +++ b/autoload/SpaceVim/plugins/pmd.vim @@ -0,0 +1,23 @@ +"============================================================================= +" 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 +"============================================================================= + + +" option Description Required +" -f/-format Report format type. Default format is `text`. - + +function! SpaceVim#plugins#pmd#run(...) + + + +endfunction + + +function! SpaceVim#plugins#pmd#complete(...) + +return '-f' +endfunction diff --git a/config/commands.vim b/config/commands.vim index 7d5bd724f..48ab64c3a 100644 --- a/config/commands.vim +++ b/config/commands.vim @@ -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() "command for open project command! -nargs=+ -complete=custom,zvim#util#complete_project OpenProject :call zvim#util#OpenProject() + +command! -nargs=* -complete=custom,SpaceVim#plugins#pmd#complete PMD :call SpaceVim#plugins#pmd#run() From f1594388cb0c44aa27686fcdaf9a78a453b16b73 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Tue, 17 Oct 2017 00:17:31 +0800 Subject: [PATCH 03/28] Add options --- autoload/SpaceVim/plugins/pmd.vim | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/autoload/SpaceVim/plugins/pmd.vim b/autoload/SpaceVim/plugins/pmd.vim index cf703b494..c3d7f2451 100644 --- a/autoload/SpaceVim/plugins/pmd.vim +++ b/autoload/SpaceVim/plugins/pmd.vim @@ -7,8 +7,17 @@ "============================================================================= -" option Description Required -" -f/-format Report format type. Default format is `text`. - +let s:options = { + \ '-f' : { + \ 'description' : '', + \ 'values' : ['text'], + \ }, + \ '-d' : { + \ 'description' : 'Root directory for sources', + \ 'values' : [], + \ }, + \ } + function! SpaceVim#plugins#pmd#run(...) From b067b95bf942976895a14ddfa4215c777bc12ab8 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Tue, 17 Oct 2017 15:37:29 +0800 Subject: [PATCH 04/28] Add command APIs --- autoload/SpaceVim/api/vim/command.vim | 12 +++++++ autoload/SpaceVim/plugins/pmd.vim | 52 +++++++++++++++++++++++---- test/api/vim/command.vader | 4 +++ 3 files changed, 62 insertions(+), 6 deletions(-) create mode 100644 autoload/SpaceVim/api/vim/command.vim create mode 100644 test/api/vim/command.vader diff --git a/autoload/SpaceVim/api/vim/command.vim b/autoload/SpaceVim/api/vim/command.vim new file mode 100644 index 000000000..c2b57d6a2 --- /dev/null +++ b/autoload/SpaceVim/api/vim/command.vim @@ -0,0 +1,12 @@ +let s:self = {} + +let s:self.options = {} + +function! s:self.complete(ArgLead, CmdLine, CursorPos) abort + return join(keys(self.options), "\n") +endfunction + + +function! SpaceVim#api#vim#command#get() + return deepcopy(s:self) +endfunction diff --git a/autoload/SpaceVim/plugins/pmd.vim b/autoload/SpaceVim/plugins/pmd.vim index c3d7f2451..b589ebe5e 100644 --- a/autoload/SpaceVim/plugins/pmd.vim +++ b/autoload/SpaceVim/plugins/pmd.vim @@ -6,6 +6,7 @@ " License: MIT license "============================================================================= +" init plugin values let s:options = { \ '-f' : { @@ -18,15 +19,54 @@ let s:options = { \ }, \ } +if !exists('Pmd_Cmd') + let g:Pmd_Cmd = ['pmd'] +endif + +if !exists('Pmd_Cache_Dir') + let g:Pmd_Cache_Dir = '~/.cache/pmd/' +endif + +if !exists('Pmd_Rulesets') + let g:Pmd_Rulesets = ["-R", "java-basic,java-design", "-property", "xsltFilename=my-own.xs"] +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 + +function! s:on_pmd_stdout(id, data, event) abort + echom string(a:data) +endfunction + +function! s:on_pmd_stderr(id, data, event) abort + echom string(a:data) +endfunction + +function! s:on_pmd_exit(id, data, event) abort + echom string(a:data) +endfunction function! SpaceVim#plugins#pmd#run(...) - - - + let argv = g:Pmd_Cmd + ['-cache', g:Pmd_Cache_Dir] + let argv += a:000 + g:Pmd_Rulesets + echom 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 +let s:CMD = SpaceVim#api#import('vim#command') +let s:CMD.options = s:options -function! SpaceVim#plugins#pmd#complete(...) - -return '-f' +function! SpaceVim#plugins#pmd#complete(ArgLead, CmdLine, CursorPos) + return s:CMD.complete(a:ArgLead, a:CmdLine, a:CursorPos) endfunction diff --git a/test/api/vim/command.vader b/test/api/vim/command.vader new file mode 100644 index 000000000..cc9f9f011 --- /dev/null +++ b/test/api/vim/command.vader @@ -0,0 +1,4 @@ +Execute ( SpaceVim api: data#list ): + let cmd = SpaceVim#api#import('vim#command') + let cmd.options = {} + AssertEqual cmd.complete('', '', ''), '' From c112db2a989f39b2f6a16d61f4d000a51cb2b091 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Tue, 17 Oct 2017 15:58:55 +0800 Subject: [PATCH 05/28] Update command api --- autoload/SpaceVim/api/vim/command.vim | 30 ++++++++++++++++++++++++++- autoload/SpaceVim/plugins/pmd.vim | 10 +++++---- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/autoload/SpaceVim/api/vim/command.vim b/autoload/SpaceVim/api/vim/command.vim index c2b57d6a2..071302cb3 100644 --- a/autoload/SpaceVim/api/vim/command.vim +++ b/autoload/SpaceVim/api/vim/command.vim @@ -2,8 +2,36 @@ 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(ArgLead, CmdLine, CursorPos) abort - return join(keys(self.options), "\n") + 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 + let complete = self.options[last_argv].complete + if type(complete) == type([]) + return join(complete, "\n") + else + endif + endif +endfunction + +function! s:self.debug() abort + echo join(self._message, "\n") endfunction diff --git a/autoload/SpaceVim/plugins/pmd.vim b/autoload/SpaceVim/plugins/pmd.vim index b589ebe5e..897baef5f 100644 --- a/autoload/SpaceVim/plugins/pmd.vim +++ b/autoload/SpaceVim/plugins/pmd.vim @@ -11,11 +11,11 @@ let s:options = { \ '-f' : { \ 'description' : '', - \ 'values' : ['text'], + \ 'complete' : ['text'], \ }, \ '-d' : { \ 'description' : 'Root directory for sources', - \ 'values' : [], + \ 'complete' : 'file', \ }, \ } @@ -64,8 +64,10 @@ function! SpaceVim#plugins#pmd#run(...) \ ) endfunction -let s:CMD = SpaceVim#api#import('vim#command') -let s:CMD.options = s:options +function! SpaceVim#plugins#pmd#debug() + call s:CMD.debug() +endfunction + function! SpaceVim#plugins#pmd#complete(ArgLead, CmdLine, CursorPos) return s:CMD.complete(a:ArgLead, a:CmdLine, a:CursorPos) From 768aca93517a08e035e350a6f2a27e4f8c4aa829 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Tue, 17 Oct 2017 16:05:52 +0800 Subject: [PATCH 06/28] Improve complete type --- autoload/SpaceVim/api/vim/command.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/autoload/SpaceVim/api/vim/command.vim b/autoload/SpaceVim/api/vim/command.vim index 071302cb3..6a62b4ab6 100644 --- a/autoload/SpaceVim/api/vim/command.vim +++ b/autoload/SpaceVim/api/vim/command.vim @@ -26,6 +26,7 @@ function! s:self.complete(ArgLead, CmdLine, CursorPos) abort if type(complete) == type([]) return join(complete, "\n") else + return join(getcompletion(a:ArgLead, complete), "\n") endif endif endfunction From 21985591d351feafe0b741693ea64b2de7689ef5 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Tue, 17 Oct 2017 16:15:54 +0800 Subject: [PATCH 07/28] Fix command api --- autoload/SpaceVim/api/vim/command.vim | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/autoload/SpaceVim/api/vim/command.vim b/autoload/SpaceVim/api/vim/command.vim index 6a62b4ab6..f5cc17064 100644 --- a/autoload/SpaceVim/api/vim/command.vim +++ b/autoload/SpaceVim/api/vim/command.vim @@ -16,6 +16,7 @@ let s:self.options = {} let s:self._message = [] 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) @@ -28,7 +29,15 @@ function! s:self.complete(ArgLead, CmdLine, CursorPos) abort else return join(getcompletion(a:ArgLead, complete), "\n") endif + elseif !empty(a:ArgLead) && len(argvs) >= 3 && index(keys(self.options), argvs[-2]) != -1 + let complete = self.options[argvs[-2]].complete + if type(complete) == type([]) + return join(complete, "\n") + else + return join(getcompletion(a:ArgLead, complete), "\n") + endif endif + endfunction function! s:self.debug() abort From 8e2eb7ee83839b9e1c97970acb7897b88bec3231 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Tue, 17 Oct 2017 16:24:45 +0800 Subject: [PATCH 08/28] Fix api --- autoload/SpaceVim/api/vim/command.vim | 29 ++++++++++++++++----------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/autoload/SpaceVim/api/vim/command.vim b/autoload/SpaceVim/api/vim/command.vim index f5cc17064..3db5f4942 100644 --- a/autoload/SpaceVim/api/vim/command.vim +++ b/autoload/SpaceVim/api/vim/command.vim @@ -15,6 +15,15 @@ let s:self.options = {} 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] @@ -23,19 +32,15 @@ function! s:self.complete(ArgLead, CmdLine, CursorPos) abort 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 - let complete = self.options[last_argv].complete - if type(complete) == type([]) - return join(complete, "\n") - else - return join(getcompletion(a:ArgLead, complete), "\n") - endif + return self._complete_opt(a:ArgLead, last_argv) elseif !empty(a:ArgLead) && len(argvs) >= 3 && index(keys(self.options), argvs[-2]) != -1 - let complete = self.options[argvs[-2]].complete - if type(complete) == type([]) - return join(complete, "\n") - else - return join(getcompletion(a:ArgLead, complete), "\n") - endif + 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 From 8d7a5818479d2299cd76abba2813d88772f48ac8 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Tue, 17 Oct 2017 16:59:22 +0800 Subject: [PATCH 09/28] Fix command options --- autoload/SpaceVim/api/vim/command.vim | 23 ++++++++++++++--------- autoload/SpaceVim/plugins/pmd.vim | 22 ++++++++++++++++++++-- 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/autoload/SpaceVim/api/vim/command.vim b/autoload/SpaceVim/api/vim/command.vim index 3db5f4942..f68f8c801 100644 --- a/autoload/SpaceVim/api/vim/command.vim +++ b/autoload/SpaceVim/api/vim/command.vim @@ -16,24 +16,26 @@ let s:self.options = {} 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 + 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 + 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 + 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) @@ -51,5 +53,8 @@ endfunction function! SpaceVim#api#vim#command#get() - return deepcopy(s:self) + return deepcopy(s:self) endfunction + + +" vim:set et sw=2 cc=80: diff --git a/autoload/SpaceVim/plugins/pmd.vim b/autoload/SpaceVim/plugins/pmd.vim index 897baef5f..03a69a452 100644 --- a/autoload/SpaceVim/plugins/pmd.vim +++ b/autoload/SpaceVim/plugins/pmd.vim @@ -9,6 +9,10 @@ " init plugin values let s:options = { + \ '-R' : { + \ 'description' : 'Comma separated list of ruleset names to use', + \ 'complete' : [], + \ }, \ '-f' : { \ 'description' : '', \ 'complete' : ['text'], @@ -17,6 +21,10 @@ let s:options = { \ 'description' : 'Root directory for sources', \ 'complete' : 'file', \ }, + \ '-cache' : { + \ 'description' : 'Set cache directory', + \ 'complete' : 'dir', + \ }, \ } if !exists('Pmd_Cmd') @@ -53,8 +61,18 @@ function! s:on_pmd_exit(id, data, event) abort endfunction function! SpaceVim#plugins#pmd#run(...) - let argv = g:Pmd_Cmd + ['-cache', g:Pmd_Cache_Dir] - let argv += a:000 + g:Pmd_Rulesets + let argv = [] + if isdirectory(g:Pmd_Cache_Dir) && index(a:000, '-cache') == -1 + let argv = g:Pmd_Cmd + ['-cache', g:Pmd_Cache_Dir] + endif + let argv += 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 echom s:JOB.start(argv, \ { \ 'on_stdout' : function('s:on_pmd_stdout'), From a344f57c0d14e1d4c519d4dd956335200f262999 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Tue, 17 Oct 2017 17:22:05 +0800 Subject: [PATCH 10/28] Fix pmd plugin --- autoload/SpaceVim/plugins/pmd.vim | 36 +++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/autoload/SpaceVim/plugins/pmd.vim b/autoload/SpaceVim/plugins/pmd.vim index 03a69a452..f805d131c 100644 --- a/autoload/SpaceVim/plugins/pmd.vim +++ b/autoload/SpaceVim/plugins/pmd.vim @@ -32,13 +32,17 @@ if !exists('Pmd_Cmd') endif if !exists('Pmd_Cache_Dir') - let g:Pmd_Cache_Dir = '~/.cache/pmd/' + let g:Pmd_Cache_Dir = expand('~/.cache/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') @@ -48,22 +52,39 @@ let s:CMD = SpaceVim#api#import('vim#command') let s:CMD.options = s:options +let s:rst = [] + function! s:on_pmd_stdout(id, data, event) abort - echom string(a:data) + 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 - echom string(a:data) + if g:Pmd_silent_stderr == 0 + echom string(a:data) + endif endfunction function! s:on_pmd_exit(id, data, event) abort - echom string(a:data) + call setqflist(s:rst) + let s:rst = [] + copen endfunction function! SpaceVim#plugins#pmd#run(...) - let argv = [] + let argv = g:Pmd_Cmd if isdirectory(g:Pmd_Cache_Dir) && index(a:000, '-cache') == -1 - let argv = g:Pmd_Cmd + ['-cache', g:Pmd_Cache_Dir] + let argv += ['-cache', g:Pmd_Cache_Dir] endif let argv += a:000 if index(a:000, '-R') == -1 @@ -73,7 +94,7 @@ function! SpaceVim#plugins#pmd#run(...) echohl ErrorMsg | echo 'you need to run PMD with -d option!' return endif - echom s:JOB.start(argv, + call s:JOB.start(argv, \ { \ 'on_stdout' : function('s:on_pmd_stdout'), \ 'on_stderr' : function('s:on_pmd_stderr'), @@ -90,3 +111,4 @@ endfunction function! SpaceVim#plugins#pmd#complete(ArgLead, CmdLine, CursorPos) return s:CMD.complete(a:ArgLead, a:CmdLine, a:CursorPos) endfunction + From b75606a405b5be3c598aa07e0cb4b6dd189b1430 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Tue, 17 Oct 2017 23:11:16 +0800 Subject: [PATCH 11/28] Add debug for job api --- autoload/SpaceVim/api/job.vim | 11 +++++++++++ autoload/SpaceVim/plugins/pmd.vim | 16 +++++----------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/autoload/SpaceVim/api/job.vim b/autoload/SpaceVim/api/job.vim index 2bd8cb3bf..d07fa4511 100644 --- a/autoload/SpaceVim/api/job.vim +++ b/autoload/SpaceVim/api/job.vim @@ -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 diff --git a/autoload/SpaceVim/plugins/pmd.vim b/autoload/SpaceVim/plugins/pmd.vim index f805d131c..bdbb49b3c 100644 --- a/autoload/SpaceVim/plugins/pmd.vim +++ b/autoload/SpaceVim/plugins/pmd.vim @@ -22,8 +22,8 @@ let s:options = { \ 'complete' : 'file', \ }, \ '-cache' : { - \ 'description' : 'Set cache directory', - \ 'complete' : 'dir', + \ 'description' : 'Set cache file', + \ 'complete' : 'file', \ }, \ } @@ -31,10 +31,6 @@ if !exists('Pmd_Cmd') let g:Pmd_Cmd = ['pmd'] endif -if !exists('Pmd_Cache_Dir') - let g:Pmd_Cache_Dir = expand('~/.cache/pmd/') -endif - if !exists('Pmd_Rulesets') let g:Pmd_Rulesets = ["-R", "java-basic,java-design", "-property", "xsltFilename=my-own.xs"] endif @@ -70,6 +66,7 @@ function! s:on_pmd_stdout(id, data, event) abort 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 @@ -82,11 +79,7 @@ function! s:on_pmd_exit(id, data, event) abort endfunction function! SpaceVim#plugins#pmd#run(...) - let argv = g:Pmd_Cmd - if isdirectory(g:Pmd_Cache_Dir) && index(a:000, '-cache') == -1 - let argv += ['-cache', g:Pmd_Cache_Dir] - endif - let argv += a:000 + let argv = g:Pmd_Cmd + a:000 if index(a:000, '-R') == -1 let argv += g:Pmd_Rulesets endif @@ -105,6 +98,7 @@ endfunction function! SpaceVim#plugins#pmd#debug() call s:CMD.debug() + call s:JOB.debug() endfunction From 81caf7521c44f57331a73b5264ca132887b469e8 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Tue, 17 Oct 2017 23:23:07 +0800 Subject: [PATCH 12/28] Add test for command api --- test/api/vim/command.vader | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/test/api/vim/command.vader b/test/api/vim/command.vader index cc9f9f011..6e41509bb 100644 --- a/test/api/vim/command.vader +++ b/test/api/vim/command.vader @@ -1,4 +1,10 @@ -Execute ( SpaceVim api: data#list ): +Execute ( SpaceVim api: data#command complete): let cmd = SpaceVim#api#import('vim#command') - let cmd.options = {} - AssertEqual cmd.complete('', '', ''), '' + 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" From b87ea593a86b4f9723c5c83f47ca54d680373f60 Mon Sep 17 00:00:00 2001 From: Felix Yan Date: Thu, 19 Oct 2017 12:39:28 +0800 Subject: [PATCH 13/28] Fix a typo in doc/SpaceVim.txt --- doc/SpaceVim.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/SpaceVim.txt b/doc/SpaceVim.txt index 4d90ee8a7..8a7849bb2 100644 --- a/doc/SpaceVim.txt +++ b/doc/SpaceVim.txt @@ -371,10 +371,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 From 66688235aefd5214a5b910f42d8106c39172a18d Mon Sep 17 00:00:00 2001 From: Felix Yan Date: Thu, 19 Oct 2017 16:23:38 +0800 Subject: [PATCH 14/28] Fix typos in autoload/SpaceVim.vim --- autoload/SpaceVim.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autoload/SpaceVim.vim b/autoload/SpaceVim.vim index 987d98d49..14ea69109 100644 --- a/autoload/SpaceVim.vim +++ b/autoload/SpaceVim.vim @@ -342,10 +342,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'] From d43db5a03963ec7356d2f16caafc76efa64ec736 Mon Sep 17 00:00:00 2001 From: Adrien Bouttier Date: Thu, 19 Oct 2017 13:04:43 +0200 Subject: [PATCH 15/28] Display mode in statusline like in some airline theme --- autoload/SpaceVim.vim | 7 +++++++ autoload/SpaceVim/layers/core/statusline.vim | 18 +++++++++++++++++- doc/SpaceVim.txt | 3 +++ docs/documentation.md | 1 + mode/basic.vim | 1 + mode/dark_powered.vim | 1 + 6 files changed, 30 insertions(+), 1 deletion(-) diff --git a/autoload/SpaceVim.vim b/autoload/SpaceVim.vim index 14ea69109..f432ddb7b 100644 --- a/autoload/SpaceVim.vim +++ b/autoload/SpaceVim.vim @@ -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: " > diff --git a/autoload/SpaceVim/layers/core/statusline.vim b/autoload/SpaceVim/layers/core/statusline.vim index 7737d8aad..26cd179f1 100644 --- a/autoload/SpaceVim/layers/core/statusline.vim +++ b/autoload/SpaceVim/layers/core/statusline.vim @@ -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] diff --git a/doc/SpaceVim.txt b/doc/SpaceVim.txt index 8a7849bb2..7a4161443 100644 --- a/doc/SpaceVim.txt +++ b/doc/SpaceVim.txt @@ -313,6 +313,9 @@ Set SpaceVim windows index type, default is 0. *g:spacevim_enable_tabline_filetype_icon* Enable/Disable tabline filetype icon. default is 0. + *g:spacevim_enable_statusline_display_mode* +Enable/Disable statusline display mode. default is 0. + *g:spacevim_enable_os_fileformat_icon* Enable/Disable os fileformat icon. default is 0. diff --git a/docs/documentation.md b/docs/documentation.md index cb6232b1f..61bed669c 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -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 diff --git a/mode/basic.vim b/mode/basic.vim index 272033e55..4282c87f7 100644 --- a/mode/basic.vim +++ b/mode/basic.vim @@ -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 diff --git a/mode/dark_powered.vim b/mode/dark_powered.vim index 3130afc10..3fb642c2f 100644 --- a/mode/dark_powered.vim +++ b/mode/dark_powered.vim @@ -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 = [] From 7f61c0964d1d14ce130abfcd87e94bc80dfade78 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sun, 22 Oct 2017 21:27:45 +0800 Subject: [PATCH 16/28] Update appveyor setting --- .ci/install.ps1 | 96 +++++++++++++++++++++++++++++++++++++++++++++++++ appveyor.yml | 30 +++++++++++++--- 2 files changed, 121 insertions(+), 5 deletions(-) create mode 100644 .ci/install.ps1 diff --git a/.ci/install.ps1 b/.ci/install.ps1 new file mode 100644 index 000000000..5ea33925a --- /dev/null +++ b/.ci/install.ps1 @@ -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 +} diff --git a/appveyor.yml b/appveyor.yml index 81e4fb215..0768c8812 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,9 +1,29 @@ -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 + - CONDITION: Official 8.0.0069-32 + - CONDITION: Kaoriya latest-32 + - CONDITION: Kaoriya latest-64 + - CONDITION: Kaoriya 8.0.0082-32 + - CONDITION: Kaoriya 8.0.0082-64 + - CONDITION: Neovim latest-32 + - CONDITION: Neovim latest-64 + - CONDITION: Neovim 0.2.0-32 + - CONDITION: Neovim 0.2.0-64 +install: + - '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' + - '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' build: off deploy: off From 613882f33bcfc4f2786ba17683a8f396ad1c2cef Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sun, 22 Oct 2017 21:37:17 +0800 Subject: [PATCH 17/28] Enable test in windows --- appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/appveyor.yml b/appveyor.yml index 0768c8812..72f385296 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -25,5 +25,6 @@ test_script: - 'echo %THEMIS_VIM%' - 'echo %THEMIS_ARGS%' - '%THEMIS_VIM% --version' + - '%THEMIS_VIM% -Nu test/vimrc -c "Vader! test/**"' build: off deploy: off From ba1b9179f3080bcda90ef3ec182359ec06e4f85b Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sun, 22 Oct 2017 21:51:08 +0800 Subject: [PATCH 18/28] Enable cache --- appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/appveyor.yml b/appveyor.yml index 72f385296..7be281a93 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,5 +1,6 @@ version: '{build}' clone_depth: 1 +cache: C:\Users\appveyor\.cache\vimfiles environment: matrix: - CONDITION: Official latest-32 From 7a1ea156c78ce35e887258208a2bc8600373d63b Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sun, 22 Oct 2017 22:03:31 +0800 Subject: [PATCH 19/28] Clone dein --- appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/appveyor.yml b/appveyor.yml index 7be281a93..bc06d74a9 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -17,6 +17,7 @@ install: - '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 From 30cff2d56907f533f1d90307917dad1f3b6b1275 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sun, 22 Oct 2017 22:14:36 +0800 Subject: [PATCH 20/28] Update appveyor --- appveyor.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index bc06d74a9..6889ea8e4 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -4,16 +4,11 @@ cache: C:\Users\appveyor\.cache\vimfiles environment: matrix: - CONDITION: Official latest-32 - - CONDITION: Official 8.0.0069-32 - - CONDITION: Kaoriya latest-32 - - CONDITION: Kaoriya latest-64 - - CONDITION: Kaoriya 8.0.0082-32 - - CONDITION: Kaoriya 8.0.0082-64 - CONDITION: Neovim latest-32 - CONDITION: Neovim latest-64 - - CONDITION: Neovim 0.2.0-32 - - CONDITION: Neovim 0.2.0-64 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' From e7352fac712bbe53e6faee69529491a0ab39cb97 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sun, 22 Oct 2017 22:25:12 +0800 Subject: [PATCH 21/28] Update vim#buffer api --- appveyor.yml | 2 -- autoload/SpaceVim/api/vim/buffer.vim | 6 +++++- doc/SpaceVim.txt | 10 +++++++--- test/api/unicode/box.vader | 1 + 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 6889ea8e4..d4b37f0fa 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -4,8 +4,6 @@ cache: C:\Users\appveyor\.cache\vimfiles environment: matrix: - CONDITION: Official latest-32 - - CONDITION: Neovim latest-32 - - CONDITION: Neovim latest-64 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' diff --git a/autoload/SpaceVim/api/vim/buffer.vim b/autoload/SpaceVim/api/vim/buffer.vim index 4dcfbe5e9..48759a1f7 100644 --- a/autoload/SpaceVim/api/vim/buffer.vim +++ b/autoload/SpaceVim/api/vim/buffer.vim @@ -76,7 +76,11 @@ 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 - else + 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 endif endfunction diff --git a/doc/SpaceVim.txt b/doc/SpaceVim.txt index 7a4161443..b16bc89ab 100644 --- a/doc/SpaceVim.txt +++ b/doc/SpaceVim.txt @@ -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: @@ -313,9 +320,6 @@ Set SpaceVim windows index type, default is 0. *g:spacevim_enable_tabline_filetype_icon* Enable/Disable tabline filetype icon. default is 0. - *g:spacevim_enable_statusline_display_mode* -Enable/Disable statusline display mode. default is 0. - *g:spacevim_enable_os_fileformat_icon* Enable/Disable os fileformat icon. default is 0. diff --git a/test/api/unicode/box.vader b/test/api/unicode/box.vader index 0cce8f40f..97fcc82f6 100644 --- a/test/api/unicode/box.vader +++ b/test/api/unicode/box.vader @@ -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 │', '╰─────┴─────┴─────╯'] From 21755a25ee36de89c6223bdda13b0a38ad0fd983 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sun, 22 Oct 2017 22:31:59 +0800 Subject: [PATCH 22/28] Skip job test in windows --- test/api/job.vader | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/api/job.vader b/test/api/job.vader index 295a4b1c7..b94b2fcce 100644 --- a/test/api/job.vader +++ b/test/api/job.vader @@ -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 = '' From 73d0fb28b028bcdb4d095e4b511ebee7ea9ab0fc Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sun, 22 Oct 2017 22:37:44 +0800 Subject: [PATCH 23/28] Add log --- test/api/vim/buffer.vader | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/api/vim/buffer.vader b/test/api/vim/buffer.vader index 5bd1cc405..b415b871f 100644 --- a/test/api/vim/buffer.vader +++ b/test/api/vim/buffer.vader @@ -6,6 +6,8 @@ Execute ( SpaceVim api: vim#buffer open ): AssertEqual &buftype, 'nofile' Execute ( SpaceVim api: vim#buffer buf_set_lines): + Log "setbuflin: " . exist('*setbufline') + Log "has py: " . has('python') new let buffer = SpaceVim#api#import('vim#buffer') let nr = bufnr('%') From 707a65f9be49c25e72eddae239f6943eb257815e Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sun, 22 Oct 2017 22:40:04 +0800 Subject: [PATCH 24/28] Fix unkown func --- test/api/vim/buffer.vader | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/api/vim/buffer.vader b/test/api/vim/buffer.vader index b415b871f..a06c67c6f 100644 --- a/test/api/vim/buffer.vader +++ b/test/api/vim/buffer.vader @@ -6,7 +6,7 @@ Execute ( SpaceVim api: vim#buffer open ): AssertEqual &buftype, 'nofile' Execute ( SpaceVim api: vim#buffer buf_set_lines): - Log "setbuflin: " . exist('*setbufline') + Log "setbuflin: " . exists('*setbufline') Log "has py: " . has('python') new let buffer = SpaceVim#api#import('vim#buffer') From 782cbefa3546a8d5a124d8ee3bc66cfa622190cf Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sun, 22 Oct 2017 22:45:16 +0800 Subject: [PATCH 25/28] Fix old version vim --- autoload/SpaceVim/api/vim/buffer.vim | 3 +++ 1 file changed, 3 insertions(+) diff --git a/autoload/SpaceVim/api/vim/buffer.vim b/autoload/SpaceVim/api/vim/buffer.vim index 48759a1f7..fd5d27e40 100644 --- a/autoload/SpaceVim/api/vim/buffer.vim +++ b/autoload/SpaceVim/api/vim/buffer.vim @@ -81,6 +81,9 @@ function! s:self.buf_set_lines(buffer, start, end, strict_indexing, replacement) 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, a:replacement) endif endfunction From 05abdf2d4a5a3479c92f4e28be9d4c2c86fdebc3 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sun, 22 Oct 2017 22:50:28 +0800 Subject: [PATCH 26/28] Add test --- autoload/SpaceVim/api/vim/buffer.vim | 2 +- test/api/vim/buffer.vader | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/autoload/SpaceVim/api/vim/buffer.vim b/autoload/SpaceVim/api/vim/buffer.vim index fd5d27e40..3be0a852f 100644 --- a/autoload/SpaceVim/api/vim/buffer.vim +++ b/autoload/SpaceVim/api/vim/buffer.vim @@ -83,7 +83,7 @@ function! s:self.buf_set_lines(buffer, start, end, strict_indexing, replacement) endfor else exe 'b' . a:buffer - call setline(a:start, a:replacement) + call setline(a:start - 1, a:replacement) endif endfunction diff --git a/test/api/vim/buffer.vader b/test/api/vim/buffer.vader index a06c67c6f..7ad5d4782 100644 --- a/test/api/vim/buffer.vader +++ b/test/api/vim/buffer.vader @@ -8,9 +8,12 @@ Execute ( SpaceVim api: vim#buffer open ): Execute ( SpaceVim api: vim#buffer buf_set_lines): Log "setbuflin: " . exists('*setbufline') Log "has py: " . has('python') - new + Log "has py3: " . has('python3') let buffer = SpaceVim#api#import('vim#buffer') + new let nr = bufnr('%') new + let cb = bufnr('%') call buffer.buf_set_lines(nr, 0, 1, 0, ['line 1', 'line 2', 'line 3']) AssertEqual getbufline(nr, 1, '$'), ['line 1', 'line 2', 'line 3'] + Log getbufline(cb, 1, '$') From 7ab778dbbe908b3d9a6d2bedde7d9c252a7e8f10 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sun, 22 Oct 2017 22:55:06 +0800 Subject: [PATCH 27/28] Skip windows test for vim#buffer api --- test/api/vim/buffer.vader | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/test/api/vim/buffer.vader b/test/api/vim/buffer.vader index 7ad5d4782..2e18c03fc 100644 --- a/test/api/vim/buffer.vader +++ b/test/api/vim/buffer.vader @@ -6,14 +6,13 @@ Execute ( SpaceVim api: vim#buffer open ): AssertEqual &buftype, 'nofile' Execute ( SpaceVim api: vim#buffer buf_set_lines): - Log "setbuflin: " . exists('*setbufline') - Log "has py: " . has('python') - Log "has py3: " . has('python3') let buffer = SpaceVim#api#import('vim#buffer') + let os = SpaceVim#api#import('system') + if os.isWindows + finish + endif new let nr = bufnr('%') new - let cb = bufnr('%') call buffer.buf_set_lines(nr, 0, 1, 0, ['line 1', 'line 2', 'line 3']) AssertEqual getbufline(nr, 1, '$'), ['line 1', 'line 2', 'line 3'] - Log getbufline(cb, 1, '$') From d491697c58151f0fbdabf52756675332e1a896b2 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sun, 22 Oct 2017 22:57:23 +0800 Subject: [PATCH 28/28] Disable cache --- appveyor.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index d4b37f0fa..65db75871 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,6 +1,5 @@ version: '{build}' clone_depth: 1 -cache: C:\Users\appveyor\.cache\vimfiles environment: matrix: - CONDITION: Official latest-32