1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-03 12:10:05 +08:00

Merge branch 'dev' into lang/ruby

This commit is contained in:
Wang Shidong 2017-10-08 06:17:11 -05:00 committed by GitHub
commit 918e41c81b
36 changed files with 809 additions and 321 deletions

9
.editorconfig Normal file
View File

@ -0,0 +1,9 @@
root = true
[*.vim]
indent_style = space
indent_size = 2
end_of_line = 1f
insert_final_newline = true
charset = utf_8

1
.gitignore vendored
View File

@ -24,3 +24,4 @@ cscope.files
cscope.out cscope.out
cscope.in.out cscope.in.out
cscope.po.out cscope.po.out
build/

View File

@ -27,39 +27,36 @@ matrix:
install: install:
- | - |
set -e
if [ "${LINT#vimlint}" != "$LINT" ]; then if [ "${LINT#vimlint}" != "$LINT" ]; then
git clone --depth=1 https://github.com/syngan/vim-vimlint /tmp/vimlint git clone --depth=1 https://github.com/syngan/vim-vimlint /tmp/vimlint
git clone --depth=1 https://github.com/ynkdir/vim-vimlparser /tmp/vimlparser git clone --depth=1 https://github.com/ynkdir/vim-vimlparser /tmp/vimlparser
elif [ "${LINT#vint}" != "$LINT" ]; then elif [ "${LINT#vint}" != "$LINT" ]; then
virtualenv /tmp/vint && source /tmp/vint/bin/activate && pip install vim-vint virtualenv /tmp/vint && source /tmp/vint/bin/activate && pip install vim-vint
elif [ "${LINT#vader}" != "$LINT" ]; then elif [ "${LINT#vader}" != "$LINT" ]; then
git clone https://github.com/junegunn/vader.vim.git /tmp/vader
C_OPTS="--prefix=$DEPS --with-features=huge --disable-gui --enable-pythoninterp" C_OPTS="--prefix=$DEPS --with-features=huge --disable-gui --enable-pythoninterp"
git clone --depth 1 https://github.com/vim/vim (git clone --depth 1 https://github.com/vim/vim /tmp/vim &&
cd vim cd /tmp/vim &&
./configure $C_OPTS ./configure $C_OPTS &&
make make install)
make install
cd -
fi fi
script: script:
- | - |
set -ex
if [ "$LINT" = "vimlint" ]; then if [ "$LINT" = "vimlint" ]; then
sh /tmp/vimlint/bin/vimlint.sh -l /tmp/vimlint -p /tmp/vimlparser ./config for file in $(find . -name "*.vim");
sh /tmp/vimlint/bin/vimlint.sh -l /tmp/vimlint -p /tmp/vimlparser ./autoload do
sh /tmp/vimlint/bin/vimlint.sh -l /tmp/vimlint -p /tmp/vimlparser ./ftplugin sh /tmp/vimlint/bin/vimlint.sh -l /tmp/vimlint -p /tmp/vimlparser $file;
sh /tmp/vimlint/bin/vimlint.sh -l /tmp/vimlint -p /tmp/vimlparser ./syntax done
sh /tmp/vimlint/bin/vimlint.sh -l /tmp/vimlint -p /tmp/vimlparser ./mode
elif [ "$LINT" = "vimlint-errors" ]; then elif [ "$LINT" = "vimlint-errors" ]; then
sh /tmp/vimlint/bin/vimlint.sh -E -l /tmp/vimlint -p /tmp/vimlparser ./config for file in $(find . -name "*.vim");
sh /tmp/vimlint/bin/vimlint.sh -E -l /tmp/vimlint -p /tmp/vimlparser ./autoload do
sh /tmp/vimlint/bin/vimlint.sh -E -l /tmp/vimlint -p /tmp/vimlparser ./ftplugin sh /tmp/vimlint/bin/vimlint.sh -E -l /tmp/vimlint -p /tmp/vimlparser $file;
sh /tmp/vimlint/bin/vimlint.sh -E -l /tmp/vimlint -p /tmp/vimlparser ./syntax done
sh /tmp/vimlint/bin/vimlint.sh -E -l /tmp/vimlint -p /tmp/vimlparser ./mode
elif [ "$LINT" = "vint" ]; then elif [ "$LINT" = "vint" ]; then
vint . vint .
elif [ "$LINT" = "vint-errors" ]; then elif [ "$LINT" = "vint-errors" ]; then
vint --error . vint --error .
elif [ "$LINT" = "vader" ]; then elif [ "$LINT" = "vader" ]; then
vim -Nu test/test.vim -c 'Vader! test/**' make test
fi fi

13
Makefile Normal file
View File

@ -0,0 +1,13 @@
test: build/vader | build
vim -Nu test/vimrc -c 'Vader! test/**'
build/vader:
git clone --depth 1 https://github.com/junegunn/vader.vim.git $@
build:
mkdir -p $@
clean:
$(RM) -r build
.PHONY: clean test

View File

@ -1,32 +1,33 @@
[![SpaceVim](https://spacevim.org/logo.png)](https://spacevim.org) [![SpaceVim](https://spacevim.org/logo.png)](https://spacevim.org)
[Wiki](https://github.com/SpaceVim/SpaceVim/wiki) | [Wiki](https://github.com/SpaceVim/SpaceVim/wiki) \|
[Documentation](http://spacevim.org/documentation/) | [Documentation](http://spacevim.org/documentation/) \|
[Twitter](https://twitter.com/SpaceVim) | [Twitter](https://twitter.com/SpaceVim) \|
[Community](https://spacevim.org/community/) | [Community](https://spacevim.org/community/) \|
[Gitter **Chat**](https://gitter.im/SpaceVim/SpaceVim) | [Gitter **Chat**](https://gitter.im/SpaceVim/SpaceVim) \|
[中文文档](http://spacevim.org/README_zh_cn/) [中文文档](http://spacevim.org/README_zh_cn/)
[![Build Status](https://travis-ci.org/SpaceVim/SpaceVim.svg?branch=dev)](https://travis-ci.org/SpaceVim/SpaceVim) [![Build Status](https://travis-ci.org/SpaceVim/SpaceVim.svg?branch=dev)](https://travis-ci.org/SpaceVim/SpaceVim)
[![codecov](https://codecov.io/gh/SpaceVim/SpaceVim/branch/master/graph/badge.svg)](https://codecov.io/gh/SpaceVim/SpaceVim)
![Version](https://img.shields.io/badge/version-0.5.0--dev-FF00CC.svg) ![Version](https://img.shields.io/badge/version-0.5.0--dev-FF00CC.svg)
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
[![Doc](https://img.shields.io/badge/doc-%3Ah%20SpaceVim-orange.svg)](doc/SpaceVim.txt) [![Doc](https://img.shields.io/badge/doc-%3Ah%20SpaceVim-orange.svg)](doc/SpaceVim.txt)
[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/SpaceVim/SpaceVim.svg)](http://isitmaintained.com/project/SpaceVim/SpaceVim "Average time to resolve an issue") [![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/SpaceVim/SpaceVim.svg)](http://isitmaintained.com/project/SpaceVim/SpaceVim "Average time to resolve an issue")
[![Percentage of issues still open](http://isitmaintained.com/badge/open/SpaceVim/SpaceVim.svg)](http://isitmaintained.com/project/SpaceVim/SpaceVim "Percentage of issues still open") [![Percentage of issues still open](http://isitmaintained.com/badge/open/SpaceVim/SpaceVim.svg)](http://isitmaintained.com/project/SpaceVim/SpaceVim "Percentage of issues still open")
SpaceVim is a community-driven vim distribution that seeks to provide layer feature, especially for neovim. It offers a variety of layers to choose from. to create a suitable vim development environment, you just need to select the required layers. If you use SpaceVim, SpaceVim is a community-driven vim distribution that seeks to provide layer feature, compatible with vim and neoVim. Layers help collect related plugins together to provide features. Also help keep configuration organized and reduces overhead for the user by keeping them from having to think about what plugins to install. star it on github is a great way of getting feedback and gives me the kick to put more time into development.
please star it on github. It's a great way of getting feedback and gives me the kick to
put more time into development.
![welcome-page](https://cloud.githubusercontent.com/assets/13142418/26402270/28ad72b8-40bc-11e7-945e-003f41e057be.png) ![welcome-page](https://cloud.githubusercontent.com/assets/13142418/26402270/28ad72b8-40bc-11e7-945e-003f41e057be.png)
See the [documentation](https://spacevim.org/documentation) or [the list of layers](http://spacevim.org/layers/) for more information. See the [documentation](https://spacevim.org/documentation) or [the list of layers](http://spacevim.org/layers/) for more information.
Here is a throughput graph of the repository for the last few weeks: Here is a throughput graph of the repository for the last few weeks:
[![Throughput Graph](https://graphs.waffle.io/SpaceVim/SpaceVim/throughput.svg)](https://waffle.io/SpaceVim/SpaceVim/metrics/throughput) [![Throughput Graph](https://graphs.waffle.io/SpaceVim/SpaceVim/throughput.svg)](https://waffle.io/SpaceVim/SpaceVim/metrics/throughput)
### Requirements
SpaceVim's basic mode only requests `git` comamnd in your `$PATH`, but if you want to get better user experience, you need to install [nerd-font](https://github.com/ryanoasis/nerd-fonts). And make sure your terminal support [true colors](https://gist.github.com/XVilka/8346728).
### Install ### Install
@ -44,11 +45,11 @@ curl -sLf https://spacevim.org/install.sh | bash -s -- -h
### Features ### Features
- **Great documentation:** access documentation in Vim with - **Great documentation:** access documentation in Vim with <kbd>:h SpaceVim</kbd>.
<kbd>:h SpaceVim</kbd>.
- **Beautiful GUI:** you'll love the awesome UI and its useful features. - **Beautiful GUI:** you'll love the awesome UI and its useful features.
- **Mnemonic key bindings:** all key bindings have mnemonic prefixes. - **Mnemonic key bindings:** all key bindings have mnemonic prefixes.
- **Lazy load plugins:** Lazy-load 90% of plugins with [dein.vim](https://github.com/Shougo/dein.vim) - **Lazy load plugins:** Lazy-load 90% of plugins with [dein.vim](https://github.com/Shougo/dein.vim)
![UI for dein](https://user-images.githubusercontent.com/13142418/31309093-36c01150-abb3-11e7-836c-3ad406bdd71a.gif)
- **Neovim centric:** Dark powered mode of SpaceVim - **Neovim centric:** Dark powered mode of SpaceVim
### Support SpaceVim ### Support SpaceVim
@ -62,6 +63,7 @@ If you want to show your support financially you can buy a drink for the mainta
### Credits & Thanks ### Credits & Thanks
- [![GitHub contributors](https://img.shields.io/github/contributors/SpaceVim/SpaceVim.svg)](https://github.com/SpaceVim/SpaceVim/graphs/contributors) - [![GitHub contributors](https://img.shields.io/github/contributors/SpaceVim/SpaceVim.svg)](https://github.com/SpaceVim/SpaceVim/graphs/contributors)
- [@Gabirel](https://github.com/Gabirel) and his [Hack-SpaceVim](https://github.com/Gabirel/Hack-SpaceVim)
- [vimdoc](https://github.com/google/vimdoc) generate doc file for SpaceVim - [vimdoc](https://github.com/google/vimdoc) generate doc file for SpaceVim
- [Rafael Bodill](https://github.com/rafi) and his vim-config - [Rafael Bodill](https://github.com/rafi) and his vim-config
- [Bailey Ling](https://github.com/bling) and his dotvim - [Bailey Ling](https://github.com/bling) and his dotvim

View File

@ -200,6 +200,9 @@ let g:spacevim_vim_help_language = 'en'
" < " <
let g:spacevim_language = '' let g:spacevim_language = ''
"" ""
" Option for keep the spacevim server ailive
let g:spacevim_keep_server_alive = 1
""
" The colorscheme of SpaceVim. Default is 'gruvbox'. " The colorscheme of SpaceVim. Default is 'gruvbox'.
let g:spacevim_colorscheme = 'gruvbox' let g:spacevim_colorscheme = 'gruvbox'
"" ""
@ -345,7 +348,7 @@ let g:spacevim_enable_vimfiler_gitstatus = 0
" Enable/Disable filetypeicon colum in vimfiler buffer, default is 0. " Enable/Disable filetypeicon colum in vimfiler buffer, default is 0.
let g:spacevim_enable_vimfiler_filetypeicon = 0 let g:spacevim_enable_vimfiler_filetypeicon = 0
let g:spacevim_smartcloseignorewin = ['__Tagbar__' , 'vimfiler:default'] let g:spacevim_smartcloseignorewin = ['__Tagbar__' , 'vimfiler:default']
let g:spacevim_smartcloseignoreft = ['help', 'tagbar', 'vimfiler'] let g:spacevim_smartcloseignoreft = ['help', 'tagbar', 'vimfiler', 'SpaceVimRunner']
let g:spacevim_altmoveignoreft = ['Tagbar' , 'vimfiler'] let g:spacevim_altmoveignoreft = ['Tagbar' , 'vimfiler']
let g:spacevim_enable_javacomplete2_py = 0 let g:spacevim_enable_javacomplete2_py = 0
let g:spacevim_src_root = 'E:\sources\' let g:spacevim_src_root = 'E:\sources\'
@ -467,6 +470,10 @@ endfunction
function! SpaceVim#end() abort function! SpaceVim#end() abort
if g:spacevim_keep_server_alive
call SpaceVim#server#export_server()
endif
if !empty(g:spacevim_windows_leader) if !empty(g:spacevim_windows_leader)
call SpaceVim#mapping#leader#defindWindowsLeader(g:spacevim_windows_leader) call SpaceVim#mapping#leader#defindWindowsLeader(g:spacevim_windows_leader)
endif endif

View File

@ -1,5 +1,5 @@
function! SpaceVim#api#job#get() abort function! SpaceVim#api#job#get() abort
return deepcopy(s:self) return deepcopy(s:self)
endfunction endfunction
" make vim and neovim use same job func. " make vim and neovim use same job func.
@ -9,195 +9,220 @@ 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_job = !has('nvim') && has('job') && has('patch-8.0.0027')
let s:self.vim_co = SpaceVim#api#import('vim#compatible') let s:self.vim_co = SpaceVim#api#import('vim#compatible')
if !s:self.nvim_job && !s:self.vim_job
augroup SpaceVim_job
au!
au! User SpaceVim_job_stdout nested call call(s:self.opts.on_stdout, s:self.job_argv)
au! User SpaceVim_job_stderr nested call call(s:self.opts.on_stderr, s:self.job_argv)
au! User SpaceVim_job_exit nested call call(s:self.opts.on_exit, s:self.job_argv)
augroup ENd
endif
function! s:self.warn(...) abort function! s:self.warn(...) abort
if len(a:000) == 0 if len(a:000) == 0
echohl WarningMsg | echom 'Current version do not support job feature, fallback to sync system()' | echohl None echohl WarningMsg | echom 'Current version do not support job feature, fallback to sync system()' | echohl None
elseif len(a:000) == 1 && type(a:1) == type('') elseif len(a:000) == 1 && type(a:1) == type('')
echohl WarningMsg | echom a:1| echohl None echohl WarningMsg | echom a:1| echohl None
else else
endif endif
endfunction endfunction
function! s:self.warp(argv, opts) abort function! s:self.warp(argv, opts) abort
let obj = {} let obj = {}
let obj._argv = a:argv let obj._argv = a:argv
let obj._opts = a:opts let obj._opts = a:opts
let obj.in_io = get(a:opts, 'in_io', 'pipe') let obj.in_io = get(a:opts, 'in_io', 'pipe')
" @vimlint(EVL103, 1, a:job_id) " @vimlint(EVL103, 1, a:job_id)
function! obj._out_cb(job_id, data) abort function! obj._out_cb(job_id, data) abort
if has_key(self._opts, 'on_stdout') if has_key(self._opts, 'on_stdout')
call self._opts.on_stdout(self._opts.jobpid, [a:data], 'stdout') call self._opts.on_stdout(self._opts.jobpid, [a:data], 'stdout')
endif
endfunction
function! obj._err_cb(job_id, data) abort
if has_key(self._opts, 'on_stderr')
call self._opts.on_stderr(self._opts.jobpid, [a:data], 'stderr')
endif
endfunction
function! obj._exit_cb(job_id, data) abort
if has_key(self._opts, 'on_exit')
call self._opts.on_exit(self._opts.jobpid, a:data, 'exit')
endif
endfunction
" @vimlint(EVL103, 0, a:job_id)
let obj = {
\ 'argv': a:argv,
\ 'opts': {
\ 'mode': 'nl',
\ 'in_io' : obj.in_io,
\ 'out_cb': obj._out_cb,
\ 'err_cb': obj._err_cb,
\ 'exit_cb': obj._exit_cb,
\ }
\ }
if has_key(a:opts, 'cwd')
call extend(obj.opts, {'cwd' : a:opts.cwd})
endif endif
return obj endfunction
function! obj._err_cb(job_id, data) abort
if has_key(self._opts, 'on_stderr')
call self._opts.on_stderr(self._opts.jobpid, [a:data], 'stderr')
endif
endfunction
function! obj._exit_cb(job_id, data) abort
if has_key(self._opts, 'on_exit')
call self._opts.on_exit(self._opts.jobpid, a:data, 'exit')
endif
endfunction
" @vimlint(EVL103, 0, a:job_id)
let obj = {
\ 'argv': a:argv,
\ 'opts': {
\ 'mode': 'nl',
\ 'in_io' : obj.in_io,
\ 'out_cb': obj._out_cb,
\ 'err_cb': obj._err_cb,
\ 'exit_cb': obj._exit_cb,
\ }
\ }
if has_key(a:opts, 'cwd')
call extend(obj.opts, {'cwd' : a:opts.cwd})
endif
return obj
endfunction endfunction
" start a job, and return the job_id. " start a job, and return the job_id.
function! s:self.start(argv, ...) abort function! s:self.start(argv, ...) abort
if self.nvim_job if self.nvim_job
if len(a:000) > 0 if len(a:000) > 0
let job = jobstart(a:argv, a:1) let job = jobstart(a:argv, a:1)
else
let job = jobstart(a:argv)
endi
if job > 0
let msg = ['process '. jobpid(job), ' run']
call extend(self.jobs, {job : msg})
endif
return job
elseif self.vim_job
if len(a:000) > 0
let opts = a:1
else
let opts = {}
endif
let id = len(self.jobs) + 1
let opts.jobpid = id
let wrapped = self.warp(a:argv, opts)
if has_key(wrapped.opts, 'cwd')
let old_wd = getcwd()
let cwd = expand(wrapped.opts.cwd, 1)
" Avoid error E475: Invalid argument: cwd
call remove(wrapped.opts, 'cwd')
exe 'cd' fnameescape(cwd)
endif
let job = job_start(wrapped.argv, wrapped.opts)
if exists('old_wd')
exe 'cd' fnameescape(old_wd)
endif
call extend(self.jobs, {id : job})
return id
else else
if len(a:000) > 0 let job = jobstart(a:argv)
let opts = a:1 endi
else if job > 0
let opts = {} let msg = ['process '. jobpid(job), ' run']
endif call extend(self.jobs, {job : msg})
if has_key(opts, 'cwd')
let old_wd = getcwd()
let cwd = expand(opts.cwd, 1)
exe 'cd' fnameescape(cwd)
endif
let output = self.vim_co.systemlist(a:argv)
if exists('old_wd')
exe 'cd' fnameescape(old_wd)
endif
let id = -1
if v:shell_error
if has_key(opts,'on_stderr')
call call(opts.on_stderr, [id, output, 'stderr'])
endif
else
if has_key(opts,'on_stdout')
call call(opts.on_stdout, [id, output, 'stdout'])
endif
endif
if has_key(opts,'on_exit')
call call(opts.on_exit, [id, v:shell_error, 'exit'])
endif
return id
endif endif
return job
elseif self.vim_job
if len(a:000) > 0
let opts = a:1
else
let opts = {}
endif
let id = len(self.jobs) + 1
let opts.jobpid = id
let wrapped = self.warp(a:argv, opts)
if has_key(wrapped.opts, 'cwd')
let old_wd = getcwd()
let cwd = expand(wrapped.opts.cwd, 1)
" Avoid error E475: Invalid argument: cwd
call remove(wrapped.opts, 'cwd')
exe 'cd' fnameescape(cwd)
endif
let job = job_start(wrapped.argv, wrapped.opts)
if exists('old_wd')
exe 'cd' fnameescape(old_wd)
endif
call extend(self.jobs, {id : job})
return id
else
if len(a:000) > 0
let opts = a:1
else
let opts = {}
endif
if has_key(opts, 'cwd')
let old_wd = getcwd()
let cwd = expand(opts.cwd, 1)
exe 'cd' fnameescape(cwd)
endif
let output = self.vim_co.systemlist(a:argv)
if exists('old_wd')
exe 'cd' fnameescape(old_wd)
endif
let id = -1
let s:self.opts = opts
if v:shell_error
if has_key(opts,'on_stderr')
let s:self.job_argv = [id, output, 'stderr']
try
doautocmd User SpaceVim_job_stderr
catch
doautocmd User SpaceVim_job_stderr
endtry
endif
else
if has_key(opts,'on_stdout')
let s:self.job_argv = [id, output, 'stdout']
try
doautocmd User SpaceVim_job_stdout
catch
doautocmd User SpaceVim_job_stdout
endtry
endif
endif
if has_key(opts,'on_exit')
let s:self.job_argv = [id, v:shell_error, 'exit']
try
doautocmd User SpaceVim_job_exit
catch
doautocmd User SpaceVim_job_exit
endtry
endif
return id
endif
endfunction endfunction
function! s:self.stop(id) abort function! s:self.stop(id) abort
if self.nvim_job if self.nvim_job
if has_key(self.jobs, a:id) if has_key(self.jobs, a:id)
call jobstop(a:id) call jobstop(a:id)
call remove(self.jobs, a:id) call remove(self.jobs, a:id)
else
call self.warn('No job with such id')
endif
elseif self.vim_job
if has_key(self.jobs, a:id)
call job_stop(get(self.jobs, a:id))
call remove(self.jobs, a:id)
endif
else else
call self.warn() call self.warn('No job with such id')
endif endif
elseif self.vim_job
if has_key(self.jobs, a:id)
call job_stop(get(self.jobs, a:id))
call remove(self.jobs, a:id)
endif
else
call self.warn()
endif
endfunction endfunction
function! s:self.send(id, data) abort function! s:self.send(id, data) abort
if self.nvim_job if self.nvim_job
if has_key(self.jobs, a:id) if has_key(self.jobs, a:id)
if type(a:data) == type('') if type(a:data) == type('')
call jobsend(a:id, [a:data, '']) call jobsend(a:id, [a:data, ''])
else else
call jobsend(a:id, a:data) call jobsend(a:id, a:data)
endif endif
else
call self.warn('No job with such id')
endif
elseif self.vim_job
if has_key(self.jobs, a:id)
let job = get(self.jobs, a:id)
let chanel = job_getchannel(job)
call ch_sendraw(chanel, a:data . "\n")
else
call self.warn('No job with such id')
endif
else else
call self.warn() call self.warn('No job with such id')
endif endif
elseif self.vim_job
if has_key(self.jobs, a:id)
let job = get(self.jobs, a:id)
let chanel = job_getchannel(job)
call ch_sendraw(chanel, a:data . "\n")
else
call self.warn('No job with such id')
endif
else
call self.warn()
endif
endfunction endfunction
function! s:self.status(id) abort function! s:self.status(id) abort
if self.nvim_job if self.nvim_job
if has_key(self.jobs, a:id) if has_key(self.jobs, a:id)
return get(self.jobs, a:id)[1] return get(self.jobs, a:id)[1]
endif
elseif self.vim_job
if has_key(self.jobs, a:id)
return job_status(get(self.jobs, a:id))
endif
else
call self.warn('No job with such id!')
endif endif
elseif self.vim_job
if has_key(self.jobs, a:id)
return job_status(get(self.jobs, a:id))
endif
else
call self.warn('No job with such id!')
endif
endfunction endfunction
function! s:self.list() abort function! s:self.list() abort
return copy(self.jobs) return copy(self.jobs)
endfunction endfunction
function! s:self.info(id) abort function! s:self.info(id) abort
let info = {} let info = {}
if self.nvim_job if self.nvim_job
let info.status = self.status(a:id) let info.status = self.status(a:id)
let info.job_id = a:id let info.job_id = a:id
return info return info
elseif self.vim_job elseif self.vim_job
if has_key(self.jobs, a:id) if has_key(self.jobs, a:id)
return job_info(get(self.jobs, a:id)) return job_info(get(self.jobs, a:id))
else
call self.warn('No job with such id!')
endif
else else
call self.warn() call self.warn('No job with such id!')
endif endif
else
call self.warn()
endif
endfunction endfunction

View File

@ -12,46 +12,75 @@ else
endif endif
function! s:self.open(opts) abort function! s:self.open(opts) abort
let buf = get(a:opts, 'bufname', '') let buf = get(a:opts, 'bufname', '')
let mode = get(a:opts, 'mode', 'vertical topleft split') let mode = get(a:opts, 'mode', 'vertical topleft split')
let Initfunc = get(a:opts, 'initfunc', '') let Initfunc = get(a:opts, 'initfunc', '')
let cmd = get(a:opts, 'cmd', '') let cmd = get(a:opts, 'cmd', '')
if empty(buf) if empty(buf)
exe mode | enew exe mode | enew
else else
exe mode buf exe mode buf
endif endif
if !empty(Initfunc) if !empty(Initfunc)
call call(Initfunc, []) call call(Initfunc, [])
endif endif
if !empty(cmd) if !empty(cmd)
exe cmd exe cmd
endif endif
endfunction endfunction
func! s:self.resize(size, ...) abort func! s:self.resize(size, ...) abort
let cmd = get(a:000, 0, 'vertical') let cmd = get(a:000, 0, 'vertical')
exe cmd 'resize' a:size exe cmd 'resize' a:size
endf endf
function! s:self.listed_buffers() abort function! s:self.listed_buffers() abort
return filter(range(1, bufnr('$')), 'buflisted(v:val)') return filter(range(1, bufnr('$')), 'buflisted(v:val)')
endfunction endfunction
function! s:self.filter_do(expr) abort function! s:self.filter_do(expr) abort
let buffers = range(1, bufnr('$')) let buffers = range(1, bufnr('$'))
for f_expr in a:expr.expr for f_expr in a:expr.expr
let buffers = filter(buffers, f_expr) let buffers = filter(buffers, f_expr)
endfor endfor
for b in buffers for b in buffers
exe printf(a:expr.do, b) exe printf(a:expr.do, b)
endfor endfor
endfunction
" just same as nvim_buf_set_lines
function! s:self.buf_set_lines(buffer, start, end, strict_indexing, replacement) abort
if exists('*nvim_buf_set_lines')
call nvim_buf_set_lines(a:buffer, a:start, a:end, a:strict_indexing, a:replacement)
elseif has('python')
py import vim
py import string
if bufexists(a:buffer)
py bufnr = string.atoi(vim.eval("a:buffer"))
py start_line = string.atoi(vim.eval("a:start"))
py end_line = string.atoi(vim.eval("a:end"))
py lines = vim.eval("a:replacement")
py vim.buffers[bufnr][start_line:end_line] = lines
endif
elseif has('python3')
py3 import vim
py3 import string
if bufexists(a:buffer)
py3 bufnr = string.atoi(vim.eval("a:buffer"))
py3 start_line = string.atoi(vim.eval("a:start"))
py3 end_line = string.atoi(vim.eval("a:end"))
py3 lines = vim.eval("a:replacement")
py3 vim.buffers[bufnr][start_line:end_line] = lines
endif
else
endif
endfunction endfunction
fu! SpaceVim#api#vim#buffer#get() abort fu! SpaceVim#api#vim#buffer#get() abort
return deepcopy(s:self) return deepcopy(s:self)
endf endf

View File

@ -1,7 +1,7 @@
let s:self = {} let s:self = {}
function! s:self.build(left_sections, right_sections, lsep, rsep, hi_a, hi_b, hi_c, hi_z) abort function! s:self.build(left_sections, right_sections, lsep, rsep, fname, hi_a, hi_b, hi_c, hi_z) abort
let l = '%#' . a:hi_a . '#' . a:left_sections[0] let l = '%#' . a:hi_a . '#' . a:left_sections[0]
let l .= '%#' . a:hi_a . '_' . a:hi_b . '#' . a:lsep let l .= '%#' . a:hi_a . '_' . a:hi_b . '#' . a:lsep
let flag = 1 let flag = 1
@ -24,9 +24,9 @@ function! s:self.build(left_sections, right_sections, lsep, rsep, hi_a, hi_b, hi
endif endif
endif endif
if flag == 1 if flag == 1
let l .= '%#' . a:hi_c . '_' . a:hi_z . '#' . a:lsep . '%=' let l .= '%#' . a:hi_c . '_' . a:hi_z . '#' . a:lsep . a:fname . '%='
else else
let l .= '%#' . a:hi_b . '_' . a:hi_z . '#' . a:lsep . '%=' let l .= '%#' . a:hi_b . '_' . a:hi_z . '#' . a:lsep . a:fname . '%='
endif endif
let l .= '%#' . a:hi_b . '_' . a:hi_z . '#' . a:rsep let l .= '%#' . a:hi_b . '_' . a:hi_z . '#' . a:rsep
let flag = 1 let flag = 1

View File

@ -35,6 +35,13 @@ function! SpaceVim#commands#load() abort
command! -nargs=* command! -nargs=*
\ -complete=custom,SpaceVim#commands#complete_plugin \ -complete=custom,SpaceVim#commands#complete_plugin
\ SPUpdate call SpaceVim#commands#update_plugin(<f-args>) \ SPUpdate call SpaceVim#commands#update_plugin(<f-args>)
""
" Command for reinstall plugin, support completion of plugin anme.
command! -nargs=+
\ -complete=custom,SpaceVim#commands#complete_plugin
\ SPReinstall call SpaceVim#commands#reinstall_plugin(<f-args>)
"" ""
" Command for install plugins. " Command for install plugins.
command! -nargs=* SPInstall call SpaceVim#commands#install_plugin(<f-args>) command! -nargs=* SPInstall call SpaceVim#commands#install_plugin(<f-args>)
@ -80,6 +87,14 @@ function! SpaceVim#commands#update_plugin(...) abort
endif endif
endfunction endfunction
function! SpaceVim#commands#reinstall_plugin(...)
if g:spacevim_plugin_manager ==# 'dein'
call SpaceVim#plugins#manager#reinstall(a:000)
elseif g:spacevim_plugin_manager ==# 'neobundle'
elseif g:spacevim_plugin_manager ==# 'vim-plug'
endif
endfunction
function! SpaceVim#commands#install_plugin(...) abort function! SpaceVim#commands#install_plugin(...) abort
if g:spacevim_plugin_manager ==# 'neobundle' if g:spacevim_plugin_manager ==# 'neobundle'
elseif g:spacevim_plugin_manager ==# 'dein' elseif g:spacevim_plugin_manager ==# 'dein'

View File

@ -15,4 +15,9 @@ function! SpaceVim#layers#core#config() abort
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', 'f'], 'CtrlP', 'find files in current project', 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) call SpaceVim#mapping#space#def('nnoremap', ['p', '/'], 'Grepper', 'fuzzy search for text in current project', 1)
call SpaceVim#mapping#space#def('nnoremap', ['q', 'q'], 'qa', 'prompt-kill-vim', 1)
call SpaceVim#mapping#space#def('nnoremap', ['q', 'Q'], 'qa!', 'kill-vim', 1)
call SpaceVim#mapping#space#def('nnoremap', ['q', 'R'], '', 'restart-vim(TODO)', 1)
call SpaceVim#mapping#space#def('nnoremap', ['q', 'r'], '', 'restart-vim-resume-layouts(TODO)', 1)
call SpaceVim#mapping#space#def('nnoremap', ['q', 't'], 'tabclose!', 'kill current tab', 1)
endfunction endfunction

View File

@ -86,6 +86,15 @@ function! s:check_mode() abort
endif endif
endfunction endfunction
" only when there are more than two buffers have same name.
function! s:buffer_name() abort
if get(b:, '_spacevim_statusline_showbfname', 0) == 1
return ' ' . bufname('%')
else
return ''
endif
endfunction
function! s:search_status() abort function! s:search_status() abort
let ct = 0 let ct = 0
let tt = 0 let tt = 0
@ -242,6 +251,8 @@ function! SpaceVim#layers#core#statusline#get(...) abort
return '%#SpaceVim_statusline_a# Transient State %#SpaceVim_statusline_a_SpaceVim_statusline_b#' return '%#SpaceVim_statusline_a# Transient State %#SpaceVim_statusline_a_SpaceVim_statusline_b#'
elseif &filetype ==# 'HelpDescribe' elseif &filetype ==# 'HelpDescribe'
return '%#SpaceVim_statusline_a# HelpDescribe %#SpaceVim_statusline_a_SpaceVim_statusline_b#' return '%#SpaceVim_statusline_a# HelpDescribe %#SpaceVim_statusline_a_SpaceVim_statusline_b#'
elseif &filetype ==# 'SpaceVimRunner'
return '%#SpaceVim_statusline_a# Runner %#SpaceVim_statusline_a_SpaceVim_statusline_b# %{SpaceVim#plugins#runner#status()}'
endif endif
if a:0 > 0 if a:0 > 0
return s:active() return s:active()
@ -285,7 +296,8 @@ function! s:active() abort
if index(s:loaded_sections, 'whitespace') != -1 if index(s:loaded_sections, 'whitespace') != -1
call add(rsec, s:whitespace()) call add(rsec, s:whitespace())
endif endif
return s:STATUSLINE.build(lsec, rsec, s:lsep, s:rsep, let fname = s:buffer_name()
return s:STATUSLINE.build(lsec, rsec, s:lsep, s:rsep, fname,
\ 'SpaceVim_statusline_a', 'SpaceVim_statusline_b', 'SpaceVim_statusline_c', 'SpaceVim_statusline_z') \ 'SpaceVim_statusline_a', 'SpaceVim_statusline_b', 'SpaceVim_statusline_c', 'SpaceVim_statusline_z')
endfunction endfunction
@ -386,7 +398,7 @@ function! SpaceVim#layers#core#statusline#config() abort
\ 'toggle the statuline itself', 1) \ 'toggle the statuline itself', 1)
function! TagbarStatusline(...) abort function! TagbarStatusline(...) abort
let name = (strwidth(a:3) > (g:spacevim_sidebar_width - 15)) ? a:3[:g:spacevim_sidebar_width - 20] . '..' : a:3 let name = (strwidth(a:3) > (g:spacevim_sidebar_width - 15)) ? a:3[:g:spacevim_sidebar_width - 20] . '..' : a:3
return s:STATUSLINE.build([s:winnr(),' Tagbar ', ' ' . name . ' '], [], s:lsep, s:rsep, return s:STATUSLINE.build([s:winnr(),' Tagbar ', ' ' . name . ' '], [], s:lsep, s:rsep, '',
\ 'SpaceVim_statusline_ia', 'SpaceVim_statusline_b', 'SpaceVim_statusline_c', 'SpaceVim_statusline_z') \ 'SpaceVim_statusline_ia', 'SpaceVim_statusline_b', 'SpaceVim_statusline_c', 'SpaceVim_statusline_z')
endfunction endfunction
let g:tagbar_status_func = 'TagbarStatusline' let g:tagbar_status_func = 'TagbarStatusline'
@ -413,17 +425,22 @@ endfunction
" | " |
" +- a:marked : The number of marked files, or a comma separated list of " +- a:marked : The number of marked files, or a comma separated list of
" the marked filenames. " the marked filenames.
" @vimlint(EVL103, 1, a:regex)
" @vimlint(EVL103, 1, a:marked)
function! SpaceVim#layers#core#statusline#ctrlp(focus, byfname, regex, prev, item, next, marked) abort function! SpaceVim#layers#core#statusline#ctrlp(focus, byfname, regex, prev, item, next, marked) abort
return s:STATUSLINE.build([' Ctrlp ', ' ' . a:prev . ' ', ' ' . a:item . ' ', ' ' . a:next . ' '], return s:STATUSLINE.build([' Ctrlp ', ' ' . a:prev . ' ', ' ' . a:item . ' ', ' ' . a:next . ' '],
\ [' ' . a:focus . ' ', ' ' . a:byfname . ' ', ' ' . getcwd() . ' '], s:lsep, s:rsep, \ [' ' . a:focus . ' ', ' ' . a:byfname . ' ', ' ' . getcwd() . ' '], s:lsep, s:rsep, '',
\ 'SpaceVim_statusline_a_bold', 'SpaceVim_statusline_b', 'SpaceVim_statusline_c', 'SpaceVim_statusline_z') \ 'SpaceVim_statusline_a_bold', 'SpaceVim_statusline_b', 'SpaceVim_statusline_c', 'SpaceVim_statusline_z')
endfunction endfunction
" @vimlint(EVL103, 0, a:regex)
" @vimlint(EVL103, 0, a:marked)
" a:str : Either the number of files scanned so far, or a string indicating " a:str : Either the number of files scanned so far, or a string indicating
" the current directory is being scanned with a user_command. " the current directory is being scanned with a user_command.
function! SpaceVim#layers#core#statusline#ctrlp_status(str) abort function! SpaceVim#layers#core#statusline#ctrlp_status(str) abort
return s:STATUSLINE.build([' Ctrlp ', ' ' . a:str . ' '], return s:STATUSLINE.build([' Ctrlp ', ' ' . a:str . ' '],
\ [' ' . getcwd() . ' '], s:lsep, s:rsep, \ [' ' . getcwd() . ' '], s:lsep, s:rsep, '',
\ 'SpaceVim_statusline_a', 'SpaceVim_statusline_b', 'SpaceVim_statusline_c', 'SpaceVim_statusline_z') \ 'SpaceVim_statusline_a', 'SpaceVim_statusline_b', 'SpaceVim_statusline_c', 'SpaceVim_statusline_z')
endfunction endfunction

View File

@ -58,9 +58,20 @@ function! s:tabname(id) abort
endif endif
endfunction endfunction
function! s:need_show_bfname(stack, nr) abort
let dupbufs = filter(a:stack, "fnamemodify(bufname(v:val), ':t') ==# fnamemodify(bufname(a:nr), ':t')")
if len(dupbufs) >= 2
for i in dupbufs
call setbufvar(i, '_spacevim_statusline_showbfname', 1)
endfor
endif
endfunction
function! SpaceVim#layers#core#tabline#get() abort function! SpaceVim#layers#core#tabline#get() abort
let nr = tabpagenr('$') let nr = tabpagenr('$')
let t = '' let t = ''
" the stack should be the bufnr stack of tabline
let stack = []
if nr > 1 if nr > 1
let ct = tabpagenr() let ct = tabpagenr()
if ct == 1 if ct == 1
@ -78,6 +89,8 @@ function! SpaceVim#layers#core#tabline#get() abort
if empty(name) if empty(name)
let name = 'No Name' let name = 'No Name'
endif endif
call add(stack, buflist[winnr - 1])
call s:need_show_bfname(stack, buflist[winnr - 1])
if g:spacevim_buffer_index_type == 3 if g:spacevim_buffer_index_type == 3
let id = s:messletters.index_num(i) let id = s:messletters.index_num(i)
elseif g:spacevim_buffer_index_type == 4 elseif g:spacevim_buffer_index_type == 4
@ -101,7 +114,7 @@ function! SpaceVim#layers#core#tabline#get() abort
endif endif
endfor endfor
let t .= '%=%#SpaceVim_tabline_a_SpaceVim_tabline_b#' . s:rsep let t .= '%=%#SpaceVim_tabline_a_SpaceVim_tabline_b#' . s:rsep
let t .= '%#SpaceVim_tabline_a# Tabs' let t .= '%#SpaceVim_tabline_a# Tabs '
else else
let s:buffers = s:BUFFER.listed_buffers() let s:buffers = s:BUFFER.listed_buffers()
let g:_spacevim_list_buffers = s:buffers let g:_spacevim_list_buffers = s:buffers
@ -123,6 +136,8 @@ function! SpaceVim#layers#core#tabline#get() abort
if empty(name) if empty(name)
let name = 'No Name' let name = 'No Name'
endif endif
call add(stack, i)
call s:need_show_bfname(stack, i)
if g:spacevim_buffer_index_type == 3 if g:spacevim_buffer_index_type == 3
let id = s:messletters.index_num(index(s:buffers, i) + 1) let id = s:messletters.index_num(index(s:buffers, i) + 1)
elseif g:spacevim_buffer_index_type == 4 elseif g:spacevim_buffer_index_type == 4
@ -146,7 +161,7 @@ function! SpaceVim#layers#core#tabline#get() abort
endif endif
endfor endfor
let t .= '%=%#SpaceVim_tabline_a_SpaceVim_tabline_b#' . s:rsep let t .= '%=%#SpaceVim_tabline_a_SpaceVim_tabline_b#' . s:rsep
let t .= '%#SpaceVim_tabline_a# Buffers' let t .= '%#SpaceVim_tabline_a# Buffers '
endif endif
return t return t
endfunction endfunction
@ -173,7 +188,7 @@ endfunction
function! SpaceVim#layers#core#tabline#jump(id) abort function! SpaceVim#layers#core#tabline#jump(id) abort
if len(s:buffers) >= a:id if len(s:buffers) >= a:id
let bid = s:buffers[a:id - 1] let bid = s:buffers[a:id - 1]
exe 'b' . bid exe 'silent b' . bid
endif endif
endfunction endfunction

View File

@ -19,7 +19,7 @@ function! SpaceVim#layers#edit#plugins() abort
\ ['gcmt/wildfire.vim',{'on_map' : '<Plug>(wildfire-'}], \ ['gcmt/wildfire.vim',{'on_map' : '<Plug>(wildfire-'}],
\ ['easymotion/vim-easymotion'], \ ['easymotion/vim-easymotion'],
\ ['haya14busa/vim-easyoperator-line'], \ ['haya14busa/vim-easyoperator-line'],
\ ['editorconfig/editorconfig-vim', { 'on_cmd' : 'EditorConfigReload'}], \ ['editorconfig/editorconfig-vim', { 'merged' : 0}],
\ ['floobits/floobits-neovim', { 'on_cmd' : ['FlooJoinWorkspace','FlooShareDirPublic','FlooShareDirPrivate']}], \ ['floobits/floobits-neovim', { 'on_cmd' : ['FlooJoinWorkspace','FlooShareDirPublic','FlooShareDirPrivate']}],
\ ] \ ]
if executable('fcitx') if executable('fcitx')

View File

@ -138,6 +138,9 @@ function! s:language_specified_mappings() abort
" debug " debug
let g:_spacevim_mappings_space.l.d = {'name' : '+Debug'} let g:_spacevim_mappings_space.l.d = {'name' : '+Debug'}
call SpaceVim#mapping#space#langSPC('nmap', ['l','d', 's'], ':VBGstartJDB', 'start jdb', 0)
call SpaceVim#mapping#space#langSPC('nmap', ['l','d', 't'], 'VBGtoggleBreakpointThisLine', 'toggle breakpoint at this line', 1)
" maven " maven
let g:_spacevim_mappings_space.l.m = {'name' : '+Maven'} let g:_spacevim_mappings_space.l.m = {'name' : '+Maven'}
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','m', 'i'], 'call call(' call SpaceVim#mapping#space#langSPC('nnoremap', ['l','m', 'i'], 'call call('

View File

@ -1,3 +1,12 @@
"=============================================================================
" php.vim --- lang#php layer
" Copyright (c) 2016-2017 Shidong Wang & Contributors
" Author: Shidong Wang < wsdjeg at 163.com >
" URL: https://spacevim.org
" License: MIT license
"=============================================================================
"" ""
" @section lang#php, layer-lang-php " @section lang#php, layer-lang-php
" @parentsection layers " @parentsection layers

View File

@ -8,25 +8,33 @@
" < " <
function! SpaceVim#layers#lang#python#plugins() abort function! SpaceVim#layers#lang#python#plugins() abort
let plugins = [] let plugins = []
" python " python
if has('nvim') if has('nvim')
call add(plugins, ['zchee/deoplete-jedi', { 'on_ft' : 'python'}]) call add(plugins, ['zchee/deoplete-jedi', { 'on_ft' : 'python'}])
else else
call add(plugins, ['davidhalter/jedi-vim', { 'on_ft' : 'python', call add(plugins, ['davidhalter/jedi-vim', { 'on_ft' : 'python',
\ 'if' : has('python') || has('python3')}]) \ 'if' : has('python') || has('python3')}])
endif endif
call add(plugins, ['Vimjas/vim-python-pep8-indent', call add(plugins, ['Vimjas/vim-python-pep8-indent',
\ { 'on_ft' : 'python'}]) \ { 'on_ft' : 'python'}])
return plugins return plugins
endfunction endfunction
function! SpaceVim#layers#lang#python#config() abort function! SpaceVim#layers#lang#python#config() abort
call SpaceVim#plugins#runner#reg_runner('python', 'python %s')
call SpaceVim#layers#edit#add_ft_head_tamplate('python', call SpaceVim#mapping#space#regesit_lang_mappings('python', funcref('s:language_specified_mappings'))
\ ['#!/usr/bin/env python', call SpaceVim#layers#edit#add_ft_head_tamplate('python',
\ '# -*- coding: utf-8 -*-', \ ['#!/usr/bin/env python',
\ ''] \ '# -*- coding: utf-8 -*-',
\ ) \ '']
\ )
endfunction endfunction
function! s:language_specified_mappings() abort
call SpaceVim#mapping#space#langSPC('nmap', ['l','r'],
\ 'call SpaceVim#plugins#runner#open()',
\ 'execute current file', 1)
endfunction

View File

@ -8,7 +8,7 @@
function! SpaceVim#layers#lang#ruby#plugins() abort function! SpaceVim#layers#lang#ruby#plugins() abort
let plugins = [] let plugins = []
call add(plugins, ['vim-ruby/vim-ruby', { 'on_ft' : 'ruby'}])
return plugins return plugins
endfunction endfunction

View File

@ -1,16 +1,37 @@
function! SpaceVim#layers#lang#vim#plugins() abort function! SpaceVim#layers#lang#vim#plugins() abort
let plugins = [ let plugins = [
\ ['syngan/vim-vimlint', { 'on_ft' : 'vim'}], \ ['syngan/vim-vimlint', { 'on_ft' : 'vim'}],
\ ['ynkdir/vim-vimlparser', { 'on_ft' : 'vim'}], \ ['ynkdir/vim-vimlparser', { 'on_ft' : 'vim'}],
\ ['todesking/vint-syntastic', { 'on_ft' : 'vim'}], \ ['todesking/vint-syntastic', { 'on_ft' : 'vim'}],
\ ] \ ]
call add(plugins,['tweekmonster/exception.vim']) call add(plugins,['tweekmonster/exception.vim'])
call add(plugins,['mhinz/vim-lookup']) call add(plugins,['mhinz/vim-lookup'])
call add(plugins,['Shougo/neco-vim', { 'on_event' : 'InsertEnter', 'loadconf_before' : 1}]) call add(plugins,['Shougo/neco-vim', { 'on_event' : 'InsertEnter', 'loadconf_before' : 1}])
call add(plugins,['tweekmonster/helpful.vim', {'on_cmd': 'HelpfulVersion'}]) call add(plugins,['tweekmonster/helpful.vim', {'on_cmd': 'HelpfulVersion'}])
return plugins return plugins
endfunction endfunction
function! SpaceVim#layers#lang#vim#config() abort function! SpaceVim#layers#lang#vim#config() abort
call SpaceVim#mapping#gd#add('vim','lookup#lookup') call SpaceVim#mapping#gd#add('vim','lookup#lookup')
call SpaceVim#mapping#space#regesit_lang_mappings('vim', funcref('s:language_specified_mappings'))
endfunction
function! s:language_specified_mappings() abort
call SpaceVim#mapping#space#langSPC('nmap', ['l','e'], 'call call('
\ . string(function('s:eval_cursor')) . ', [])',
\ 'echo eval under cursor', 1)
call SpaceVim#mapping#space#langSPC('nmap', ['l','v'], 'call call('
\ . string(function('s:helpversion_cursor')) . ', [])',
\ 'echo helpversion under cursor', 1)
endfunction
function! s:eval_cursor() abort
let is_keyword = &iskeyword
set iskeyword+=:
echo expand('<cword>') 'is' eval(expand('<cword>'))
let &iskeyword = is_keyword
endfunction
function! s:helpversion_cursor() abort
exe 'HelpfulVersion' expand('<cword>')
endfunction endfunction

View File

@ -11,9 +11,8 @@ function! SpaceVim#layers#shell#plugins() abort
let plugins = [] let plugins = []
if has('nvim') if has('nvim')
call add(plugins,['Shougo/deol.nvim']) call add(plugins,['Shougo/deol.nvim'])
else
call add(plugins,['Shougo/vimshell.vim', { 'on_cmd':['VimShell']}])
endif endif
call add(plugins,['Shougo/vimshell.vim', { 'on_cmd':['VimShell']}])
return plugins return plugins
endfunction endfunction
@ -33,7 +32,7 @@ function! SpaceVim#layers#shell#config() abort
endfunction endfunction
function! SpaceVim#layers#shell#set_variable(var) abort function! SpaceVim#layers#shell#set_variable(var) abort
let s:default_shell = get(a:var, 'defaut_shell', 'terminal') let s:default_shell = get(a:var, 'default_shell', 'terminal')
let s:default_position = get(a:var, 'default_position', 'top') let s:default_position = get(a:var, 'default_position', 'top')
let s:default_height = get(a:var, 'default_height', 30) let s:default_height = get(a:var, 'default_height', 30)
endfunction endfunction
@ -42,6 +41,7 @@ let s:shell_win_nr = 0
function! s:open_default_shell() abort function! s:open_default_shell() abort
if s:shell_win_nr != 0 && getwinvar(s:shell_win_nr, '&buftype') ==# 'terminal' && &buftype !=# 'terminal' if s:shell_win_nr != 0 && getwinvar(s:shell_win_nr, '&buftype') ==# 'terminal' && &buftype !=# 'terminal'
exe s:shell_win_nr . 'wincmd w' exe s:shell_win_nr . 'wincmd w'
startinsert
return return
endif endif
if &buftype ==# 'terminal' if &buftype ==# 'terminal'
@ -60,14 +60,20 @@ function! s:open_default_shell() abort
exe 'resize ' . lines exe 'resize ' . lines
endif endif
if s:default_shell ==# 'terminal' if s:default_shell ==# 'terminal'
if exists(':te') if exists(':terminal')
exe 'te' if has('nvim')
exe 'terminal'
else
call term_start('bash', {'curwin' : 1, 'term_finish' : 'close'})
endif
let s:shell_win_nr = winnr() let s:shell_win_nr = winnr()
let w:shell_layer_win = 1 let w:shell_layer_win = 1
startinsert
else else
echo ':terminal is not supported in this version' echo ':terminal is not supported in this version'
endif endif
elseif s:default_shell ==# 'VimShell' elseif s:default_shell ==# 'VimShell'
VimShell VimShell
imap <buffer> <C-d> exit<esc><Plug>(vimshell_enter)
endif endif
endfunction endfunction

View File

@ -30,7 +30,7 @@ function! SpaceVim#layers#ui#config() abort
let g:indentLine_fileTypeExclude = ['help', 'startify', 'vimfiler'] let g:indentLine_fileTypeExclude = ['help', 'startify', 'vimfiler']
let g:signify_disable_by_default = 0 let g:signify_disable_by_default = 0
let g:signify_line_highlight = 0 let g:signify_line_highlight = 0
noremap <silent> <F2> :TagbarToggle<CR> noremap <silent> <F2> :silent TagbarToggle<CR>
" Ui toggles " Ui toggles
call SpaceVim#mapping#space#def('nnoremap', ['t', '8'], 'call call(' call SpaceVim#mapping#space#def('nnoremap', ['t', '8'], 'call call('
\ . string(s:_function('s:toggle_fill_column')) . ', [])', \ . string(s:_function('s:toggle_fill_column')) . ', [])',
@ -76,7 +76,7 @@ function! SpaceVim#layers#ui#config() abort
\ 'toggle syntax checker', 1) \ 'toggle syntax checker', 1)
call SpaceVim#mapping#space#def('nnoremap', ['t', 'S'], 'call call(' call SpaceVim#mapping#space#def('nnoremap', ['t', 'S'], 'call call('
\ . string(s:_function('s:toggle_spell_check')) . ', [])', \ . string(s:_function('s:toggle_spell_check')) . ', [])',
\ 'toggle syntax checker', 1) \ 'toggle spell checker', 1)
call SpaceVim#mapping#space#def('nnoremap', ['t', 'w'], 'call call(' call SpaceVim#mapping#space#def('nnoremap', ['t', 'w'], 'call call('
\ . string(s:_function('s:toggle_whitespace')) . ', [])', \ . string(s:_function('s:toggle_whitespace')) . ', [])',
\ 'toggle the whitespace', 1) \ 'toggle the whitespace', 1)
@ -202,9 +202,9 @@ function! s:toggle_syntax_checker() abort
call SpaceVim#layers#core#statusline#toggle_mode('syntax-checking') call SpaceVim#layers#core#statusline#toggle_mode('syntax-checking')
let g:_spacevim_toggle_syntax_flag = g:_spacevim_toggle_syntax_flag * -1 let g:_spacevim_toggle_syntax_flag = g:_spacevim_toggle_syntax_flag * -1
if g:_spacevim_toggle_syntax_flag == 1 if g:_spacevim_toggle_syntax_flag == 1
echo "syntax-checking enabled." echo 'syntax-checking enabled.'
else else
echo "syntax-checking disabled." echo 'syntax-checking disabled.'
endif endif
endfunction endfunction
@ -215,6 +215,11 @@ function! s:toggle_spell_check() abort
let &l:spell = 1 let &l:spell = 1
endif endif
call SpaceVim#layers#core#statusline#toggle_mode('spell-checking') call SpaceVim#layers#core#statusline#toggle_mode('spell-checking')
if &l:spell == 1
echo 'spell-checking enabled.'
else
echo 'spell-checking disabled.'
endif
endfunction endfunction
function! s:toggle_whitespace() abort function! s:toggle_whitespace() abort

View File

@ -401,6 +401,7 @@ function! s:winopen() " {{{
setlocal nocursorline nocursorcolumn colorcolumn= setlocal nocursorline nocursorcolumn colorcolumn=
setlocal winfixwidth winfixheight setlocal winfixwidth winfixheight
call s:updateStatusline() call s:updateStatusline()
call s:toggle_hide_cursor()
endfunction " }}} endfunction " }}}
function! s:updateStatusline() abort function! s:updateStatusline() abort
@ -428,7 +429,16 @@ function! s:guide_help_msg() abort
return substitute(msg,' ', '\\ ', 'g') return substitute(msg,' ', '\\ ', 'g')
endfunction endfunction
let s:t_ve = ''
function! s:toggle_hide_cursor() abort
let t_ve = &t_ve
let &t_ve = s:t_ve
let s:t_ve = t_ve
endfunction
function! s:winclose() " {{{ function! s:winclose() " {{{
call s:toggle_hide_cursor()
noautocmd execute s:gwin.'wincmd w' noautocmd execute s:gwin.'wincmd w'
if s:gwin == winnr() if s:gwin == winnr()
noautocmd close noautocmd close

View File

@ -1,15 +1,9 @@
let s:file = expand('<sfile>:~') let s:file = expand('<sfile>:~')
function! SpaceVim#mapping#space#init() abort function! SpaceVim#mapping#space#init() abort
if s:has_map_to_spc()
return
endif
nnoremap <silent><nowait> [SPC] :<c-u>LeaderGuide " "<CR>
vnoremap <silent><nowait> [SPC] :<c-u>LeaderGuideVisual " "<CR>
nmap <Space> [SPC]
vmap <Space> [SPC]
let g:_spacevim_mappings_space = {} let g:_spacevim_mappings_space = {}
let g:_spacevim_mappings_prefixs['[SPC]'] = {'name' : '+SPC prefix'} let g:_spacevim_mappings_prefixs['[SPC]'] = {'name' : '+SPC prefix'}
let g:_spacevim_mappings_space['?'] = ['Unite menu:CustomKeyMaps -input=[SPC]', 'show mappings'] let g:_spacevim_mappings_space['?'] =
\ ['Unite menu:CustomKeyMaps -input=[SPC]', 'show mappings']
let g:_spacevim_mappings_space.t = {'name' : '+Toggles'} let g:_spacevim_mappings_space.t = {'name' : '+Toggles'}
let g:_spacevim_mappings_space.t.h = {'name' : '+Toggles highlight'} let g:_spacevim_mappings_space.t.h = {'name' : '+Toggles highlight'}
let g:_spacevim_mappings_space.t.m = {'name' : '+modeline'} let g:_spacevim_mappings_space.t.m = {'name' : '+modeline'}
@ -23,12 +17,22 @@ function! SpaceVim#mapping#space#init() abort
let g:_spacevim_mappings_space.w = {'name' : '+Windows'} let g:_spacevim_mappings_space.w = {'name' : '+Windows'}
let g:_spacevim_mappings_space.p = {'name' : '+Projects'} let g:_spacevim_mappings_space.p = {'name' : '+Projects'}
let g:_spacevim_mappings_space.h = {'name' : '+Help'} let g:_spacevim_mappings_space.h = {'name' : '+Help'}
let g:_spacevim_mappings_space.q = {'name' : '+Quit'}
let g:_spacevim_mappings_space.l = {'name' : '+Language Specified'} let g:_spacevim_mappings_space.l = {'name' : '+Language Specified'}
let g:_spacevim_mappings_space.s = {'name' : '+Searching'} let g:_spacevim_mappings_space.s = {'name' : '+Searching'}
let g:_spacevim_mappings_space.r = {'name' : '+Registers/rings/resume'} let g:_spacevim_mappings_space.r = {'name' : '+Registers/rings/resume'}
if s:has_map_to_spc()
return
endif
nnoremap <silent><nowait> [SPC] :<c-u>LeaderGuide " "<CR>
vnoremap <silent><nowait> [SPC] :<c-u>LeaderGuideVisual " "<CR>
nmap <Space> [SPC]
vmap <Space> [SPC]
" Windows " Windows
for i in range(1, 9) for i in range(1, 9)
exe "call SpaceVim#mapping#space#def('nnoremap', [" . i . "], 'call SpaceVim#layers#core#statusline#jump(" . i . ")', 'window " . i . "', 1)" exe "call SpaceVim#mapping#space#def('nnoremap', ["
\ . i . "], 'call SpaceVim#layers#core#statusline#jump("
\ . i . ")', 'window " . i . "', 1)"
endfor endfor
let g:_spacevim_mappings_space.w['<Tab>'] = ['wincmd w', 'alternate-window'] let g:_spacevim_mappings_space.w['<Tab>'] = ['wincmd w', 'alternate-window']
nnoremap <silent> [SPC]w<tab> :wincmd w<cr> nnoremap <silent> [SPC]w<tab> :wincmd w<cr>
@ -37,33 +41,60 @@ function! SpaceVim#mapping#space#init() abort
\ 'call call(' \ 'call call('
\ . string(function('s:windows_layout_toggle')) \ . string(function('s:windows_layout_toggle'))
\ . ', [])', 'windows-layout-toggle', 1) \ . ', [])', 'windows-layout-toggle', 1)
call SpaceVim#mapping#space#def('nnoremap', ['w', 'c'], 'Goyo', 'centered-buffer-mode', 1) call SpaceVim#mapping#space#def('nnoremap', ['w', 'c'],
call SpaceVim#mapping#space#def('nnoremap', ['w', 'C'], 'ChooseWin | Goyo', 'centered-buffer-mode(other windows)', 1) \ 'Goyo', 'centered-buffer-mode', 1)
call SpaceVim#mapping#space#def('nnoremap', ['w', 'd'], 'close', 'delete window', 1) call SpaceVim#mapping#space#def('nnoremap', ['w', 'C'],
call SpaceVim#mapping#space#def('nnoremap', ['w', 'D'], 'ChooseWin | close | wincmd w', 'delete window (other windows)', 1) \ 'ChooseWin | Goyo', 'centered-buffer-mode(other windows)', 1)
call SpaceVim#mapping#space#def('nnoremap', ['w', 'F'], 'tabnew', 'create new tab', 1) call SpaceVim#mapping#space#def('nnoremap', ['w', 'd'],
call SpaceVim#mapping#space#def('nnoremap', ['w', 'h'], 'wincmd h', 'window-left', 1) \ 'close', 'delete window', 1)
call SpaceVim#mapping#space#def('nnoremap', ['w', 'j'], 'wincmd j', 'window-down', 1) call SpaceVim#mapping#space#def('nnoremap', ['w', 'D'],
call SpaceVim#mapping#space#def('nnoremap', ['w', 'k'], 'wincmd k', 'window-up', 1) \ 'ChooseWin | close | wincmd w', 'delete window (other windows)', 1)
call SpaceVim#mapping#space#def('nnoremap', ['w', 'l'], 'wincmd l', 'window-right', 1) call SpaceVim#mapping#space#def('nnoremap', ['w', 'F'],
call SpaceVim#mapping#space#def('nnoremap', ['w', 'H'], 'wincmd H', 'window-far-left', 1) \ 'tabnew', 'create new tab', 1)
call SpaceVim#mapping#space#def('nnoremap', ['w', 'J'], 'wincmd J', 'window-far-down', 1) call SpaceVim#mapping#space#def('nnoremap', ['w', 'h'],
call SpaceVim#mapping#space#def('nnoremap', ['w', 'K'], 'wincmd K', 'window-far-up', 1) \ 'wincmd h', 'window-left', 1)
call SpaceVim#mapping#space#def('nnoremap', ['w', 'L'], 'wincmd L', 'window-far-right', 1) call SpaceVim#mapping#space#def('nnoremap', ['w', 'j'],
call SpaceVim#mapping#space#def('nnoremap', ['w', 'm'], 'only', 'maximize/minimize window', 1) \ 'wincmd j', 'window-down', 1)
call SpaceVim#mapping#space#def('nnoremap', ['w', 'M'], 'ChooseWinSwap', 'swap window', 1) call SpaceVim#mapping#space#def('nnoremap', ['w', 'k'],
call SpaceVim#mapping#space#def('nnoremap', ['w', 'o'], 'tabnext', 'other tabs', 1) \ 'wincmd k', 'window-up', 1)
call SpaceVim#mapping#space#def('nnoremap', ['w', '/'], 'bel vs | wincmd w', 'split-window-right', 1) call SpaceVim#mapping#space#def('nnoremap', ['w', 'l'],
call SpaceVim#mapping#space#def('nnoremap', ['w', 'v'], 'bel vs | wincmd w', 'split-window-right', 1) \ 'wincmd l', 'window-right', 1)
call SpaceVim#mapping#space#def('nnoremap', ['w', '-'], 'bel split | wincmd w', 'split-window-below', 1) call SpaceVim#mapping#space#def('nnoremap', ['w', 'H'],
call SpaceVim#mapping#space#def('nnoremap', ['w', 's'], 'bel split | wincmd w', 'split-window-below', 1) \ 'wincmd H', 'window-far-left', 1)
call SpaceVim#mapping#space#def('nnoremap', ['w', 'S'], 'bel split', 'split-focus-window-below', 1) call SpaceVim#mapping#space#def('nnoremap', ['w', 'J'],
call SpaceVim#mapping#space#def('nnoremap', ['w', '2'], 'silent only | vs | wincmd w', 'layout-double-columns', 1) \ 'wincmd J', 'window-far-down', 1)
call SpaceVim#mapping#space#def('nnoremap', ['w', '3'], 'silent only | vs | vs | wincmd H', 'split-window-below', 1) call SpaceVim#mapping#space#def('nnoremap', ['w', 'K'],
call SpaceVim#mapping#space#def('nnoremap', ['w', 'V'], 'bel vs', 'split-window-right-focus', 1) \ 'wincmd K', 'window-far-up', 1)
call SpaceVim#mapping#space#def('nnoremap', ['w', '='], 'wincmd =', 'balance-windows', 1) call SpaceVim#mapping#space#def('nnoremap', ['w', 'L'],
call SpaceVim#mapping#space#def('nnoremap', ['w', 'w'], 'wincmd w', 'cycle and focus between windows', 1) \ 'wincmd L', 'window-far-right', 1)
call SpaceVim#mapping#space#def('nnoremap', ['w', 'W'], 'ChooseWin', 'select window', 1) call SpaceVim#mapping#space#def('nnoremap', ['w', 'm'],
\ 'only', 'maximize/minimize window', 1)
call SpaceVim#mapping#space#def('nnoremap', ['w', 'M'],
\ 'ChooseWinSwap', 'swap window', 1)
call SpaceVim#mapping#space#def('nnoremap', ['w', 'o'],
\ 'tabnext', 'other tabs', 1)
call SpaceVim#mapping#space#def('nnoremap', ['w', '/'],
\ 'bel vs | wincmd w', 'split-window-right', 1)
call SpaceVim#mapping#space#def('nnoremap', ['w', 'v'],
\ 'bel vs | wincmd w', 'split-window-right', 1)
call SpaceVim#mapping#space#def('nnoremap', ['w', '-'],
\ 'bel split | wincmd w', 'split-window-below', 1)
call SpaceVim#mapping#space#def('nnoremap', ['w', 's'],
\ 'bel split | wincmd w', 'split-window-below', 1)
call SpaceVim#mapping#space#def('nnoremap', ['w', 'S'],
\ 'bel split', 'split-focus-window-below', 1)
call SpaceVim#mapping#space#def('nnoremap', ['w', '2'],
\ 'silent only | vs | wincmd w', 'layout-double-columns', 1)
call SpaceVim#mapping#space#def('nnoremap', ['w', '3'],
\ 'silent only | vs | vs | wincmd H', 'split-window-below', 1)
call SpaceVim#mapping#space#def('nnoremap', ['w', 'V'],
\ 'bel vs', 'split-window-right-focus', 1)
call SpaceVim#mapping#space#def('nnoremap', ['w', '='],
\ 'wincmd =', 'balance-windows', 1)
call SpaceVim#mapping#space#def('nnoremap', ['w', 'w'],
\ 'wincmd w', 'cycle and focus between windows', 1)
call SpaceVim#mapping#space#def('nnoremap', ['w', 'W'],
\ 'ChooseWin', 'select window', 1)
call SpaceVim#mapping#space#def('nnoremap', ['w', 'u'], 'call SpaceVim#plugins#windowsmanager#UndoQuitWin()', 'undo quieted window', 1) call SpaceVim#mapping#space#def('nnoremap', ['w', 'u'], 'call SpaceVim#plugins#windowsmanager#UndoQuitWin()', 'undo quieted window', 1)
call SpaceVim#mapping#space#def('nnoremap', ['w', 'U'], 'call SpaceVim#plugins#windowsmanager#RedoQuitWin()', 'redo quieted window', 1) call SpaceVim#mapping#space#def('nnoremap', ['w', 'U'], 'call SpaceVim#plugins#windowsmanager#RedoQuitWin()', 'redo quieted window', 1)
let s:lnum = expand('<slnum>') + 3 let s:lnum = expand('<slnum>') + 3
@ -416,4 +447,4 @@ function! s:comment_to_line(invert) abort
endif endif
endfunction endfunction
" vim:set et sw=2 cc=80: " vim:set et nowrap sw=2 cc=80:

View File

@ -111,6 +111,12 @@ function! s:get_uninstalled_plugins() abort
return filter(values(dein#get()), '!isdirectory(v:val.path)') return filter(values(dein#get()), '!isdirectory(v:val.path)')
endfunction endfunction
function! SpaceVim#plugins#manager#reinstall(...)
call dein#reinstall(a:1)
endfunction
" @vimlint(EVL102, 1, l:i) " @vimlint(EVL102, 1, l:i)
function! SpaceVim#plugins#manager#install(...) abort function! SpaceVim#plugins#manager#install(...) abort
if !s:JOB.vim_job && !s:JOB.nvim_job if !s:JOB.vim_job && !s:JOB.nvim_job

View File

@ -0,0 +1,113 @@
"=============================================================================
" runner.vim --- code runner for SpaceVim
" Copyright (c) 2016-2017 Shidong Wang & Contributors
" Author: Shidong Wang < wsdjeg at 163.com >
" URL: https://spacevim.org
" License: MIT license
"=============================================================================
let s:JOB = SpaceVim#api#import('job')
let s:BUFFER = SpaceVim#api#import('vim#buffer')
let s:STRING = SpaceVim#api#import('data#string')
let s:runners = {}
let s:bufnr = 0
function! s:open_win() abort
if s:bufnr != 0 && bufexists(s:bufnr)
exe 'bd ' . s:bufnr
endif
botright split __runner__
let lines = &lines * 30 / 100
exe 'resize ' . lines
setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline nospell nonu norelativenumber
set filetype=SpaceVimRunner
nnoremap <silent><buffer> q :call SpaceVim#plugins#runner#close()<cr>
let s:bufnr = bufnr('%')
wincmd p
endfunction
function! s:async_run(runner) abort
let cmd = printf(a:runner, bufname('%'))
let s:start_time = reltime()
let s:job_id = s:JOB.start(cmd,{
\ 'on_stdout' : function('s:on_stdout'),
\ 'on_stderr' : function('s:on_stderr'),
\ 'on_exit' : function('s:on_exit'),
\ })
endfunction
function! s:update_statusline() abort
redrawstatus!
endfunction
function! SpaceVim#plugins#runner#reg_runner(ft, runner) abort
let s:runners[a:ft] = a:runner
endfunction
function! SpaceVim#plugins#runner#open() abort
let s:lines = 0
let s:status = {
\ 'is_running' : 0,
\ 'is_exit' : 0,
\ 'has_errors' : 0,
\ 'exit_code' : 0
\ }
let runner = get(s:runners, &filetype, '')
if !empty(runner)
call s:open_win()
call s:async_run(runner)
call s:update_statusline()
endif
endfunction
" @vimlint(EVL103, 1, a:job_id)
" @vimlint(EVL103, 1, a:data)
" @vimlint(EVL103, 1, a:event)
function! s:on_stdout(job_id, data, event) abort
call s:BUFFER.buf_set_lines(s:bufnr, s:lines , s:lines + 1, 0, a:data)
let s:lines += len(a:data)
call s:update_statusline()
endfunction
function! s:on_stderr(job_id, data, event) abort
let s:status.has_errors = 1
call s:BUFFER.buf_set_lines(s:bufnr, s:lines , s:lines + 1, 0, a:data)
let s:lines += len(a:data)
call s:update_statusline()
endfunction
function! s:on_exit(job_id, data, event) abort
let s:end_time = reltime(s:start_time)
let s:status.is_exit = 1
let s:status.exit_code = a:data
call s:update_statusline()
endfunction
" @vimlint(EVL103, 0, a:job_id)
" @vimlint(EVL103, 0, a:data)
" @vimlint(EVL103, 0, a:event)
function! s:debug_info() abort
return []
endfunction
function! SpaceVim#plugins#runner#status() abort
if s:status.is_running == 1
elseif s:status.is_exit == 1
return 'exit code : ' . s:status.exit_code
\ . ' time: ' . s:STRING.trim(reltimestr(s:end_time))
endif
return ''
endfunction
function! SpaceVim#plugins#runner#close() abort
if s:status.is_exit == 0
call s:JOB.close(s:job_id)
endif
exe 'bd' s:bufnr
endfunction

View File

@ -0,0 +1,41 @@
"=============================================================================
" server.vim --- server manager for SpaceVim
" Copyright (c) 2016-2017 Shidong Wang & Contributors
" Author: Shidong Wang < wsdjeg at 163.com >
" URL: https://spacevim.org
" License: MIT license
"=============================================================================
function! SpaceVim#server#connect()
if empty($SPACEVIM_SERVER_ADDRESS)
let $SPACEVIM_SERVER_ADDRESS = serverlist()[0]
return 0
else
call sockconnect('pipe', $SPACEVIM_SERVER_ADDRESS, {'rpc' : 1})
return 1
endif
endfunction
function! SpaceVim#server#export_server()
call system('export $TEST_SPACEVIM="test"')
endfunction
function! SpaceVim#server#terminate()
endfunction
function! SpaceVim#server#list()
if has('nvim')
return join(serverlist(), "\n")
else
endif
endfunction

View File

@ -1,3 +1,7 @@
if SpaceVim#server#connect()
finish
endif
let g:Config_Main_Home = fnamemodify(expand('<sfile>'), let g:Config_Main_Home = fnamemodify(expand('<sfile>'),
\ ':p:h:gs?\\?'.((has('win16') || has('win32') \ ':p:h:gs?\\?'.((has('win16') || has('win32')
\ || has('win64'))?'\':'/') . '?') \ || has('win64'))?'\':'/') . '?')

View File

@ -69,4 +69,13 @@ inoremap <expr><BS> neocomplete#smart_close_popup()."\<C-h>"
inoremap <expr><C-y> neocomplete#close_popup() inoremap <expr><C-y> neocomplete#close_popup()
inoremap <expr><C-e> neocomplete#cancel_popup() inoremap <expr><C-e> neocomplete#cancel_popup()
" Called once right before you start selecting multiple cursors
function! Multiple_cursors_before()
NeoCompleteLock
endfunction
" Called once only when the multiple selection is canceled (default <Esc>)
function! Multiple_cursors_after()
NeoCompleteUnlock
endfunction
" vim:set et sw=2 cc=80: " vim:set et sw=2 cc=80:

View File

@ -234,6 +234,9 @@ Set the message language of vim. Default is 'en_US.UTF-8'.
let g:spacevim_language = 'en_CA.utf8' let g:spacevim_language = 'en_CA.utf8'
< <
*g:spacevim_keep_server_alive*
Option for keep the spacevim server ailive
*g:spacevim_colorscheme* *g:spacevim_colorscheme*
The colorscheme of SpaceVim. Default is 'gruvbox'. The colorscheme of SpaceVim. Default is 'gruvbox'.
@ -412,6 +415,9 @@ COMMANDS *SpaceVim-commands*
:SPUpdate vim-airline :SPUpdate vim-airline
< <
:SPReinstall *:SPReinstall*
Command for reinstall plugin, support completion of plugin anme.
:SPInstall *:SPInstall* :SPInstall *:SPInstall*
Command for install plugins. Command for install plugins.

View File

@ -407,7 +407,7 @@ Reminder of the color codes for the states:
| Mode | Color | | Mode | Color |
| ------- | ------ | | ------- | ------ |
| Normal | Grey | | Normal | Grey |
| Insert | Blus | | Insert | Blue |
| Visual | Orange | | Visual | Orange |
| Replace | Aqua | | Replace | Aqua |
@ -461,7 +461,7 @@ all the colors based on the current colorscheme
**Statusline separators:** **Statusline separators:**
It is possible to easily customize the statusline separator by setting the `g:spacevim_statusline_separator` variable in your custon configration file and then redraw the statusline. For instance if you want to set back the separator to the well-known arrow separator add the following snippet to your configuration file: It is possible to easily customize the statusline separator by setting the `g:spacevim_statusline_separator` variable in your custom configration file and then redraw the statusline. For instance if you want to set back the separator to the well-known arrow separator add the following snippet to your configuration file:
```vim ```vim
let g:spacevim_statusline_separator = 'arrow' let g:spacevim_statusline_separator = 'arrow'
@ -809,7 +809,7 @@ Buffer manipulation commands (start with `b`):
##### Special Buffers ##### Special Buffers
In SpaceVim, there are many special buffers, these buffers are created by plugins or SpaceVim isself. and all of this buffers are not listed. In SpaceVim, there are many special buffers, these buffers are created by plugins or SpaceVim itself. And these buffers are not listed.
##### Files manipulations key bindings ##### Files manipulations key bindings
@ -969,7 +969,7 @@ after pressing prefix `z` in normal mode, if you do not remember the mappings, y
| `zO` | open folds recursively | | `zO` | open folds recursively |
| `zR` | set `foldlevel` to deepest fold | | `zR` | set `foldlevel` to deepest fold |
| `zW` | mark wrong spelled | | `zW` | mark wrong spelled |
| `zX` | re-apply `foldleve` | | `zX` | re-apply `foldlevel` |
| `z^` | cursor to screen bottom line N | | `z^` | cursor to screen bottom line N |
| `za` | toggle a fold | | `za` | toggle a fold |
| `zb` | redraw, cursor line at bottom | | `zb` | redraw, cursor line at bottom |

37
docs/layers/git.md Normal file
View File

@ -0,0 +1,37 @@
---
title: "SpaceVim git layer"
---
# [SpaceVim Layers:](https://spacevim.org/layers) git
<!-- vim-markdown-toc GFM -->
- [Description](#description)
- [Features](#features)
- [Install](#install)
- [Layer](#layer)
- [Key bindings](#key-bindings)
<!-- vim-markdown-toc -->
## Description
This layers adds extensive support for [git](http://git-scm.com/).
### Features
## Install
### Layer
To use this configuration layer, add `call SpaceVim#layers#load('git')` to your custom configuration file.
## Key bindings
| Key Binding | Description |
| -------------- | ---------------------- |
| `<Leader> g a` | git add current file |
| `<Leader> g A` | git add All files |
| `<Leader> g b` | open git blame window |
| `<Leader> g s` | open git status window |
| `<Leader> g c` | open git commit window |

View File

@ -1,15 +1,27 @@
# [Layers](https://spacevim.org/layers) > lang#php ---
title: "SpaceVim lang#php layer"
---
This layer is for php development. # [SpaceVim Layers:](https://spacevim.org/layers) lang#php
## Install <!-- vim-markdown-toc GFM -->
* [Description](#description)
* [Layer Installation](#layer-installation)
* [Requirement](#requirement)
To include this layer, add `SPLayer 'lang#php'` to your custom configuration file. <!-- vim-markdown-toc -->
## Description
## Requirement This layer adds PHP language support to SpaceVim.
1. [PHP 5.3+](http://php.net/) ## Layer Installation
2. [PCNTL](http://php.net/manual/en/book.pcntl.php) Extension
3. [Msgpack 0.5.7+(for NeoVim)](https://github.com/msgpack/msgpack-php) Extension or [JSON(for Vim 7.4+)](http://php.net/manual/en/intro.json.php) Extension To use this configuration layer, add `SPLayer 'lang#php'` to your custom configuration file.
4. [Composer](https://getcomposer.org/) Project
### Requirement
1. [PHP 5.3+](http://php.net/)
2. [PCNTL](http://php.net/manual/en/book.pcntl.php) Extension
3. [Msgpack 0.5.7+(for NeoVim)](https://github.com/msgpack/msgpack-php) Extension or [JSON(for Vim 7.4+)](http://php.net/manual/en/intro.json.php) Extension
4. [Composer](https://getcomposer.org/) Project

28
docs/layers/lang/vim.md Normal file
View File

@ -0,0 +1,28 @@
---
title: "SpaceVim lang#vim layer"
---
# [SpaceVim Layers:](https://spacevim.org/layers) lang#vim
<!-- vim-markdown-toc GFM -->
- [Description](#description)
- [Layer Installation](#layer-installation)
- [Key bindings](#key-bindings)
<!-- vim-markdown-toc -->
## Description
This layer is for vim plugin development.
## Layer Installation
To use this configuration layer, add `call SpaceVim#layers#load('lang#vim')` to your custom configuration file.
## Key bindings
| Key Binding | Description |
| ----------- | ----------------------------------------- |
| `SPC l e` | print the eval under the cursor |
| `SPC l v` | print the helpfulversion under the cursor |

View File

@ -1,6 +1,14 @@
Execute ( SpaceVim api: vim#buffer ): Execute ( SpaceVim api: vim#buffer open ):
new new
let buffer = SpaceVim#api#import('vim#buffer') let buffer = SpaceVim#api#import('vim#buffer')
call buffer.open({'bufname':'foo', 'cmd' : 'setl buftype=nofile bufhidden=wipe'}) call buffer.open({'bufname':'foo', 'cmd' : 'setl buftype=nofile bufhidden=wipe'})
AssertEqual bufname('%'), 'foo' AssertEqual bufname('%'), 'foo'
AssertEqual &buftype, 'nofile' AssertEqual &buftype, 'nofile'
Execute ( SpaceVim api: vim#buffer buf_set_lines):
new
let buffer = SpaceVim#api#import('vim#buffer')
let nr = bufnr('%')
new
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']

View File

@ -1,4 +0,0 @@
if [ ! -e /tmp/vader ]; then
git clone https://github.com/junegunn/vader.vim.git /tmp/vader
fi
vim -Nu test/test.vim -c 'Vader! test/**'

View File

@ -1,5 +1,5 @@
filetype off filetype off
set rtp+=/tmp/vader set rtp+=build/vader
set rtp+=. set rtp+=.
set rtp+=after set rtp+=after
filetype plugin indent on filetype plugin indent on