From b41da783e616d7053a2a29638caa7f0d42fcb5e3 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sun, 6 Aug 2017 04:37:20 +0800 Subject: [PATCH 01/28] Release v0.4.0 FEATURES: Add comment mappings #683 Achievements #677 Add text manipulation commands #684 Add text insertion commands #685 Add CompleteParameter #688 Toggle cursor position #697 Add background searching feture #699 Improve plugin manager #702 #703 Grep on the fly #705 #709 #714 #717 Add prompt api #715 Add web api #726 Add check requirement script #736 Add language specified mappings #748 Improve Java layer #749 Add project manager mappings #751 Add plugin for mark active window #755 (not sure if it will be removed) Add help for mappings #756 Update autocomplete layer doc #759 Add tags layer #764 FIX: Fix vimfiler direction #686 Fix welcome page #707 Fix visual SPC #708 Fix windows support #712 Fix n/N hl state #720 Fix guibg parse #723 Fix unknown option #727 Fix select mode statusline #737 --- autoload/SpaceVim.vim | 2 +- docs/install.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/autoload/SpaceVim.vim b/autoload/SpaceVim.vim index 009df2a51..702196ad5 100644 --- a/autoload/SpaceVim.vim +++ b/autoload/SpaceVim.vim @@ -27,7 +27,7 @@ "" " Version of SpaceVim , this value can not be changed. scriptencoding utf-8 -let g:spacevim_version = '0.4.0-dev' +let g:spacevim_version = '0.4.0' lockvar g:spacevim_version "" " Change the default indentation of SpaceVim. Default is 2. diff --git a/docs/install.sh b/docs/install.sh index 10324e254..cb243beff 100755 --- a/docs/install.sh +++ b/docs/install.sh @@ -11,7 +11,7 @@ # Reset Color_off='\033[0m' # Text Reset -Version='0.4.0-dev' +Version='0.4.0' # Regular Colors Red='\033[0;31m' From fda7e26f4f4daaaa3f461df6331c5658a8a2cd40 Mon Sep 17 00:00:00 2001 From: Tennyson Taylor Bardwell Date: Fri, 11 Aug 2017 23:34:32 -0400 Subject: [PATCH 02/28] plugin: json-vim: update to newer, forked version Updated the lang layer to use elzr/vim-json's fork or the old plugin (leshill/vim-json). Now the actual used plugin is consistent with the documentation, which pointed to elzr/vim-json before --- autoload/SpaceVim/layers/lang.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/SpaceVim/layers/lang.vim b/autoload/SpaceVim/layers/lang.vim index 3c38bdafd..aae3f3e6c 100644 --- a/autoload/SpaceVim/layers/lang.vim +++ b/autoload/SpaceVim/layers/lang.vim @@ -10,7 +10,7 @@ function! SpaceVim#layers#lang#plugins() abort \ ['juvenn/mustache.vim', { 'on_ft' : ['mustache']}], \ ['leafgarland/typescript-vim', { 'on_ft' : ['typescript']}], \ ['kchmck/vim-coffee-script', { 'on_ft' : ['coffee']}], - \ ['leshill/vim-json', { 'on_ft' : ['javascript','json']}], + \ ['elzr/vim-json', { 'on_ft' : ['javascript','json']}], \ ['elixir-lang/vim-elixir', { 'on_ft' : 'elixir'}], \ ['PotatoesMaster/i3-vim-syntax', { 'on_ft' : 'i3'}], \ ['isundil/vim-irssi-syntax', { 'on_ft' : 'irssi'}], From f4fafb83b3e28977a05429ffdc417ffb251dd4c4 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Tue, 15 Aug 2017 04:12:58 +0800 Subject: [PATCH 03/28] Remove plugin that does not exist --- autoload/SpaceVim/layers/unite.vim | 1 - 1 file changed, 1 deletion(-) diff --git a/autoload/SpaceVim/layers/unite.vim b/autoload/SpaceVim/layers/unite.vim index 31496d084..6ff98483f 100644 --- a/autoload/SpaceVim/layers/unite.vim +++ b/autoload/SpaceVim/layers/unite.vim @@ -49,7 +49,6 @@ function! SpaceVim#layers#unite#plugins() abort \ ['sgur/unite-everything'], \ ['wsdjeg/unite-dwm'], \ ['raw1z/unite-projects'], - \ ['voi/unite-ctags'], \ ['Shougo/unite-session'], \ ['osyo-manga/unite-quickfix'], \ ['ujihisa/unite-colorscheme'], From d21d26f4c1e793452a2a06c0f9a2caf0ab9f6de4 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Tue, 15 Aug 2017 04:30:33 +0800 Subject: [PATCH 04/28] Use fork instead --- autoload/SpaceVim/layers/unite.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/autoload/SpaceVim/layers/unite.vim b/autoload/SpaceVim/layers/unite.vim index 6ff98483f..1a77349e3 100644 --- a/autoload/SpaceVim/layers/unite.vim +++ b/autoload/SpaceVim/layers/unite.vim @@ -49,6 +49,7 @@ function! SpaceVim#layers#unite#plugins() abort \ ['sgur/unite-everything'], \ ['wsdjeg/unite-dwm'], \ ['raw1z/unite-projects'], + \ ['SpaceVim/unite-ctags'], \ ['Shougo/unite-session'], \ ['osyo-manga/unite-quickfix'], \ ['ujihisa/unite-colorscheme'], From 864826182d3dcd46cfdbf18285cb045d49668c89 Mon Sep 17 00:00:00 2001 From: tenfy Date: Tue, 15 Aug 2017 10:52:09 +0800 Subject: [PATCH 05/28] Remove g:delimitMate_matchpairs setting. Let `)`(delimitMate mapping) can work. Remove '<:>' mapping, let the `less then` operator can work. Fixes #772 --- autoload/SpaceVim/layers/autocomplete.vim | 1 - 1 file changed, 1 deletion(-) diff --git a/autoload/SpaceVim/layers/autocomplete.vim b/autoload/SpaceVim/layers/autocomplete.vim index 64eeec865..b5e9b88c1 100644 --- a/autoload/SpaceVim/layers/autocomplete.vim +++ b/autoload/SpaceVim/layers/autocomplete.vim @@ -65,7 +65,6 @@ endfunction function! SpaceVim#layers#autocomplete#config() abort - let g:delimitMate_matchpairs = '[:],{:},<:>' inoremap ( complete_parameter#pre_complete("()") "mapping From febd39e89d73026346ef6a1e95ce14435f738632 Mon Sep 17 00:00:00 2001 From: tenfy Date: Tue, 15 Aug 2017 14:01:56 +0800 Subject: [PATCH 06/28] Call complete_parameter#pre_complete only pumvisible. If pumvisible is false, call "\delimitMate(" --- autoload/SpaceVim/layers/autocomplete.vim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/autoload/SpaceVim/layers/autocomplete.vim b/autoload/SpaceVim/layers/autocomplete.vim index b5e9b88c1..e9ae4237c 100644 --- a/autoload/SpaceVim/layers/autocomplete.vim +++ b/autoload/SpaceVim/layers/autocomplete.vim @@ -65,7 +65,10 @@ endfunction function! SpaceVim#layers#autocomplete#config() abort - inoremap ( complete_parameter#pre_complete("()") + imap ( + \ pumvisible() ? + \ complete_parameter#pre_complete("()") : + \ "\delimitMate(" "mapping imap SpaceVim#mapping#tab() From ed9ccacb85c750a74ac1ce28faaf8763042e2d0e Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Wed, 16 Aug 2017 05:06:58 +0800 Subject: [PATCH 07/28] Fix mapping to ( --- autoload/SpaceVim/layers/autocomplete.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/autoload/SpaceVim/layers/autocomplete.vim b/autoload/SpaceVim/layers/autocomplete.vim index e9ae4237c..b265c0ce5 100644 --- a/autoload/SpaceVim/layers/autocomplete.vim +++ b/autoload/SpaceVim/layers/autocomplete.vim @@ -68,7 +68,9 @@ function! SpaceVim#layers#autocomplete#config() abort imap ( \ pumvisible() ? \ complete_parameter#pre_complete("()") : - \ "\delimitMate(" + \ (len(maparg('delimitMate(', 'i')) == 0) ? + \ "\delimitMate(" : + \ '(' "mapping imap SpaceVim#mapping#tab() From 5314857d79a436492a1c96bd4fd575301865fbfa Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Wed, 16 Aug 2017 06:09:25 +0800 Subject: [PATCH 08/28] Update statusline for ctrlp buffer --- autoload/SpaceVim/layers/core/statusline.vim | 670 ++++++++++--------- config/main.vim | 6 +- 2 files changed, 358 insertions(+), 318 deletions(-) diff --git a/autoload/SpaceVim/layers/core/statusline.vim b/autoload/SpaceVim/layers/core/statusline.vim index 96b6ef451..977fd166f 100644 --- a/autoload/SpaceVim/layers/core/statusline.vim +++ b/autoload/SpaceVim/layers/core/statusline.vim @@ -18,413 +18,449 @@ let s:VIMCOMP = SpaceVim#api#import('vim#compatible') " 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' : ['', ''], + \ } let s:loaded_modes = ['syntax-checking'] let s:modes = { - \ 'center-cursor': { - \ 'icon' : '⊝', - \ 'desc' : 'centered-cursor mode', - \ }, - \ 'hi-characters-for-long-lines' :{ - \ 'icon' : '⑧', - \ 'desc' : 'toggle highlight of characters for long lines', - \ }, - \ 'fill-column-indicator' :{ - \ 'icon' : s:MESSLETTERS.circled_letter('f'), - \ 'desc' : 'fill-column-indicator mode', - \ }, - \ 'syntax-checking' :{ - \ 'icon' : s:MESSLETTERS.circled_letter('s'), - \ 'desc' : 'syntax-checking mode', - \ }, - \ 'spell-checking' :{ - \ 'icon' : s:MESSLETTERS.circled_letter('S'), - \ 'desc' : 'spell-checking mode', - \ }, - \ 'whitespace' :{ - \ 'icon' : s:MESSLETTERS.circled_letter('w'), - \ 'desc' : 'whitespace mode', - \ }, - \ } + \ 'center-cursor': { + \ 'icon' : '⊝', + \ 'desc' : 'centered-cursor mode', + \ }, + \ 'hi-characters-for-long-lines' :{ + \ 'icon' : '⑧', + \ 'desc' : 'toggle highlight of characters for long lines', + \ }, + \ 'fill-column-indicator' :{ + \ 'icon' : s:MESSLETTERS.circled_letter('f'), + \ 'desc' : 'fill-column-indicator mode', + \ }, + \ 'syntax-checking' :{ + \ 'icon' : s:MESSLETTERS.circled_letter('s'), + \ 'desc' : 'syntax-checking mode', + \ }, + \ 'spell-checking' :{ + \ 'icon' : s:MESSLETTERS.circled_letter('S'), + \ 'desc' : 'spell-checking mode', + \ }, + \ 'whitespace' :{ + \ 'icon' : s:MESSLETTERS.circled_letter('w'), + \ 'desc' : 'whitespace mode', + \ }, + \ } let s:loaded_sections = ['syntax checking', 'major mode', 'minor mode lighters', 'version control info', 'cursorpos'] function! s:battery_status() abort - if executable('acpi') - return ' ⚡' . substitute(split(system('acpi'))[-1], '%', '%%', 'g') . ' ' - else - return '' - endif + if executable('acpi') + return ' ⚡' . substitute(split(system('acpi'))[-1], '%', '%%', 'g') . ' ' + else + return '' + endif endfunction function! s:check_mode() abort - if mode() == 'n' - return 'n' - elseif mode() =='i' - return 'i' - elseif mode() =~ 'v' - return 'v' - elseif mode() =~ 'R' - return 'R' - endif + if mode() == 'n' + return 'n' + elseif mode() =='i' + return 'i' + elseif mode() =~ 'v' + return 'v' + elseif mode() =~ 'R' + return 'R' + endif endfunction function! s:search_status() abort - let ct = 0 - let tt = 0 - let ctl = split(s:VIMCOMP.execute('keeppatterns .,$s/' . @/ . '//gn', 'silent!'), "\n") - if !empty(ctl) - let ct = split(ctl[0])[0] - endif - let ttl = split(s:VIMCOMP.execute('keeppatterns %s/' . @/ . '//gn', 'silent!'), "\n") - if !empty(ctl) - let tt = split(ttl[0])[0] - endif - return ' ' . (str2nr(tt) - str2nr(ct) + 1) . '/' . tt . ' ' + let ct = 0 + let tt = 0 + let ctl = split(s:VIMCOMP.execute('keeppatterns .,$s/' . @/ . '//gn', 'silent!'), "\n") + if !empty(ctl) + let ct = split(ctl[0])[0] + endif + let ttl = split(s:VIMCOMP.execute('keeppatterns %s/' . @/ . '//gn', 'silent!'), "\n") + if !empty(ctl) + let tt = split(ttl[0])[0] + endif + return ' ' . (str2nr(tt) - str2nr(ct) + 1) . '/' . tt . ' ' endfunction function! s:time() abort - return ' ' . s:TIME.current_time() . ' ' + return ' ' . s:TIME.current_time() . ' ' endfunction if g:spacevim_enable_neomake - function! s:syntax_checking() - if !exists('g:loaded_neomake') - return '' - endif - let counts = neomake#statusline#LoclistCounts() - let warnings = get(counts, 'W', 0) - let errors = get(counts, 'E', 0) - let l = warnings ? ' %#SpaceVim_statusline_warn#●' . warnings . ' ' : '' - let l .= errors ? (warnings ? '' : ' ') . '%#SpaceVim_statusline_error#●' . errors . ' ' : '' - return l - endfunction + function! s:syntax_checking() + if !exists('g:loaded_neomake') + return '' + endif + let counts = neomake#statusline#LoclistCounts() + let warnings = get(counts, 'W', 0) + let errors = get(counts, 'E', 0) + let l = warnings ? ' %#SpaceVim_statusline_warn#●' . warnings . ' ' : '' + let l .= errors ? (warnings ? '' : ' ') . '%#SpaceVim_statusline_error#●' . errors . ' ' : '' + return l + endfunction else - function! s:syntax_checking() - if !exists(':SyntasticCheck') - return '' - endif - let l = SyntasticStatuslineFlag() - if strlen(l) > 0 - return l - else - return '' - endif - endfunction + function! s:syntax_checking() + if !exists(':SyntasticCheck') + return '' + endif + let l = SyntasticStatuslineFlag() + if strlen(l) > 0 + return l + else + return '' + endif + endfunction endif function! s:winnr(...) abort - if a:0 > 1 - return ' ' . s:MESSLETTERS.circled_num(winnr(), g:spacevim_windows_index_type) . ' ' - else - return '%{SpaceVim#layers#core#statusline#mode(mode())} ' . s:MESSLETTERS.circled_num(winnr(), g:spacevim_windows_index_type) . ' ' - endif + if a:0 > 1 + return ' ' . s:MESSLETTERS.circled_num(winnr(), g:spacevim_windows_index_type) . ' ' + else + return '%{SpaceVim#layers#core#statusline#mode(mode())} ' . s:MESSLETTERS.circled_num(winnr(), g:spacevim_windows_index_type) . ' ' + endif endfunction function! s:filename() abort - let name = fnamemodify(bufname('%'), ':t') - if empty(name) - let name = 'No Name' - endif - return (&modified ? ' * ' : ' - ') . s:filesize() . name . ' ' + let name = fnamemodify(bufname('%'), ':t') + if empty(name) + let name = 'No Name' + endif + return (&modified ? ' * ' : ' - ') . s:filesize() . name . ' ' endfunction function! s:git_branch() abort - if exists('g:loaded_fugitive') - let l:head = fugitive#head() - if empty(l:head) - call fugitive#detect(getcwd()) - let l:head = fugitive#head() - endif - return empty(l:head) ? '' : '  '.l:head . ' ' + if exists('g:loaded_fugitive') + let l:head = fugitive#head() + if empty(l:head) + call fugitive#detect(getcwd()) + let l:head = fugitive#head() endif - return '' + return empty(l:head) ? '' : '  '.l:head . ' ' + endif + return '' endfunction function! s:whitespace() abort - let ln = search('\s\+$', 'n') - if ln != 0 - return ' trailing[' . ln . '] ' - else - return '' - endif + let ln = search('\s\+$', 'n') + if ln != 0 + return ' trailing[' . ln . '] ' + else + return '' + endif endfunction function! s:cursorpos() abort - return ' %l:%c ' + return ' %l:%c ' endfunction function! s:modes() abort - let m = ' ❖ ' - for mode in s:loaded_modes - let m .= s:modes[mode].icon . ' ' - endfor - return m . ' ' + let m = ' ❖ ' + for mode in s:loaded_modes + let m .= s:modes[mode].icon . ' ' + endfor + return m . ' ' endfunction function! s:filesize() abort - let l:size = getfsize(bufname('%')) - if l:size == 0 || l:size == -1 || l:size == -2 - return '' - endif - if l:size < 1024 - return l:size.' bytes ' - elseif l:size < 1024*1024 - return printf('%.1f', l:size/1024.0).'k ' - elseif l:size < 1024*1024*1024 - return printf('%.1f', l:size/1024.0/1024.0) . 'm ' - else - return printf('%.1f', l:size/1024.0/1024.0/1024.0) . 'g ' - endif + let l:size = getfsize(bufname('%')) + if l:size == 0 || l:size == -1 || l:size == -2 + return '' + endif + if l:size < 1024 + return l:size.' bytes ' + elseif l:size < 1024*1024 + return printf('%.1f', l:size/1024.0).'k ' + elseif l:size < 1024*1024*1024 + return printf('%.1f', l:size/1024.0/1024.0) . 'm ' + else + return printf('%.1f', l:size/1024.0/1024.0/1024.0) . 'g ' + endif endfunction function! SpaceVim#layers#core#statusline#get(...) abort - 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 - elseif &filetype ==# 'startify' - call fugitive#detect(getcwd()) - elseif &filetype ==# 'SpaceVimLayerManager' - return '%#SpaceVim_statusline_a#' . s:winnr(1) . '%#SpaceVim_statusline_a_SpaceVim_statusline_b#' . s:lsep - \ . '%#SpaceVim_statusline_b# LayerManager %#SpaceVim_statusline_b_SpaceVim_statusline_c#' . s:lsep - elseif &filetype ==# 'SpaceVimPlugManager' - return '%#SpaceVim_statusline_a#' . s:winnr(1) . '%#SpaceVim_statusline_a_SpaceVim_statusline_b#' . s:lsep - \ . '%#SpaceVim_statusline_b# PlugManager %#SpaceVim_statusline_b_SpaceVim_statusline_c#' . s:lsep - elseif &filetype ==# 'SpaceVimTabsManager' - return '%#SpaceVim_statusline_a#' . s:winnr(1) . '%#SpaceVim_statusline_a_SpaceVim_statusline_b#' . s:lsep - \ . '%#SpaceVim_statusline_b# TabsManager %#SpaceVim_statusline_b_SpaceVim_statusline_c#' . s:lsep - elseif &filetype ==# 'denite' - return '%#SpaceVim_statusline_a_bold# %{SpaceVim#layers#core#statusline#denite_mode()} ' - \ . '%#SpaceVim_statusline_a_bold_SpaceVim_statusline_b#' . s:lsep . ' ' - \ . '%#SpaceVim_statusline_b#%{denite#get_status_sources()} %#SpaceVim_statusline_b_SpaceVim_statusline_z#' . s:lsep . ' ' - \ . '%#SpaceVim_statusline_z#%=%#SpaceVim_statusline_c_SpaceVim_statusline_z#' . s:rsep - \ . '%#SpaceVim_statusline_c# %{denite#get_status_path() . denite#get_status_linenr()}' - elseif &filetype ==# 'unite' - return '%#SpaceVim_statusline_a_bold#%{SpaceVim#layers#core#statusline#unite_mode()} Unite ' - \ . '%#SpaceVim_statusline_a_bold_SpaceVim_statusline_b#' . s:lsep . ' %{get(unite#get_context(), "buffer_name", "")} ' - \ . '%#SpaceVim_statusline_b_SpaceVim_statusline_c#' . s:lsep . ' ' - \ . '%#SpaceVim_statusline_c# %{unite#get_status_string()} ' - elseif &filetype ==# 'SpaceVimFlyGrep' - return '%#SpaceVim_statusline_a# FlyGrep %#SpaceVim_statusline_a_SpaceVim_statusline_b#' . s:lsep - \ . '%#SpaceVim_statusline_b# %{getcwd()}%#SpaceVim_statusline_b_SpaceVim_statusline_c#' . s:lsep - \ . '%#SpaceVim_statusline_c# %{SpaceVim#plugins#flygrep#lineNr()}' - elseif &filetype ==# 'TransientState' - return '%#SpaceVim_statusline_a# Transient State %#SpaceVim_statusline_a_SpaceVim_statusline_b#' - elseif &filetype ==# 'HelpDescribe' - return '%#SpaceVim_statusline_a# HelpDescribe %#SpaceVim_statusline_a_SpaceVim_statusline_b#' - endif - if a:0 > 0 - return s:active() - else - return s:inactive() - endif + 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 + elseif &filetype ==# 'startify' + call fugitive#detect(getcwd()) + elseif &filetype ==# 'SpaceVimLayerManager' + return '%#SpaceVim_statusline_a#' . s:winnr(1) . '%#SpaceVim_statusline_a_SpaceVim_statusline_b#' . s:lsep + \ . '%#SpaceVim_statusline_b# LayerManager %#SpaceVim_statusline_b_SpaceVim_statusline_c#' . s:lsep + elseif &filetype ==# 'SpaceVimPlugManager' + return '%#SpaceVim_statusline_a#' . s:winnr(1) . '%#SpaceVim_statusline_a_SpaceVim_statusline_b#' . s:lsep + \ . '%#SpaceVim_statusline_b# PlugManager %#SpaceVim_statusline_b_SpaceVim_statusline_c#' . s:lsep + elseif &filetype ==# 'SpaceVimTabsManager' + return '%#SpaceVim_statusline_a#' . s:winnr(1) . '%#SpaceVim_statusline_a_SpaceVim_statusline_b#' . s:lsep + \ . '%#SpaceVim_statusline_b# TabsManager %#SpaceVim_statusline_b_SpaceVim_statusline_c#' . s:lsep + elseif &filetype ==# 'denite' + return '%#SpaceVim_statusline_a_bold# %{SpaceVim#layers#core#statusline#denite_mode()} ' + \ . '%#SpaceVim_statusline_a_bold_SpaceVim_statusline_b#' . s:lsep . ' ' + \ . '%#SpaceVim_statusline_b#%{denite#get_status_sources()} %#SpaceVim_statusline_b_SpaceVim_statusline_z#' . s:lsep . ' ' + \ . '%#SpaceVim_statusline_z#%=%#SpaceVim_statusline_c_SpaceVim_statusline_z#' . s:rsep + \ . '%#SpaceVim_statusline_c# %{denite#get_status_path() . denite#get_status_linenr()}' + elseif &filetype ==# 'unite' + return '%#SpaceVim_statusline_a_bold#%{SpaceVim#layers#core#statusline#unite_mode()} Unite ' + \ . '%#SpaceVim_statusline_a_bold_SpaceVim_statusline_b#' . s:lsep . ' %{get(unite#get_context(), "buffer_name", "")} ' + \ . '%#SpaceVim_statusline_b_SpaceVim_statusline_c#' . s:lsep . ' ' + \ . '%#SpaceVim_statusline_c# %{unite#get_status_string()} ' + elseif &filetype ==# 'SpaceVimFlyGrep' + return '%#SpaceVim_statusline_a# FlyGrep %#SpaceVim_statusline_a_SpaceVim_statusline_b#' . s:lsep + \ . '%#SpaceVim_statusline_b# %{getcwd()}%#SpaceVim_statusline_b_SpaceVim_statusline_c#' . s:lsep + \ . '%#SpaceVim_statusline_c# %{SpaceVim#plugins#flygrep#lineNr()}' + elseif &filetype ==# 'TransientState' + return '%#SpaceVim_statusline_a# Transient State %#SpaceVim_statusline_a_SpaceVim_statusline_b#' + elseif &filetype ==# 'HelpDescribe' + return '%#SpaceVim_statusline_a# HelpDescribe %#SpaceVim_statusline_a_SpaceVim_statusline_b#' + endif + if a:0 > 0 + return s:active() + else + return s:inactive() + endif endfunction function! s:active() abort - let lsec = [s:winnr(), s:filename()] - if index(s:loaded_sections, 'search status') != -1 - call add(lsec, s:search_status()) - endif - if index(s:loaded_sections, 'major mode') != -1 && !empty(&filetype) - call add(lsec, ' ' . &filetype . ' ') - endif - let rsec = [] - if index(s:loaded_sections, 'syntax checking') != -1 && s:syntax_checking() != '' - call add(lsec, s:syntax_checking()) - endif + let lsec = [s:winnr(), s:filename()] + if index(s:loaded_sections, 'search status') != -1 + call add(lsec, s:search_status()) + endif + if index(s:loaded_sections, 'major mode') != -1 && !empty(&filetype) + call add(lsec, ' ' . &filetype . ' ') + endif + let rsec = [] + if index(s:loaded_sections, 'syntax checking') != -1 && s:syntax_checking() != '' + call add(lsec, s:syntax_checking()) + endif - if index(s:loaded_sections, 'minor mode lighters') != -1 - call add(lsec, s:modes()) - endif - if index(s:loaded_sections, 'version control info') != -1 - call add(lsec, s:git_branch()) - endif - call add(lsec, SpaceVim#plugins#searcher#count()) - if index(s:loaded_sections, 'battery status') != -1 - call add(rsec, s:battery_status()) - endif - call add(rsec, '%{" " . &ff . " | " . (&fenc!=""?&fenc:&enc) . " "}') - if index(s:loaded_sections, 'cursorpos') != -1 - call add(rsec, s:cursorpos()) - endif - call add(rsec, ' %P ') - if index(s:loaded_sections, 'time') != -1 - call add(rsec, s:time()) - endif + if index(s:loaded_sections, 'minor mode lighters') != -1 + call add(lsec, s:modes()) + endif + if index(s:loaded_sections, 'version control info') != -1 + call add(lsec, s:git_branch()) + endif + call add(lsec, SpaceVim#plugins#searcher#count()) + if index(s:loaded_sections, 'battery status') != -1 + call add(rsec, s:battery_status()) + endif + call add(rsec, '%{" " . &ff . " | " . (&fenc!=""?&fenc:&enc) . " "}') + if index(s:loaded_sections, 'cursorpos') != -1 + call add(rsec, s:cursorpos()) + endif + call add(rsec, ' %P ') + if index(s:loaded_sections, 'time') != -1 + call add(rsec, s:time()) + endif - if index(s:loaded_sections, 'whitespace') != -1 - call add(rsec, s:whitespace()) - endif - return s:STATUSLINE.build(lsec, rsec, s:lsep, s:rsep, - \ 'SpaceVim_statusline_a', 'SpaceVim_statusline_b', 'SpaceVim_statusline_c', 'SpaceVim_statusline_z') + if index(s:loaded_sections, 'whitespace') != -1 + call add(rsec, s:whitespace()) + endif + return s:STATUSLINE.build(lsec, rsec, s:lsep, s:rsep, + \ 'SpaceVim_statusline_a', 'SpaceVim_statusline_b', 'SpaceVim_statusline_c', 'SpaceVim_statusline_z') 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 ' + 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 ' endfunction function! s:gitgutter() abort - if exists('b:gitgutter_summary') - let l:summary = get(b:, 'gitgutter_summary') - if l:summary[0] != 0 || l:summary[1] != 0 || l:summary[2] != 0 - return ' +'.l:summary[0].' ~'.l:summary[1].' -'.l:summary[2].' ' - endif + if exists('b:gitgutter_summary') + let l:summary = get(b:, 'gitgutter_summary') + if l:summary[0] != 0 || l:summary[1] != 0 || l:summary[2] != 0 + return ' +'.l:summary[0].' ~'.l:summary[1].' -'.l:summary[2].' ' endif - return '' + endif + return '' endfunction function! SpaceVim#layers#core#statusline#init() abort - augroup SpaceVim_statusline - autocmd! - autocmd BufWinEnter,WinEnter,FileType - \ * let &l:statusline = SpaceVim#layers#core#statusline#get(1) - autocmd BufWinLeave,WinLeave * let &l:statusline = SpaceVim#layers#core#statusline#get() - autocmd ColorScheme * call SpaceVim#layers#core#statusline#def_colors() - augroup END + augroup SpaceVim_statusline + autocmd! + autocmd BufWinEnter,WinEnter,FileType + \ * let &l:statusline = SpaceVim#layers#core#statusline#get(1) + autocmd BufWinLeave,WinLeave * let &l:statusline = SpaceVim#layers#core#statusline#get() + autocmd ColorScheme * call SpaceVim#layers#core#statusline#def_colors() + augroup END endfunction let s:colors_template = SpaceVim#mapping#guide#theme#gruvbox#palette() function! SpaceVim#layers#core#statusline#def_colors() abort - 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 - let s:colors_template = t - exe 'hi! SpaceVim_statusline_a ctermbg=' . t[0][2] . ' ctermfg=' . t[0][3] . ' guibg=' . t[0][1] . ' guifg=' . t[0][0] - exe 'hi! SpaceVim_statusline_a_bold cterm=bold gui=bold ctermbg=' . t[0][2] . ' ctermfg=' . t[0][3] . ' guibg=' . t[0][1] . ' guifg=' . t[0][0] - exe 'hi! SpaceVim_statusline_ia ctermbg=' . t[0][2] . ' ctermfg=' . t[0][3] . ' guibg=' . t[0][1] . ' guifg=' . t[0][0] - exe 'hi! SpaceVim_statusline_b ctermbg=' . t[1][2] . ' ctermfg=' . t[1][3] . ' guibg=' . t[1][1] . ' guifg=' . t[1][0] - exe 'hi! SpaceVim_statusline_c ctermbg=' . t[2][2] . ' ctermfg=' . t[2][3] . ' guibg=' . t[2][1] . ' guifg=' . t[2][0] - exe 'hi! SpaceVim_statusline_z ctermbg=' . t[3][1] . ' ctermfg=' . t[3][1] . ' guibg=' . t[3][0] . ' guifg=' . t[3][0] - hi! SpaceVim_statusline_error ctermbg=003 ctermfg=Black guibg=#504945 guifg=#fb4934 gui=bold - hi! SpaceVim_statusline_warn ctermbg=003 ctermfg=Black guibg=#504945 guifg=#fabd2f gui=bold - call s:HI.hi_separator('SpaceVim_statusline_a', 'SpaceVim_statusline_b') - call s:HI.hi_separator('SpaceVim_statusline_a_bold', 'SpaceVim_statusline_b') - call s:HI.hi_separator('SpaceVim_statusline_ia', 'SpaceVim_statusline_b') - call s:HI.hi_separator('SpaceVim_statusline_b', 'SpaceVim_statusline_c') - call s:HI.hi_separator('SpaceVim_statusline_b', 'SpaceVim_statusline_z') - call s:HI.hi_separator('SpaceVim_statusline_c', 'SpaceVim_statusline_z') + 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 + let s:colors_template = t + exe 'hi! SpaceVim_statusline_a ctermbg=' . t[0][2] . ' ctermfg=' . t[0][3] . ' guibg=' . t[0][1] . ' guifg=' . t[0][0] + exe 'hi! SpaceVim_statusline_a_bold cterm=bold gui=bold ctermbg=' . t[0][2] . ' ctermfg=' . t[0][3] . ' guibg=' . t[0][1] . ' guifg=' . t[0][0] + exe 'hi! SpaceVim_statusline_ia ctermbg=' . t[0][2] . ' ctermfg=' . t[0][3] . ' guibg=' . t[0][1] . ' guifg=' . t[0][0] + exe 'hi! SpaceVim_statusline_b ctermbg=' . t[1][2] . ' ctermfg=' . t[1][3] . ' guibg=' . t[1][1] . ' guifg=' . t[1][0] + exe 'hi! SpaceVim_statusline_c ctermbg=' . t[2][2] . ' ctermfg=' . t[2][3] . ' guibg=' . t[2][1] . ' guifg=' . t[2][0] + exe 'hi! SpaceVim_statusline_z ctermbg=' . t[3][1] . ' ctermfg=' . t[3][1] . ' guibg=' . t[3][0] . ' guifg=' . t[3][0] + hi! SpaceVim_statusline_error ctermbg=003 ctermfg=Black guibg=#504945 guifg=#fb4934 gui=bold + hi! SpaceVim_statusline_warn ctermbg=003 ctermfg=Black guibg=#504945 guifg=#fabd2f gui=bold + call s:HI.hi_separator('SpaceVim_statusline_a', 'SpaceVim_statusline_b') + call s:HI.hi_separator('SpaceVim_statusline_a_bold', 'SpaceVim_statusline_b') + call s:HI.hi_separator('SpaceVim_statusline_ia', 'SpaceVim_statusline_b') + call s:HI.hi_separator('SpaceVim_statusline_b', 'SpaceVim_statusline_c') + call s:HI.hi_separator('SpaceVim_statusline_b', 'SpaceVim_statusline_z') + call s:HI.hi_separator('SpaceVim_statusline_c', 'SpaceVim_statusline_z') endfunction function! SpaceVim#layers#core#statusline#toggle_mode(name) abort - if index(s:loaded_modes, a:name) != -1 - call remove(s:loaded_modes, index(s:loaded_modes, a:name)) - else - call add(s:loaded_modes, a:name) - endif - let &l:statusline = SpaceVim#layers#core#statusline#get(1) + if index(s:loaded_modes, a:name) != -1 + call remove(s:loaded_modes, index(s:loaded_modes, a:name)) + else + call add(s:loaded_modes, a:name) + endif + let &l:statusline = SpaceVim#layers#core#statusline#get(1) endfunction function! SpaceVim#layers#core#statusline#toggle_section(name) abort - if index(s:loaded_sections, a:name) != -1 - call remove(s:loaded_sections, index(s:loaded_sections, a:name)) - else - call add(s:loaded_sections, a:name) - endif - let &l:statusline = SpaceVim#layers#core#statusline#get(1) + if index(s:loaded_sections, a:name) != -1 + call remove(s:loaded_sections, index(s:loaded_sections, a:name)) + else + call add(s:loaded_sections, a:name) + endif + let &l:statusline = SpaceVim#layers#core#statusline#get(1) endfunction function! SpaceVim#layers#core#statusline#rsep() - return get(s:separators, g:spacevim_statusline_separator, s:separators['arrow']) + return get(s:separators, g:spacevim_statusline_separator, s:separators['arrow']) 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")', - \ 'version control info', 1) - call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'M'], 'call SpaceVim#layers#core#statusline#toggle_section("major mode")', - \ 'toggle the major mode', 1) - call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'b'], 'call SpaceVim#layers#core#statusline#toggle_section("battery status")', - \ 'toggle the battery status', 1) - call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 't'], 'call SpaceVim#layers#core#statusline#toggle_section("time")', - \ 'toggle the time', 1) - call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'p'], 'call SpaceVim#layers#core#statusline#toggle_section("cursorpos")', - \ '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) - 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') - endfunction - let g:tagbar_status_func = 'TagbarStatusline' - let g:unite_force_overwrite_statusline = 0 + 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")', + \ 'version control info', 1) + call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'M'], 'call SpaceVim#layers#core#statusline#toggle_section("major mode")', + \ 'toggle the major mode', 1) + call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'b'], 'call SpaceVim#layers#core#statusline#toggle_section("battery status")', + \ 'toggle the battery status', 1) + call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 't'], 'call SpaceVim#layers#core#statusline#toggle_section("time")', + \ 'toggle the time', 1) + call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'p'], 'call SpaceVim#layers#core#statusline#toggle_section("cursorpos")', + \ '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) + 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') + endfunction + let g:tagbar_status_func = 'TagbarStatusline' + let g:unite_force_overwrite_statusline = 0 + let g:ctrlp_status_func = { + \ 'main': 'SpaceVim#layers#core#statusline#ctrlp', + \ 'prog': 'SpaceVim#layers#core#statusline#ctrlp_status', + \ } +endfunction + +" Arguments: +" | +" +- a:focus : The focus of the prompt: "prt" or "win". +" | +" +- a:byfname : In filename mode or in full path mode: "file" or "path". +" | +" +- a:regex : In regex mode: 1 or 0. +" | +" +- a:prev : The previous search mode. +" | +" +- a:item : The current search mode. +" | +" +- a:next : The next search mode. +" | +" +- a:marked : The number of marked files, or a comma separated list of +" the marked filenames. +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') +endfunction + +" a:str : Either the number of files scanned so far, or a string indicating +" the current directory is being scanned with a user_command. +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') endfunction function! SpaceVim#layers#core#statusline#jump(i) abort - if winnr('$') >= a:i - exe a:i . 'wincmd w' - endif + if winnr('$') >= a:i + exe a:i . 'wincmd w' + endif endfunction function! SpaceVim#layers#core#statusline#mode(mode) - let t = s:colors_template - if get(w:, 'spacevim_statusline_mode', '') != a:mode - if a:mode == 'n' - exe 'hi! SpaceVim_statusline_a ctermbg=' . t[0][2] . ' ctermfg=' . t[0][3] . ' guibg=' . t[0][1] . ' guifg=' . t[0][0] - elseif a:mode == 'i' - exe 'hi! SpaceVim_statusline_a ctermbg=' . t[4][3] . ' ctermfg=' . t[4][2] . ' guibg=' . t[4][1] . ' guifg=' . t[4][0] - elseif a:mode == 'R' - exe 'hi! SpaceVim_statusline_a ctermbg=' . t[6][3] . ' ctermfg=' . t[6][2] . ' guibg=' . t[6][1] . ' guifg=' . t[6][0] - elseif a:mode == 'v' || a:mode == 'V' || a:mode == '^V' || a:mode == 's' || a:mode == 'S' || a:mode == '^S' - exe 'hi! SpaceVim_statusline_a ctermbg=' . t[5][3] . ' ctermfg=' . t[5][2] . ' guibg=' . t[5][1] . ' guifg=' . t[5][0] - endif - call s:HI.hi_separator('SpaceVim_statusline_a', 'SpaceVim_statusline_b') - let w:spacevim_statusline_mode = a:mode + let t = s:colors_template + if get(w:, 'spacevim_statusline_mode', '') != a:mode + if a:mode == 'n' + exe 'hi! SpaceVim_statusline_a ctermbg=' . t[0][2] . ' ctermfg=' . t[0][3] . ' guibg=' . t[0][1] . ' guifg=' . t[0][0] + elseif a:mode == 'i' + exe 'hi! SpaceVim_statusline_a ctermbg=' . t[4][3] . ' ctermfg=' . t[4][2] . ' guibg=' . t[4][1] . ' guifg=' . t[4][0] + elseif a:mode == 'R' + exe 'hi! SpaceVim_statusline_a ctermbg=' . t[6][3] . ' ctermfg=' . t[6][2] . ' guibg=' . t[6][1] . ' guifg=' . t[6][0] + elseif a:mode == 'v' || a:mode == 'V' || a:mode == '^V' || a:mode == 's' || a:mode == 'S' || a:mode == '^S' + exe 'hi! SpaceVim_statusline_a ctermbg=' . t[5][3] . ' ctermfg=' . t[5][2] . ' guibg=' . t[5][1] . ' guifg=' . t[5][0] endif - return '' + call s:HI.hi_separator('SpaceVim_statusline_a', 'SpaceVim_statusline_b') + let w:spacevim_statusline_mode = a:mode + endif + return '' endfunction function! SpaceVim#layers#core#statusline#denite_mode() - let t = s:colors_template - let dmode = split(denite#get_status_mode())[1] - if get(w:, 'spacevim_statusline_mode', '') != dmode - if dmode == 'NORMAL' - exe 'hi! SpaceVim_statusline_a_bold cterm=bold gui=bold ctermbg=' . t[0][2] . ' ctermfg=' . t[0][3] . ' guibg=' . t[0][1] . ' guifg=' . t[0][0] - elseif dmode == 'INSERT' - exe 'hi! SpaceVim_statusline_a_bold cterm=bold gui=bold ctermbg=' . t[4][3] . ' ctermfg=' . t[4][2] . ' guibg=' . t[4][1] . ' guifg=' . t[4][0] - endif - call s:HI.hi_separator('SpaceVim_statusline_a_bold', 'SpaceVim_statusline_b') - let w:spacevim_statusline_mode = dmode + let t = s:colors_template + let dmode = split(denite#get_status_mode())[1] + if get(w:, 'spacevim_statusline_mode', '') != dmode + if dmode == 'NORMAL' + exe 'hi! SpaceVim_statusline_a_bold cterm=bold gui=bold ctermbg=' . t[0][2] . ' ctermfg=' . t[0][3] . ' guibg=' . t[0][1] . ' guifg=' . t[0][0] + elseif dmode == 'INSERT' + exe 'hi! SpaceVim_statusline_a_bold cterm=bold gui=bold ctermbg=' . t[4][3] . ' ctermfg=' . t[4][2] . ' guibg=' . t[4][1] . ' guifg=' . t[4][0] endif - return dmode + call s:HI.hi_separator('SpaceVim_statusline_a_bold', 'SpaceVim_statusline_b') + let w:spacevim_statusline_mode = dmode + endif + return dmode endfunction function! SpaceVim#layers#core#statusline#unite_mode() - let t = s:colors_template - let dmode = mode() - if get(w:, 'spacevim_statusline_mode', '') != dmode - if dmode == 'n' - exe 'hi! SpaceVim_statusline_a_bold cterm=bold gui=bold ctermbg=' . t[0][2] . ' ctermfg=' . t[0][3] . ' guibg=' . t[0][1] . ' guifg=' . t[0][0] - elseif dmode == 'i' - exe 'hi! SpaceVim_statusline_a_bold cterm=bold gui=bold ctermbg=' . t[4][3] . ' ctermfg=' . t[4][2] . ' guibg=' . t[4][1] . ' guifg=' . t[4][0] - endif - call s:HI.hi_separator('SpaceVim_statusline_a_bold', 'SpaceVim_statusline_b') - let w:spacevim_statusline_mode = dmode + let t = s:colors_template + let dmode = mode() + if get(w:, 'spacevim_statusline_mode', '') != dmode + if dmode == 'n' + exe 'hi! SpaceVim_statusline_a_bold cterm=bold gui=bold ctermbg=' . t[0][2] . ' ctermfg=' . t[0][3] . ' guibg=' . t[0][1] . ' guifg=' . t[0][0] + elseif dmode == 'i' + exe 'hi! SpaceVim_statusline_a_bold cterm=bold gui=bold ctermbg=' . t[4][3] . ' ctermfg=' . t[4][2] . ' guibg=' . t[4][1] . ' guifg=' . t[4][0] endif - return '' + call s:HI.hi_separator('SpaceVim_statusline_a_bold', 'SpaceVim_statusline_b') + let w:spacevim_statusline_mode = dmode + endif + return '' endfunction + +" vim:set et sw=2 cc=80: diff --git a/config/main.vim b/config/main.vim index 60c1c9ebb..6abcba9a0 100644 --- a/config/main.vim +++ b/config/main.vim @@ -1,4 +1,6 @@ -let g:Config_Main_Home = fnamemodify(expand(''), ':p:h:gs?\\?'.((has('win16') || has('win32') || has('win64'))?'\':'/') . '?') +let g:Config_Main_Home = fnamemodify(expand(''), + \ ':p:h:gs?\\?'.((has('win16') || has('win32') + \ || has('win64'))?'\':'/') . '?') " [dir?, path] @@ -58,3 +60,5 @@ endif call zvim#util#source_rc('commands.vim') filetype plugin indent on syntax on + +" vim:set et sw=2 cc=80: From 34d100d6835216f57f5d72da0f6ae6964affa1d4 Mon Sep 17 00:00:00 2001 From: techgaun Date: Sun, 20 Aug 2017 22:45:58 -0500 Subject: [PATCH 09/28] remove stray chars from documentation --- docs/documentation.md | 220 +++++++++++++++++++++--------------------- 1 file changed, 109 insertions(+), 111 deletions(-) diff --git a/docs/documentation.md b/docs/documentation.md index f9f3610e5..ec5ce1f4d 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -6,131 +6,131 @@ title: "Documentation" * [Core Pillars](#core-pillars) - * [Mnemonic](#mnemonic) - * [Discoverable](#discoverable) - * [Consistent](#consistent) - * [Crowd-Configured](#crowd-configured) + * [Mnemonic](#mnemonic) + * [Discoverable](#discoverable) + * [Consistent](#consistent) + * [Crowd-Configured](#crowd-configured) * [Highlighted features](#highlighted-features) * [Screenshots](#screenshots) - * [welcome page](#welcome-page) - * [working flow](#working-flow) + * [welcome page](#welcome-page) + * [working flow](#working-flow) * [Who can benefit from this?](#who-can-benefit-from-this) * [Update and Rollback](#update-and-rollback) - * [Update SpaceVim itself](#update-spacevim-itself) - * [Automatic Updates](#automatic-updates) - * [Updating from the SpaceVim Buffer](#updating-from-the-spacevim-buffer) - * [Updating Manually with git](#updating-manually-with-git) - * [Update plugins](#update-plugins) + * [Update SpaceVim itself](#update-spacevim-itself) + * [Automatic Updates](#automatic-updates) + * [Updating from the SpaceVim Buffer](#updating-from-the-spacevim-buffer) + * [Updating Manually with git](#updating-manually-with-git) + * [Update plugins](#update-plugins) * [Configuration layers](#configuration-layers) * [Custom Configuration](#custom-configuration) - * [Automatic Generation](#automatic-generation) - * [Alternative directory](#alternative-directory) + * [Automatic Generation](#automatic-generation) + * [Alternative directory](#alternative-directory) * [Concepts](#concepts) - * [Transient-states](#transient-states) + * [Transient-states](#transient-states) * [Awesome ui](#awesome-ui) - * [Colorschemes](#colorschemes) - * [Font](#font) - * [UI Toggles](#ui-toggles) - * [Statusline && tabline](#statusline--tabline) - * [statusline](#statusline) - * [tabline](#tabline) + * [Colorschemes](#colorschemes) + * [Font](#font) + * [UI Toggles](#ui-toggles) + * [Statusline && tabline](#statusline--tabline) + * [statusline](#statusline) + * [tabline](#tabline) * [Manual](#manual) - * [Completion](#completion) - * [Unite/Denite](#unitedenite) - * [Mappings within unite/denite buffer](#mappings-within-unitedenite-buffer) - * [Discovering](#discovering) - * [Mappings](#mappings) - * [Mappings guide](#mappings-guide) - * [Unide/Denite describe key bindings](#unidedenite-describe-key-bindings) - * [Getting help](#getting-help) - * [Available layers](#available-layers) - * [Available plugins in SpaceVim](#available-plugins-in-spacevim) - * [New packages from ELPA repositories](#new-packages-from-elpa-repositories) - * [Toggles](#toggles) - * [Navigating](#navigating) - * [Point/Cursor](#pointcursor) - * [Vim motions with vim-easymotion](#vim-motions-with-vim-easymotion) - * [quick-jump-link mode (TODO)](#quick-jump-link-mode-todo) - * [Unimpaired bindings](#unimpaired-bindings) - * [Jumping, Joining and Splitting](#jumping-joining-and-splitting) - * [Jumping](#jumping) - * [Joining and splitting](#joining-and-splitting) - * [Window manipulation](#window-manipulation) - * [Window manipulation key bindings](#window-manipulation-key-bindings) - * [Buffers and Files](#buffers-and-files) - * [Buffers manipulation key bindings](#buffers-manipulation-key-bindings) - * [Create a new empty buffer](#create-a-new-empty-buffer) - * [Special Buffers](#special-buffers) - * [Files manipulations key bindings](#files-manipulations-key-bindings) - * [Vim and SpaceVim files](#vim-and-spacevim-files) - * [File tree](#file-tree) - * [File tree navigation](#file-tree-navigation) - * [Open file with file tree.](#open-file-with-file-tree) - * [Commands starting with `g`](#commands-starting-with-g) - * [Commands starting with `z`](#commands-starting-with-z) - * [Auto-saving](#auto-saving) - * [Searching](#searching) - * [With an external tool](#with-an-external-tool) - * [Useful key bindings](#useful-key-bindings) - * [Searching in current file](#searching-in-current-file) - * [Searching in all loaded buffers](#searching-in-all-loaded-buffers) - * [Searching in an arbitrary directory](#searching-in-an-arbitrary-directory) - * [Searching in a project](#searching-in-a-project) - * [Background searching in a project](#background-searching-in-a-project) - * [Searching the web](#searching-the-web) - * [Searching on the fly](#searching-on-the-fly) - * [Persistent highlighting](#persistent-highlighting) - * [Editing](#editing) - * [Paste text](#paste-text) - * [Auto-indent pasted text](#auto-indent-pasted-text) - * [Text manipulation commands](#text-manipulation-commands) - * [Text insertion commands](#text-insertion-commands) - * [Commenting](#commenting) - * [Multi-Encodings](#multi-encodings) - * [Errors handling](#errors-handling) - * [Managing projects](#managing-projects) + * [Completion](#completion) + * [Unite/Denite](#unitedenite) + * [Mappings within unite/denite buffer](#mappings-within-unitedenite-buffer) + * [Discovering](#discovering) + * [Mappings](#mappings) + * [Mappings guide](#mappings-guide) + * [Unide/Denite describe key bindings](#unidedenite-describe-key-bindings) + * [Getting help](#getting-help) + * [Available layers](#available-layers) + * [Available plugins in SpaceVim](#available-plugins-in-spacevim) + * [New packages from ELPA repositories](#new-packages-from-elpa-repositories) + * [Toggles](#toggles) + * [Navigating](#navigating) + * [Point/Cursor](#pointcursor) + * [Vim motions with vim-easymotion](#vim-motions-with-vim-easymotion) + * [quick-jump-link mode (TODO)](#quick-jump-link-mode-todo) + * [Unimpaired bindings](#unimpaired-bindings) + * [Jumping, Joining and Splitting](#jumping-joining-and-splitting) + * [Jumping](#jumping) + * [Joining and splitting](#joining-and-splitting) + * [Window manipulation](#window-manipulation) + * [Window manipulation key bindings](#window-manipulation-key-bindings) + * [Buffers and Files](#buffers-and-files) + * [Buffers manipulation key bindings](#buffers-manipulation-key-bindings) + * [Create a new empty buffer](#create-a-new-empty-buffer) + * [Special Buffers](#special-buffers) + * [Files manipulations key bindings](#files-manipulations-key-bindings) + * [Vim and SpaceVim files](#vim-and-spacevim-files) + * [File tree](#file-tree) + * [File tree navigation](#file-tree-navigation) + * [Open file with file tree.](#open-file-with-file-tree) + * [Commands starting with `g`](#commands-starting-with-g) + * [Commands starting with `z`](#commands-starting-with-z) + * [Auto-saving](#auto-saving) + * [Searching](#searching) + * [With an external tool](#with-an-external-tool) + * [Useful key bindings](#useful-key-bindings) + * [Searching in current file](#searching-in-current-file) + * [Searching in all loaded buffers](#searching-in-all-loaded-buffers) + * [Searching in an arbitrary directory](#searching-in-an-arbitrary-directory) + * [Searching in a project](#searching-in-a-project) + * [Background searching in a project](#background-searching-in-a-project) + * [Searching the web](#searching-the-web) + * [Searching on the fly](#searching-on-the-fly) + * [Persistent highlighting](#persistent-highlighting) + * [Editing](#editing) + * [Paste text](#paste-text) + * [Auto-indent pasted text](#auto-indent-pasted-text) + * [Text manipulation commands](#text-manipulation-commands) + * [Text insertion commands](#text-insertion-commands) + * [Commenting](#commenting) + * [Multi-Encodings](#multi-encodings) + * [Errors handling](#errors-handling) + * [Managing projects](#managing-projects) * [Achievements](#achievements) - * [issues](#issues) - * [Stars, forks and watchers](#stars-forks-and-watchers) + * [issues](#issues) + * [Stars, forks and watchers](#stars-forks-and-watchers) * [Features](#features) - * [Awesome ui](#awesome-ui-1) - * [Mnemonic key bindings](#mnemonic-key-bindings) + * [Awesome ui](#awesome-ui-1) + * [Mnemonic key bindings](#mnemonic-key-bindings) * [Language specific mode](#language-specific-mode) * [Key Mapping](#key-mapping) - * [c/c++ support](#cc-support) - * [go support](#go-support) - * [python support](#python-support) + * [c/c++ support](#cc-support) + * [go support](#go-support) + * [python support](#python-support) * [Neovim centric - Dark powered mode of SpaceVim.](#neovim-centric---dark-powered-mode-of-spacevim) * [Modular configuration](#modular-configuration) * [Multiple leader mode](#multiple-leader-mode) - * [Global origin vim leader](#global-origin-vim-leader) - * [Local origin vim leader](#local-origin-vim-leader) - * [Windows function leader](#windows-function-leader) - * [Unite work flow leader](#unite-work-flow-leader) + * [Global origin vim leader](#global-origin-vim-leader) + * [Local origin vim leader](#local-origin-vim-leader) + * [Windows function leader](#windows-function-leader) + * [Unite work flow leader](#unite-work-flow-leader) * [Unite centric work-flow](#unite-centric-work-flow) - * [Plugin Highlights](#plugin-highlights) - * [Non Lazy-Loaded Plugins](#non-lazy-loaded-plugins) - * [Lazy-Loaded Plugins](#lazy-loaded-plugins) - * [Language](#language) - * [Commands](#commands) - * [Commands](#commands-1) - * [Completion](#completion-1) - * [Unite](#unite) - * [Operators & Text Objects](#operators--text-objects) - * [Custom Key bindings](#custom-key-bindings) - * [File Operations](#file-operations) - * [Editor UI](#editor-ui) - * [Window Management](#window-management) - * [Native functions](#native-functions) - * [Plugin: Unite](#plugin-unite) - * [Plugin: neocomplete](#plugin-neocomplete) - * [Plugin: NERD Commenter](#plugin-nerd-commenter) - * [Plugin: Goyo and Limelight](#plugin-goyo-and-limelight) - * [Plugin: ChooseWin](#plugin-choosewin) - * [Plugin: Bookmarks](#plugin-bookmarks) - * [Plugin: Gina/Gita](#plugin-ginagita) - * [Plugin: vim-signify](#plugin-vim-signify) - * [Misc Plugins](#misc-plugins) + * [Plugin Highlights](#plugin-highlights) + * [Non Lazy-Loaded Plugins](#non-lazy-loaded-plugins) + * [Lazy-Loaded Plugins](#lazy-loaded-plugins) + * [Language](#language) + * [Commands](#commands) + * [Commands](#commands-1) + * [Completion](#completion-1) + * [Unite](#unite) + * [Operators & Text Objects](#operators--text-objects) + * [Custom Key bindings](#custom-key-bindings) + * [File Operations](#file-operations) + * [Editor UI](#editor-ui) + * [Window Management](#window-management) + * [Native functions](#native-functions) + * [Plugin: Unite](#plugin-unite) + * [Plugin: neocomplete](#plugin-neocomplete) + * [Plugin: NERD Commenter](#plugin-nerd-commenter) + * [Plugin: Goyo and Limelight](#plugin-goyo-and-limelight) + * [Plugin: ChooseWin](#plugin-choosewin) + * [Plugin: Bookmarks](#plugin-bookmarks) + * [Plugin: Gina/Gita](#plugin-ginagita) + * [Plugin: vim-signify](#plugin-vim-signify) + * [Misc Plugins](#misc-plugins) @@ -847,7 +847,7 @@ SpaceVim use vimfiler as the default file tree, and the default key binding is ` let g:spacevim_filemanager = 'nerdtree' ``` -VCS integration is supported, there will be a colum status, this feature maybe make vimfiler slow, so it is not enabled by default. to enable this feature, add `let g:spacevim_enable_vimfiler_gitstatus = 1` to your custom config. here is any picture for this feature: +VCS integration is supported, there will be a column status, this feature maybe make vimfiler slow, so it is not enabled by default. to enable this feature, add `let g:spacevim_enable_vimfiler_gitstatus = 1` to your custom config. here is any picture for this feature: ![file-tree](https://user-images.githubusercontent.com/13142418/26881817-279225b2-4bcb-11e7-8872-7e4bd3d1c84e.png) @@ -887,8 +887,6 @@ If there is only one file buffer opened, a file is opened in the active window, | `sg` | open file in an vertically split window | | `sv` | open file in an horizontally split window | -<<<<<<< HEAD - ### Commands starting with `g` after pressing prefix `g` in normal mode, if you do not remember the mappings, you will see the guide which will tell you the functional of all mappings starting with `g`. From dd4598ef0c6154de5c3b7c32920fe4e1f9da33b9 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Tue, 22 Aug 2017 03:45:29 +0800 Subject: [PATCH 10/28] Update version --- README.md | 2 +- autoload/SpaceVim.vim | 2 +- docs/index.md | 2 +- docs/install.sh | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 27b86416e..69ec00c01 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ [Gitter **Chat**](https://gitter.im/SpaceVim/SpaceVim) [![Build Status](https://travis-ci.org/SpaceVim/SpaceVim.svg?branch=dev)](https://travis-ci.org/SpaceVim/SpaceVim) -![Version](https://img.shields.io/badge/version-0.4.0--dev-FF00CC.svg) +![Version](https://img.shields.io/badge/version-0.5.0--dev-FF00CC.svg) [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) [![Doc](https://img.shields.io/badge/doc-%3Ah%20SpaceVim-orange.svg)](doc/SpaceVim.txt) [![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/SpaceVim/SpaceVim.svg)](http://isitmaintained.com/project/SpaceVim/SpaceVim "Average time to resolve an issue") diff --git a/autoload/SpaceVim.vim b/autoload/SpaceVim.vim index 702196ad5..4dae49bc7 100644 --- a/autoload/SpaceVim.vim +++ b/autoload/SpaceVim.vim @@ -27,7 +27,7 @@ "" " Version of SpaceVim , this value can not be changed. scriptencoding utf-8 -let g:spacevim_version = '0.4.0' +let g:spacevim_version = '0.5.0-dev' lockvar g:spacevim_version "" " Change the default indentation of SpaceVim. Default is 2. diff --git a/docs/index.md b/docs/index.md index d94b67876..da85f1097 100644 --- a/docs/index.md +++ b/docs/index.md @@ -5,7 +5,7 @@ title: "Home" # Introduction [![Build Status](https://travis-ci.org/SpaceVim/SpaceVim.svg?branch=dev)](https://travis-ci.org/SpaceVim/SpaceVim) -![Version](https://img.shields.io/badge/version-0.4.0--dev-FF00CC.svg) +![Version](https://img.shields.io/badge/version-0.5.0--dev-FF00CC.svg) [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://raw.githubusercontent.com/SpaceVim/SpaceVim/dev/LICENSE) [![Doc](https://img.shields.io/badge/doc-%3Ah%20SpaceVim-orange.svg?style=flat-square)](https://raw.githubusercontent.com/SpaceVim/SpaceVim/dev/doc/SpaceVim.txt) [![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/SpaceVim/SpaceVim.svg)](http://isitmaintained.com/project/SpaceVim/SpaceVim "Average time to resolve an issue") diff --git a/docs/install.sh b/docs/install.sh index cb243beff..2a0d80ea2 100755 --- a/docs/install.sh +++ b/docs/install.sh @@ -11,7 +11,7 @@ # Reset Color_off='\033[0m' # Text Reset -Version='0.4.0' +Version='0.5.0-dev' # Regular Colors Red='\033[0;31m' From f80c39d1c1b76cb932f6aacea0518c4ced879dcc Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Tue, 22 Aug 2017 03:56:15 +0800 Subject: [PATCH 11/28] Add mapping g for jump to tag under cursor close #785 --- autoload/SpaceVim/mapping/g.vim | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/autoload/SpaceVim/mapping/g.vim b/autoload/SpaceVim/mapping/g.vim index 09659f9c0..ff2787f1f 100644 --- a/autoload/SpaceVim/mapping/g.vim +++ b/autoload/SpaceVim/mapping/g.vim @@ -94,10 +94,8 @@ function! SpaceVim#mapping#g#init() abort nnoremap gs gs let g:_spacevim_mappings_g['v'] = ['call feedkeys("gv", "n")', 'reselect the previous Visual area'] nnoremap gv gv - - - - + let g:_spacevim_mappings_g[''] = ['call feedkeys("g", "n")', 'jump to tag under cursor'] + nnoremap g g let g:_spacevim_mappings_g['d'] = ['call SpaceVim#mapping#gd()', 'goto definition'] call SpaceVim#mapping#def('nnoremap ', 'gd', ':call SpaceVim#mapping#gd()', 'Goto declaration', '') From 8e7f28f069210fa2c3817c79d78d46b7f8db0b79 Mon Sep 17 00:00:00 2001 From: Lewis Cowper Date: Tue, 22 Aug 2017 10:01:16 +0200 Subject: [PATCH 12/28] fix typo --- autoload/SpaceVim/layers/edit.vim | 2 +- docs/documentation.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/autoload/SpaceVim/layers/edit.vim b/autoload/SpaceVim/layers/edit.vim index 398aef9b9..bf6010c0d 100644 --- a/autoload/SpaceVim/layers/edit.vim +++ b/autoload/SpaceVim/layers/edit.vim @@ -49,7 +49,7 @@ function! SpaceVim#layers#edit#config() abort let g:_spacevim_mappings_space.x.i = {'name' : '+change symbol style'} nnoremap CountSelectionRegion :call count_selection_region() xnoremap CountSelectionRegion :call count_selection_region() - call SpaceVim#mapping#space#def('nmap', ['x', 'c'], 'CountSelectionRegion', 'cunt in the selection region', 0, 1) + call SpaceVim#mapping#space#def('nmap', ['x', 'c'], 'CountSelectionRegion', 'count in the selection region', 0, 1) call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', '&'], 'Tabularize /&', 'align region at &', 1) call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', '('], 'Tabularize /(', 'align region at (', 1) call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', ')'], 'Tabularize /)', 'align region at )', 1) diff --git a/docs/documentation.md b/docs/documentation.md index ec5ce1f4d..0f85244e4 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -1195,7 +1195,7 @@ Text related commands (start with `x`): | `SPC x a L` | right-align with evil-lion (TODO) | | `SPC x a r` | align region using user-specified regexp (TODO) | | `SPC x a m` | align region at arithmetic operators `(+-*/)` (TODO) | -| `SPC x c` | cunt the number of chars/words/lines in the selection region | +| `SPC x c` | count the number of chars/words/lines in the selection region | | `SPC x d w` | delete trailing whitespaces | | `SPC x d SPC` | Delete all spaces and tabs around point, leaving one space | | `SPC x g l` | set lanuages used by translate commands (TODO) | From 718b6723879ed91fe395615b6ae740128ccd3660 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Thu, 24 Aug 2017 04:01:43 +0800 Subject: [PATCH 13/28] Move context from readme --- README.md | 179 +----------------------------------------------------- 1 file changed, 3 insertions(+), 176 deletions(-) diff --git a/README.md b/README.md index 69ec00c01..b39a57681 100644 --- a/README.md +++ b/README.md @@ -13,40 +13,6 @@ [![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/SpaceVim/SpaceVim.svg)](http://isitmaintained.com/project/SpaceVim/SpaceVim "Average time to resolve an issue") [![Percentage of issues still open](http://isitmaintained.com/badge/open/SpaceVim/SpaceVim.svg)](http://isitmaintained.com/project/SpaceVim/SpaceVim "Percentage of issues still open") -SpaceVim is a community-driven vim distribution that seeks to provide layer feature, especially for neovim. It offers a variety of layers to choose from. to create a suitable vim development environment, you just need to select the required layers. - -See the [documentation](https://spacevim.org/documentation) or [the list of layers](http://spacevim.org/layers/) for more information. - -Here is a throughput graph of the repository for the last few weeks: - -[![Throughput Graph](https://graphs.waffle.io/SpaceVim/SpaceVim/throughput.svg)](https://waffle.io/SpaceVim/SpaceVim/metrics/throughput) - -# Table of Contents - - - -* [Introduction](#introduction) -* [Features](#features) - * [Mnemonic key bindings](#mnemonic-key-bindings) - * [Unite work flow](#unite-work-flow) - * [module statusline](#module-statusline) -* [Install](#install) - * [1. Requirements](#1-requirements) - * [2. Install SpaceVim in Linux/Mac](#2-install-spacevim-in-linuxmac) - * [3. Install SpaceVim in windows](#3-install-spacevim-in-windows) -* [Update](#update) -* [Documentation](#documentation) - * [Quick start guide](#quick-start-guide) -* [Community](#community) -* [Support SpaceVim](#support-spacevim) - * [contribute to SpaceVim](#contribute-to-spacevim) - * [Write post about SpaceVim](#write-post-about-spacevim) -* [Credits & Thanks](#credits--thanks) - - - -## Introduction - [SpaceVim](https://github.com/SpaceVim/SpaceVim) is a community-driven vim distribution with a bundle of modular configuration, here we call these modules as layers, each layer has different plugins and config, users just need to select the layers they need. It got inspired by [spacemacs](https://github.com/syl20bnr/spacemacs). If you use SpaceVim, @@ -55,10 +21,6 @@ put more time into development. ![welcome-page](https://cloud.githubusercontent.com/assets/13142418/26402270/28ad72b8-40bc-11e7-945e-003f41e057be.png) -If you are new to vim, you should learn about Vim in general, read [vim-galore](https://github.com/mhinz/vim-galore). - -## Features - - **Great documentation:** access documentation in Vim with :h SpaceVim. - **Beautiful GUI:** you'll love the awesome UI and its useful features. @@ -71,59 +33,15 @@ If you are new to vim, you should learn about Vim in general, read [vim-galore]( [conventions](http://spacevim.org/development/). - **Neovim centric:** Dark powered mode of SpaceVim -### Mnemonic key bindings +See the [documentation](https://spacevim.org/documentation) or [the list of layers](http://spacevim.org/layers/) for more information. -By default the guide buffer will be displayed 1000ms after the key has been pressed. You can change the delay by setting `'timeoutlen'` option to your liking (the value is in milliseconds). +Here is a throughput graph of the repository for the last few weeks: -for example, after pressing `` in normal mode, you will see : +[![Throughput Graph](https://graphs.waffle.io/SpaceVim/SpaceVim/throughput.svg)](https://waffle.io/SpaceVim/SpaceVim/metrics/throughput) -![mapping-guide](https://cloud.githubusercontent.com/assets/13142418/25778673/ae8c3168-3337-11e7-8536-ee78d59e5a9c.png) - -this guide show you all the available key bindings begin with `[SPC]`, you can type `b` for all the buffer mappings, `p` for project mappings, etc. after pressing `` in guide buffer, you will get paging and help info in the statusline. - -here is the guide for the default mappings in SpaceVim: - -![spc](https://user-images.githubusercontent.com/13142418/27549426-8141bd86-5ace-11e7-9082-eb86b398acdc.png) - -### Unite work flow - -![unite](docs/img/unite_mappings.png) - -### module statusline - -The `core#statusline` layer provide a heavily customized powerline with the following capabilities:, It is inspired by spacemacs's mode-line. and this layer is loaded by default. - -- show the window number -- color code for current state -- show the number of search results -- toggle syntax checking info -- toggle battery info -- toggle minor mode lighters - -![search status](https://cloud.githubusercontent.com/assets/13142418/26313080/578cc68c-3f3c-11e7-9259-a27419d49572.png) ## Install -### 1. Requirements - -**nerd fonts and true colors:** - -SpaceVim provides basic and awesome mode, if you want to use awesome mode, you need to install the [nerd-fonts](https://github.com/ryanoasis/nerd-fonts) and make sure your terminal support [true colors](https://gist.github.com/XVilka/8346728). - -**Vim 7.4 above or neovim:** - -- [neovim installation](https://github.com/neovim/neovim/wiki/Installing-Neovim) - -- [install vim with python, python3 and lua support](https://github.com/Valloric/YouCompleteMe/wiki/Building-Vim-from-source) - -**git:** - -SpaceVim will download all plugins via git. - -### 2. Install SpaceVim in Linux/Mac - -Install SpaceVim with the command below: - ```bash curl -sLf https://spacevim.org/install.sh | bash ``` @@ -136,93 +54,7 @@ for more info about the install script, please check: curl -sLf https://spacevim.org/install.sh | bash -s -- -h ``` -### 3. Install SpaceVim in windows -- For vim in windows, please just clone this repo as vimfiles in you Home directory. -by default, when open a cmd, the current dir is your Home directory, run this command in cmd. -make sure you have a backup of your own vimfiles. also you need remove `~/_vimrc` in your home directory. - -```sh -git clone https://github.com/SpaceVim/SpaceVim.git vimfiles -``` - -- For neovim in windows, please clone this repo as `AppData\Local\nvim` in your home directory. -for more info, please check out [neovim's wiki](https://github.com/neovim/neovim/wiki/Installing-Neovim). -by default, when open a cmd, the current dir is your Home directory, run this command in cmd. - -```bash -git clone https://github.com/SpaceVim/SpaceVim.git AppData\Local\nvim -``` - -## Update - -you can update SpaceVim with the command below: - -```viml -:SPUpdate SpaceVim -``` - -## Documentation - -### Quick start guide - -SpaceVim load custom configuration from `~/.SpaceVim.d/init.vim`, - -:warning: It is not `~/.SpaceVim/init.vim`, user should not change anything in `~/.SpaceVim/`. - -here is an example: - -```vim -" Here are some basic customizations, please refer to the ~/.SpaceVim.d/init.vim -" file for all possible options: -let g:spacevim_default_indent = 3 -let g:spacevim_max_column = 80 - -" Change the default directory where all miscellaneous persistent files go. -" By default it is ~/.cache/vimfiles/. -let g:spacevim_plugin_bundle_dir = '~/.cache/vimfiles/' - -" set SpaceVim colorscheme -let g:spacevim_colorscheme = 'gruvbox' - -" Set plugin manager, you want to use, default is dein.vim -let g:spacevim_plugin_manager = 'dein' " neobundle or dein or vim-plug - -" Set windows shortcut leader [Window], default is `s` -let g:spacevim_windows_leader = 's' - -" Set unite work flow shortcut leader [Unite], default is `f` -let g:spacevim_unite_leader = 'f' - -" Set Denite work flow shortcut leader [Denite], default is `F` -let g:spacevim_denite_leader = 'F' - -" By default, language specific plugins are not loaded. This can be changed -" with the following, then the plugins for go development will be loaded. -call SpaceVim#layers#load('lang#go') - -" loaded ui layer -call SpaceVim#layers#load('ui') - -" If there is a particular plugin you don't like, you can define this -" variable to disable them entirely: -let g:spacevim_disabled_plugins=[ - \ ['junegunn/fzf.vim'], - \ ] - -" If you want to add some custom plugins, use these options: -let g:spacevim_custom_plugins = [ - \ ['plasticboy/vim-markdown', {'on_ft' : 'markdown'}], - \ ['wsdjeg/GitHub.vim'], - \ ] - -" set the guifont -let g:spacevim_guifont = 'DejaVu\ Sans\ Mono\ for\ Powerline\ 11' -``` - -Comprehensive documentation is available for each layer by :h SpaceVim. - -You can also check the [general documentation](http://spacevim.org/documentation/). ## Community @@ -261,11 +93,6 @@ markdown Before contributing be sure to consult the [contribution guidelines](http://spacevim.org/development/#contribution-guidelines) and [conventions](http://spacevim.org/development/#conventions). -### Write post about SpaceVim - -if you want to write something about SpaceVim, and want your post to be posted in [SpaceVim's blog page](https://spacevim.org/blog), please show us the link. - - ## Credits & Thanks - [![GitHub contributors](https://img.shields.io/github/contributors/SpaceVim/SpaceVim.svg)](https://github.com/SpaceVim/SpaceVim/graphs/contributors) From e3daff27a000df3d59104fb7edd9fc40900ef982 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Thu, 24 Aug 2017 04:08:11 +0800 Subject: [PATCH 14/28] Update readme --- README.md | 63 ++++++++++++++++--------------------------------------- 1 file changed, 18 insertions(+), 45 deletions(-) diff --git a/README.md b/README.md index b39a57681..be3a148c1 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,8 @@ [Documentation](http://spacevim.org/documentation/) | [Twitter](https://twitter.com/SpaceVim) | [Community](https://spacevim.org/community/) | -[Gitter **Chat**](https://gitter.im/SpaceVim/SpaceVim) +[Gitter **Chat**](https://gitter.im/SpaceVim/SpaceVim) | +[中文文档](http://spacevim.org/README_zh_cn/) [![Build Status](https://travis-ci.org/SpaceVim/SpaceVim.svg?branch=dev)](https://travis-ci.org/SpaceVim/SpaceVim) ![Version](https://img.shields.io/badge/version-0.5.0--dev-FF00CC.svg) @@ -21,17 +22,6 @@ put more time into development. ![welcome-page](https://cloud.githubusercontent.com/assets/13142418/26402270/28ad72b8-40bc-11e7-945e-003f41e057be.png) -- **Great documentation:** access documentation in Vim with - :h SpaceVim. -- **Beautiful GUI:** you'll love the awesome UI and its useful features. -- **Mnemonic key bindings:** commands have mnemonic prefixes like - [Window] for all the window and buffer commands or [Unite] for the - unite work flow commands. -- **Lazy load plugins:** Lazy-load 90% of plugins with [dein.vim] -- **Batteries included:** discover hundreds of ready-to-use packages nicely - organised in configuration layers following a set of - [conventions](http://spacevim.org/development/). -- **Neovim centric:** Dark powered mode of SpaceVim See the [documentation](https://spacevim.org/documentation) or [the list of layers](http://spacevim.org/layers/) for more information. @@ -40,7 +30,7 @@ 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) -## Install +### Install ```bash curl -sLf https://spacevim.org/install.sh | bash @@ -54,46 +44,29 @@ for more info about the install script, please check: curl -sLf https://spacevim.org/install.sh | bash -s -- -h ``` +### Features +- **Great documentation:** access documentation in Vim with + :h SpaceVim. +- **Beautiful GUI:** you'll love the awesome UI and its useful features. +- **Mnemonic key bindings:** commands have mnemonic prefixes like + [Window] for all the window and buffer commands or [Unite] for the + unite work flow commands. +- **Lazy load plugins:** Lazy-load 90% of plugins with [dein.vim] +- **Batteries included:** discover hundreds of ready-to-use packages nicely + organised in configuration layers following a set of + [conventions](http://spacevim.org/development/). +- **Neovim centric:** Dark powered mode of SpaceVim -## Community - -Try these SpaceVim hangouts for any questions, problems or comments. -- Chat - - [![Gitter](https://badges.gitter.im/SpaceVim/SpaceVim.svg)](https://gitter.im/SpaceVim/SpaceVim?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) - - [![QQ](https://img.shields.io/badge/QQ群-121056965-blue.svg)](https://jq.qq.com/?_wv=1027&k=43DB6SG) - - [![Facebook](https://img.shields.io/badge/FaceBook-SpaceVim-blue.svg)](https://www.facebook.com/SpaceVim) -- Ask - - [issue tracker](https://github.com/SpaceVim/SpaceVim/issues) for issue and feature requests - - vi StackExchange for "how to" & configuration questions - - [![Twitter Follow](https://img.shields.io/twitter/follow/SpaceVim.svg?style=social&label=Follow&maxAge=2592000)](https://twitter.com/SpaceVim) for hugs & pithy comments -- Discuss - - [google mailing list](https://groups.google.com/forum/#!forum/spacevim) - - -## Support SpaceVim +### 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. -If you want to show your support financially you can contribute to [Bountysource](https://www.bountysource.com/teams/spacevim) or buy a drink for the maintainer by clicking following icon. +If you want to show your support financially you can buy a drink for the maintainer by clicking following icon. Buy Me a Coffee at ko-fi.com -If you used SpaceVim in a project and you want to show that fact, you can use the SpaceVim badge: - -[![](https://spacevim.org/img/build-with-SpaceVim.svg)](https://spacevim.org) - -markdown - -```markdown -[![](https://spacevim.org/img/build-with-SpaceVim.svg)](https://spacevim.org) -``` - -### contribute to SpaceVim - -Before contributing be sure to consult the [contribution guidelines](http://spacevim.org/development/#contribution-guidelines) and [conventions](http://spacevim.org/development/#conventions). - -## Credits & Thanks +### Credits & Thanks - [![GitHub contributors](https://img.shields.io/github/contributors/SpaceVim/SpaceVim.svg)](https://github.com/SpaceVim/SpaceVim/graphs/contributors) - [vimdoc](https://github.com/google/vimdoc) generate doc file for SpaceVim From bc5ada5fc6339a3d935a60f0a8245cf87ed7a3c3 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Thu, 24 Aug 2017 04:19:49 +0800 Subject: [PATCH 15/28] Update intr --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index be3a148c1..c64ed998b 100644 --- a/README.md +++ b/README.md @@ -14,9 +14,7 @@ [![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/SpaceVim/SpaceVim.svg)](http://isitmaintained.com/project/SpaceVim/SpaceVim "Average time to resolve an issue") [![Percentage of issues still open](http://isitmaintained.com/badge/open/SpaceVim/SpaceVim.svg)](http://isitmaintained.com/project/SpaceVim/SpaceVim "Percentage of issues still open") -[SpaceVim](https://github.com/SpaceVim/SpaceVim) is a community-driven vim distribution with a bundle of modular configuration, -here we call these modules as layers, each layer has different plugins and config, users just need -to select the layers they need. It got inspired by [spacemacs](https://github.com/syl20bnr/spacemacs). If you use SpaceVim, +SpaceVim is a community-driven vim distribution that seeks to provide layer feature, especially for neovim. It offers a variety of layers to choose from. to create a suitable vim development environment, you just need to select the required layers. If you use SpaceVim, please star it on github. It's a great way of getting feedback and gives me the kick to put more time into development. From 0d220f5d349e540b6232f5fc7b70734320e3b3d3 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Thu, 24 Aug 2017 05:41:59 +0800 Subject: [PATCH 16/28] Update readme --- README.md | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index c64ed998b..01d9e8fbf 100644 --- a/README.md +++ b/README.md @@ -47,13 +47,8 @@ curl -sLf https://spacevim.org/install.sh | bash -s -- -h - **Great documentation:** access documentation in Vim with :h SpaceVim. - **Beautiful GUI:** you'll love the awesome UI and its useful features. -- **Mnemonic key bindings:** commands have mnemonic prefixes like - [Window] for all the window and buffer commands or [Unite] for the - unite work flow commands. -- **Lazy load plugins:** Lazy-load 90% of plugins with [dein.vim] -- **Batteries included:** discover hundreds of ready-to-use packages nicely - organised in configuration layers following a set of - [conventions](http://spacevim.org/development/). +- **Mnemonic key bindings:** all key bindings have mnemonic prefixes. +- **Lazy load plugins:** Lazy-load 90% of plugins with [dein.vim](https://github.com/Shougo/dein.vim) - **Neovim centric:** Dark powered mode of SpaceVim ### Support SpaceVim From f33fbfd39159d5f300eab8a278662c623bdf8a80 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sat, 26 Aug 2017 20:17:33 +0800 Subject: [PATCH 17/28] Bug: can not override layer options. Fix #793 --- autoload/SpaceVim/layers.vim | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/autoload/SpaceVim/layers.vim b/autoload/SpaceVim/layers.vim index 736499758..ca9ac0463 100644 --- a/autoload/SpaceVim/layers.vim +++ b/autoload/SpaceVim/layers.vim @@ -12,9 +12,12 @@ function! SpaceVim#layers#load(layer, ...) abort endif if index(g:spacevim_plugin_groups, a:layer) == -1 call add(g:spacevim_plugin_groups, a:layer) - if a:0 == 1 && type(a:1) == 4 + endif + if a:0 == 1 && type(a:1) == 4 + try call SpaceVim#layers#{a:layer}#set_variable(a:1) - endif + catch /^Vim\%((\a\+)\)\=:E117/ + endtry endif if a:0 > 0 && type(a:1) == 1 for l in a:000 From 4005a767dcd0d8e97e91ef4df6542087bce53a90 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sat, 26 Aug 2017 21:45:38 +0800 Subject: [PATCH 18/28] Add help desc --- autoload/SpaceVim/layers/default.vim | 212 ++++++++++++++------------- autoload/SpaceVim/mapping/space.vim | 26 +++- syntax/HelpDescribe.vim | 8 + 3 files changed, 140 insertions(+), 106 deletions(-) create mode 100644 syntax/HelpDescribe.vim diff --git a/autoload/SpaceVim/layers/default.vim b/autoload/SpaceVim/layers/default.vim index 8103aaa9d..c8761dadd 100644 --- a/autoload/SpaceVim/layers/default.vim +++ b/autoload/SpaceVim/layers/default.vim @@ -2,12 +2,15 @@ " @section Default, default " @parentsection layers +let s:filename = expand(':~') + function! SpaceVim#layers#default#plugins() abort let plugins = [] return plugins endfunction +let s:lnum = expand('') + 3 function! SpaceVim#layers#default#config() abort " Unimpaired bindings " Quickly add empty lines @@ -47,7 +50,20 @@ function! SpaceVim#layers#default#config() abort " Select last paste nnoremap gp '`['.strpart(getregtype(), 0, 1).'`]' - call SpaceVim#mapping#space#def('nnoremap', ['f', 'f'], "exe 'CtrlP ' . fnamemodify(bufname('%'), ':h')", 'Find files in the directory of the current buffer', 1) + let lnum = expand('') + s:lnum - 1 + call SpaceVim#mapping#space#def('nnoremap', ['f', 'f'], + \ "exe 'CtrlP ' . fnamemodify(bufname('%'), ':h')", + \ ['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) @@ -286,7 +302,7 @@ function! s:delete_current_buffer_file() abort endif endif redraw! - + endfunction function! s:swap_buffer_with_nth_win(nr) abort @@ -317,102 +333,102 @@ function! s:buffer_transient_state() abort 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, - \ }, - \ ], + \ '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() diff --git a/autoload/SpaceVim/mapping/space.vim b/autoload/SpaceVim/mapping/space.vim index d45665316..58ba5fe86 100644 --- a/autoload/SpaceVim/mapping/space.vim +++ b/autoload/SpaceVim/mapping/space.vim @@ -1,3 +1,4 @@ +let s:file = expand(':~') function! SpaceVim#mapping#space#init() abort if s:has_map_to_spc() return @@ -63,19 +64,28 @@ function! SpaceVim#mapping#space#init() abort call SpaceVim#mapping#space#def('nnoremap', ['w', 'W'], 'ChooseWin', 'select window', 1) call SpaceVim#mapping#space#def('nnoremap', ['w', 'u'], 'call SpaceVim#plugins#windowsmanager#UndoQuitWin()', 'undo quieted window', 1) call SpaceVim#mapping#space#def('nnoremap', ['w', 'U'], 'call SpaceVim#plugins#windowsmanager#RedoQuitWin()', 'redo quieted window', 1) - nnoremap [SPC]bn :bnext - let g:_spacevim_mappings_space.b.n = ['bnext', 'next buffer', + let s:lnum = expand('') + 3 + call SpaceVim#mapping#space#def('nnoremap', ['b', 'n'], 'bnext', ['next buffer', \ [ - \ 'SPC b n is running :bnext, jump to next buffer', + \ '[SPC b n] is running :bnext, jump to next buffer', \ 'which is a vim build in command', \ 'It is bound to SPC b n, ] b,', + \ '', + \ 'Definition: ' . s:file . ':' . s:lnum, \ ] \ ] - call SpaceVim#mapping#menu('Open next buffer', '[SPC]bn', 'bp') - nnoremap [SPC]bp :bp - let g:_spacevim_mappings_space.b.p = ['bp', 'previous buffer'] - call SpaceVim#mapping#menu('Open previous buffer', '[SPC]bp', 'bp') - + \ , 1) + let s:lnum = expand('') + 3 + call SpaceVim#mapping#space#def('nnoremap', ['b', 'p'], 'bp', ['previous buffer', + \ [ + \ 'SPC b p is running :bp, jump to previous buffer', + \ 'which is a vim build in command', + \ 'It is bound to SPC b p, [ b,', + \ '', + \ 'Definition: ' . s:file . ':' . s:lnum, + \ ] + \ ] + \ , 1) " " Comments sections " diff --git a/syntax/HelpDescribe.vim b/syntax/HelpDescribe.vim new file mode 100644 index 000000000..69482ad9c --- /dev/null +++ b/syntax/HelpDescribe.vim @@ -0,0 +1,8 @@ +if exists("b:current_syntax") + finish +endif +let b:current_syntax = "HelpDescribe" +syntax case ignore +syn match FileName /[^:]*:\d\+:/ + +hi def link FileName Comment From d33f6fa04ed07fc74ec775cb2b217e2f7b3ebcfb Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sat, 26 Aug 2017 14:28:32 +0000 Subject: [PATCH 19/28] Update fild founder cmd --- autoload/SpaceVim/layers/default.vim | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/autoload/SpaceVim/layers/default.vim b/autoload/SpaceVim/layers/default.vim index c8761dadd..65fc02481 100644 --- a/autoload/SpaceVim/layers/default.vim +++ b/autoload/SpaceVim/layers/default.vim @@ -51,8 +51,15 @@ function! SpaceVim#layers#default#config() abort 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'], - \ "exe 'CtrlP ' . fnamemodify(bufname('%'), ':h')", + \ cmd, \ ['Find files in the directory of the current buffer', \ [ \ '[SPC f f] is to find files in the directory of the current buffer', From bb2d69809b0f22f81bc0df14bae07ba534158146 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sat, 26 Aug 2017 15:40:20 +0000 Subject: [PATCH 20/28] Update autocomplete layer --- docs/layers/autocomplete.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/layers/autocomplete.md b/docs/layers/autocomplete.md index 5d9eeb1e3..157edabcf 100644 --- a/docs/layers/autocomplete.md +++ b/docs/layers/autocomplete.md @@ -44,17 +44,18 @@ call SpaceVim#layers#load('autocomplete') You can customize the user experience of auto-completion with the following layer variables: -1. `auto-completion-return-key-behavior` set the action to perform when the `RET` key is pressed, the possible values are: +1. `auto-completion-return-key-behavior` set the action to perform when the `Return`/`Enter` key is pressed, the possible values are: - `complete` completes with the current selection -- `nil` does nothing +- `smart` completes with current selection and expand snippet or argvs +- `nil` 2. `auto-completion-tab-key-behavior` set the action to perform when the `TAB` key is pressed, the possible values are: - `smart` cycle candidates, expand snippets, jump parameters - `complete` completes with the current selection - `cycle` completes the common prefix and cycle between candidates -- `nil` does nothing +- `nil` insert a carriage return 3. `auto-completion-complete-with-key-sequence` is a string of two characters denoting a key sequence that will perform a `complete` action if the sequence as been entered quickly enough. If its value is `nil` then the feature is disabled. 4. `auto-completion-complete-with-key-sequence-delay` is the number of seconds to wait for the auto-completion key sequence to be entered. The default value is 0.1 seconds. @@ -98,13 +99,13 @@ call SpaceVim#layers#load('autocomplete', { ### auto-complete -| Key bindings | Description | -| ------------ | -------------------------------------------------------------------- | -| `` | select next candidate | -| `` | select previous candidate | -| `` | expand selection or select next candidate | -| `` | select previous candidate | -| `` | complete word, if word is already completed insert a carriage return | +| Key bindings | Description | +| ------------ | --------------------------------------------- | +| `` | select next candidate | +| `` | select previous candidate | +| `` | base on `auto-completion-tab-key-behavior` | +| `` | select previous candidate | +| `` | base on `auto-completion-return-key-behavior` | ### Neosnippet @@ -112,4 +113,3 @@ call SpaceVim#layers#load('autocomplete', { | ----------- | -------------------------------------------------------------- | | `M-/` | Expand a snippet if text before point is a prefix of a snippet | | `SPC i s` | List all current yasnippets for inserting | - From ce638b8a846e89daef19996c181e2012cae9d6e3 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sat, 26 Aug 2017 15:45:41 +0000 Subject: [PATCH 21/28] Add gq for format Nmove text --- autoload/SpaceVim/mapping/g.vim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/autoload/SpaceVim/mapping/g.vim b/autoload/SpaceVim/mapping/g.vim index ff2787f1f..25b0ba381 100644 --- a/autoload/SpaceVim/mapping/g.vim +++ b/autoload/SpaceVim/mapping/g.vim @@ -68,6 +68,8 @@ function! SpaceVim#mapping#g#init() abort nnoremap gn gn let g:_spacevim_mappings_g['Q'] = ['call feedkeys("gQ", "n")', 'switch to Ex mode'] nnoremap gQ gQ + let g:_spacevim_mappings_g['q'] = ['call feedkeys("gq", "n")', 'format Nmove text'] + nnoremap gq gq let g:_spacevim_mappings_g['R'] = ['call feedkeys("gR", "n")', 'enter VREPLACE mode'] nnoremap gR gR let g:_spacevim_mappings_g['T'] = ['call feedkeys("gT", "n")', 'previous tag page'] From 5473814b669f65bcc74fd752fa3dd53b428c16a5 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sat, 26 Aug 2017 16:41:44 +0000 Subject: [PATCH 22/28] Update autocomplete layer options --- autoload/SpaceVim/layers/autocomplete.vim | 40 ++++++++++++++++------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/autoload/SpaceVim/layers/autocomplete.vim b/autoload/SpaceVim/layers/autocomplete.vim index b265c0ce5..68880eedf 100644 --- a/autoload/SpaceVim/layers/autocomplete.vim +++ b/autoload/SpaceVim/layers/autocomplete.vim @@ -73,15 +73,28 @@ function! SpaceVim#layers#autocomplete#config() abort \ '(' "mapping - imap SpaceVim#mapping#tab() - imap SpaceVim#mapping#shift_tab() - imap SpaceVim#mapping#enter() - smap - \ neosnippet#expandable_or_jumpable() ? - \ "\(neosnippet_expand_or_jump)" : - \ (complete_parameter#jumpable(1) ? - \ "\(complete_parameter#goto_next_parameter)" : - \ "\") + if s:tab_key_behavior ==# 'smart' + 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() + elseif s:tab_key_behavior ==# 'complete' + inoremap pumvisible() ? "\" : "\" + elseif s:tab_key_behavior ==# 'cycle' + inoremap pumvisible() ? "\" : "\" + inoremap pumvisible() ? "\" : "" + elseif s:tab_key_behavior ==# 'nil' + endif + if s:return_key_behavior ==# 'smart' + imap SpaceVim#mapping#enter() + elseif s:return_key_behavior ==# 'complete' + imap pumvisible() ? "\" : "\" + elseif s:return_key_behavior ==# 'nil' + endif inoremap pumvisible() ? "\" : "\" inoremap pumvisible() ? "\" : "\" @@ -91,10 +104,15 @@ function! SpaceVim#layers#autocomplete#config() abort imap \ neosnippet#expandable() ? \ "\(neosnippet_expand)" : "" - call SpaceVim#mapping#space#def('nnoremap', ['i', 's'], 'Unite neosnippet', 'insert sneppets', 1) + call SpaceVim#mapping#space#def('nnoremap', ['i', 's'], 'Unite neosnippet', 'insert sneppets', 1) endfunction -function! SpaceVim#layers#autocomplete#set_variable(var) +let s:return_key_behavior = 'smart' +let s:tab_key_behavior = 'smart' +let s:key_sequence = 'nil' +let s:key_sequence_delay = 0.1 + +function! SpaceVim#layers#autocomplete#set_variable(var) abort let s:return_key_behavior = get(a:var, \ 'auto-completion-return-key-behavior', From d89d80699c9fd9256a13d605f3a09a57f3ffd32e Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sat, 26 Aug 2017 22:33:24 +0000 Subject: [PATCH 23/28] Update travis config --- .travis.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.travis.yml b/.travis.yml index 3e9e7d675..b9f5ea232 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,11 @@ language: python sudo: false +notifications: + slack: + on_success: never + on_failure: never + cache: pip: true From e4dc232be14871fe9a19b8dc771f1a0f34fcf8a8 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sun, 27 Aug 2017 13:53:52 +0800 Subject: [PATCH 24/28] Fix ag command in windows --- config/plugins/ctrlp.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/plugins/ctrlp.vim b/config/plugins/ctrlp.vim index e8169aafd..4b392678c 100644 --- a/config/plugins/ctrlp.vim +++ b/config/plugins/ctrlp.vim @@ -20,7 +20,7 @@ if executable('rg') && !exists('g:ctrlp_user_command') let g:ctrlp_user_command = 'rg %s --no-ignore --hidden --files -g "" ' \ . join(zvim#util#Generate_ignore(g:spacevim_wildignore,'rg', 1)) elseif executable('ag') && !exists('g:ctrlp_user_command') - let g:ctrlp_user_command = 'ag %s --hidden -i -g "" ' . join(zvim#util#Generate_ignore(g:spacevim_wildignore,'ag')) + let g:ctrlp_user_command = 'ag --hidden -i -g "" ' . join(zvim#util#Generate_ignore(g:spacevim_wildignore,'ag')) . ' %s' endif if !exists('g:ctrlp_match_func') && (has('python') || has('python3')) let g:ctrlp_match_func = { 'match': 'pymatcher#PyMatch' } From 11c7d5cbdaa7a2d5defcde6b6084930a8d781022 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sun, 27 Aug 2017 15:00:49 +0800 Subject: [PATCH 25/28] Fix #803 --- autoload/SpaceVim/plugins/manager.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/SpaceVim/plugins/manager.vim b/autoload/SpaceVim/plugins/manager.vim index 140934f7f..9f49cce21 100644 --- a/autoload/SpaceVim/plugins/manager.vim +++ b/autoload/SpaceVim/plugins/manager.vim @@ -208,7 +208,7 @@ function! SpaceVim#plugins#manager#update(...) abort elseif reponame ==# 'SpaceVim' let repo = { \ 'name' : 'SpaceVim', - \ 'path' : expand('~/.SpaceVim') + \ 'path' : fnamemodify(g:Config_Main_Home, ':h') \ } call s:pull(repo) From cb18e655176a174481275a3a581fb9bf6cbcf4dd Mon Sep 17 00:00:00 2001 From: Nathan Wilson Date: Tue, 29 Aug 2017 11:41:16 -0400 Subject: [PATCH 26/28] Fix command documentation --- autoload/SpaceVim/layers/default.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/SpaceVim/layers/default.vim b/autoload/SpaceVim/layers/default.vim index 65fc02481..e96b82f10 100644 --- a/autoload/SpaceVim/layers/default.vim +++ b/autoload/SpaceVim/layers/default.vim @@ -86,7 +86,7 @@ function! SpaceVim#layers#default#config() abort 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 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) From 233d30bc249d4735212f0d5ad6e934df2d7f65b6 Mon Sep 17 00:00:00 2001 From: zhujinxuan Date: Wed, 30 Aug 2017 18:39:31 -0400 Subject: [PATCH 27/28] Add Julia Support --- autoload/SpaceVim/layers/lang/julia.vim | 32 +++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 autoload/SpaceVim/layers/lang/julia.vim diff --git a/autoload/SpaceVim/layers/lang/julia.vim b/autoload/SpaceVim/layers/lang/julia.vim new file mode 100644 index 000000000..348fd312e --- /dev/null +++ b/autoload/SpaceVim/layers/lang/julia.vim @@ -0,0 +1,32 @@ +"============================================================================= +" julia.vim --- Julia Language configuration for SpaceVim +" Copyright (c) 2012-2016 Shidong Wang & Contributors +" Author: Jinxuan Zhu +" URL: https://spacevim.org +" License: MIT license +"============================================================================= +"" +" @section lang#julia, layer-lang-julia +" @parentsection layers +" The layer provides synatax highlight and linting for julia. +" The completeion only works in nvim with deoplete. +" However, the julia-vim could not be load on-demanding +" due to its LaTeXToUnicode feature. +" + +function! SpaceVim#layers#lang#julia#plugins() abort + let plugins = [] + call add(plugins, ['JuliaEditorSupport/julia-vim' ]) + if (has('nvim')) + call add(plugins, ['JuliaEditorSupport/deoplete-julia', {'on_ft' : 'julia'}]) + endif + call add(plugins, ['zyedidia/julialint.vim', {'on_ft' : 'julia'}]) + return plugins +endfunction + + +function! SpaceVim#layers#lang#julia#config() abort + let g:latex_to_unicode_tab = 0 + au! BufNewFile,BufRead *.jl setf julia + au! BufNewFile,BufRead *.julia setf julia +endfunction From aecd8f8c89f23fb1fb1b5c8699b6f76afb3b5bc3 Mon Sep 17 00:00:00 2001 From: George Marchin Date: Fri, 1 Sep 2017 08:50:36 -0500 Subject: [PATCH 28/28] Add vim-repeat to edit layer This is a really nice plugin which adds a user pluggable "." command. It integrates seamlessly with several plugins, notably tpope/vim-surround and makes the "." command capable of repeating on the entire surround command, rather than just a part of the command. ysaw" becomes easily repeatable! --- autoload/SpaceVim/layers/edit.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/autoload/SpaceVim/layers/edit.vim b/autoload/SpaceVim/layers/edit.vim index bf6010c0d..2914bfd2b 100644 --- a/autoload/SpaceVim/layers/edit.vim +++ b/autoload/SpaceVim/layers/edit.vim @@ -6,6 +6,7 @@ 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'], \ ['terryma/vim-expand-region', { 'loadconf' : 1}],