diff --git a/.SpaceVim.d/autoload/SpaceVim/dev/layers.vim b/.SpaceVim.d/autoload/SpaceVim/dev/layers.vim
new file mode 100644
index 000000000..3e4a9ef0e
--- /dev/null
+++ b/.SpaceVim.d/autoload/SpaceVim/dev/layers.vim
@@ -0,0 +1,44 @@
+function! SpaceVim#dev#layers#update() abort
+
+ let [start, end] = s:find_position()
+ if start != 0 && end != 0
+ if end - start > 1
+ exe (start + 1) . ',' . (end - 1) . 'delete'
+ endif
+ call append(start, s:generate_content())
+ silent! Neoformat
+ endif
+
+endfunction
+
+function! s:find_position() abort
+ let start = search('^$','bwnc')
+ let end = search('^$','bnwc')
+ return sort([start, end])
+endfunction
+
+function! s:generate_content() abort
+ let content = ['', '## Available layers', '']
+ let content += s:layer_list()
+ return content
+endfunction
+
+function! s:layer_list() abort
+ let layers = SpaceVim#util#globpath('~/.SpaceVim/', "docs/layers/**/*.md")
+ let list = [
+ \ '| Name | Description |',
+ \ '| ---------- | ------------ |'
+ \ ]
+ for layer in layers
+ let name = split(layer, '/docs/layers')[1][:-4] . '/'
+ let url = 'https://spacevim.org/layers' . name
+ let content = readfile(layer)
+ if len(content) > 3
+ let line = '| [' . join(split(name, '/'), '#') . '](' . url . ') | ' . content[2][14:-2] . ' | '
+ else
+ let line = '| [' . join(split(name, '/'), '#') . '](' . url . ') | can not find Description |'
+ endif
+ call add(list, line)
+ endfor
+ return list
+endfunction
diff --git a/.ci/after_failure.sh b/.ci/after_failure.sh
index ca758e464..19cc7786e 100755
--- a/.ci/after_failure.sh
+++ b/.ci/after_failure.sh
@@ -11,8 +11,10 @@ if [ "$TRAVIS_PULL_REQUEST" != "false" ] ; then
git clone https://github.com/wsdjeg/GitHub.vim.git build/GitHub.vim
docker run -it --rm \
-v $PWD/.ci:/.ci \
+ -v $PWD/autoload/SpaceVim/api:/API/autoload/SpaceVim/api \
+ -v $PWD/autoload/SpaceVim/api.vim:/API/autoload/SpaceVim/api.vim \
-v $PWD/build:/build \
- spacevim/vims neovim-stable -u .ci/common/github_commenter.vim
+ spacevim/vims neovim-stable -u /.ci/common/github_commenter.vim
rm build_log
fi
elif [ "$LINT" = "vint-errors" ] ; then
@@ -25,8 +27,10 @@ if [ "$TRAVIS_PULL_REQUEST" != "false" ] ; then
git clone https://github.com/wsdjeg/GitHub.vim.git build/GitHub.vim
docker run -it --rm \
-v $PWD/.ci:/.ci \
+ -v $PWD/autoload/SpaceVim/api:/API/autoload/SpaceVim/api \
+ -v $PWD/autoload/SpaceVim/api.vim:/API/autoload/SpaceVim/api.vim \
-v $PWD/build:/build \
- spacevim/vims neovim-stable -u .ci/common/github_commenter.vim
+ spacevim/vims neovim-stable -u /.ci/common/github_commenter.vim
rm build_log
fi
elif [ "$LINT" = "vader" ] ; then
diff --git a/.ci/after_success.sh b/.ci/after_success.sh
index e69de29bb..91f5dfa2a 100755
--- a/.ci/after_success.sh
+++ b/.ci/after_success.sh
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+
+if [ "$TRAVIS_PULL_REQUEST" != "false" ] ; then
+ if [ "$LINT" = "vimlint-errors" ] ; then
+ VIMLINT_LOG=""
+ git clone https://github.com/wsdjeg/GitHub.vim.git build/GitHub.vim
+ docker run -it --rm \
+ -v $PWD/.ci:/.ci \
+ -v $PWD/autoload/SpaceVim/api:/API/autoload/SpaceVim/api \
+ -v $PWD/autoload/SpaceVim/api.vim:/API/autoload/SpaceVim/api.vim \
+ -v $PWD/build:/build \
+ spacevim/vims neovim-stable -u /.ci/common/github_commenter.vim
+ elif [ "$LINT" = "vint-errors" ] ; then
+ VIMLINT_LOG=""
+ git clone https://github.com/wsdjeg/GitHub.vim.git build/GitHub.vim
+ docker run -it --rm \
+ -v $PWD/.ci:/.ci \
+ -v $PWD/autoload/SpaceVim/api:/API/autoload/SpaceVim/api \
+ -v $PWD/autoload/SpaceVim/api.vim:/API/autoload/SpaceVim/api.vim \
+ -v $PWD/build:/build \
+ spacevim/vims neovim-stable -u /.ci/common/github_commenter.vim
+ elif [ "$LINT" = "vader" ] ; then
+ echo ""
+ fi
+fi
diff --git a/.ci/common/github_commenter.vim b/.ci/common/github_commenter.vim
index 0885e967d..c09cd6fe6 100644
--- a/.ci/common/github_commenter.vim
+++ b/.ci/common/github_commenter.vim
@@ -1,8 +1,8 @@
exe 'set nocp'
-set rtp+=build/GitHub.vim
-so build/GitHub.vim/plugin/github.vim
-so build/GitHub.vim/autoload/github/api/issues.vim
-so build/GitHub.vim/autoload/github/api/util.vim
+set rtp+=/build/GitHub.vim
+set rtp+=/API
+so /build/GitHub.vim/plugin/github.vim
+let s:LIST = SpaceVim#api#import('data#list')
let s:log = filereadable('build_log') ? system('cat build_log') : ''
function! s:update_log(log, summary, new_log) abort
let log = split(a:log, "\n")
@@ -16,8 +16,12 @@ function! s:update_log(log, summary, new_log) abort
let end = i
endif
endfor
- return a:log . "\n" . a:new_log
-
+ if begin != -1 && end != -1
+ return s:LIST.replace(log, begin, end, split(a:new_log, "\n"))
+ else
+ return a:log . "\n" . a:new_log
+ endif
+
endfunction
if !empty(s:log)
if $LINT == 'vader'
@@ -44,5 +48,26 @@ if !empty(s:log)
\ {'body': s:update_log(s:comment.body, s:summary, s:log)}, 'SpaceVimBot', $BOTSECRET)
endif
endif
+else
+ if $LINT == 'vader'
+ let s:summary = $VIM . ' ' . $LINT . ' build log'
+ else
+ let s:summary = $LINT . ' build log'
+ endif
+ let s:log = '' . s:summary . "
\n" . s:log . "\n "
+ let s:comments = github#api#issues#List_comments('SpaceVim', 'SpaceVim',$TRAVIS_PULL_REQUEST ,'')
+ if !empty(s:comments)
+ let s:nr = 0
+ for s:comment in s:comments
+ if s:comment.user.login ==# 'SpaceVimBot'
+ let s:nr = s:comment.id
+ break
+ endif
+ endfor
+ if s:nr != 0
+ call github#api#issues#Edit_comment('SpaceVim','SpaceVim', s:nr,
+ \ {'body': s:update_log(s:comment.body, s:summary, s:log)}, 'SpaceVimBot', $BOTSECRET)
+ endif
+ endif
endif
quit
diff --git a/.ci/script.sh b/.ci/script.sh
index 13ba8ae53..bfc4ea4bb 100755
--- a/.ci/script.sh
+++ b/.ci/script.sh
@@ -12,9 +12,9 @@ elif [ "$LINT" = "vimlint-errors" ]; then
fi
for file in $(git diff --name-only HEAD dev | grep .vim$);
do
- /tmp/vimlint/bin/vimlint.sh -E -l /tmp/vimlint -p /tmp/vimlparser $file >> build_log;
+ /tmp/vimlint/bin/vimlint.sh -E -l /tmp/vimlint -p /tmp/vimlparser $file >> build_log 2>&1;
done
- if [[ -f build_log ]]; then
+ if [[ -s build_log ]]; then
cat build_log
exit 2
fi
diff --git a/README.md b/README.md
index ea50e308b..a608f8928 100644
--- a/README.md
+++ b/README.md
@@ -20,7 +20,7 @@ SpaceVim is a community-driven vim distribution that supports vim and Neovim. S
Please star the project on github - it is a great way to show your appreciation while providing us motivation to continue working on this project. The extra visibility for the project doesn't hurt either!
-![welcome-page](https://cloud.githubusercontent.com/assets/13142418/26402270/28ad72b8-40bc-11e7-945e-003f41e057be.png)
+![welcome-page](https://user-images.githubusercontent.com/13142418/33793078-3446cb6e-dc76-11e7-9998-376a355557a4.png)
See the [documentation](https://spacevim.org/documentation) or [the list of layers](http://spacevim.org/layers/) for more information.
@@ -28,6 +28,20 @@ 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)
+
+
+- [Requirements](#requirements)
+- [Install](#install)
+ - [Linux and macOS](#linux-and-macos)
+ - [Windows](#windows)
+- [Project layout](#project-layout)
+- [Features](#features)
+- [Blogs](#blogs)
+- [Support SpaceVim](#support-spacevim)
+- [Credits & Thanks](#credits--thanks)
+
+
+
### Requirements
At a minimum, SpaceVim requires `git` to be installed. For a better graphical experience, install [nerd-font](https://github.com/ryanoasis/nerd-fonts) and make sure your terminal supports [true colors](https://gist.github.com/XVilka/8346728).
@@ -68,15 +82,25 @@ The easist way is to download [install.cmd](https://spacevim.org/install.cmd) an
- **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.
+- **Beautiful UI:** you'll love the awesome UI and its useful features.
+ ![beautiful UI](https://user-images.githubusercontent.com/13142418/33804722-bc241f50-dd70-11e7-8dd8-b45827c0019c.png)
- **Mnemonic key bindings:** all key bindings have mnemonic prefixes.
![mapping guide](https://user-images.githubusercontent.com/13142418/31550099-c8173ff8-b062-11e7-967e-6378a9c3b467.gif)
-- **Describe key bindings:** use SPC h d k to describe key bindings.
- ![describe key](https://user-images.githubusercontent.com/13142418/32134986-060a3b8a-bc2a-11e7-89a2-3ee4e616bf06.gif)
+- **Describe key bindings:** use SPC h d k to describe key bindings, and find definition of key bindings.
+ ![describe key](https://user-images.githubusercontent.com/13142418/33804739-52dbc498-dd71-11e7-97e5-ed0fa6ec1719.gif)
- **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)
+- **Awesome statusline:** a heavily customized modular statusline.
+ ![statusline](https://user-images.githubusercontent.com/13142418/33804880-b9177142-dd73-11e7-82d5-1780dc27e7e3.png)
- **Neovim centric:** Dark powered mode of SpaceVim
+### Blogs
+
+- [Use Vim as a Java IDE](http://spacevim.org/use-vim-as-a-java-ide/)
+- [An async code runner in SpaceVim](http://spacevim.org/async-code-runner-in-SpaceVim/)
+
+More posts are in the [SpaceVim's Blog](https://spacevim.org/blog/)
+
### Support SpaceVim
The best way to support SpaceVim is to contribute to it either by reporting bugs, helping the community on the Gitter Chat or sending pull requests.
diff --git a/autoload/SpaceVim.vim b/autoload/SpaceVim.vim
index 85fdaf71d..610245ea4 100644
--- a/autoload/SpaceVim.vim
+++ b/autoload/SpaceVim.vim
@@ -98,7 +98,7 @@ let g:spacevim_realtime_leader_guide = 1
" let g:spacevim_enable_key_frequency = 1
" <
let g:spacevim_enable_key_frequency = 0
-if has('python3')
+if has('python3') && SpaceVim#util#haspyxlib('neovim')
""
" Set the autocomplete engine of spacevim, the default logic is:
" >
@@ -195,7 +195,7 @@ let g:spacevim_statusline_inactive_separator = 'arrow'
" \ 'version control info'
" \ ]
" <
-let g:spacevim_statusline_left_sections = ['winnr', 'filename', 'major mode', 'syntax checking', 'minor mode lighters', 'version control info']
+let g:spacevim_statusline_left_sections = ['winnr', 'filename', 'major mode', 'syntax checking', 'minor mode lighters', 'version control info', 'hunks']
""
" Define the right section of statusline in active windows. By default:
" >
@@ -254,11 +254,13 @@ let g:spacevim_warning_symbol = '⚠'
" <
let g:spacevim_info_symbol = '🛈'
""
-" Set the SpaceVim cursor shape in the terminal. Set to 0 to prevent Nvim from
-" changing the cursor shape. Set to 1 to enable non-blinking mode-sensitive
-" cursor (this is the default). Set to 2 to enable blinking mode-sensitive
-" cursor. Host terminal must support the DECSCUSR CSI escape sequence.
-"
+" Set the SpaceVim cursor shape in the terminal.
+" >
+" 0 : to prevent Nvim from changing the cursor shape.
+" 1 : to enable non-blinking mode-sensitive cursor.
+" 2 : to enable blinking mode-sensitive cursor (default).
+" >
+" Host terminal must support the DECSCUSR CSI escape sequence.
" Depending on the terminal emulator, using this option with nvim under
" tmux might require adding the following to ~/.tmux.conf:
" >
@@ -428,7 +430,17 @@ let g:spacevim_enable_vimfiler_gitstatus = 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', 'SpaceVimQuickFix', 'HelpDescribe']
+let g:spacevim_smartcloseignoreft = [
+ \ 'help',
+ \ 'tagbar',
+ \ 'vimfiler',
+ \ 'SpaceVimRunner',
+ \ 'SpaceVimREPL',
+ \ 'SpaceVimQuickFix',
+ \ 'HelpDescribe',
+ \ 'VebuggerShell',
+ \ 'VebuggerTerminal',
+ \ ]
let g:spacevim_altmoveignoreft = ['Tagbar' , 'vimfiler']
let g:spacevim_enable_javacomplete2_py = 0
let g:spacevim_src_root = 'E:\sources\'
@@ -637,6 +649,8 @@ function! SpaceVim#end() abort
set norelativenumber
endif
+ let &shiftwidth = g:spacevim_default_indent
+
if g:spacevim_realtime_leader_guide
nnoremap :LeaderGuide get(g:, 'mapleader', '\')
vnoremap :LeaderGuideVisual get(g:, 'mapleader', '\')
diff --git a/autoload/SpaceVim/api/bash/complete.vim b/autoload/SpaceVim/api/bash/complete.vim
index 816586861..a52f02137 100644
--- a/autoload/SpaceVim/api/bash/complete.vim
+++ b/autoload/SpaceVim/api/bash/complete.vim
@@ -7,7 +7,7 @@ let s:COP = SpaceVim#api#import('vim#compatible')
" this is for vim command completion
function! s:self.complete(ArgLead, CmdLine, CursorPos) abort
- if a:CmdLine =~ '^[^ ]*$'
+ if a:CmdLine =~ '^\s\{0,\}\w\+$'
return s:COP.systemlist('compgen -c ' . a:CmdLine)
endif
let result = s:COP.systemlist([s:completer, a:CmdLine])
@@ -18,7 +18,7 @@ endfunction
" this is for vim input()
function! s:self.complete_input(ArgLead, CmdLine, CursorPos) abort
- if a:CmdLine =~ '^[^ ]*$'
+ if a:CmdLine =~ '^\s\{0,\}\w\+$'
return s:COP.systemlist('compgen -c ' . a:CmdLine)
endif
let result = s:COP.systemlist([s:completer, a:CmdLine])
diff --git a/autoload/SpaceVim/api/data/list.vim b/autoload/SpaceVim/api/data/list.vim
index dfe247a40..888948978 100644
--- a/autoload/SpaceVim/api/data/list.vim
+++ b/autoload/SpaceVim/api/data/list.vim
@@ -10,6 +10,7 @@ function! SpaceVim#api#data#list#get() abort
\ 'has' : '',
\ 'has_index' : '',
\ 'listpart' : '',
+ \ 'replace' : '',
\ },
\ "function('s:' . v:key)"
\ )
@@ -101,4 +102,12 @@ function! s:has_index(list, index) abort
return 0 <= a:index && a:index < len(a:list)
endfunction
+function! s:replace(list, begin, end, re_list)
+ if a:begin <= a:end && a:begin >= 0 && a:end < len(a:list)
+ return a:list[:a:begin - 1] + a:re_list + a:list[a:end + 1:]
+ else
+ return a:list
+ endif
+endf
+
" vim:set et sw=2 cc=80:
diff --git a/autoload/SpaceVim/api/file.vim b/autoload/SpaceVim/api/file.vim
index c97cee22d..688a9b7e3 100644
--- a/autoload/SpaceVim/api/file.vim
+++ b/autoload/SpaceVim/api/file.vim
@@ -28,7 +28,7 @@ let s:file_node_extensions = {
\ 'json' : '',
\ 'js' : '',
\ 'jsx' : '',
- \ 'rb' : '',
+ \ 'rb' : '',
\ 'php' : '',
\ 'py' : '',
\ 'pyc' : '',
diff --git a/autoload/SpaceVim/api/job.vim b/autoload/SpaceVim/api/job.vim
index d07fa4511..026c194c2 100644
--- a/autoload/SpaceVim/api/job.vim
+++ b/autoload/SpaceVim/api/job.vim
@@ -190,7 +190,11 @@ function! s:self.send(id, data) abort
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")
+ if type(a:data) == type('')
+ call ch_sendraw(chanel, a:data . "\n")
+ else
+ call ch_sendraw(chanel, join(a:data, "\n"))
+ endif
else
call self.warn('No job with such id')
endif
diff --git a/autoload/SpaceVim/api/transient_state.vim b/autoload/SpaceVim/api/transient_state.vim
index 10bda30f7..7709cc5b8 100644
--- a/autoload/SpaceVim/api/transient_state.vim
+++ b/autoload/SpaceVim/api/transient_state.vim
@@ -4,217 +4,239 @@ let s:self._keys = {}
let s:self._on_syntax = ''
let s:self._title = 'Transient State'
let s:self._handle_inputs = {}
+let s:self._is_quit = []
function! s:self.open() abort
- noautocmd botright split __transient_state__
- let self._bufid = bufnr('%')
- setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline nospell nonu norelativenumber
- set filetype=TransientState
- " let save_tve = &t_ve
- " setlocal t_ve=
- " setlocal nomodifiable
- " setf SpaceVimFlyGrep
- " let &t_ve = save_tve
- if !empty(self._on_syntax) && type(self._on_syntax) ==# 2
- call call(self._on_syntax, [])
+ noautocmd botright split __transient_state__
+ let self._bufid = bufnr('%')
+ setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline nospell nonu norelativenumber
+ set filetype=TransientState
+ " let save_tve = &t_ve
+ " setlocal t_ve=
+ " setlocal nomodifiable
+ " setf SpaceVimFlyGrep
+ " let &t_ve = save_tve
+ if !empty(self._on_syntax) && type(self._on_syntax) ==# 2
+ call call(self._on_syntax, [])
+ else
+ hi def link SpaceVim_Transient_State_Exit Keyword
+ hi def link SpaceVim_Transient_State_Notexit Number
+ hi def link SpaceVim_Transient_State_Title Title
+ endif
+ call setline(1, self._title)
+ let b:transient_state_title = self._title
+ call append(line('$'), '')
+ call self.highlight_title()
+ call self._update_content()
+ call append(line('$'), '')
+ call append(line('$'), '[KEY] exits state [KEY] will not exit')
+ call self.highlight_keys(1, line('$') - 1, 1, 4)
+ call self.highlight_keys(0, line('$') - 1, 21, 24)
+ if winheight(0) > line('$')
+ exe 'resize ' . line('$')
+ endif
+ " move to prvious window
+ wincmd p
+ while 1
+ redraw!
+ let char = self._getchar()
+ if char ==# "\" || char ==# "\" || char2nr(char) == 128
+ continue
+ endif
+ if !has_key(self._handle_inputs, char)
+ break
else
- hi def link SpaceVim_Transient_State_Exit Keyword
- hi def link SpaceVim_Transient_State_Notexit Number
- hi def link SpaceVim_Transient_State_Title Title
+ if type(self._handle_inputs[char]) == 2
+ call call(self._handle_inputs[char], [])
+ elseif type(self._handle_inputs[char]) == 1
+ exe self._handle_inputs[char]
+ endif
endif
- call setline(1, self._title)
- let b:transient_state_title = self._title
- call append(line('$'), '')
- call self.highlight_title()
- call self._update_content()
- call append(line('$'), '')
- call append(line('$'), '[KEY] exits state [KEY] will not exit')
- call self.highlight_keys(1, line('$') - 1, 1, 4)
- call self.highlight_keys(0, line('$') - 1, 21, 24)
- if winheight(0) > line('$')
- exe 'resize ' . line('$')
+ if index(self._is_quit, char) != -1
+ break
endif
- " move to prvious window
- wincmd p
- while 1
- redraw!
- let char = self._getchar()
- if char ==# "\" || char ==# "\" || char2nr(char) == 128
- continue
- endif
- if !has_key(self._handle_inputs, char)
- break
- else
- if type(self._handle_inputs[char]) == 2
- call call(self._handle_inputs[char], [])
- elseif type(self._handle_inputs[char]) == 1
- exe self._handle_inputs[char]
- endif
- endif
- endwhile
- exe 'bd ' . self._bufid
- doautocmd WinEnter
+ endwhile
+ exe 'bd ' . self._bufid
+ doautocmd WinEnter
endfunction
+
function! s:self._getchar(...) abort
- let ret = call('getchar', a:000)
- return (type(ret) == type(0) ? nr2char(ret) : ret)
+ let ret = call('getchar', a:000)
+ return (type(ret) == type(0) ? nr2char(ret) : ret)
endfunction
function! s:self.defind_keys(dict) abort
- let self._keys = a:dict
+ let self._keys = a:dict
endfunction
function! s:self.set_syntax(func) abort
- let self._on_syntax = a:func
+ let self._on_syntax = a:func
endfunction
function! s:self.set_title(title) abort
- let self._title = a:title
+ let self._title = a:title
endfunction
if has('nvim')
- function! s:self.highlight_keys(exit, line, begin, end) abort
- if a:exit
- call nvim_buf_add_highlight(self._bufid, 0, 'SpaceVim_Transient_State_Exit', a:line, a:begin, a:end)
- else
- call nvim_buf_add_highlight(self._bufid, 0, 'SpaceVim_Transient_State_Notexit', a:line, a:begin, a:end)
- endif
- endfunction
+ function! s:self.highlight_keys(exit, line, begin, end) abort
+ if a:exit
+ call nvim_buf_add_highlight(self._bufid, 0, 'SpaceVim_Transient_State_Exit', a:line, a:begin, a:end)
+ else
+ call nvim_buf_add_highlight(self._bufid, 0, 'SpaceVim_Transient_State_Notexit', a:line, a:begin, a:end)
+ endif
+ endfunction
else
- function! s:self.highlight_keys(exit, line, begin, end) abort
- if a:exit
- call matchaddpos('SpaceVim_Transient_State_Exit', [[a:line + 1, a:begin + 1, a:end - a:begin]])
- else
- call matchaddpos('SpaceVim_Transient_State_Notexit', [[a:line + 1, a:begin + 1, a:end - a:begin]])
- endif
- endfunction
+ function! s:self.highlight_keys(exit, line, begin, end) abort
+ if a:exit
+ call matchaddpos('SpaceVim_Transient_State_Exit', [[a:line + 1, a:begin + 1, a:end - a:begin]])
+ else
+ call matchaddpos('SpaceVim_Transient_State_Notexit', [[a:line + 1, a:begin + 1, a:end - a:begin]])
+ endif
+ endfunction
endif
if has('nvim')
- function! s:self.highlight_title() abort
- call nvim_buf_add_highlight(self._bufid, 0, 'SpaceVim_Transient_State_Title', 0, 0, len(self._title))
- endfunction
+ function! s:self.highlight_title() abort
+ call nvim_buf_add_highlight(self._bufid, 0, 'SpaceVim_Transient_State_Title', 0, 0, len(self._title))
+ endfunction
else
- function! s:self.highlight_title() abort
- call matchaddpos('SpaceVim_Transient_State_Title', [1])
- endfunction
+ function! s:self.highlight_title() abort
+ call matchaddpos('SpaceVim_Transient_State_Title', [1])
+ endfunction
endif
function! s:self._update_content() abort
- if get(self._keys, 'layout', '') == 'vertical split'
- let linenum = max([len(self._keys.right), len(self._keys.left)])
- let left_max_key_len = 0
- for key in self._keys.left
- if type(key.key) == 1 " is a string
- let left_max_key_len = max([len(key.key), left_max_key_len])
- elseif type(key.key) == 3 " is a list
- let left_max_key_len = max([len(join(key.key, '/')), left_max_key_len])
- elseif type(key.key) == 4 " is a dict
- let left_max_key_len = max([len(key.key.name), left_max_key_len])
- endif
- endfor
- let right_max_key_len = 0
- for key in self._keys.right
- if type(key.key) == 1 " is a string
- let right_max_key_len = max([len(key.key), right_max_key_len])
- elseif type(key.key) == 3 " is a list
- let g:wsd = key.key
- let right_max_key_len = max([len(join(key.key, '/')), right_max_key_len])
- elseif type(key.key) == 4 " is a dict
- let right_max_key_len = max([len(key.key.name), right_max_key_len])
- endif
- endfor
- for i in range(linenum)
- let left = get(self._keys.left, i)
- let right = get(self._keys.right, i)
- let line = ''
- if !empty(left)
- if type(left.key) == 1
- let line .= '[' . left.key . '] ' . repeat(' ', left_max_key_len - len(left.key)) . left.desc
- call self.highlight_keys(left.exit, i + 2, 1, 1 + len(left.key))
- if !empty(left.cmd)
- call extend(self._handle_inputs, {left.key : left.cmd})
- elseif !empty(left.func)
- call extend(self._handle_inputs, {left.key : left.func})
- endif
- elseif type(left.key) == 3
- let line .= '[' . join(left.key, '/') . '] '
- let line .= repeat(' ', left_max_key_len - len(join(left.key, '/')))
- let line .= left.desc
- let begin = 1
- for key in left.key
- call self.highlight_keys(left.exit, i + 2, begin, begin + len(key))
- let begin = begin + len(key) + 1
- endfor
- if !empty(left.cmd)
- for key in left.key
- call extend(self._handle_inputs, {key : left.cmd})
- endfor
- elseif !empty(left.func)
- for key in left.key
- call extend(self._handle_inputs, {key : left.func})
- endfor
- endif
- elseif type(left.key) == 4
- let line .= '[' . left.key.name . '] '
- let line .= repeat(' ', left_max_key_len - len(left.key.name))
- let line .= left.desc
- for pos in left.key.pos
- call self.highlight_keys(left.exit, i + 2, pos[0], pos[1])
- endfor
- for handles in left.key.handles
- call extend(self._handle_inputs, {handles[0] : handles[1]})
- endfor
- endif
- endif
- let line .= repeat(' ', 40 - len(line))
- if !empty(right)
- if type(right.key) == 1
- let line .= '[' . right.key . '] ' . repeat(' ', right_max_key_len - len(right.key)) . right.desc
- call self.highlight_keys(right.exit, i + 2, 41, 41 + len(right.key))
- if !empty(right.cmd)
- call extend(self._handle_inputs, {right.key : right.cmd})
- elseif !empty(right.func)
- call extend(self._handle_inputs, {right.key : right.func})
- endif
- elseif type(right.key) == 3
- let line .= '[' . join(right.key, '/') . '] '
- let line .= repeat(' ', right_max_key_len - len(join(right.key, '/')))
- let line .= right.desc
- let begin = 41
- for key in right.key
- call self.highlight_keys(right.exit, i + 2, begin, begin + len(key))
- let begin = begin + len(key) + 1
- endfor
- if !empty(right.cmd)
- for key in right.key
- call extend(self._handle_inputs, {key : right.cmd})
- endfor
- elseif !empty(right.func)
- for key in right.key
- call extend(self._handle_inputs, {key : right.func})
- endfor
- endif
- elseif type(right.key) == 4
- let line .= '[' . right.key.name . '] '
- let line .= repeat(' ', right_max_key_len - len(right.key.name))
- let line .= right.desc
- let begin = 41
- for pos in right.key.pos
- call self.highlight_keys(right.exit, i + 2, begin + pos[0], begin + pos[1])
- endfor
- for handles in right.key.handles
- call extend(self._handle_inputs, {handles[0] : handles[1]})
- endfor
- endif
- endif
- call append(line('$'), line)
- endfor
- endif
+ if get(self._keys, 'layout', '') == 'vertical split'
+ let linenum = max([len(self._keys.right), len(self._keys.left)])
+ let left_max_key_len = 0
+ for key in self._keys.left
+ if type(key.key) == 1 " is a string
+ let left_max_key_len = max([len(key.key), left_max_key_len])
+ elseif type(key.key) == 3 " is a list
+ let left_max_key_len = max([len(join(key.key, '/')), left_max_key_len])
+ elseif type(key.key) == 4 " is a dict
+ let left_max_key_len = max([len(key.key.name), left_max_key_len])
+ endif
+ endfor
+ let right_max_key_len = 0
+ for key in self._keys.right
+ if type(key.key) == 1 " is a string
+ let right_max_key_len = max([len(key.key), right_max_key_len])
+ elseif type(key.key) == 3 " is a list
+ let right_max_key_len = max([len(join(key.key, '/')), right_max_key_len])
+ elseif type(key.key) == 4 " is a dict
+ let right_max_key_len = max([len(key.key.name), right_max_key_len])
+ endif
+ endfor
+ for i in range(linenum)
+ let left = get(self._keys.left, i)
+ let right = get(self._keys.right, i)
+ let line = ''
+ if !empty(left)
+ if type(left.key) == 1
+ let line .= '[' . left.key . '] ' . repeat(' ', left_max_key_len - len(left.key)) . left.desc
+ call self.highlight_keys(left.exit, i + 2, 1, 1 + len(left.key))
+ if !empty(left.cmd)
+ call extend(self._handle_inputs, {left.key : left.cmd})
+ elseif !empty(left.func)
+ call extend(self._handle_inputs, {left.key : left.func})
+ endif
+ if left.exit
+ call add(self._is_quit, left.key)
+ endif
+ elseif type(left.key) == 3
+ let line .= '[' . join(left.key, '/') . '] '
+ let line .= repeat(' ', left_max_key_len - len(join(left.key, '/')))
+ let line .= left.desc
+ let begin = 1
+ for key in left.key
+ call self.highlight_keys(left.exit, i + 2, begin, begin + len(key))
+ let begin = begin + len(key) + 1
+ endfor
+ if !empty(left.cmd)
+ for key in left.key
+ call extend(self._handle_inputs, {key : left.cmd})
+ endfor
+ elseif !empty(left.func)
+ for key in left.key
+ call extend(self._handle_inputs, {key : left.func})
+ endfor
+ endif
+ if left.exit
+ call extend(self._is_quit, left.key)
+ endif
+ elseif type(left.key) == 4
+ let line .= '[' . left.key.name . '] '
+ let line .= repeat(' ', left_max_key_len - len(left.key.name))
+ let line .= left.desc
+ for pos in left.key.pos
+ call self.highlight_keys(left.exit, i + 2, pos[0], pos[1])
+ endfor
+ for handles in left.key.handles
+ call extend(self._handle_inputs, {handles[0] : handles[1]})
+ endfor
+ if left.exit
+ call extend(self._is_quit, keys(left.key))
+ endif
+ endif
+ endif
+ let line .= repeat(' ', 40 - len(line))
+ if !empty(right)
+ if type(right.key) == 1
+ let line .= '[' . right.key . '] ' . repeat(' ', right_max_key_len - len(right.key)) . right.desc
+ call self.highlight_keys(right.exit, i + 2, 41, 41 + len(right.key))
+ if !empty(right.cmd)
+ call extend(self._handle_inputs, {right.key : right.cmd})
+ elseif !empty(right.func)
+ call extend(self._handle_inputs, {right.key : right.func})
+ endif
+ if right.exit
+ call add(self._is_quit, right.key)
+ endif
+ elseif type(right.key) == 3
+ let line .= '[' . join(right.key, '/') . '] '
+ let line .= repeat(' ', right_max_key_len - len(join(right.key, '/')))
+ let line .= right.desc
+ let begin = 41
+ for key in right.key
+ call self.highlight_keys(right.exit, i + 2, begin, begin + len(key))
+ let begin = begin + len(key) + 1
+ endfor
+ if !empty(right.cmd)
+ for key in right.key
+ call extend(self._handle_inputs, {key : right.cmd})
+ endfor
+ elseif !empty(right.func)
+ for key in right.key
+ call extend(self._handle_inputs, {key : right.func})
+ endfor
+ endif
+ if right.exit
+ call extend(self._is_quit, right.key)
+ endif
+ elseif type(right.key) == 4
+ let line .= '[' . right.key.name . '] '
+ let line .= repeat(' ', right_max_key_len - len(right.key.name))
+ let line .= right.desc
+ let begin = 41
+ for pos in right.key.pos
+ call self.highlight_keys(right.exit, i + 2, begin + pos[0], begin + pos[1])
+ endfor
+ for handles in right.key.handles
+ call extend(self._handle_inputs, {handles[0] : handles[1]})
+ endfor
+ if right.exit
+ call extend(self._is_quit, keys(right.key))
+ endif
+ endif
+ endif
+ call append(line('$'), line)
+ endfor
+ endif
endfunction
function! SpaceVim#api#transient_state#get() abort
- return deepcopy(s:self)
+ return deepcopy(s:self)
endfunction
diff --git a/autoload/SpaceVim/api/vim/signatures.vim b/autoload/SpaceVim/api/vim/signatures.vim
new file mode 100644
index 000000000..b8aff723e
--- /dev/null
+++ b/autoload/SpaceVim/api/vim/signatures.vim
@@ -0,0 +1,30 @@
+let s:self = {}
+let s:self.id = []
+function! s:self.info(line, col, message) abort
+ let chars = SpaceVim#api#import('data#string').string2chars(a:message)
+ for index in range(len(chars))
+ call add(self.id, matchaddpos('Conceal', [[a:line, a:col - 1 + index, 1]], 10, -1, {'conceal' : chars[index]}))
+ endfor
+endfunction
+
+
+function! s:self.set_group(group) abort
+ let self.group = a:group
+ exe 'highlight ' . self.group . ' ctermbg=green guibg=green'
+endfunction
+
+call s:self.set_group('SpaceVim_signatures')
+
+function! s:self.clear() abort
+ for id in self.id
+ call matchdelete(id)
+ endfor
+ let self.id = []
+endfunction
+
+
+function! SpaceVim#api#vim#signatures#get()
+
+ return deepcopy(s:self)
+
+endfunction
diff --git a/autoload/SpaceVim/api/vim/statusline.vim b/autoload/SpaceVim/api/vim/statusline.vim
index 019da8572..f09628452 100644
--- a/autoload/SpaceVim/api/vim/statusline.vim
+++ b/autoload/SpaceVim/api/vim/statusline.vim
@@ -1,48 +1,83 @@
let s:self = {}
-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:hi_b . '#' . a:lsep
- let flag = 1
- for sec in filter(a:left_sections[1:], '!empty(v:val)')
- if flag == 1
- let l .= '%#' . a:hi_b . '#' . sec
- let l .= '%#' . a:hi_b . '_' . a:hi_c . '#' . a:lsep
- else
- let l .= '%#' . a:hi_c . '#' . sec
- let l .= '%#' . a:hi_c . '_' . a:hi_b . '#' . a:lsep
- endif
- let flag = flag * -1
- endfor
- let l = l[:len(a:lsep) * -1 - 1]
- if empty(a:right_sections)
- if flag == 1
- return l . '%#' . a:hi_c . '#'
- else
- return l . '%#' . a:hi_b . '#'
- endif
+function! s:self.check_width(len, sec, winwidth) abort
+ return a:len + self.len(a:sec) < a:winwidth
+endfunction
+
+function! s:self.len(sec) abort
+ let str = matchstr(a:sec, '%{.*}')
+ if !empty(str)
+ return len(a:sec) - len(str) + len(eval(str[2:-2])) + 4
+ else
+ return len(a:sec) + 4
+ endif
+endfunction
+
+function! s:self.eval(sec) abort
+ return substitute(a:sec, '%{.*}', '', 'g')
+endfunction
+
+function! s:self.build(left_sections, right_sections, lsep, rsep, fname, hi_a, hi_b, hi_c, hi_z, winwidth) abort
+ let l = '%#' . a:hi_a . '#' . a:left_sections[0]
+ let l .= '%#' . a:hi_a . '_' . a:hi_b . '#' . a:lsep
+ let flag = 1
+ let len = 0
+ for sec in filter(a:left_sections[1:], '!empty(v:val)')
+ if self.check_width(len, sec, a:winwidth)
+ let len += self.len(sec)
+ if flag == 1
+ let l .= '%#' . a:hi_b . '#' . sec
+ let l .= '%#' . a:hi_b . '_' . a:hi_c . '#' . a:lsep
+ else
+ let l .= '%#' . a:hi_c . '#' . sec
+ let l .= '%#' . a:hi_c . '_' . a:hi_b . '#' . a:lsep
+ endif
+ let flag = flag * -1
endif
+ endfor
+ let l = l[:len(a:lsep) * -1 - 1]
+ if empty(a:right_sections)
if flag == 1
- let l .= '%#' . a:hi_c . '_' . a:hi_z . '#' . a:lsep . a:fname . '%='
+ return l . '%#' . a:hi_c . '#'
else
- let l .= '%#' . a:hi_b . '_' . a:hi_z . '#' . a:lsep . a:fname . '%='
+ return l . '%#' . a:hi_b . '#'
endif
- let l .= '%#' . a:hi_b . '_' . a:hi_z . '#' . a:rsep
- let flag = 1
- for sec in filter(a:right_sections, '!empty(v:val)')
- if flag == 1
- let l .= '%#' . a:hi_b . '#' . sec
- let l .= '%#' . a:hi_c . '_' . a:hi_b . '#' . a:rsep
- else
- let l .= '%#' . a:hi_c . '#' . sec
- let l .= '%#' . a:hi_b . '_' . a:hi_c . '#' . a:rsep
- endif
- let flag = flag * -1
- endfor
- return l[:-4]
+ endif
+ if self.check_width(len, a:fname, a:winwidth)
+ let len += self.len(a:fname)
+ if flag == 1
+ let l .= '%#' . a:hi_c . '_' . a:hi_z . '#' . a:lsep . a:fname . '%='
+ else
+ let l .= '%#' . a:hi_b . '_' . a:hi_z . '#' . a:lsep . a:fname . '%='
+ endif
+ else
+ if flag == 1
+ let l .= '%#' . a:hi_c . '_' . a:hi_z . '#' . a:lsep . '%='
+ else
+ let l .= '%#' . a:hi_b . '_' . a:hi_z . '#' . a:lsep . '%='
+ endif
+ endif
+ let l .= '%#' . a:hi_b . '_' . a:hi_z . '#' . a:rsep
+ let flag = 1
+ for sec in filter(a:right_sections, '!empty(v:val)')
+ if self.check_width(len, sec, a:winwidth)
+ let len += self.len(sec)
+ if flag == 1
+ let l .= '%#' . a:hi_b . '#' . sec
+ let l .= '%#' . a:hi_c . '_' . a:hi_b . '#' . a:rsep
+ else
+ let l .= '%#' . a:hi_c . '#' . sec
+ let l .= '%#' . a:hi_b . '_' . a:hi_c . '#' . a:rsep
+ endif
+ let flag = flag * -1
+ endif
+ endfor
+ return l[:-4]
endfunction
function! SpaceVim#api#vim#statusline#get() abort
- return deepcopy(s:self)
+ return deepcopy(s:self)
endfunction
+
+" vim:set et sw=2 cc=80 nowrap:
diff --git a/autoload/SpaceVim/issue.vim b/autoload/SpaceVim/issue.vim
index 4ba569065..812afbcf0 100644
--- a/autoload/SpaceVim/issue.vim
+++ b/autoload/SpaceVim/issue.vim
@@ -45,7 +45,6 @@ function! SpaceVim#issue#new()
\ 'body' : join(getline(1, '$'), "\n"),
\ }
let response = github#api#issues#Create('SpaceVim', 'SpaceVim', username, password, issue)
- let g:wsd = response
if has_key(response, 'html_url')
echo 'Issue created done: ' . response.html_url
else
diff --git a/autoload/SpaceVim/layers/autocomplete.vim b/autoload/SpaceVim/layers/autocomplete.vim
index 802446238..590318b40 100644
--- a/autoload/SpaceVim/layers/autocomplete.vim
+++ b/autoload/SpaceVim/layers/autocomplete.vim
@@ -110,13 +110,23 @@ function! SpaceVim#layers#autocomplete#config() abort
if s:tab_key_behavior ==# 'smart'
if has('patch-7.4.774')
imap SpaceVim#mapping#tab()
- smap
- \ neosnippet#expandable_or_jumpable() ?
- \ "\(neosnippet_expand_or_jump)" :
- \ (complete_parameter#jumpable(1) ?
- \ "\(complete_parameter#goto_next_parameter)" :
- \ "\")
- imap SpaceVim#mapping#shift_tab()
+ if g:spacevim_snippet_engine ==# 'neosnippet'
+ smap
+ \ neosnippet#expandable_or_jumpable() ?
+ \ "\(neosnippet_expand_or_jump)" :
+ \ (complete_parameter#jumpable(1) ?
+ \ "\(complete_parameter#goto_next_parameter)" :
+ \ "\")
+ imap SpaceVim#mapping#shift_tab()
+ elseif g:spacevim_snippet_engine ==# 'ultisnips'
+ imap SpaceVim#mapping#tab()
+ imap SpaceVim#mapping#shift_tab()
+ snoremap
+ \ :call UltiSnips#JumpForwards()
+ snoremap
+ \ :call UltiSnips#JumpBackwards()
+ else
+ endif
else
call SpaceVim#logger#warn('smart tab in autocomplete layer need patch 7.4.774')
endif
diff --git a/autoload/SpaceVim/layers/chat.vim b/autoload/SpaceVim/layers/chat.vim
index 418ef14fb..d4c8d7f59 100644
--- a/autoload/SpaceVim/layers/chat.vim
+++ b/autoload/SpaceVim/layers/chat.vim
@@ -4,7 +4,14 @@ function! SpaceVim#layers#chat#plugins() abort
\ ]
endfunction
+let s:BASE64 = SpaceVim#api#import('data#base64')
function! SpaceVim#layers#chat#config()
+ let g:chatting_server_ip = s:BASE64.decode('NDUuNzYuMTAwLjQ5')
+ let g:chatting_server_port = 8989
+ if !exists('g:chatting_server_lib')
+ let g:chatting_server_lib = '/home/wsdjeg/SpaceVim/Chatting-server/target/Chatting-1.0-SNAPSHOT.jar'
+ endif
call SpaceVim#mapping#space#def('nnoremap', ['a', 'q'], 'call chat#qq#start()', 'Start QQ server', 1)
+ call SpaceVim#mapping#space#def('nnoremap', ['a', 'o'], 'call chat#chatting#OpenMsgWin()', 'open spacevim community', 1)
endfunction
diff --git a/autoload/SpaceVim/layers/checkers.vim b/autoload/SpaceVim/layers/checkers.vim
index e388a0dcc..9d7eb0bd2 100644
--- a/autoload/SpaceVim/layers/checkers.vim
+++ b/autoload/SpaceVim/layers/checkers.vim
@@ -3,6 +3,8 @@
" @parentsection layers
" SpaceVim uses neomake as default syntax checker.
+let s:SIG = SpaceVim#api#import('vim#signatures')
+let s:STRING = SpaceVim#api#import('data#string')
function! SpaceVim#layers#checkers#plugins() abort
let plugins = []
@@ -19,6 +21,9 @@ endfunction
function! SpaceVim#layers#checkers#config() abort
+ let g:neomake_cursormoved_delay = get(g:, 'neomake_cursormoved_delay', 300)
+ let g:ale_echo_delay = get(g:, 'ale_echo_delay', 300)
+
call SpaceVim#mapping#space#def('nnoremap', ['e', 'c'], 'call call('
\ . string(s:_function('s:clear_errors')) . ', [])',
\ 'clear all errors', 1)
@@ -38,14 +43,72 @@ function! SpaceVim#layers#checkers#config() abort
augroup SpaceVim_layer_checker
autocmd!
- if g:spacevim_enable_neomake
- autocmd User NeomakeFinished nested let &l:statusline = SpaceVim#layers#core#statusline#get(1)
+ if g:spacevim_enable_neomake
+ autocmd User NeomakeFinished nested
+ \ let &l:statusline = SpaceVim#layers#core#statusline#get(1)
+
+ " when move cursor, the error message will be shown below current line
+ " after a delay
+ autocmd CursorMoved * call neomake_cursor_move_delay()
+
+ " when switch to Insert mode, stop timer and clear the signature
+ if exists('##CmdLineEnter')
+ autocmd InsertEnter,WinLeave,CmdLineEnter *
+ \ call neomake_signatures_clear()
+ autocmd CmdLineEnter *
+ \ call neomake_signatures_clear() | redraw
+ else
+ autocmd InsertEnter,WinLeave * call neomake_signatures_clear()
+ endif
elseif g:spacevim_enable_ale
- autocmd User ALELint let &l:statusline = SpaceVim#layers#core#statusline#get(1)
+ autocmd User ALELint
+ \ let &l:statusline = SpaceVim#layers#core#statusline#get(1)
endif
augroup END
endfunction
+function! s:neomake_cursor_move_delay() abort
+ call s:neomake_signatures_clear()
+ let s:neomake_cursormoved_timer = timer_start(g:neomake_cursormoved_delay,
+ \ function('s:neomake_signatures_current_error'))
+endfunction
+
+let s:last_echoed_error = ''
+let s:clv = &conceallevel
+function! s:neomake_signatures_current_error(...) abort
+ call s:neomake_signatures_clear()
+ try
+ let message = neomake#GetCurrentErrorMsg()
+ catch /^Vim\%((\a\+)\)\=:E117/
+ let message = ''
+ endtry
+ if empty(message)
+ if exists('s:last_echoed_error')
+ unlet s:last_echoed_error
+ endif
+ return
+ endif
+ if exists('s:last_echoed_error')
+ \ && s:last_echoed_error == message
+ return
+ endif
+ let s:last_echoed_error = message
+ set conceallevel=2
+ if len(line('.') + 1) > len(message)
+ let message = s:STRING.fill(message, len(line('.') + 1))
+ endif
+ call s:SIG.info(line('.') + 1, 1, message)
+endfunction
+
+function! s:neomake_signatures_clear() abort
+ if exists('s:neomake_cursormoved_timer') && s:neomake_cursormoved_timer != 0
+ call timer_stop(s:neomake_cursormoved_timer)
+ endif
+ let s:last_echoed_error = ''
+ let &conceallevel = s:clv
+ call s:SIG.clear()
+endfunction
+
function! s:verify_syntax_setup() abort
if g:spacevim_enable_neomake
NeomakeInfo
@@ -56,13 +119,15 @@ endfunction
function! s:error_transient_state() abort
if g:spacevim_enable_neomake
- let has_errors = neomake#statusline#LoclistCounts()
+ let num_errors = neomake#statusline#LoclistCounts()
elseif g:spacevim_enable_ale
- let has_errors = ''
+ let counts = ale#statusline#Count(buffer_name('%'))
+ let num_errors = counts.error + counts.warning + counts.style_error
+ \ + counts.style_warning
else
- let has_errors = ''
+ let num_errors = 0
endif
- if empty(has_errors)
+ if empty(num_errors)
echo 'no buffers contain error message locations'
return
endif
diff --git a/autoload/SpaceVim/layers/core/statusline.vim b/autoload/SpaceVim/layers/core/statusline.vim
index 754275e3e..c746b40b9 100644
--- a/autoload/SpaceVim/layers/core/statusline.vim
+++ b/autoload/SpaceVim/layers/core/statusline.vim
@@ -72,6 +72,9 @@ let s:loaded_sections = ['syntax checking', 'major mode', 'minor mode lighters',
let s:loaded_sections_r = g:spacevim_statusline_right_sections
let s:loaded_sections_l = g:spacevim_statusline_left_sections
+let [s:lsep , s:rsep] = get(s:separators, g:spacevim_statusline_separator, s:separators['arrow'])
+let [s:ilsep , s:irsep] = get(s:i_separators, g:spacevim_statusline_inactive_separator, s:i_separators['arrow'])
+
" build in sections for SpaceVim statusline
function! s:winnr(...) abort
if a:0 > 1
@@ -131,7 +134,7 @@ function! s:git_branch() abort
call fugitive#detect(getcwd())
let l:head = fugitive#head()
endif
- return empty(l:head) ? '' : ' '.l:head . ' '
+ return empty(l:head) ? '' : ' '.l:head . ' '
endif
return ''
endfunction
@@ -151,7 +154,7 @@ endfunction
function! s:date() abort
return ' ' . s:TIME.current_date() . ' '
-
+
endfunction
function! s:whitespace() abort
@@ -222,6 +225,25 @@ else
endfunction
endif
+function! s:hunks() abort
+ let hunks = [0,0,0]
+ try
+ let hunks = GitGutterGetHunkSummary()
+ catch
+ endtry
+ let rst = ''
+ if hunks[0] > 0
+ let rst .= hunks[0] . '+ '
+ endif
+ if hunks[1] > 0
+ let rst .= hunks[1] . '~ '
+ endif
+ if hunks[2] > 0
+ let rst .= hunks[2] . '- '
+ endif
+ return empty(rst) ? '' : ' ' . rst
+endfunction
+
let s:registed_sections = {
\ 'winnr' : function('s:winnr'),
\ 'syntax checking' : function('s:syntax_checking'),
@@ -230,6 +252,7 @@ let s:registed_sections = {
\ 'major mode' : function('s:major_mode'),
\ 'minor mode lighters' : function('s:modes'),
\ 'version control info' : function('s:git_branch'),
+ \ 'hunks' : function('s:hunks'),
\ 'cursorpos' : function('s:cursorpos'),
\ 'percentage' : function('s:percentage'),
\ 'time' : function('s:time'),
@@ -293,6 +316,9 @@ function! s:filesize() abort
endfunction
function! SpaceVim#layers#core#statusline#get(...) abort
+ for nr in range(1, winnr('$'))
+ call setwinvar(nr, 'winwidth', winwidth(nr))
+ endfor
if &filetype ==# 'vimfiler'
return '%#SpaceVim_statusline_ia#' . s:winnr(1) . '%#SpaceVim_statusline_ia_SpaceVim_statusline_b#' . s:lsep
\ . '%#SpaceVim_statusline_b# vimfiler %#SpaceVim_statusline_b_SpaceVim_statusline_c#' . s:lsep
@@ -328,10 +354,18 @@ function! SpaceVim#layers#core#statusline#get(...) abort
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()}'
+ elseif &filetype ==# 'SpaceVimREPL'
+ return '%#SpaceVim_statusline_a# REPL %#SpaceVim_statusline_a_SpaceVim_statusline_b# %{SpaceVim#plugins#repl#status()}'
elseif &filetype ==# 'VimMailClient'
return '%#SpaceVim_statusline_a# VimMail %#SpaceVim_statusline_a_SpaceVim_statusline_b# %{mail#client#win#status().dir}'
elseif &filetype ==# 'SpaceVimQuickFix'
return '%#SpaceVim_statusline_a# SpaceVimQuickFix %#SpaceVim_statusline_a_SpaceVim_statusline_b#'
+ elseif &filetype ==# 'VebuggerShell'
+ return '%#SpaceVim_statusline_ia#' . s:winnr(1) . '%#SpaceVim_statusline_ia_SpaceVim_statusline_b#' . s:lsep
+ \ . '%#SpaceVim_statusline_b# VebuggerShell %#SpaceVim_statusline_b_SpaceVim_statusline_c#' . s:lsep
+ elseif &filetype ==# 'VebuggerTerminal'
+ return '%#SpaceVim_statusline_ia#' . s:winnr(1) . '%#SpaceVim_statusline_ia_SpaceVim_statusline_b#' . s:lsep
+ \ . '%#SpaceVim_statusline_b# VebuggerTerminal %#SpaceVim_statusline_b_SpaceVim_statusline_c#' . s:lsep
endif
if a:0 > 0
return s:active()
@@ -355,19 +389,25 @@ function! s:active() abort
endfor
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', winwidth(winnr()))
endfunction
function! s:inactive() abort
- return '%#SpaceVim_statusline_ia#' . s:winnr() . '%#SpaceVim_statusline_ia_SpaceVim_statusline_b#' . s:lsep
- \ . '%#SpaceVim_statusline_b#' . s:filename() . s:ilsep
- \ . ' ' . &filetype . ' ' . s:ilsep
- \ . s:modes() . s:ilsep
- \ . s:git_branch() . s:ilsep
- \ . ' %='
- \ . s:irsep . '%{" " . &ff . "|" . (&fenc!=""?&fenc:&enc) . " "}'
- \ . s:irsep . ' %P '
+ let l = '%#SpaceVim_statusline_ia#' . s:winnr() . '%#SpaceVim_statusline_ia_SpaceVim_statusline_b#' . s:lsep . '%#SpaceVim_statusline_b#'
+ let secs = [s:filename(), &filetype, s:modes(), s:git_branch()]
+ let base = 10
+ for sec in secs
+ let len = s:STATUSLINE.len(sec)
+ let base += len
+ let l .= '%{ get(w:, "winwidth", 150) < ' . base . ' ? "" : (" ' . s:STATUSLINE.eval(sec) . ' ' . s:ilsep . '")}'
+ endfor
+ if get(w:, 'winwidth', 150) > base + 10
+ let l .= join(['%=', '%{" " . &ff . "|" . (&fenc!=""?&fenc:&enc) . " "}', ' %P '], s:irsep)
+ endif
+ return l
endfunction
+
+
function! s:gitgutter() abort
if exists('b:gitgutter_summary')
let l:summary = get(b:, 'gitgutter_summary')
@@ -456,8 +496,6 @@ function! SpaceVim#layers#core#statusline#rsep()
endfunction
function! SpaceVim#layers#core#statusline#config() abort
- let [s:lsep , s:rsep] = get(s:separators, g:spacevim_statusline_separator, s:separators['arrow'])
- let [s:ilsep , s:irsep] = get(s:i_separators, g:spacevim_statusline_inactive_separator, s:i_separators['arrow'])
call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'm'], 'call SpaceVim#layers#core#statusline#toggle_section("minor mode lighters")',
\ 'toggle the minor mode lighters', 1)
call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'v'], 'call SpaceVim#layers#core#statusline#toggle_section("version control info")',
@@ -474,10 +512,12 @@ function! SpaceVim#layers#core#statusline#config() abort
\ 'toggle the cursor position', 1)
call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'T'], 'if &laststatus == 2 | let &laststatus = 0 | else | let &laststatus = 2 | endif',
\ 'toggle the statuline itself', 1)
+ call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'h'], 'call SpaceVim#layers#core#statusline#toggle_section("hunks")',
+ \ 'toggle the hunks summary', 1)
function! TagbarStatusline(...) abort
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, '',
- \ 'SpaceVim_statusline_ia', 'SpaceVim_statusline_b', 'SpaceVim_statusline_c', 'SpaceVim_statusline_z')
+ \ 'SpaceVim_statusline_ia', 'SpaceVim_statusline_b', 'SpaceVim_statusline_c', 'SpaceVim_statusline_z', g:spacevim_sidebar_width)
endfunction
let g:tagbar_status_func = 'TagbarStatusline'
let g:unite_force_overwrite_statusline = 0
@@ -509,7 +549,7 @@ endfunction
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 . ' '],
\ [' ' . 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', winwidth(winnr()))
endfunction
" @vimlint(EVL103, 0, a:regex)
" @vimlint(EVL103, 0, a:marked)
@@ -519,7 +559,7 @@ endfunction
function! SpaceVim#layers#core#statusline#ctrlp_status(str) abort
return s:STATUSLINE.build([' Ctrlp ', ' ' . a:str . ' '],
\ [' ' . 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', winwidth(winnr()))
endfunction
function! SpaceVim#layers#core#statusline#jump(i) abort
@@ -591,14 +631,14 @@ endfunction
function! SpaceVim#layers#core#statusline#register_sections(name, func)
- if has_key(s:registed_sections, a:name)
- call SpaceVim#logger#info('statusline build-in section ' . a:name . ' has been changed!')
- call extend(s:registed_sections, {a:name : a:func})
- else
- call extend(s:registed_sections, {a:name : a:func})
- endif
+ if has_key(s:registed_sections, a:name)
+ call SpaceVim#logger#info('statusline build-in section ' . a:name . ' has been changed!')
+ call extend(s:registed_sections, {a:name : a:func})
+ else
+ call extend(s:registed_sections, {a:name : a:func})
+ endif
endfunction
-" vim:set et sw=2 cc=80:
+" vim:set et sw=2 cc=80 nowrap:
diff --git a/autoload/SpaceVim/layers/core/tabline.vim b/autoload/SpaceVim/layers/core/tabline.vim
index fa93cfffe..51a0b2d5d 100644
--- a/autoload/SpaceVim/layers/core/tabline.vim
+++ b/autoload/SpaceVim/layers/core/tabline.vim
@@ -22,188 +22,240 @@ let s:buffers = s:BUFFER.listed_buffers()
" init
let s:separators = {
- \ 'arrow' : ["\ue0b0", "\ue0b2"],
- \ 'curve' : ["\ue0b4", "\ue0b6"],
- \ 'slant' : ["\ue0b8", "\ue0ba"],
- \ 'brace' : ["\ue0d2", "\ue0d4"],
- \ 'fire' : ["\ue0c0", "\ue0c2"],
- \ 'nil' : ['', ''],
- \ }
+ \ 'arrow' : ["\ue0b0", "\ue0b2"],
+ \ 'curve' : ["\ue0b4", "\ue0b6"],
+ \ 'slant' : ["\ue0b8", "\ue0ba"],
+ \ 'brace' : ["\ue0d2", "\ue0d4"],
+ \ 'fire' : ["\ue0c0", "\ue0c2"],
+ \ 'nil' : ['', ''],
+ \ }
let s:i_separators = {
- \ 'arrow' : ["\ue0b1", "\ue0b3"],
- \ 'bar' : ["|", "|"],
- \ 'nil' : ['', ''],
- \ }
+ \ 'arrow' : ["\ue0b1", "\ue0b3"],
+ \ 'bar' : ["|", "|"],
+ \ 'nil' : ['', ''],
+ \ }
function! s:tabname(id) abort
- if g:spacevim_buffer_index_type == 3
- let id = s:messletters.index_num(a:id)
- elseif g:spacevim_buffer_index_type == 4
- let id = a:id
- else
- let id = s:messletters.bubble_num(a:id, g:spacevim_buffer_index_type) . ' '
- endif
- let fn = fnamemodify(bufname(a:id), ':t')
- if g:spacevim_enable_tabline_filetype_icon
- let icon = s:file.fticon(fn)
- if !empty(icon)
- let fn = icon . ' ' . fn
- endif
- endif
- if empty(fn)
- return 'No Name'
- else
- return id . fn
+ if g:spacevim_buffer_index_type == 3
+ let id = s:messletters.index_num(a:id)
+ elseif g:spacevim_buffer_index_type == 4
+ let id = a:id
+ else
+ let id = s:messletters.bubble_num(a:id, g:spacevim_buffer_index_type) . ' '
+ endif
+ let fn = fnamemodify(bufname(a:id), ':t')
+ if g:spacevim_enable_tabline_filetype_icon
+ let icon = s:file.fticon(fn)
+ if !empty(icon)
+ let fn = icon . ' ' . fn
endif
+ endif
+ if empty(fn)
+ return 'No Name'
+ else
+ return id . fn
+ endif
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
+ 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! s:is_modified(nr) abort
+ return getbufvar(a:nr, '&modified', 0)
endfunction
function! SpaceVim#layers#core#tabline#get() abort
- let nr = tabpagenr('$')
- let t = ''
- " the stack should be the bufnr stack of tabline
- let stack = []
- if nr > 1
- let ct = tabpagenr()
- if ct == 1
- let t = '%#SpaceVim_tabline_a# '
- else
- let t = '%#SpaceVim_tabline_b# '
- endif
- for i in range(1, nr)
- if i == ct
- let t .= '%#SpaceVim_tabline_a#'
- endif
- let buflist = tabpagebuflist(i)
- let winnr = tabpagewinnr(i)
- let name = fnamemodify(bufname(buflist[winnr - 1]), ':t')
- if empty(name)
- let name = 'No Name'
- endif
- call add(stack, buflist[winnr - 1])
- call s:need_show_bfname(stack, buflist[winnr - 1])
- if g:spacevim_buffer_index_type == 3
- let id = s:messletters.index_num(i)
- elseif g:spacevim_buffer_index_type == 4
- let id = i
- else
- let id = s:messletters.circled_num(i, g:spacevim_buffer_index_type)
- endif
- if g:spacevim_enable_tabline_filetype_icon
- let icon = s:file.fticon(name)
- if !empty(icon)
- let name = icon . ' ' . name
- endif
- endif
- let t .= id . ' ' . name
- if i == ct - 1
- let t .= ' %#SpaceVim_tabline_b_SpaceVim_tabline_a#' . s:lsep . ' '
- elseif i == ct
- let t .= ' %#SpaceVim_tabline_a_SpaceVim_tabline_b#' . s:lsep . ' '
- else
- let t .= ' ' . s:ilsep . ' '
- endif
- endfor
- let t .= '%=%#SpaceVim_tabline_a_SpaceVim_tabline_b#' . s:rsep
- let t .= '%#SpaceVim_tabline_a# Tabs '
+ let nr = tabpagenr('$')
+ let t = ''
+ " the stack should be the bufnr stack of tabline
+ let stack = []
+ if nr > 1
+ let ct = tabpagenr()
+ if ct == 1
+ let t = '%#SpaceVim_tabline_a# '
else
- let s:buffers = s:BUFFER.listed_buffers()
- let g:_spacevim_list_buffers = s:buffers
- if len(s:buffers) == 0
- return ''
- endif
- let ct = bufnr('%')
- let pt = index(s:buffers, ct) > 0 ? s:buffers[index(s:buffers, ct) - 1] : -1
- if ct == get(s:buffers, 0, -1)
- let t = '%#SpaceVim_tabline_a# '
- else
- let t = '%#SpaceVim_tabline_b# '
- endif
- for i in s:buffers
- if i == ct
- let t .= '%#SpaceVim_tabline_a#'
- endif
- let name = fnamemodify(bufname(i), ':t')
- if empty(name)
- let name = 'No Name'
- endif
- call add(stack, i)
- call s:need_show_bfname(stack, i)
- if g:spacevim_buffer_index_type == 3
- let id = s:messletters.index_num(index(s:buffers, i) + 1)
- elseif g:spacevim_buffer_index_type == 4
- let id = index(s:buffers, i) + 1
- else
- let id = s:messletters.circled_num(index(s:buffers, i) + 1, g:spacevim_buffer_index_type)
- endif
- if g:spacevim_enable_tabline_filetype_icon
- let icon = s:file.fticon(name)
- if !empty(icon)
- let name = icon . ' ' . name
- endif
- endif
- let t .= id . ' ' . name
- if i == ct
- let t .= ' %#SpaceVim_tabline_a_SpaceVim_tabline_b#' . s:lsep . ' '
- elseif i == pt
- let t .= ' %#SpaceVim_tabline_b_SpaceVim_tabline_a#' . s:lsep . ' '
- else
- let t .= ' ' . s:ilsep . ' '
- endif
- endfor
- let t .= '%=%#SpaceVim_tabline_a_SpaceVim_tabline_b#' . s:rsep
- let t .= '%#SpaceVim_tabline_a# Buffers '
+ let t = '%#SpaceVim_tabline_b# '
endif
- return t
+ for i in range(1, nr)
+ if i == ct
+ let t .= '%#SpaceVim_tabline_a#'
+ endif
+ let buflist = tabpagebuflist(i)
+ let winnr = tabpagewinnr(i)
+ let name = fnamemodify(bufname(buflist[winnr - 1]), ':t')
+ if empty(name)
+ let name = 'No Name'
+ endif
+ call add(stack, buflist[winnr - 1])
+ call s:need_show_bfname(stack, buflist[winnr - 1])
+ if g:spacevim_buffer_index_type == 3
+ let id = s:messletters.index_num(i)
+ elseif g:spacevim_buffer_index_type == 4
+ let id = i
+ else
+ let id = s:messletters.circled_num(i, g:spacevim_buffer_index_type)
+ endif
+ if g:spacevim_enable_tabline_filetype_icon
+ let icon = s:file.fticon(name)
+ if !empty(icon)
+ let name = icon . ' ' . name
+ endif
+ endif
+ let t .= id . ' ' . name
+ if i == ct - 1
+ let t .= ' %#SpaceVim_tabline_b_SpaceVim_tabline_a#' . s:lsep . ' '
+ elseif i == ct
+ let t .= ' %#SpaceVim_tabline_a_SpaceVim_tabline_b#' . s:lsep . ' '
+ else
+ let t .= ' ' . s:ilsep . ' '
+ endif
+ endfor
+ let t .= '%=%#SpaceVim_tabline_a_SpaceVim_tabline_b#' . s:rsep
+ let t .= '%#SpaceVim_tabline_a# Tabs '
+ else
+ let s:buffers = s:BUFFER.listed_buffers()
+ let g:_spacevim_list_buffers = s:buffers
+ if len(s:buffers) == 0
+ return ''
+ endif
+ let ct = bufnr('%')
+ let pt = index(s:buffers, ct) > 0 ? s:buffers[index(s:buffers, ct) - 1] : -1
+ if ct == get(s:buffers, 0, -1)
+ if getbufvar(ct, '&modified', 0)
+ let t = '%#SpaceVim_tabline_m# '
+ else
+ let t = '%#SpaceVim_tabline_a# '
+ endif
+ else
+ let t = '%#SpaceVim_tabline_b# '
+ endif
+ let index = 1
+ for i in s:buffers
+ if getbufvar(i, '&modified', 0) && i != ct
+ let t .= '%#SpaceVim_tabline_m_i#'
+ elseif i == ct
+ if s:is_modified(i)
+ let t .= '%#SpaceVim_tabline_m#'
+ else
+ let t .= '%#SpaceVim_tabline_a#'
+ endif
+ else
+ let t .= '%#SpaceVim_tabline_b#'
+ endif
+ let name = fnamemodify(bufname(i), ':t')
+ if empty(name)
+ let name = 'No Name'
+ endif
+ call add(stack, i)
+ call s:need_show_bfname(stack, i)
+ " here is the begin of a tab name
+ if has('tablineat')
+ let t .= '%' . index . '@SpaceVim#layers#core#tabline#jump@'
+ endif
+ if g:spacevim_buffer_index_type == 3
+ let id = s:messletters.index_num(index(s:buffers, i) + 1)
+ elseif g:spacevim_buffer_index_type == 4
+ let id = index(s:buffers, i) + 1
+ else
+ let id = s:messletters.circled_num(index(s:buffers, i) + 1, g:spacevim_buffer_index_type)
+ endif
+ if g:spacevim_enable_tabline_filetype_icon
+ let icon = s:file.fticon(name)
+ if !empty(icon)
+ let name = icon . ' ' . name
+ endif
+ endif
+ let t .= id . ' ' . name
+ " here is the end of a tabname
+ if has('tablineat')
+ let t .= '%X'
+ endif
+ if i == ct
+ if s:is_modified(i)
+ let t .= ' %#SpaceVim_tabline_m_SpaceVim_tabline_b#' . s:lsep . ' '
+ else
+ let t .= ' %#SpaceVim_tabline_a_SpaceVim_tabline_b#' . s:lsep . ' '
+ endif
+ elseif i == pt
+ if getbufvar(ct, '&modified', 0)
+ let t .= ' %#SpaceVim_tabline_b_SpaceVim_tabline_m#' . s:lsep . ' '
+ else
+ let t .= ' %#SpaceVim_tabline_b_SpaceVim_tabline_a#' . s:lsep . ' '
+ endif
+ else
+ let t .= ' %#SpaceVim_tabline_b#' . s:ilsep . ' '
+ endif
+ let index += 1
+ endfor
+ let t .= '%=%#SpaceVim_tabline_a_SpaceVim_tabline_b#' . s:rsep
+ let t .= '%#SpaceVim_tabline_a# Buffers '
+ endif
+ return t
endfunction
function! SpaceVim#layers#core#tabline#config() abort
- let [s:lsep , s:rsep] = get(s:separators, g:spacevim_statusline_separator, s:separators['arrow'])
- let [s:ilsep , s:irsep] = get(s:i_separators, g:spacevim_statusline_inactive_separator, s:separators['arrow'])
- set tabline=%!SpaceVim#layers#core#tabline#get()
- augroup SpaceVim_tabline
- autocmd!
- autocmd ColorScheme * call SpaceVim#layers#core#tabline#def_colors()
- augroup END
- for i in range(1, 9)
- exe "call SpaceVim#mapping#def('nmap ', '" . i
- \ . "', ':call SpaceVim#layers#core#tabline#jump("
- \ . i . ")', 'Switch to airline tab " . i
- \ . "', '', 'tabline index " . i . "')"
- endfor
- call SpaceVim#mapping#def('nmap', '-', ':bprevious', 'Switch to previous airline tag', '', 'window previous')
- call SpaceVim#mapping#def('nmap', '+', ':bnext', 'Switch to next airline tag', '', 'window next')
- "call SpaceVim#mapping#space#def('nmap', ['-'], 'bprevious', 'window previous', 1)
- "call SpaceVim#mapping#space#def('nmap', ['+'], 'bnext', 'window next', 1)
+ let [s:lsep , s:rsep] = get(s:separators, g:spacevim_statusline_separator, s:separators['arrow'])
+ let [s:ilsep , s:irsep] = get(s:i_separators, g:spacevim_statusline_inactive_separator, s:separators['arrow'])
+ set tabline=%!SpaceVim#layers#core#tabline#get()
+ augroup SpaceVim_tabline
+ autocmd!
+ autocmd ColorScheme * call SpaceVim#layers#core#tabline#def_colors()
+ augroup END
+ for i in range(1, 9)
+ exe "call SpaceVim#mapping#def('nmap ', '" . i
+ \ . "', ':call SpaceVim#layers#core#tabline#jump("
+ \ . i . ")', 'Switch to airline tab " . i
+ \ . "', '', 'tabline index " . i . "')"
+ endfor
+ call SpaceVim#mapping#def('nmap', '-', ':bprevious', 'Switch to previous airline tag', '', 'window previous')
+ call SpaceVim#mapping#def('nmap', '+', ':bnext', 'Switch to next airline tag', '', 'window next')
+ "call SpaceVim#mapping#space#def('nmap', ['-'], 'bprevious', 'window previous', 1)
+ "call SpaceVim#mapping#space#def('nmap', ['+'], 'bnext', 'window next', 1)
endfunction
-function! SpaceVim#layers#core#tabline#jump(id) abort
+function! SpaceVim#layers#core#tabline#jump(id, ...) abort
+ if get(a:000, 2, '') == 'm'
if len(s:buffers) >= a:id
- let bid = s:buffers[a:id - 1]
- exe 'silent b' . bid
+ let bid = s:buffers[a:id - 1]
+ exe 'silent b' . bid
+ bd
endif
+ elseif get(a:000, 2, '') == 'l'
+ if len(s:buffers) >= a:id
+ let bid = s:buffers[a:id - 1]
+ exe 'silent b' . bid
+ endif
+ else
+ if len(s:buffers) >= a:id
+ let bid = s:buffers[a:id - 1]
+ exe 'silent b' . bid
+ endif
+ endif
endfunction
function! SpaceVim#layers#core#tabline#def_colors() abort
- if !empty(g:spacevim_custom_color_palette)
- let t = g:spacevim_custom_color_palette
- else
- let name = get(g:, 'colors_name', 'gruvbox')
- try
- let t = SpaceVim#mapping#guide#theme#{name}#palette()
- catch /^Vim\%((\a\+)\)\=:E117/
- let t = SpaceVim#mapping#guide#theme#gruvbox#palette()
- endtry
- endif
- exe 'hi! SpaceVim_tabline_a ctermbg=' . t[0][2] . ' ctermfg=' . t[0][3] . ' guibg=' . t[0][1] . ' guifg=' . t[0][0]
- exe 'hi! SpaceVim_tabline_b ctermbg=' . t[1][2] . ' ctermfg=' . t[1][3] . ' guibg=' . t[1][1] . ' guifg=' . t[1][0]
- call s:HI.hi_separator('SpaceVim_tabline_a', 'SpaceVim_tabline_b')
+ if !empty(g:spacevim_custom_color_palette)
+ let t = g:spacevim_custom_color_palette
+ else
+ let name = get(g:, 'colors_name', 'gruvbox')
+ try
+ let t = SpaceVim#mapping#guide#theme#{name}#palette()
+ catch /^Vim\%((\a\+)\)\=:E117/
+ let t = SpaceVim#mapping#guide#theme#gruvbox#palette()
+ endtry
+ endif
+ exe 'hi! SpaceVim_tabline_a ctermbg=' . t[0][2] . ' ctermfg=' . t[0][3] . ' guibg=' . t[0][1] . ' guifg=' . t[0][0]
+ exe 'hi! SpaceVim_tabline_b ctermbg=' . t[1][2] . ' ctermfg=' . t[1][3] . ' guibg=' . t[1][1] . ' guifg=' . t[1][0]
+ " SpaceVim_tabline_c is for modified buffers
+ exe 'hi! SpaceVim_tabline_m ctermbg=' . t[4][3] . ' ctermfg=' . t[4][2] . ' guibg=' . t[4][1] . ' guifg=' . t[4][0]
+ exe 'hi! SpaceVim_tabline_m_i ctermbg=' . t[1][2] . ' ctermfg=' . t[4][3] . ' guibg=' . t[1][1] . ' guifg=' . t[4][1]
+ call s:HI.hi_separator('SpaceVim_tabline_a', 'SpaceVim_tabline_b')
+ call s:HI.hi_separator('SpaceVim_tabline_m', 'SpaceVim_tabline_b')
+ call s:HI.hi_separator('SpaceVim_tabline_m', 'SpaceVim_tabline_a')
endfunction
diff --git a/autoload/SpaceVim/layers/debug.vim b/autoload/SpaceVim/layers/debug.vim
index 833937ffa..836b48f4f 100644
--- a/autoload/SpaceVim/layers/debug.vim
+++ b/autoload/SpaceVim/layers/debug.vim
@@ -1,9 +1,93 @@
function! SpaceVim#layers#debug#plugins() abort
- let plugins = []
- call add(plugins,['idanarye/vim-vebugger', {'merged' : 0}])
- return plugins
+ let plugins = []
+ call add(plugins,['idanarye/vim-vebugger', {'merged' : 0}])
+ return plugins
endfunction
function! SpaceVim#layers#debug#config() abort
-
+ call SpaceVim#mapping#space#def('nnoremap', ['d', 'l'], 'call SpaceVim#layers#debug#launching(&ft)', 'launching debugger', 1)
+ call SpaceVim#mapping#space#def('nnoremap', ['d', 'b'], 'VBGtoggleBreakpointThisLine', 'Toggle a breakpoint for the current line', 1)
+ call SpaceVim#mapping#space#def('nnoremap', ['d', 'B'], 'VBGclearBreakpoints', 'Clear all breakpoints', 1)
+ call SpaceVim#mapping#space#def('nnoremap', ['d', 'c'], 'VBGcontinue', 'Continue the execution', 1)
+ call SpaceVim#mapping#space#def('nnoremap', ['d', 'o'], 'VBGstepOver', 'step over', 1)
+ call SpaceVim#mapping#space#def('nnoremap', ['d', 'i'], 'VBGstepIn', 'step into functions', 1)
+ call SpaceVim#mapping#space#def('nnoremap', ['d', 'O'], 'VBGstepOut', 'step out of current function', 1)
+ call SpaceVim#mapping#space#def('nnoremap', ['d', 'k'], 'VBGkill', 'Terminates the debugger', 1)
+ let g:_spacevim_mappings_space.d.e = {'name' : '+Evaluate/Execute'}
+ call SpaceVim#mapping#space#def('nnoremap', ['d', 'e', 's'], 'VBGevalSelectedText', 'Evaluate and print the selected text', 1)
+ call SpaceVim#mapping#space#def('nnoremap', ['d', 'e', 'e'], 'VBGevalWordUnderCursor', 'Evaluate the under the cursor', 1)
+ call SpaceVim#mapping#space#def('nnoremap', ['d', 'e', 'S'], 'VBGexecuteSelectedText', 'Execute the selected text', 1)
+ call SpaceVim#mapping#space#def('nnoremap', ['d', '.'], 'call call('
+ \ . string(s:_function('s:buffer_transient_state')) . ', [])',
+ \ 'debug transient state', 1)
endfunction
+
+function! SpaceVim#layers#debug#launching(ft) abort
+ if a:ft ==# 'python'
+ exe 'VBGstartPDB ' . bufname('%')
+ elseif a:ft ==# 'ruby'
+ exe 'VBGstartRDebug ' . bufname('%')
+ else
+ echohl WarningMsg
+ echo 'read :h vebugger-launching'
+ echohl None
+ endif
+endfunction
+
+function! s:buffer_transient_state() abort
+ let state = SpaceVim#api#import('transient_state')
+ call state.set_title('Debug Transient State')
+ call state.defind_keys(
+ \ {
+ \ 'layout' : 'vertical split',
+ \ 'left' : [
+ \ {
+ \ 'key' : 'o',
+ \ 'desc' : 'step over',
+ \ 'func' : '',
+ \ 'cmd' : 'VBGstepOver',
+ \ 'exit' : 0,
+ \ },
+ \ {
+ \ 'key' : 'i',
+ \ 'desc' : 'step into functions',
+ \ 'func' : '',
+ \ 'cmd' : 'VBGstepIn',
+ \ 'exit' : 0,
+ \ },
+ \ ],
+ \ 'right' : [
+ \ {
+ \ 'key' : 'O',
+ \ 'desc' : 'step out of current function',
+ \ 'func' : '',
+ \ 'cmd' : 'VBGstepOut',
+ \ 'exit' : 0,
+ \ },
+ \ {
+ \ 'key' : 'k',
+ \ 'desc' : 'Terminates the debugger',
+ \ 'func' : '',
+ \ 'cmd' : 'VBGkill',
+ \ 'exit' : 1,
+ \ },
+ \ ],
+ \ }
+ \ )
+ call state.open()
+endfunction
+
+" function() wrapper
+if v:version > 703 || v:version == 703 && has('patch1170')
+ function! s:_function(fstr) abort
+ return function(a:fstr)
+ endfunction
+else
+ function! s:_SID() abort
+ return matchstr(expand(''), '\zs\d\+\ze__SID$')
+ endfunction
+ let s:_s = '' . s:_SID() . '_'
+ function! s:_function(fstr) abort
+ return function(substitute(a:fstr, 's:', s:_s, 'g'))
+ endfunction
+endif
diff --git a/autoload/SpaceVim/layers/default.vim b/autoload/SpaceVim/layers/default.vim
index 6925f7dc8..39122cd6b 100644
--- a/autoload/SpaceVim/layers/default.vim
+++ b/autoload/SpaceVim/layers/default.vim
@@ -5,439 +5,497 @@
let s:filename = expand(':~')
function! SpaceVim#layers#default#plugins() abort
- let plugins = []
+ let plugins = []
- return plugins
+ return plugins
endfunction
let s:lnum = expand('') + 3
function! SpaceVim#layers#default#config() abort
- " Unimpaired bindings
- " Quickly add empty lines
- nnoremap [ :put! =repeat(nr2char(10), v:count1)
- nnoremap ] :put =repeat(nr2char(10), v:count1)
+ " Unimpaired bindings
+ " Quickly add empty lines
+ nnoremap [ :put! =repeat(nr2char(10), v:count1)
+ nnoremap ] :put =repeat(nr2char(10), v:count1)
- "]e or [e move current line ,count can be useed
- nnoremap [e :execute 'move -1-'. v:count1
- nnoremap ]e :execute 'move +'. v:count1
+ "]e or [e move current line ,count can be useed
+ nnoremap [e :execute 'move -1-'. v:count1
+ nnoremap ]e :execute 'move +'. v:count1
- " [b or ]n go to previous or next buffer
- nnoremap [b :bN
- nnoremap ]b :bn
+ " [b or ]n go to previous or next buffer
+ nnoremap [b :bN
+ nnoremap ]b :bn
- " [f or ]f go to next or previous file in dir
- nnoremap ]f :call next_file()
- nnoremap [f :call previous_file()
+ " [f or ]f go to next or previous file in dir
+ nnoremap ]f :call next_file()
+ nnoremap [f :call previous_file()
- " [l or ]l go to next and previous error
- nnoremap [l :lprevious
- nnoremap ]l :lnext
+ " [l or ]l go to next and previous error
+ nnoremap [l :lprevious
+ nnoremap ]l :lnext
- " [c or ]c go to next or previous vcs hunk
+ " [c or ]c go to next or previous vcs hunk
- " [w or ]w go to next or previous window
- nnoremap [w :call previous_window()
- nnoremap ]w :call next_window()
+ " [w or ]w go to next or previous window
+ nnoremap [w :call previous_window()
+ nnoremap ]w :call next_window()
- " [t or ]t for next and previous tab
- nnoremap [t :tabprevious
- nnoremap ]t :tabnext
+ " [t or ]t for next and previous tab
+ nnoremap [t :tabprevious
+ nnoremap ]t :tabnext
- " [p or ]p for p and P
- nnoremap [p P
- nnoremap ]p p
+ " [p or ]p for p and P
+ nnoremap [p P
+ nnoremap ]p p
- " Select last paste
- nnoremap gp '`['.strpart(getregtype(), 0, 1).'`]'
+ " Select last paste
+ nnoremap gp '`['.strpart(getregtype(), 0, 1).'`]'
- let lnum = expand('') + s:lnum - 1
- if has('python3')
- let cmd = 'DeniteBufferDir file_rec'
- elseif has('python')
- let cmd = "exe 'LeaderfFile ' . fnamemodify(bufname('%'), ':h')"
- else
- let cmd = "exe 'CtrlP ' . fnamemodify(bufname('%'), ':h')"
- endif
- call SpaceVim#mapping#space#def('nnoremap', ['f', 'f'],
- \ cmd,
- \ ['Find files in the directory of the current buffer',
- \ [
- \ '[SPC f f] is to find files in the directory of the current buffer',
- \ 'vim with +python3 support will use denite',
- \ 'vim with +python support will use leaderf',
- \ 'otherwise will use ctrlp',
- \ '',
- \ 'Definition: ' . s:filename . ':' . lnum,
- \ ]
- \ ]
- \ , 1)
- call SpaceVim#mapping#space#def('nnoremap', ['f', 's'], 'write', 'save buffer', 1)
- call SpaceVim#mapping#space#def('nnoremap', ['f', 'S'], 'wall', 'save all buffer', 1)
- call SpaceVim#mapping#space#def('nnoremap', ['f', 'W'], 'write !sudo tee % >/dev/null', 'save buffer with sudo', 1)
- " help mappings
- call SpaceVim#mapping#space#def('nnoremap', ['h', 'I'], 'call SpaceVim#issue#report()', 'Reporting an issue of SpaceVim', 1)
- if has('python3')
- call SpaceVim#mapping#space#def('nnoremap', ['h', 'i'], 'DeniteCursorWord help', 'get help with the symbol at point', 1)
- else
- call SpaceVim#mapping#space#def('nnoremap', ['h', 'i'], 'UniteWithCursorWord help', 'get help with the symbol at point', 1)
- endif
- call SpaceVim#mapping#space#def('nnoremap', ['h', 'l'], 'SPLayer -l', 'lists all the layers available in SpaceVim', 1)
- call SpaceVim#mapping#space#def('nnoremap', ['h', 'm'], 'Unite manpage', 'search available man pages', 1)
- call SpaceVim#mapping#space#def('nnoremap', ['h', 'k'], 'LeaderGuide "[KEYs]"', 'show top-level bindings with mapping guide', 1)
- call SpaceVim#mapping#space#def('nnoremap', ['h', '[SPC]'], 'Unite help -input=SpaceVim', 'unite-SpaceVim-help', 1)
- call SpaceVim#mapping#space#def('nnoremap', ['j', '0'], 'm`^', 'push mark and goto beginning of line', 0)
- call SpaceVim#mapping#space#def('nnoremap', ['j', '$'], 'm`g_', 'push mark and goto end of line', 0)
- call SpaceVim#mapping#space#def('nnoremap', ['j', 'b'], '', 'jump backward', 0)
- call SpaceVim#mapping#space#def('nnoremap', ['j', 'f'], '', 'jump forward', 0)
- call SpaceVim#mapping#space#def('nnoremap', ['j', 'd'], 'VimFiler -no-split', 'Explore current directory', 1)
- call SpaceVim#mapping#space#def('nnoremap', ['j', 'D'], 'VimFiler', 'Explore current directory (other window)', 1)
- call SpaceVim#mapping#space#def('nmap', ['j', 'j'], '(easymotion-prefix)s', 'jump to a character', 0)
- call SpaceVim#mapping#space#def('nmap', ['j', 'J'], '(easymotion-s2)', 'jump to a suite of two characters', 0)
- call SpaceVim#mapping#space#def('nnoremap', ['j', 'k'], 'j==', 'go to next line and indent', 0)
- call SpaceVim#mapping#space#def('nmap', ['j', 'l'], '(easymotion-bd-jk)', 'jump to a line', 0)
- call SpaceVim#mapping#space#def('nmap', ['j', 'v'], '(easymotion-bd-jk)', 'jump to a line', 0)
- call SpaceVim#mapping#space#def('nmap', ['j', 'w'], '(easymotion-bd-w)', 'jump to a word', 0)
- call SpaceVim#mapping#space#def('nmap', ['j', 'q'], '(easymotion-bd-jk)', 'jump to a line', 0)
- call SpaceVim#mapping#space#def('nnoremap', ['j', 'n'], "i\\", 'sp-newline', 0)
- call SpaceVim#mapping#space#def('nnoremap', ['j', 'o'], "i\\k$", 'open-line', 0)
- call SpaceVim#mapping#space#def('nnoremap', ['j', 's'], 'call call('
- \ . string(s:_function('s:split_string')) . ', [0])',
- \ 'split sexp', 1)
- call SpaceVim#mapping#space#def('nnoremap', ['j', 'S'], 'call call('
- \ . string(s:_function('s:split_string')) . ', [1])',
- \ 'split-and-add-newline', 1)
- call SpaceVim#mapping#space#def('nnoremap', ['w', 'r'], 'call call('
- \ . string(s:_function('s:next_window')) . ', [])',
- \ 'rotate windows forward', 1)
- call SpaceVim#mapping#space#def('nnoremap', ['w', 'R'], 'call call('
- \ . string(s:_function('s:previous_window')) . ', [])',
- \ 'rotate windows backward', 1)
- call SpaceVim#mapping#space#def('nnoremap', ['j', 'u'], 'call call('
- \ . string(s:_function('s:jump_to_url')) . ', [])',
- \ 'jump to url', 1)
- call SpaceVim#mapping#space#def('nnoremap', [''], 'try | b# | catch | endtry', 'last buffer', 1)
- call SpaceVim#mapping#space#def('nnoremap', ['b', '.'], 'call call('
- \ . string(s:_function('s:buffer_transient_state')) . ', [])',
- \ 'buffer transient state', 1)
- call SpaceVim#mapping#space#def('nnoremap', ['b', 'd'], 'call SpaceVim#mapping#close_current_buffer()', 'kill-this-buffer', 1)
- call SpaceVim#mapping#space#def('nnoremap', ['b', 'D'],
- \ 'call SpaceVim#mapping#kill_visible_buffer_choosewin()',
- \ 'kill-this-buffer', 1)
- call SpaceVim#mapping#space#def('nnoremap', ['b', ''], 'call SpaceVim#mapping#clearBuffers()', 'kill-other-buffers', 1)
- call SpaceVim#mapping#space#def('nnoremap', ['b', 'c'], 'call SpaceVim#mapping#clear_saved_buffers()', 'clear all saved buffers', 1)
- call SpaceVim#mapping#space#def('nnoremap', ['b', 'e'], 'call call('
- \ . string(s:_function('s:safe_erase_buffer')) . ', [])',
- \ 'safe-erase-buffer', 1)
- call SpaceVim#mapping#space#def('nnoremap', ['b', 'h'], 'Startify', 'home', 1)
- call SpaceVim#mapping#space#def('nnoremap', ['b', 'm'], 'call call('
- \ . string(s:_function('s:open_message_buffer')) . ', [])',
- \ 'open-message-buffer', 1)
- call SpaceVim#mapping#space#def('nnoremap', ['b', 'P'], 'normal! ggdG"+P', 'copy-clipboard-to-whole-buffer', 1)
- call SpaceVim#mapping#space#def('nnoremap', ['b', 'R'], 'call call('
- \ . string(s:_function('s:safe_revert_buffer')) . ', [])',
- \ 'safe-revert-buffer', 1)
- call SpaceVim#mapping#space#def('nnoremap', ['b', 'Y'], 'normal! ggVG"+y``', 'copy-whole-buffer-to-clipboard', 1)
- call SpaceVim#mapping#space#def('nnoremap', ['b', 'w'], 'setl readonly!', 'read-only-mode', 1)
- let g:_spacevim_mappings_space.b.N = {'name' : '+New empty buffer'}
- call SpaceVim#mapping#space#def('nnoremap', ['b', 'N', 'h'], 'topleft vertical new', 'new-empty-buffer-left', 1)
- call SpaceVim#mapping#space#def('nnoremap', ['b', 'N', 'j'], 'rightbelow new', 'new-empty-buffer-below', 1)
- call SpaceVim#mapping#space#def('nnoremap', ['b', 'N', 'k'], 'new', 'new-empty-buffer-above', 1)
- call SpaceVim#mapping#space#def('nnoremap', ['b', 'N', 'l'], 'rightbelow vertical new', 'new-empty-buffer-right', 1)
- call SpaceVim#mapping#space#def('nnoremap', ['b', 'N', 'n'], 'enew', 'new-empty-buffer', 1)
+ let lnum = expand('') + s:lnum - 1
+ if has('python3')
+ let cmd = 'DeniteBufferDir file_rec'
+ elseif has('python')
+ let cmd = "exe 'LeaderfFile ' . fnamemodify(bufname('%'), ':h')"
+ else
+ let cmd = "exe 'CtrlP ' . fnamemodify(bufname('%'), ':h')"
+ endif
+ call SpaceVim#mapping#space#def('nnoremap', ['f', 'f'],
+ \ cmd,
+ \ ['Find files in the directory of the current buffer',
+ \ [
+ \ '[SPC f f] is to find files in the directory of the current buffer',
+ \ 'vim with +python3 support will use denite',
+ \ 'vim with +python support will use leaderf',
+ \ 'otherwise will use ctrlp',
+ \ '',
+ \ 'Definition: ' . s:filename . ':' . lnum,
+ \ ]
+ \ ]
+ \ , 1)
+ call SpaceVim#mapping#space#def('nnoremap', ['f', 's'], 'write', 'save buffer', 1)
+ call SpaceVim#mapping#space#def('nnoremap', ['f', 'S'], 'wall', 'save all buffer', 1)
+ call SpaceVim#mapping#space#def('nnoremap', ['f', 'W'], 'write !sudo tee % >/dev/null', 'save buffer with sudo', 1)
+ " help mappings
+ call SpaceVim#mapping#space#def('nnoremap', ['h', 'I'], 'call SpaceVim#issue#report()', 'Reporting an issue of SpaceVim', 1)
+ if has('python3')
+ call SpaceVim#mapping#space#def('nnoremap', ['h', 'i'], 'DeniteCursorWord help', 'get help with the symbol at point', 1)
+ else
+ call SpaceVim#mapping#space#def('nnoremap', ['h', 'i'], 'UniteWithCursorWord help', 'get help with the symbol at point', 1)
+ endif
+ call SpaceVim#mapping#space#def('nnoremap', ['h', 'l'], 'SPLayer -l', 'lists all the layers available in SpaceVim', 1)
+ call SpaceVim#mapping#space#def('nnoremap', ['h', 'm'], 'Unite manpage', 'search available man pages', 1)
+ call SpaceVim#mapping#space#def('nnoremap', ['h', 'k'], 'LeaderGuide "[KEYs]"', 'show top-level bindings with mapping guide', 1)
+ call SpaceVim#mapping#space#def('nnoremap', ['h', '[SPC]'], 'Unite help -input=SpaceVim', 'unite-SpaceVim-help', 1)
+ call SpaceVim#mapping#space#def('nnoremap', ['j', '0'], 'm`^', 'push mark and goto beginning of line', 0)
+ call SpaceVim#mapping#space#def('nnoremap', ['j', '$'], 'm`g_', 'push mark and goto end of line', 0)
+ call SpaceVim#mapping#space#def('nnoremap', ['j', 'b'], '', 'jump backward', 0)
+ call SpaceVim#mapping#space#def('nnoremap', ['j', 'f'], '', 'jump forward', 0)
+ call SpaceVim#mapping#space#def('nnoremap', ['j', 'd'], 'VimFiler -no-split', 'Explore current directory', 1)
+ call SpaceVim#mapping#space#def('nnoremap', ['j', 'D'], 'VimFiler', 'Explore current directory (other window)', 1)
+ call SpaceVim#mapping#space#def('nmap', ['j', 'j'], '(easymotion-prefix)s', 'jump to a character', 0)
+ call SpaceVim#mapping#space#def('nmap', ['j', 'J'], '(easymotion-s2)', 'jump to a suite of two characters', 0)
+ call SpaceVim#mapping#space#def('nnoremap', ['j', 'k'], 'j==', 'go to next line and indent', 0)
+ call SpaceVim#mapping#space#def('nmap', ['j', 'l'], '(easymotion-bd-jk)', 'jump to a line', 0)
+ call SpaceVim#mapping#space#def('nmap', ['j', 'v'], '(easymotion-bd-jk)', 'jump to a line', 0)
+ call SpaceVim#mapping#space#def('nmap', ['j', 'w'], '(easymotion-bd-w)', 'jump to a word', 0)
+ call SpaceVim#mapping#space#def('nmap', ['j', 'q'], '(easymotion-bd-jk)', 'jump to a line', 0)
+ call SpaceVim#mapping#space#def('nnoremap', ['j', 'n'], "i\\", 'sp-newline', 0)
+ call SpaceVim#mapping#space#def('nnoremap', ['j', 'o'], "i\\k$", 'open-line', 0)
+ call SpaceVim#mapping#space#def('nnoremap', ['j', 's'], 'call call('
+ \ . string(s:_function('s:split_string')) . ', [0])',
+ \ 'split sexp', 1)
+ call SpaceVim#mapping#space#def('nnoremap', ['j', 'S'], 'call call('
+ \ . string(s:_function('s:split_string')) . ', [1])',
+ \ 'split-and-add-newline', 1)
+ call SpaceVim#mapping#space#def('nnoremap', ['w', 'r'], 'call call('
+ \ . string(s:_function('s:next_window')) . ', [])',
+ \ 'rotate windows forward', 1)
+ call SpaceVim#mapping#space#def('nnoremap', ['w', 'R'], 'call call('
+ \ . string(s:_function('s:previous_window')) . ', [])',
+ \ 'rotate windows backward', 1)
+ call SpaceVim#mapping#space#def('nnoremap', ['j', 'u'], 'call call('
+ \ . string(s:_function('s:jump_to_url')) . ', [])',
+ \ 'jump to url', 1)
+ call SpaceVim#mapping#space#def('nnoremap', [''], 'try | b# | catch | endtry', 'last buffer', 1)
+ call SpaceVim#mapping#space#def('nnoremap', ['b', '.'], 'call call('
+ \ . string(s:_function('s:buffer_transient_state')) . ', [])',
+ \ 'buffer transient state', 1)
+ call SpaceVim#mapping#space#def('nnoremap', ['b', 'd'], 'call SpaceVim#mapping#close_current_buffer()', 'kill-this-buffer', 1)
+ call SpaceVim#mapping#space#def('nnoremap', ['b', 'D'],
+ \ 'call SpaceVim#mapping#kill_visible_buffer_choosewin()',
+ \ 'kill-this-buffer', 1)
+ call SpaceVim#mapping#space#def('nnoremap', ['b', ''], 'call SpaceVim#mapping#clearBuffers()', 'kill-other-buffers', 1)
+ call SpaceVim#mapping#space#def('nnoremap', ['b', 'c'], 'call SpaceVim#mapping#clear_saved_buffers()', 'clear all saved buffers', 1)
+ call SpaceVim#mapping#space#def('nnoremap', ['b', 'e'], 'call call('
+ \ . string(s:_function('s:safe_erase_buffer')) . ', [])',
+ \ 'safe-erase-buffer', 1)
+ call SpaceVim#mapping#space#def('nnoremap', ['b', 'h'], 'Startify', 'home', 1)
+ call SpaceVim#mapping#space#def('nnoremap', ['b', 'm'], 'call call('
+ \ . string(s:_function('s:open_message_buffer')) . ', [])',
+ \ 'open-message-buffer', 1)
+ call SpaceVim#mapping#space#def('nnoremap', ['b', 'P'], 'normal! ggdG"+P', 'copy-clipboard-to-whole-buffer', 1)
+ call SpaceVim#mapping#space#def('nnoremap', ['b', 'R'], 'call call('
+ \ . string(s:_function('s:safe_revert_buffer')) . ', [])',
+ \ 'safe-revert-buffer', 1)
+ call SpaceVim#mapping#space#def('nnoremap', ['b', 'Y'], 'normal! ggVG"+y``', 'copy-whole-buffer-to-clipboard', 1)
+ call SpaceVim#mapping#space#def('nnoremap', ['b', 'w'], 'setl readonly!', 'read-only-mode', 1)
+ let g:_spacevim_mappings_space.b.N = {'name' : '+New empty buffer'}
+ call SpaceVim#mapping#space#def('nnoremap', ['b', 'N', 'h'], 'topleft vertical new', 'new-empty-buffer-left', 1)
+ call SpaceVim#mapping#space#def('nnoremap', ['b', 'N', 'j'], 'rightbelow new', 'new-empty-buffer-below', 1)
+ call SpaceVim#mapping#space#def('nnoremap', ['b', 'N', 'k'], 'new', 'new-empty-buffer-above', 1)
+ call SpaceVim#mapping#space#def('nnoremap', ['b', 'N', 'l'], 'rightbelow vertical new', 'new-empty-buffer-right', 1)
+ call SpaceVim#mapping#space#def('nnoremap', ['b', 'N', 'n'], 'enew', 'new-empty-buffer', 1)
- " file mappings
- call SpaceVim#mapping#space#def('nnoremap', ['f', 'b'], 'Unite vim_bookmarks', 'unite-filtered-bookmarks', 1)
- let g:_spacevim_mappings_space.f.C = {'name' : '+Files/convert'}
- call SpaceVim#mapping#space#def('nnoremap', ['f', 'C', 'd'], 'update | e ++ff=dos | w', 'unix2dos', 1)
- call SpaceVim#mapping#space#def('nnoremap', ['f', 'C', 'u'], 'update | e ++ff=dos | setlocal ff=unix | w', 'dos2unix', 1)
- call SpaceVim#mapping#space#def('nnoremap', ['f', 'D'], 'call call('
- \ . string(s:_function('s:delete_current_buffer_file')) . ', [])',
- \ 'delete-current-buffer-file', 1)
- call SpaceVim#mapping#space#def('nnoremap', ['f', 'F'], 'normal! gf', 'open-cursor-file', 1)
- call SpaceVim#mapping#space#def('nnoremap', ['f', 'r'], 'Unite file_mru', 'open-recent-file', 1)
- if g:spacevim_filemanager ==# 'vimfiler'
- call SpaceVim#mapping#space#def('nnoremap', ['f', 't'], 'VimFiler', 'toggle_file_tree', 1)
- call SpaceVim#mapping#space#def('nnoremap', ['f', 'T'], 'VimFiler -no-toggle', 'show_file_tree', 1)
- elseif g:spacevim_filemanager ==# 'nerdtree'
- call SpaceVim#mapping#space#def('nnoremap', ['f', 't'], 'NERDTreeToggle', 'toggle_file_tree', 1)
- call SpaceVim#mapping#space#def('nnoremap', ['f', 't'], 'NERDTree', 'toggle_file_tree', 1)
- endif
- call SpaceVim#mapping#space#def('nnoremap', ['f', 'y'], 'call zvim#util#CopyToClipboard()', 'show-and-copy-buffer-filename', 1)
- let g:_spacevim_mappings_space.f.v = {'name' : '+Vim(SpaceVim)'}
- call SpaceVim#mapping#space#def('nnoremap', ['f', 'v', 'v'], 'let @+=g:spacevim_version | echo g:spacevim_version', 'display-and-copy-version', 1)
- call SpaceVim#mapping#space#def('nnoremap', ['f', 'v', 'd'], 'SPConfig', 'open-custom-configuration', 1)
+ " file mappings
+ call SpaceVim#mapping#space#def('nnoremap', ['f', 'b'], 'BookmarkShowAll', 'unite-filtered-bookmarks', 1)
+ let g:_spacevim_mappings_space.f.C = {'name' : '+Files/convert'}
+ call SpaceVim#mapping#space#def('nnoremap', ['f', 'C', 'd'], 'update | e ++ff=dos | w', 'unix2dos', 1)
+ call SpaceVim#mapping#space#def('nnoremap', ['f', 'C', 'u'], 'update | e ++ff=dos | setlocal ff=unix | w', 'dos2unix', 1)
+ call SpaceVim#mapping#space#def('nnoremap', ['f', 'D'], 'call call('
+ \ . string(s:_function('s:delete_current_buffer_file')) . ', [])',
+ \ 'delete-current-buffer-file', 1)
+ call SpaceVim#mapping#space#def('nnoremap', ['f', 'F'], 'normal! gf', 'open-cursor-file', 1)
+ call SpaceVim#mapping#space#def('nnoremap', ['f', 'r'], 'Unite file_mru', 'open-recent-file', 1)
+ if g:spacevim_filemanager ==# 'vimfiler'
+ call SpaceVim#mapping#space#def('nnoremap', ['f', 't'], 'VimFiler', 'toggle_file_tree', 1)
+ call SpaceVim#mapping#space#def('nnoremap', ['f', 'T'], 'VimFiler -no-toggle', 'show_file_tree', 1)
+ elseif g:spacevim_filemanager ==# 'nerdtree'
+ call SpaceVim#mapping#space#def('nnoremap', ['f', 't'], 'NERDTreeToggle', 'toggle_file_tree', 1)
+ call SpaceVim#mapping#space#def('nnoremap', ['f', 't'], 'NERDTree', 'toggle_file_tree', 1)
+ endif
+ call SpaceVim#mapping#space#def('nnoremap', ['f', 'y'], 'call zvim#util#CopyToClipboard()', 'show-and-copy-buffer-filename', 1)
+ let g:_spacevim_mappings_space.f.v = {'name' : '+Vim(SpaceVim)'}
+ call SpaceVim#mapping#space#def('nnoremap', ['f', 'v', 'v'], 'let @+=g:spacevim_version | echo g:spacevim_version', 'display-and-copy-version', 1)
+ call SpaceVim#mapping#space#def('nnoremap', ['f', 'v', 'd'], 'SPConfig', 'open-custom-configuration', 1)
+ let lnum = expand('') + s:lnum - 1
+ call SpaceVim#mapping#space#def('nnoremap', ['n', '-'], 'call call('
+ \ . string(s:_function('s:number_transient_state')) . ', ["-"])',
+ \ ['Decrease number under cursor',
+ \ [
+ \ '[SPC n -] is to decrease the number under the cursor, and open',
+ \ 'the number translate state buffer',
+ \ '',
+ \ 'Definition: ' . s:filename . ':' . lnum,
+ \ ]
+ \ ]
+ \ , 1)
+ let lnum = expand('') + s:lnum - 1
+ call SpaceVim#mapping#space#def('nnoremap', ['n', '+'], 'call call('
+ \ . string(s:_function('s:number_transient_state')) . ', ["+"])',
+ \ ['Increase number under cursor',
+ \ [
+ \ '[SPC n +] is to increase the number under the cursor, and open',
+ \ 'the number translate state buffer',
+ \ '',
+ \ 'Definition: ' . s:filename . ':' . lnum,
+ \ ]
+ \ ]
+ \ , 1)
+endfunction
+
+function! s:number_transient_state(n) abort
+ if a:n ==# '+'
+ exe "normal! \"
+ else
+ exe "normal! \"
+ endif
+ let state = SpaceVim#api#import('transient_state')
+ call state.set_title('Number Transient State')
+ call state.defind_keys(
+ \ {
+ \ 'layout' : 'vertical split',
+ \ 'left' : [
+ \ {
+ \ 'key' : ['+','='],
+ \ 'desc' : 'increase number',
+ \ 'func' : '',
+ \ 'cmd' : "normal! \",
+ \ 'exit' : 0,
+ \ },
+ \ ],
+ \ 'right' : [
+ \ {
+ \ 'key' : '-',
+ \ 'desc' : 'decrease number',
+ \ 'func' : '',
+ \ 'cmd' : "normal! \",
+ \ 'exit' : 0,
+ \ },
+ \ ],
+ \ }
+ \ )
+ call state.open()
endfunction
let s:file = SpaceVim#api#import('file')
let s:MESSAGE = SpaceVim#api#import('vim#message')
function! s:next_file() abort
- let dir = expand('%:p:h')
- let f = expand('%:t')
- let file = s:file.ls(dir, 1)
- if index(file, f) == -1
- call add(file,f)
- endif
- call sort(file)
- if len(file) != 1
- if index(file, f) == len(file) - 1
- exe 'e ' . dir . s:file.separator . file[0]
- else
- exe 'e ' . dir . s:file.separator . file[index(file, f) + 1]
- endif
+ let dir = expand('%:p:h')
+ let f = expand('%:t')
+ let file = s:file.ls(dir, 1)
+ if index(file, f) == -1
+ call add(file,f)
+ endif
+ call sort(file)
+ if len(file) != 1
+ if index(file, f) == len(file) - 1
+ exe 'e ' . dir . s:file.separator . file[0]
+ else
+ exe 'e ' . dir . s:file.separator . file[index(file, f) + 1]
endif
+ endif
endfunction
function! s:previous_file() abort
- let dir = expand('%:p:h')
- let f = expand('%:t')
- let file = s:file.ls(dir, 1)
- if index(file, f) == -1
- call add(file,f)
- endif
- call sort(file)
- if len(file) != 1
- if index(file, f) == 0
- exe 'e ' . dir . s:file.separator . file[-1]
- else
- exe 'e ' . dir . s:file.separator . file[index(file, f) - 1]
- endif
+ let dir = expand('%:p:h')
+ let f = expand('%:t')
+ let file = s:file.ls(dir, 1)
+ if index(file, f) == -1
+ call add(file,f)
+ endif
+ call sort(file)
+ if len(file) != 1
+ if index(file, f) == 0
+ exe 'e ' . dir . s:file.separator . file[-1]
+ else
+ exe 'e ' . dir . s:file.separator . file[index(file, f) - 1]
endif
+ endif
endfunction
function! s:next_window() abort
- try
- exe (winnr() + 1 ) . 'wincmd w'
- catch
- exe 1 . 'wincmd w'
- endtry
+ try
+ exe (winnr() + 1 ) . 'wincmd w'
+ catch
+ exe 1 . 'wincmd w'
+ endtry
endfunction
function! s:previous_window() abort
- try
- if winnr() == 1
- exe winnr('$') . 'wincmd w'
- else
- exe (winnr() - 1 ) . 'wincmd w'
- endif
- catch
- exe winnr('$') . 'wincmd w'
- endtry
+ try
+ if winnr() == 1
+ exe winnr('$') . 'wincmd w'
+ else
+ exe (winnr() - 1 ) . 'wincmd w'
+ endif
+ catch
+ exe winnr('$') . 'wincmd w'
+ endtry
endfunction
function! s:split_string(newline) abort
- let syn_name = synIDattr(synID(line("."), col("."), 1), "name")
- if syn_name == &filetype . 'String'
- let c = col('.')
- let sep = ''
- while c > 0
- if s:is_string(line('.'), c)
- let c = c - 1
- else
- let sep = getline('.')[c]
- break
- endif
- endwhile
- if a:newline
- let save_register_m = @m
- let @m = sep . "\n" . sep
- normal! "mp
- let @m = save_register_m
- else
- let save_register_m = @m
- let @m = sep . sep
- normal! "mp
- let @m = save_register_m
- endif
+ let syn_name = synIDattr(synID(line("."), col("."), 1), "name")
+ if syn_name == &filetype . 'String'
+ let c = col('.')
+ let sep = ''
+ while c > 0
+ if s:is_string(line('.'), c)
+ let c = c - 1
+ else
+ let sep = getline('.')[c]
+ break
+ endif
+ endwhile
+ if a:newline
+ let save_register_m = @m
+ let @m = sep . "\n" . sep
+ normal! "mp
+ let @m = save_register_m
+ else
+ let save_register_m = @m
+ let @m = sep . sep
+ normal! "mp
+ let @m = save_register_m
endif
+ endif
endfunction
function! s:is_string(l,c) abort
- return synIDattr(synID(a:l, a:c, 1), "name") == &filetype . 'String'
+ return synIDattr(synID(a:l, a:c, 1), "name") == &filetype . 'String'
endfunction
" function() wrapper
if v:version > 703 || v:version == 703 && has('patch1170')
- function! s:_function(fstr) abort
- return function(a:fstr)
- endfunction
+ function! s:_function(fstr) abort
+ return function(a:fstr)
+ endfunction
else
- function! s:_SID() abort
- return matchstr(expand(''), '\zs\d\+\ze__SID$')
- endfunction
- let s:_s = '' . s:_SID() . '_'
- function! s:_function(fstr) abort
- return function(substitute(a:fstr, 's:', s:_s, 'g'))
- endfunction
+ function! s:_SID() abort
+ return matchstr(expand(''), '\zs\d\+\ze__SID$')
+ endfunction
+ let s:_s = '' . s:_SID() . '_'
+ function! s:_function(fstr) abort
+ return function(substitute(a:fstr, 's:', s:_s, 'g'))
+ endfunction
endif
function! s:jump_to_url() abort
- let g:EasyMotion_re_anywhere = 'http[s]*://'
- call feedkeys("\(easymotion-jumptoanywhere)")
+ let g:EasyMotion_re_anywhere = 'http[s]*://'
+ call feedkeys("\(easymotion-jumptoanywhere)")
endfunction
function! s:safe_erase_buffer() abort
- if s:MESSAGE.confirm('Erase content of buffer ' . expand('%:t'))
- normal! ggdG
- endif
- redraw!
+ if s:MESSAGE.confirm('Erase content of buffer ' . expand('%:t'))
+ normal! ggdG
+ endif
+ redraw!
endfunction
function! s:open_message_buffer() abort
- vertical topleft edit __Message_Buffer__
- setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline nospell nonumber norelativenumber
- setf message
- normal! ggdG
- silent put =execute(':message')
- normal! G
- setlocal nomodifiable
- nnoremap q :silent bd
+ vertical topleft edit __Message_Buffer__
+ setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline nospell nonumber norelativenumber
+ setf message
+ normal! ggdG
+ silent put =execute(':message')
+ normal! G
+ setlocal nomodifiable
+ nnoremap q :silent bd
endfunction
function! s:safe_revert_buffer() abort
- if s:MESSAGE.confirm('Revert buffer form ' . expand('%:p'))
- edit!
- endif
- redraw!
+ if s:MESSAGE.confirm('Revert buffer form ' . expand('%:p'))
+ edit!
+ endif
+ redraw!
endfunction
function! s:delete_current_buffer_file() abort
- if s:MESSAGE.confirm('Are you sure you want to delete this file')
- let f = fnameescape(expand('%:p'))
- call SpaceVim#mapping#close_current_buffer()
- if delete(f) == 0
- echo "File '" . f . "' successfully removed"
- endif
+ if s:MESSAGE.confirm('Are you sure you want to delete this file')
+ let f = fnameescape(expand('%:p'))
+ call SpaceVim#mapping#close_current_buffer()
+ if delete(f) == 0
+ echo "File '" . f . "' successfully removed"
endif
- redraw!
+ endif
+ redraw!
endfunction
function! s:swap_buffer_with_nth_win(nr) abort
- if a:nr <= winnr('$') && a:nr != winnr()
- let cb = bufnr('%')
- let tb = winbufnr(a:nr)
- if cb != tb
- exe a:nr . 'wincmd w'
- exe 'b' . cb
- wincmd p
- exe 'b' . tb
- endif
+ if a:nr <= winnr('$') && a:nr != winnr()
+ let cb = bufnr('%')
+ let tb = winbufnr(a:nr)
+ if cb != tb
+ exe a:nr . 'wincmd w'
+ exe 'b' . cb
+ wincmd p
+ exe 'b' . tb
endif
+ endif
endfunction
function! s:move_buffer_to_nth_win(nr) abort
- if a:nr <= winnr('$') && a:nr != winnr()
- let cb = bufnr('%')
- bp
- exe a:nr . 'wincmd w'
- exe 'b' . cb
- wincmd p
- endif
+ if a:nr <= winnr('$') && a:nr != winnr()
+ let cb = bufnr('%')
+ bp
+ exe a:nr . 'wincmd w'
+ exe 'b' . cb
+ wincmd p
+ endif
endfunction
function! s:buffer_transient_state() abort
- let state = SpaceVim#api#import('transient_state')
- call state.set_title('Buffer Selection Transient State')
- call state.defind_keys(
- \ {
- \ 'layout' : 'vertical split',
- \ 'left' : [
- \ {
- \ 'key' : {
- \ 'name' : 'C-1..C-9',
- \ 'pos' : [[1,4], [6,9]],
- \ 'handles' : [
- \ ["\" , ''],
- \ ["\" , ''],
- \ ["\" , ''],
- \ ["\" , ''],
- \ ["\" , ''],
- \ ["\" , ''],
- \ ["\" , ''],
- \ ["\" , ''],
- \ ["\" , ''],
- \ ],
- \ },
- \ 'desc' : 'goto nth window',
- \ 'func' : '',
- \ 'cmd' : '',
- \ 'exit' : 0,
- \ },
- \ {
- \ 'key' : {
- \ 'name' : '1..9',
- \ 'pos' : [[1,2], [4,5]],
- \ 'handles' : [
- \ ['1' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [1])'],
- \ ['2' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [2])'],
- \ ['3' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [3])'],
- \ ['4' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [4])'],
- \ ['5' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [5])'],
- \ ['6' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [6])'],
- \ ['7' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [7])'],
- \ ['8' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [8])'],
- \ ['9' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [9])'],
- \ ],
- \ },
- \ 'desc' : 'move buffer to nth window',
- \ 'func' : '',
- \ 'cmd' : '',
- \ 'exit' : 0,
- \ },
- \ {
- \ 'key' : {
- \ 'name' : 'M-1..M-9',
- \ 'pos' : [[1,4], [6,9]],
- \ 'handles' : [
- \ ["\" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [1])'],
- \ ["\" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [2])'],
- \ ["\" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [3])'],
- \ ["\" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [4])'],
- \ ["\" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [5])'],
- \ ["\" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [6])'],
- \ ["\" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [7])'],
- \ ["\" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [8])'],
- \ ["\" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [9])'],
- \ ],
- \ },
- \ 'desc' : 'swap buffer with nth window',
- \ 'func' : '',
- \ 'cmd' : '',
- \ 'exit' : 0,
- \ },
- \ ],
- \ 'right' : [
- \ {
- \ 'key' : 'n',
- \ 'desc' : 'next buffer',
- \ 'func' : '',
- \ 'cmd' : 'bnext',
- \ 'exit' : 0,
- \ },
- \ {
- \ 'key' : ['N', 'p'],
- \ 'desc' : 'previous buffer',
- \ 'func' : '',
- \ 'cmd' : 'bp',
- \ 'exit' : 0,
- \ },
- \ {
- \ 'key' : 'd',
- \ 'desc' : 'kill buffer',
- \ 'func' : '',
- \ 'cmd' : 'call SpaceVim#mapping#close_current_buffer()',
- \ 'exit' : 0,
- \ },
- \ {
- \ 'key' : 'q',
- \ 'desc' : 'quit',
- \ 'func' : '',
- \ 'cmd' : '',
- \ 'exit' : 1,
- \ },
- \ ],
- \ }
- \ )
- call state.open()
+ let state = SpaceVim#api#import('transient_state')
+ call state.set_title('Buffer Selection Transient State')
+ call state.defind_keys(
+ \ {
+ \ 'layout' : 'vertical split',
+ \ 'left' : [
+ \ {
+ \ 'key' : {
+ \ 'name' : 'C-1..C-9',
+ \ 'pos' : [[1,4], [6,9]],
+ \ 'handles' : [
+ \ ["\" , ''],
+ \ ["\" , ''],
+ \ ["\" , ''],
+ \ ["\" , ''],
+ \ ["\" , ''],
+ \ ["\" , ''],
+ \ ["\" , ''],
+ \ ["\" , ''],
+ \ ["\" , ''],
+ \ ],
+ \ },
+ \ 'desc' : 'goto nth window',
+ \ 'func' : '',
+ \ 'cmd' : '',
+ \ 'exit' : 0,
+ \ },
+ \ {
+ \ 'key' : {
+ \ 'name' : '1..9',
+ \ 'pos' : [[1,2], [4,5]],
+ \ 'handles' : [
+ \ ['1' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [1])'],
+ \ ['2' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [2])'],
+ \ ['3' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [3])'],
+ \ ['4' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [4])'],
+ \ ['5' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [5])'],
+ \ ['6' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [6])'],
+ \ ['7' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [7])'],
+ \ ['8' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [8])'],
+ \ ['9' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [9])'],
+ \ ],
+ \ },
+ \ 'desc' : 'move buffer to nth window',
+ \ 'func' : '',
+ \ 'cmd' : '',
+ \ 'exit' : 0,
+ \ },
+ \ {
+ \ 'key' : {
+ \ 'name' : 'M-1..M-9',
+ \ 'pos' : [[1,4], [6,9]],
+ \ 'handles' : [
+ \ ["\" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [1])'],
+ \ ["\" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [2])'],
+ \ ["\" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [3])'],
+ \ ["\" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [4])'],
+ \ ["\" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [5])'],
+ \ ["\" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [6])'],
+ \ ["\" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [7])'],
+ \ ["\" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [8])'],
+ \ ["\" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [9])'],
+ \ ],
+ \ },
+ \ 'desc' : 'swap buffer with nth window',
+ \ 'func' : '',
+ \ 'cmd' : '',
+ \ 'exit' : 0,
+ \ },
+ \ ],
+ \ 'right' : [
+ \ {
+ \ 'key' : 'n',
+ \ 'desc' : 'next buffer',
+ \ 'func' : '',
+ \ 'cmd' : 'bnext',
+ \ 'exit' : 0,
+ \ },
+ \ {
+ \ 'key' : ['N', 'p'],
+ \ 'desc' : 'previous buffer',
+ \ 'func' : '',
+ \ 'cmd' : 'bp',
+ \ 'exit' : 0,
+ \ },
+ \ {
+ \ 'key' : 'd',
+ \ 'desc' : 'kill buffer',
+ \ 'func' : '',
+ \ 'cmd' : 'call SpaceVim#mapping#close_current_buffer()',
+ \ 'exit' : 0,
+ \ },
+ \ {
+ \ 'key' : 'q',
+ \ 'desc' : 'quit',
+ \ 'func' : '',
+ \ 'cmd' : '',
+ \ 'exit' : 1,
+ \ },
+ \ ],
+ \ }
+ \ )
+ call state.open()
endfunction
diff --git a/autoload/SpaceVim/layers/edit.vim b/autoload/SpaceVim/layers/edit.vim
index f308eaa71..568bc6207 100644
--- a/autoload/SpaceVim/layers/edit.vim
+++ b/autoload/SpaceVim/layers/edit.vim
@@ -4,406 +4,416 @@ let s:NUMBER = SpaceVim#api#import('data#number')
let s:LIST = SpaceVim#api#import('data#list')
function! SpaceVim#layers#edit#plugins() abort
- let plugins = [
- \ ['tpope/vim-surround'],
- \ ['tpope/vim-repeat'],
- \ ['junegunn/vim-emoji'],
- \ ['terryma/vim-multiple-cursors', { 'loadconf' : 1}],
- \ ['terryma/vim-expand-region', { 'loadconf' : 1}],
- \ ['kana/vim-textobj-user'],
- \ ['kana/vim-textobj-indent'],
- \ ['kana/vim-textobj-line'],
- \ ['kana/vim-textobj-entire'],
- \ ['scrooloose/nerdcommenter', { 'loadconf' : 1}],
- \ ['mattn/emmet-vim', { 'on_cmd' : 'EmmetInstall'}],
- \ ['gcmt/wildfire.vim',{'on_map' : '(wildfire-'}],
- \ ['easymotion/vim-easymotion'],
- \ ['haya14busa/vim-easyoperator-line'],
- \ ['editorconfig/editorconfig-vim', { 'merged' : 0}],
- \ ['floobits/floobits-neovim', { 'on_cmd' : ['FlooJoinWorkspace','FlooShareDirPublic','FlooShareDirPrivate']}],
- \ ['osyo-manga/vim-jplus', { 'on_map' : '(jplus' }],
- \ ]
- if executable('fcitx')
- call add(plugins,['lilydjwg/fcitx.vim', { 'on_event' : 'InsertEnter'}])
- endif
- return plugins
+ let plugins = [
+ \ ['tpope/vim-surround'],
+ \ ['tpope/vim-repeat'],
+ \ ['junegunn/vim-emoji'],
+ \ ['terryma/vim-multiple-cursors', { 'loadconf' : 1}],
+ \ ['terryma/vim-expand-region', { 'loadconf' : 1}],
+ \ ['kana/vim-textobj-user'],
+ \ ['kana/vim-textobj-indent'],
+ \ ['kana/vim-textobj-line'],
+ \ ['kana/vim-textobj-entire'],
+ \ ['scrooloose/nerdcommenter', { 'loadconf' : 1}],
+ \ ['mattn/emmet-vim', { 'on_cmd' : 'EmmetInstall'}],
+ \ ['gcmt/wildfire.vim',{'on_map' : '(wildfire-'}],
+ \ ['easymotion/vim-easymotion'],
+ \ ['haya14busa/vim-easyoperator-line'],
+ \ ['editorconfig/editorconfig-vim', { 'merged' : 0}],
+ \ ['floobits/floobits-neovim', { 'on_cmd' : ['FlooJoinWorkspace','FlooShareDirPublic','FlooShareDirPrivate']}],
+ \ ['osyo-manga/vim-jplus', { 'on_map' : '(jplus' }],
+ \ ]
+ if executable('fcitx')
+ call add(plugins,['lilydjwg/fcitx.vim', { 'on_event' : 'InsertEnter'}])
+ endif
+ return plugins
endfunction
function! SpaceVim#layers#edit#config() abort
- let g:multi_cursor_next_key=get(g:, 'multi_cursor_next_key', '')
- let g:multi_cursor_prev_key=get(g:, 'multi_cursor_prev_key', '')
- let g:multi_cursor_skip_key=get(g:, 'multi_cursor_skip_key', '