From 46aac2c01377079db88d94b56519110d3d6bf2f7 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Thu, 8 Jun 2017 00:29:31 +0800 Subject: [PATCH 01/33] Add doc for file tree --- docs/documentation.md | 58 +++++++++++++++++++++++++++++-------------- 1 file changed, 39 insertions(+), 19 deletions(-) diff --git a/docs/documentation.md b/docs/documentation.md index 253b529bb..64e363627 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -61,6 +61,9 @@ title: "Documentation" * [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) + * [Plugin: VimFiler](#plugin-vimfiler) * [Auto-saving](#auto-saving) * [Searching](#searching) * [Editing](#editing) @@ -97,7 +100,6 @@ title: "Documentation" * [Window Management](#window-management) * [Native functions](#native-functions) * [Plugin: Unite](#plugin-unite) - * [Plugin: VimFiler](#plugin-vimfiler) * [Plugin: neocomplete](#plugin-neocomplete) * [Plugin: NERD Commenter](#plugin-nerd-commenter) * [Plugin: Goyo and Limelight](#plugin-goyo-and-limelight) @@ -803,6 +805,42 @@ Key Binding | Description `SPC f v v` | display and copy SpaceVim version `SPC f v d` | open SpaceVim custom configuration file +#### File tree + +SpaceVim use vimfiler as the default file tree, and the default key binding is `F3`, and SpaceVim also provide `SPC f t` and `SPC f T` to open the file tree. + +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: + +![file-tree](https://user-images.githubusercontent.com/13142418/26881817-279225b2-4bcb-11e7-8872-7e4bd3d1c84e.png) + +##### File tree navigation + +Navigation is centered on the `hjkl` keys with the hope of providing a fast navigation experience like in [vifm](https://github.com/vifm): + +###### Plugin: VimFiler + +Key Binding | Description +-----------| ----------- +`` or `SPC f t` | Toggle file explorer +| **Within _VimFiler_ buffers** | | +`h` or `RET` | go to parent node and collapse expanded directory +`` or `j` | select next file or directory +`` or `k` | select previous file or directory +`l` | open selected file +`Ctrl`+`j` | Un-map +`Ctrl`+`l` | Un-map +`E` | Un-map +`sv` | Split edit +`sg` | Vertical split edit +`p` | Preview +`i` | Switch to directory history +`v` | Quick look +`gx` | Execute with vimfiler associated +`'` | Toggle mark current line +`V` | Clear all marks +`Ctrl`+`r` | Redraw + + ### Auto-saving @@ -1212,24 +1250,6 @@ Key | Mode | Action ``+`ugf` | Normal | Opens Unite file with word at cursor ``+`ugt` | Normal/visual | Opens Unite tag with word at cursor -##### Plugin: VimFiler - -Key | Mode | Action ------ |:----:| ------------------ -`` | Normal | Toggle file explorer -| **Within _VimFiler_ buffers** ||| -`Ctrl`+`j` | Normal | Un-map -`Ctrl`+`l` | Normal | Un-map -`E` | Normal | Un-map -`sv` | Normal | Split edit -`sg` | Normal | Vertical split edit -`p` | Normal | Preview -`i` | Normal | Switch to directory history -`v` | Normal | Quick look -`gx` | Normal | Execute with vimfiler associated -`'` | Normal | Toggle mark current line -`V` | Normal | Clear all marks -`Ctrl`+`r` | Normal | Redraw ##### Plugin: neocomplete From a40cc8ed6c156f617a8634c7200c8473e7369a93 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Fri, 9 Jun 2017 21:08:16 +0800 Subject: [PATCH 02/33] Fix enter dir --- autoload/SpaceVim.vim | 1 + config/main.vim | 4 +++- docs/documentation.md | 14 ++++++++++---- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/autoload/SpaceVim.vim b/autoload/SpaceVim.vim index 899495f16..914ff4338 100644 --- a/autoload/SpaceVim.vim +++ b/autoload/SpaceVim.vim @@ -529,6 +529,7 @@ endfunction function! SpaceVim#welcome() abort + exe 'cd ' . g:_spacevim_enter_dir if exists('g:_spacevim_checking_flag') && g:_spacevim_checking_flag return endif diff --git a/config/main.vim b/config/main.vim index 04c76cb9f..25b763aa9 100644 --- a/config/main.vim +++ b/config/main.vim @@ -12,6 +12,8 @@ function! s:parser_argv() abort else return [1, getcwd()] endif + elseif argv(0) ==# '.' + return [1, getcwd()] elseif isdirectory(expand(argv(0))) return [1, expand(argv(0)) ] else @@ -20,7 +22,7 @@ function! s:parser_argv() abort endfunction let s:status = s:parser_argv() if s:status[0] - exe 'cd ' . s:status[1] + let g:_spacevim_enter_dir = s:status[1] augroup SPwelcom au! autocmd VimEnter * call SpaceVim#welcome() diff --git a/docs/documentation.md b/docs/documentation.md index 64e363627..7bf4a25f8 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -63,7 +63,7 @@ title: "Documentation" * [Vim and SpaceVim files](#vim-and-spacevim-files) * [File tree](#file-tree) * [File tree navigation](#file-tree-navigation) - * [Plugin: VimFiler](#plugin-vimfiler) + * [Open file with file tree.](#open-file-with-file-tree) * [Auto-saving](#auto-saving) * [Searching](#searching) * [Editing](#editing) @@ -807,7 +807,12 @@ Key Binding | Description #### File tree -SpaceVim use vimfiler as the default file tree, and the default key binding is `F3`, and SpaceVim also provide `SPC f t` and `SPC f T` to open the file tree. +SpaceVim use vimfiler as the default file tree, and the default key binding is `F3`, and SpaceVim also provide `SPC f t` and `SPC f T` to open the file tree. to change the file explore to nerdtree: + +```vim +" the default value is vimfiler +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: @@ -817,7 +822,6 @@ VCS integration is supported, there will be a colum status, this feature maybe m Navigation is centered on the `hjkl` keys with the hope of providing a fast navigation experience like in [vifm](https://github.com/vifm): -###### Plugin: VimFiler Key Binding | Description -----------| ----------- @@ -826,7 +830,7 @@ Key Binding | Description `h` or `RET` | go to parent node and collapse expanded directory `` or `j` | select next file or directory `` or `k` | select previous file or directory -`l` | open selected file +`l` | open selected file or expand directory `Ctrl`+`j` | Un-map `Ctrl`+`l` | Un-map `E` | Un-map @@ -840,7 +844,9 @@ Key Binding | Description `V` | Clear all marks `Ctrl`+`r` | Redraw +##### Open file with file tree. +By default a file is opened in the last active window, ### Auto-saving From c10761bfa4215c6b2b5ca3f12ad3fc47e9d404fb Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Fri, 9 Jun 2017 22:29:52 +0800 Subject: [PATCH 03/33] Remove vimfiler message when toggle buffer --- autoload/zvim/util.vim | 4 ++-- config/plugins/vimfiler.vim | 18 ++++++++++-------- docs/documentation.md | 13 ++++++++++--- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/autoload/zvim/util.vim b/autoload/zvim/util.vim index 07ee0da79..7be33f3cb 100644 --- a/autoload/zvim/util.vim +++ b/autoload/zvim/util.vim @@ -187,7 +187,7 @@ endfunction function! zvim#util#OpenVimfiler() abort if bufnr('vimfiler') == -1 - VimFiler + silent VimFiler if exists(':AirlineRefresh') AirlineRefresh endif @@ -198,7 +198,7 @@ function! zvim#util#OpenVimfiler() abort endif wincmd p else - VimFiler + silent VimFiler doautocmd WinEnter if exists(':AirlineRefresh') AirlineRefresh diff --git a/config/plugins/vimfiler.vim b/config/plugins/vimfiler.vim index 24c96b057..9a8f1a680 100644 --- a/config/plugins/vimfiler.vim +++ b/config/plugins/vimfiler.vim @@ -79,14 +79,16 @@ function! s:vimfilerinit() nnoremap sg vimfiler#do_action('vsplit') nnoremap sv vimfiler#do_action('split') nnoremap st vimfiler#do_action('tabswitch') - nmap gx (vimfiler_execute_vimfiler_associated) - nmap ' (vimfiler_toggle_mark_current_line) - nmap v (vimfiler_quick_look) - nmap p (vimfiler_preview_file) - nmap V (vimfiler_clear_mark_all_lines) - nmap i (vimfiler_switch_to_history_directory) - nmap (vimfiler_switch_to_other_window) - nmap (vimfiler_redraw_screen) + nmap gx (vimfiler_execute_vimfiler_associated) + nmap ' (vimfiler_toggle_mark_current_line) + nmap v (vimfiler_quick_look) + nmap p (vimfiler_preview_file) + nmap V (vimfiler_clear_mark_all_lines) + nmap i (vimfiler_switch_to_history_directory) + nmap (vimfiler_switch_to_other_window) + nmap (vimfiler_redraw_screen) + nmap (vimfiler_smart_h) + nmap (vimfiler_smart_l) endf " vim:set et sw=2: diff --git a/docs/documentation.md b/docs/documentation.md index 7bf4a25f8..519f5e7b6 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -827,13 +827,14 @@ Key Binding | Description -----------| ----------- `` or `SPC f t` | Toggle file explorer | **Within _VimFiler_ buffers** | | -`h` or `RET` | go to parent node and collapse expanded directory +`` or `h` | go to parent node and collapse expanded directory `` or `j` | select next file or directory `` or `k` | select previous file or directory -`l` | open selected file or expand directory +`` or `l` | open selected file or expand directory `Ctrl`+`j` | Un-map `Ctrl`+`l` | Un-map `E` | Un-map +`.` | toggle visible ignored files `sv` | Split edit `sg` | Vertical split edit `p` | Preview @@ -846,7 +847,13 @@ Key Binding | Description ##### Open file with file tree. -By default a file is opened in the last active window, +If there is only one file buffer opened, a file is opened in the active window, otherwise we need to use vim-choosewin to select a window to open the file. + +Key Binding | Description +-----------| ----------- +`l` or `Enter` | open file in one window +`sg` | open file in an vertically split window +`sv` | open file in an horizontally split window ### Auto-saving From 0cb3a400d84d4e2449131dc19ca5aaeeb3643b15 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sun, 11 Jun 2017 20:54:12 +0800 Subject: [PATCH 04/33] Ignore warnning msg --- autoload/SpaceVim/api/vim/highlight.vim | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/autoload/SpaceVim/api/vim/highlight.vim b/autoload/SpaceVim/api/vim/highlight.vim index 0765bafd6..482676a83 100644 --- a/autoload/SpaceVim/api/vim/highlight.vim +++ b/autoload/SpaceVim/api/vim/highlight.vim @@ -70,10 +70,16 @@ function! s:self.hide_in_normal(name) abort endif if &termguicolors || has('gui_running') let bg = self.group2dict('Normal').guibg + if empty(bg) + return + endif let group.guifg = bg let group.guibg = bg else let bg = self.group2dict('Normal').ctermbg + if empty(bg) + return + endif let group.ctermfg = bg let group.ctermbg = bg endif From badecf87603d5f862c3c9fe06257059a70cb0da5 Mon Sep 17 00:00:00 2001 From: Wang Shidong Date: Fri, 16 Jun 2017 23:37:28 +0800 Subject: [PATCH 05/33] Update php.vim (#632) --- autoload/SpaceVim/layers/lang/php.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/SpaceVim/layers/lang/php.vim b/autoload/SpaceVim/layers/lang/php.vim index 18b1c7182..977752dde 100644 --- a/autoload/SpaceVim/layers/lang/php.vim +++ b/autoload/SpaceVim/layers/lang/php.vim @@ -21,7 +21,7 @@ function! SpaceVim#layers#lang#php#plugins() abort call add(plugins, ['StanAngeloff/php.vim', { 'on_ft' : 'php'}]) call add(plugins, ['2072/PHP-Indenting-for-VIm', { 'on_ft' : 'php'}]) call add(plugins, ['rafi/vim-phpspec', { 'on_ft' : 'php'}]) - call add(plugins, ['lvht/phpfold.vim', { 'on_ft' : 'php'}]) + call add(plugins, ['lvht/phpfold.vim', { 'on_ft' : 'php', 'build' : 'composer install'}]) return plugins endfunction From d76d83f4c093bff29bf26f2d7c9ed25fda0cb00d Mon Sep 17 00:00:00 2001 From: Wang Shidong Date: Sat, 17 Jun 2017 10:37:07 +0800 Subject: [PATCH 06/33] Create 2017-02-11-vim8-new-feature-timers-zh_cn.md (#633) * Create 2017-02-11-vim8-new-feature-timers-zh_cn.md * Update 2017-02-11-vim8-new-feature-timers-zh_cn.md * Update README_zh_cn.md * Update README_zh_cn.md * Update 2017-02-11-vim8-new-feature-timers-zh_cn.md * Add example for starting a timer * Update 2017-02-11-vim8-new-feature-timers-zh_cn.md --- docs/README_zh_cn.md | 15 +++++ ...017-02-11-vim8-new-feature-timers-zh_cn.md | 58 +++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 docs/_posts/2017-02-11-vim8-new-feature-timers-zh_cn.md diff --git a/docs/README_zh_cn.md b/docs/README_zh_cn.md index 1b713b41f..35bb4534b 100644 --- a/docs/README_zh_cn.md +++ b/docs/README_zh_cn.md @@ -168,3 +168,18 @@ let g:spacevim_guifont = 'DejaVu\ Sans\ Mono\ for\ Powerline\ 11' `g:spacevim_guifont` | '' | 设置SpaceVim字体 `g:spacevim_sidebar_width` | 30 | 设置边栏宽度,文件树以及语法树 `g:spacevim_custom_plugins` | `[]` | 设置自定义插件 + + +### 延伸阅读 + +#### Vim 8 新特新之旅 + +
    + {% for post in site.categories.tutorials_cn %} +
  • + {{ post.title }} +
  • + {% endfor %} +
+ + diff --git a/docs/_posts/2017-02-11-vim8-new-feature-timers-zh_cn.md b/docs/_posts/2017-02-11-vim8-new-feature-timers-zh_cn.md new file mode 100644 index 000000000..fbc7a79dd --- /dev/null +++ b/docs/_posts/2017-02-11-vim8-new-feature-timers-zh_cn.md @@ -0,0 +1,58 @@ +--- +title: "VIM 8 新特性之旅: 定时器 (timers)" +categories: tutorials_cn +excerpt: "VIM 8 新特性之旅系列教程 - 定时器" +--- + +## 定时器( timer ) +> vim 需要支持 +timers 特性 + +### 什么是定时器? + +Vim 的定时器是指在指定时间后重复指定次数执行某个回调函数。 这一功能需要 Vim 支持 `+timers` 特性。 + +### 启动定时器 + +`timer_start({毫秒}, {回调函数}[,{选项}])` + +Vim 中这个方法将创建一个计时器,并且返回这个定时器的 ID。 回调函数接受一个参数,可以是字符串,表示方法具体名称,也可以是 `Funcref` 变量。 下面是一个示例: + +```vim +func MyHandler(id) + echo 'This is handler called for timer-' . a:id +endfunc +let timer = timer_start(500, 'MyHandler', + \ {'repeat': 3}) +``` + +#### 获取定时器信息 + +`timer_info([{ID}])` + +这个方法会返回一个存储定时器信息的列表, 当编号为 ID 的定时器不存在,将返回一个空的列表,当直接调用这个方法, 而不传递任何参数时,将返回所有定时器的信息。返回列表中每一个元素实际上是一个字典数据类型,具体的结构如下: + + + { + "id" : 该定时器的 ID, + "time" : 定时器启动是所设置的毫秒数, + "remaining" : 距定时器启动还剩余的毫秒数, + "repeat" : 定时器还需要重复执行的次数,无限执行则返回 -1, + "callback" : 回调函数, + "paused" : 是否被暂停,是则返回 1,否则返回 0 + } +     +#### 暂停定时器 + +`timer_pause({ID} , {是否})` + +这个方法接受 2 个参数,第一个参数是 定时器的 ID, 第二个参数是决定是 暂停 还是 取消暂停 的关键,当第二个参数是一个非 0 数值,或非空字符串,则该定时器被暂停,否则即为取消暂停。 + +#### 停止定时器 + +`timer_stop([{ID}])` + +停止一个编号为 ID 的定时器,ID 即为 timer_start() 方法的返回值,因此必须为数值,即便编号为 ID 的定时器不存在,这个方法也不会报错。 + +另外一个方法 timer_stopall(), 将停止所有定时器。就个人来看 vim 这个方法设计并不完美, 一个软件的方法命名应该存在一定的规则,比如前面的 timer_info() 就是一个可变参数的方法,当无参执行是返回所有定时器的信息,那么这个 timer_staop() 应该也是可以参数方法,无参执行时取消所有定时器。当然了这个仅仅是个人意见。 + +查阅跟多 Vim 中文教程,请阅读: From 6d426b2281614f7ea9c12aca66a88f5ee00d6872 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sun, 25 Jun 2017 14:00:59 +0800 Subject: [PATCH 07/33] Add z mapping guide --- autoload/SpaceVim.vim | 1 + autoload/SpaceVim/mapping/guide.vim | 4 +++- autoload/SpaceVim/mapping/z.vim | 5 +++++ docs/documentation.md | 8 ++++++++ 4 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 autoload/SpaceVim/mapping/z.vim diff --git a/autoload/SpaceVim.vim b/autoload/SpaceVim.vim index e37528941..0f9ae558b 100644 --- a/autoload/SpaceVim.vim +++ b/autoload/SpaceVim.vim @@ -472,6 +472,7 @@ function! SpaceVim#end() abort call SpaceVim#mapping#leader#defindKEYs() call SpaceVim#mapping#space#init() call SpaceVim#mapping#g#init() + call SpaceVim#mapping#z#init() if !SpaceVim#mapping#guide#has_configuration() let g:leaderGuide_map = {} call SpaceVim#mapping#guide#register_prefix_descriptions('', 'g:leaderGuide_map') diff --git a/autoload/SpaceVim/mapping/guide.vim b/autoload/SpaceVim/mapping/guide.vim index e36c69b59..ca9f8e692 100644 --- a/autoload/SpaceVim/mapping/guide.vim +++ b/autoload/SpaceVim/mapping/guide.vim @@ -572,10 +572,12 @@ call SpaceVim#mapping#guide#register_prefix_descriptions( call SpaceVim#mapping#guide#register_prefix_descriptions( \ '[KEYs]', \ 'g:_spacevim_mappings_prefixs') - call SpaceVim#mapping#guide#register_prefix_descriptions( \ 'g', \ 'g:_spacevim_mappings_g') +call SpaceVim#mapping#guide#register_prefix_descriptions( + \ 'z', + \ 'g:_spacevim_mappings_z') let &cpo = s:save_cpo unlet s:save_cpo diff --git a/autoload/SpaceVim/mapping/z.vim b/autoload/SpaceVim/mapping/z.vim new file mode 100644 index 000000000..f13f0f343 --- /dev/null +++ b/autoload/SpaceVim/mapping/z.vim @@ -0,0 +1,5 @@ +function! SpaceVim#mapping#z#init() abort + nnoremap [z] :LeaderGuide "z" + nmap z [z] + let g:_spacevim_mappings_z = {} +endfunction diff --git a/docs/documentation.md b/docs/documentation.md index cc1c01f79..2f9de342d 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -65,6 +65,7 @@ title: "Documentation" * [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) @@ -917,6 +918,13 @@ Key Binding | Description `g` | go to rightmost character `g` | show cursor info +### Commands starting with `z` + +after pressing prefix `z` 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 `z`. + +Key Binding | Description +-----------| ----------- +`z` | redraw, cursor line to top ### Auto-saving From 3fdfb3bb1b551a7fd4610d547c95aa7b446c03c6 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sun, 25 Jun 2017 14:24:12 +0800 Subject: [PATCH 08/33] Update doc for z mappings --- .SpaceVim.d/autoload/SpaceVim/dev/z.vim | 13 +++++++++++++ autoload/SpaceVim/mapping/z.vim | 12 ++++++++++++ docs/documentation.md | 7 ++++++- 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 .SpaceVim.d/autoload/SpaceVim/dev/z.vim diff --git a/.SpaceVim.d/autoload/SpaceVim/dev/z.vim b/.SpaceVim.d/autoload/SpaceVim/dev/z.vim new file mode 100644 index 000000000..17fc44900 --- /dev/null +++ b/.SpaceVim.d/autoload/SpaceVim/dev/z.vim @@ -0,0 +1,13 @@ +function! SpaceVim#dev#z#updatedoc() + let keys = keys(g:_spacevim_mappings_z) + let lines = [] + for key in keys + if key == '`' + let line = '`` z' . key . ' `` | ' . g:_spacevim_mappings_z[key][1] + else + let line = '`z' . key . '` | ' . g:_spacevim_mappings_z[key][1] + endif + call add(lines, line) + endfor + call append(line('.'), lines) +endfunction diff --git a/autoload/SpaceVim/mapping/z.vim b/autoload/SpaceVim/mapping/z.vim index f13f0f343..fa49139cf 100644 --- a/autoload/SpaceVim/mapping/z.vim +++ b/autoload/SpaceVim/mapping/z.vim @@ -2,4 +2,16 @@ function! SpaceVim#mapping#z#init() abort nnoremap [z] :LeaderGuide "z" nmap z [z] let g:_spacevim_mappings_z = {} + let g:_spacevim_mappings_z['A'] = ['call feedkeys("zA", "n")', 'toggle folds recursively'] + nnoremap zA zA + let g:_spacevim_mappings_z['C'] = ['call feedkeys("zC", "n")', 'close folds recursively'] + nnoremap zC zC + let g:_spacevim_mappings_z['D'] = ['call feedkeys("zD", "n")', 'delete folds recursively'] + nnoremap zD zD + let g:_spacevim_mappings_z['E'] = ['call feedkeys("zE", "n")', 'eliminate all folds'] + nnoremap zE zE + let g:_spacevim_mappings_z['F'] = ['call feedkeys("zF", "n")', 'create a fold for N lines'] + nnoremap zF zF + let g:_spacevim_mappings_z['G'] = ['call feedkeys("zG", "n")', 'mark good spelled'] + nnoremap zG zG endfunction diff --git a/docs/documentation.md b/docs/documentation.md index 2f9de342d..29ab0054f 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -924,7 +924,12 @@ after pressing prefix `z` in normal mode, if you do not remember the mappings, y Key Binding | Description -----------| ----------- -`z` | redraw, cursor line to top +`zA` | toggle folds recursively +`zC` | close folds recursively +`zD` | delete folds recursively +`zE` | eliminate all folds +`zF` | create a fold for N lines +`zG` | mark good spelled ### Auto-saving From c75193bb1a1f7684be43c414817728b374966f9d Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sun, 25 Jun 2017 15:30:07 +0800 Subject: [PATCH 09/33] Fix z guide statusline --- autoload/SpaceVim/mapping/leader.vim | 2 ++ autoload/SpaceVim/mapping/z.vim | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/autoload/SpaceVim/mapping/leader.vim b/autoload/SpaceVim/mapping/leader.vim index 407388511..7b57da432 100644 --- a/autoload/SpaceVim/mapping/leader.vim +++ b/autoload/SpaceVim/mapping/leader.vim @@ -293,6 +293,8 @@ function! SpaceVim#mapping#leader#getName(key) abort return '[SPC]' elseif a:key == 'g' return '[g]' + elseif a:key == 'z' + return '[z]' else return '' endif diff --git a/autoload/SpaceVim/mapping/z.vim b/autoload/SpaceVim/mapping/z.vim index fa49139cf..189cf6edc 100644 --- a/autoload/SpaceVim/mapping/z.vim +++ b/autoload/SpaceVim/mapping/z.vim @@ -14,4 +14,16 @@ function! SpaceVim#mapping#z#init() abort nnoremap zF zF let g:_spacevim_mappings_z['G'] = ['call feedkeys("zG", "n")', 'mark good spelled'] nnoremap zG zG + let g:_spacevim_mappings_z['M'] = ['call feedkeys("zM", "n")', 'set `foldlevel` to zero'] + nnoremap zM zM + let g:_spacevim_mappings_z['N'] = ['call feedkeys("zN", "n")', 'set `foldenable`'] + nnoremap zN zN + let g:_spacevim_mappings_z['O'] = ['call feedkeys("zO", "n")', 'open folds recursively'] + nnoremap zO zO + let g:_spacevim_mappings_z['R'] = ['call feedkeys("zR", "n")', 'set `foldlevel` to deepest fold'] + nnoremap zR zR + let g:_spacevim_mappings_z['W'] = ['call feedkeys("zW", "n")', 'mark wrong spelled'] + nnoremap zW zW + let g:_spacevim_mappings_z['X'] = ['call feedkeys("zX", "n")', 're-apply `foldleve`'] + nnoremap zX zX endfunction From 7b09c2b77a307f477c4e65317e98c9ebc2e7aef9 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sun, 25 Jun 2017 16:44:21 +0800 Subject: [PATCH 10/33] Add z prefix mappings --- autoload/SpaceVim/layers/incsearch.vim | 7 ------ autoload/SpaceVim/mapping/z.vim | 34 +++++++++++++++++++++++--- 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/autoload/SpaceVim/layers/incsearch.vim b/autoload/SpaceVim/layers/incsearch.vim index 740cc6d59..f2450cc5d 100644 --- a/autoload/SpaceVim/layers/incsearch.vim +++ b/autoload/SpaceVim/layers/incsearch.vim @@ -52,10 +52,6 @@ function! SpaceVim#layers#incsearch#config() abort \ ], \ }), get(a:, 1, {})) endfunction - - noremap z/ incsearch#go(config_fuzzyall()) - noremap z? incsearch#go(config_fuzzyall({'command': '?'})) - noremap zg? incsearch#go(config_fuzzyall({'is_stay': 1})) function! s:config_easyfuzzymotion(...) abort return extend(copy({ \ 'converters': [incsearch#config#fuzzy#converter()], @@ -65,9 +61,6 @@ function! SpaceVim#layers#incsearch#config() abort \ 'is_stay': 1 \ }), get(a:, 1, {})) endfunction - - noremap / incsearch#go(config_easyfuzzymotion()) - call SpaceVim#mapping#space#def('nnoremap', ['/',], 'call feedkeys("\/", "m")', 'incsearch-fuzzy', 1) endfunction diff --git a/autoload/SpaceVim/mapping/z.vim b/autoload/SpaceVim/mapping/z.vim index 189cf6edc..3ad9bbb89 100644 --- a/autoload/SpaceVim/mapping/z.vim +++ b/autoload/SpaceVim/mapping/z.vim @@ -1,4 +1,4 @@ -function! SpaceVim#mapping#z#init() abort +function! SpaceVim#mapping#z#init() abort "{{{ nnoremap [z] :LeaderGuide "z" nmap z [z] let g:_spacevim_mappings_z = {} @@ -12,7 +12,7 @@ function! SpaceVim#mapping#z#init() abort nnoremap zE zE let g:_spacevim_mappings_z['F'] = ['call feedkeys("zF", "n")', 'create a fold for N lines'] nnoremap zF zF - let g:_spacevim_mappings_z['G'] = ['call feedkeys("zG", "n")', 'mark good spelled'] + let g:_spacevim_mappings_z['G'] = ['call feedkeys("zG", "n")', 'mark good spelled(update internal-wordlist)'] nnoremap zG zG let g:_spacevim_mappings_z['M'] = ['call feedkeys("zM", "n")', 'set `foldlevel` to zero'] nnoremap zM zM @@ -26,4 +26,32 @@ function! SpaceVim#mapping#z#init() abort nnoremap zW zW let g:_spacevim_mappings_z['X'] = ['call feedkeys("zX", "n")', 're-apply `foldleve`'] nnoremap zX zX -endfunction + let g:_spacevim_mappings_z['a'] = ['call feedkeys("za", "n")', 'toggle a fold'] + nnoremap za za + let g:_spacevim_mappings_z['b'] = ['call feedkeys("zb", "n")', 'redraw, cursor line at bottom'] + nnoremap zb zb + let g:_spacevim_mappings_z['c'] = ['call feedkeys("zc", "n")', 'close a fold'] + nnoremap zc zc + let g:_spacevim_mappings_z['d'] = ['call feedkeys("zd", "n")', 'delete a fold'] + nnoremap zd zd + let g:_spacevim_mappings_z['g'] = ['call feedkeys("zg", "n")', 'mark good spelled'] + nnoremap zg zg + let g:_spacevim_mappings_z['i'] = ['call feedkeys("zi", "n")', 'toggle foldenable'] + nnoremap zi zi + let g:_spacevim_mappings_z['j'] = ['call feedkeys("zj", "n")', 'mode to start of next fold'] + nnoremap zj zj + let g:_spacevim_mappings_z['k'] = ['call feedkeys("zk", "n")', 'mode to end of previous fold'] + nnoremap zk zk + let g:_spacevim_mappings_z['m'] = ['call feedkeys("zm", "n")', 'subtract one from `foldlevel`'] + nnoremap zm zm + let g:_spacevim_mappings_z['n'] = ['call feedkeys("zn", "n")', 'reset `foldenable`'] + nnoremap zn zn + let g:_spacevim_mappings_z['o'] = ['call feedkeys("zo", "n")', 'open fold'] + nnoremap zo zo + let g:_spacevim_mappings_z['r'] = ['call feedkeys("zr", "n")', 'add one to `foldlevel`'] + nnoremap zr zr + " smart scroll + let g:_spacevim_mappings_z['z'] = ['call feedkeys("zz", "n")', 'smart scroll'] + nnoremap zz zz + +endfunction "}}} From 6faaf1869d47d2db082a37bdd20dbdd27aefc1e3 Mon Sep 17 00:00:00 2001 From: maqi Date: Mon, 26 Jun 2017 16:59:10 +0800 Subject: [PATCH 11/33] Add 'on_ft':'rust' for rust.vim rust.vim not load --- autoload/SpaceVim/layers/lang/rust.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autoload/SpaceVim/layers/lang/rust.vim b/autoload/SpaceVim/layers/lang/rust.vim index 1ce6db560..61b5cc235 100644 --- a/autoload/SpaceVim/layers/lang/rust.vim +++ b/autoload/SpaceVim/layers/lang/rust.vim @@ -38,8 +38,8 @@ function! SpaceVim#layers#lang#rust#plugins() abort let plugins = [] - call add(plugins, ['racer-rust/vim-racer', { 'on_ft' : 'rust'}]) - call add(plugins, ['rust-lang/rust.vim', {'merged' : 1}]) + call add(plugins, ['racer-rust/vim-racer', {'on_ft' : 'rust'}]) + call add(plugins, ['rust-lang/rust.vim', {'on_ft' : 'rust', 'merged' : 1}]) return plugins endfunction From f1cc39f1f5955ef74d418974b5c8199a511e8d30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Ti=C3=A1?= Date: Mon, 26 Jun 2017 07:13:45 -0600 Subject: [PATCH 12/33] Add Comments space Add keymap [SPC]cl for comment and uncomment lines. Use nerdcommenter plugin to do the line code comments. Read nerdcommenter settings in edit layer. --- autoload/SpaceVim/layers/edit.vim | 2 +- autoload/SpaceVim/mapping/space.vim | 11 ++++++++++ config/plugins/nerdcommenter.vim | 31 +++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 config/plugins/nerdcommenter.vim diff --git a/autoload/SpaceVim/layers/edit.vim b/autoload/SpaceVim/layers/edit.vim index 3a25a413a..b07429a21 100644 --- a/autoload/SpaceVim/layers/edit.vim +++ b/autoload/SpaceVim/layers/edit.vim @@ -8,7 +8,7 @@ function! SpaceVim#layers#edit#plugins() abort \ ['kana/vim-textobj-indent'], \ ['kana/vim-textobj-line'], \ ['kana/vim-textobj-entire'], - \ ['scrooloose/nerdcommenter'], + \ ['scrooloose/nerdcommenter', { 'loadconf' : 1}], \ ['mattn/emmet-vim', { 'on_cmd' : 'EmmetInstall'}], \ ['gcmt/wildfire.vim',{'on_map' : '(wildfire-'}], \ ['easymotion/vim-easymotion'], diff --git a/autoload/SpaceVim/mapping/space.vim b/autoload/SpaceVim/mapping/space.vim index 9351fe91e..5fabbabac 100644 --- a/autoload/SpaceVim/mapping/space.vim +++ b/autoload/SpaceVim/mapping/space.vim @@ -13,6 +13,7 @@ function! SpaceVim#mapping#space#init() abort let g:_spacevim_mappings_space.T = {'name' : '+UI toggles/themes'} let g:_spacevim_mappings_space.a = {'name' : '+Applications'} let g:_spacevim_mappings_space.b = {'name' : '+Buffers'} + let g:_spacevim_mappings_space.c = {'name' : '+Comments'} let g:_spacevim_mappings_space.f = {'name' : '+Files'} let g:_spacevim_mappings_space.j = {'name' : '+Jump/Join/Split'} let g:_spacevim_mappings_space.w = {'name' : '+Windows'} @@ -65,6 +66,16 @@ function! SpaceVim#mapping#space#init() abort nnoremap [SPC]bp :bp let g:_spacevim_mappings_space.b.p = ['bp', 'previous buffer'] call SpaceVim#mapping#menu('Open previous buffer', '[SPC]bp', 'bp') + + " + " Comments sections + " + " Toggles the comment state of the selected line(s). If the topmost selected + " line is commented, all selected lines are uncommented and vice versa. + let g:_spacevim_mappings_space.c.c = ['cl', 'Toggle commment line(s)'] + call SpaceVim#mapping#menu('Toggle comment line(s)', '[SPC]cl', '') + nnoremap [SPC]cl :call NERDComment("n", "Toggle") + let g:_spacevim_mappings_space.e = {'name' : '+Errors/Encoding'} let g:_spacevim_mappings_space.B = {'name' : '+Global-buffers'} nnoremap [SPC]tn :setlocal nonumber! norelativenumber! diff --git a/config/plugins/nerdcommenter.vim b/config/plugins/nerdcommenter.vim new file mode 100644 index 000000000..2f4b3c0cb --- /dev/null +++ b/config/plugins/nerdcommenter.vim @@ -0,0 +1,31 @@ +scriptencoding utf-8 + +" +" nerd-commenter plugin settings +" + +" Add extra space around delimiters when commenting, remove them when +" uncommenting +let g:NERDSpaceDelims = 1 + +" Always remove the extra spaces when uncommenting regardless of whether +" NERDSpaceDelims is set +let g:NERDRemoveExtraSpaces = 1 + +" Use compact syntax for prettified multi-line comments +let g:NERDCompactSexyComs = 1 + +" Align line-wise comment delimiters flush left instead of following code +" indentation +let g:NERDDefaultAlign = 'left' + +" Allow commenting and inverting empty lines (useful when commenting a +" region) +let g:NERDCommentEmptyLines = 1 + +" Enable trimming of trailing whitespace when uncommenting +let g:NERDTrimTrailingWhitespace = 1 + +" Always use alternative delimiter +let g:NERD_c_alt_style = 1 +let g:NERDCustomDelimiters = {'c': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' }} From 4b52c2caba9b5324a77166c834d083d0ab6d6f6e Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Mon, 26 Jun 2017 21:22:22 +0800 Subject: [PATCH 13/33] Improve js support --- autoload/SpaceVim/layers/lang/javascript.vim | 42 +++++++++++++------- config/plugins/deoplete.vim | 5 ++- 2 files changed, 31 insertions(+), 16 deletions(-) diff --git a/autoload/SpaceVim/layers/lang/javascript.vim b/autoload/SpaceVim/layers/lang/javascript.vim index 0ef0ddff2..78c7c0527 100644 --- a/autoload/SpaceVim/layers/lang/javascript.vim +++ b/autoload/SpaceVim/layers/lang/javascript.vim @@ -1,17 +1,29 @@ function! SpaceVim#layers#lang#javascript#plugins() abort - let plugins = [] - call add(plugins,['pangloss/vim-javascript', { 'on_ft' : ['javascript']}]) - if has('nvim') - call add(plugins,['carlitux/deoplete-ternjs', { 'on_ft' : ['javascript']}]) - else - call add(plugins,['ternjs/tern_for_vim', { 'on_ft' : ['javascript'], - \ 'build' : 'npm install', - \ }]) - endif - call add(plugins,['othree/javascript-libraries-syntax.vim', { 'on_ft' : ['javascript','coffee','ls','typescript']}]) - call add(plugins,['mmalecki/vim-node.js', { 'on_ft' : ['javascript']}]) - call add(plugins,['othree/yajs.vim', { 'on_ft' : ['javascript']}]) - call add(plugins,['othree/es.next.syntax.vim', { 'on_ft' : ['javascript']}]) - call add(plugins,['maksimr/vim-jsbeautify', { 'on_ft' : ['javascript']}]) - return plugins + let plugins = [] + call add(plugins,['pangloss/vim-javascript', { 'on_ft' : ['javascript']}]) + if has('nvim') + call add(plugins,['carlitux/deoplete-ternjs', { 'on_ft' : ['javascript']}]) + endif + call add(plugins,['ternjs/tern_for_vim', { 'on_ft' : ['javascript'], + \ 'build' : 'npm install', + \ }]) + call add(plugins,['othree/javascript-libraries-syntax.vim', { 'on_ft' : ['javascript','coffee','ls','typescript']}]) + call add(plugins,['mmalecki/vim-node.js', { 'on_ft' : ['javascript']}]) + call add(plugins,['othree/yajs.vim', { 'on_ft' : ['javascript']}]) + call add(plugins,['othree/es.next.syntax.vim', { 'on_ft' : ['javascript']}]) + call add(plugins,['maksimr/vim-jsbeautify', { 'on_ft' : ['javascript']}]) + return plugins endfunction + +function! SpaceVim#layers#lang#javascript#config() abort + call SpaceVim#mapping#gd#add('javascript', function('s:gotodef')) +endfunction + +function! s:gotodef() abort + if exists(':TernDef') + TernDef + endif +endfunction + + +" vim:set et sw=2 cc=80: diff --git a/config/plugins/deoplete.vim b/config/plugins/deoplete.vim index 25e6e70cd..a242f93af 100644 --- a/config/plugins/deoplete.vim +++ b/config/plugins/deoplete.vim @@ -39,7 +39,10 @@ let g:deoplete#omni#input_patterns.perl = get(g:deoplete#omni#input_patterns, 'p \]) " javascript -let g:deoplete#omni#input_patterns.javascript = get(g:deoplete#omni#input_patterns, 'javascript', ['[^. \t0-9]\.\w*']) +"let g:deoplete#omni#input_patterns.javascript = get(g:deoplete#omni#input_patterns, 'javascript', ['[^. \t0-9]\.\w*']) +let g:deoplete#ignore_sources.javascript = get(g:deoplete#ignore_sources, 'javascript', ['omni']) +call deoplete#custom#set('ternjs', 'mark', 'tern') +call deoplete#custom#set('ternjs', 'rank', 9999) " php let g:deoplete#omni#input_patterns.php = get(g:deoplete#omni#input_patterns, 'php', [ From 764ef2d21b2bf93b0578f7eec3c31630ce97515c Mon Sep 17 00:00:00 2001 From: tenfyzhong Date: Mon, 26 Jun 2017 22:01:48 +0800 Subject: [PATCH 14/33] Add plugins for makefile and protobuf tagbar-makefile, let tagbar support makefile. tagbar-proto, let tagbar support protobuf. --- autoload/SpaceVim/layers/ui.vim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/autoload/SpaceVim/layers/ui.vim b/autoload/SpaceVim/layers/ui.vim index 6112971e4..c319221ee 100644 --- a/autoload/SpaceVim/layers/ui.vim +++ b/autoload/SpaceVim/layers/ui.vim @@ -4,6 +4,8 @@ function! SpaceVim#layers#ui#plugins() abort \ ['Yggdroot/indentLine'], \ ['mhinz/vim-signify'], \ ['majutsushi/tagbar', {'loadconf' : 1}], + \ ['tenfyzhong/tagbar-makefile.vim', {'merged': 0}], + \ ['tenfyzhong/tagbar-proto.vim', {'merged': 0}], \ ['lvht/tagbar-markdown',{'merged' : 0}], \ ['t9md/vim-choosewin', {'merged' : 0}], \ ['mhinz/vim-startify', {'loadconf' : 1}], From 251df793e31cbd69c1f480dd3a40d269a7b888e8 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Mon, 26 Jun 2017 23:07:47 +0800 Subject: [PATCH 15/33] Add SPC mind maps --- README.md | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index bbcd7f6d7..a5100760d 100644 --- a/README.md +++ b/README.md @@ -81,13 +81,17 @@ for example, after pressing `` in normal mode, you will see : 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/27545241-f0d696e2-5ac1-11e7-9187-127c03dd35ae.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. +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 @@ -210,20 +214,20 @@ curl -sLf https://spacevim.org/install.sh | bash -s -- -h ### windows support - 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. +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 - ``` +```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. +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 - ``` +```bash +git clone https://github.com/SpaceVim/SpaceVim.git AppData\Local\nvim +``` ## Update From 28658fd2bd561e6427055d7de91c2f2775e03b40 Mon Sep 17 00:00:00 2001 From: Wang Shidong Date: Tue, 27 Jun 2017 00:21:49 +0800 Subject: [PATCH 16/33] Update SPC mind maps --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a5100760d..e6a4c01c1 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,7 @@ this guide show you all the available key bindings begin with `[SPC]`, you can t here is the guide for the default mappings in SpaceVim: -![spc](https://user-images.githubusercontent.com/13142418/27545241-f0d696e2-5ac1-11e7-9187-127c03dd35ae.png) +![spc](https://user-images.githubusercontent.com/13142418/27549426-8141bd86-5ace-11e7-9082-eb86b398acdc.png) ### Unite work flow From 3ade55203256eedbbf9e91a39b8daa6f3a6d8851 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Tue, 27 Jun 2017 14:16:07 +0800 Subject: [PATCH 17/33] Add some mappings with z prefix --- autoload/SpaceVim/mapping/z.vim | 36 ++++++++++++++++++++++++++++++ docs/documentation.md | 39 ++++++++++++++++++++++++++++++++- 2 files changed, 74 insertions(+), 1 deletion(-) diff --git a/autoload/SpaceVim/mapping/z.vim b/autoload/SpaceVim/mapping/z.vim index 3ad9bbb89..efe8d5092 100644 --- a/autoload/SpaceVim/mapping/z.vim +++ b/autoload/SpaceVim/mapping/z.vim @@ -2,6 +2,18 @@ function! SpaceVim#mapping#z#init() abort "{{{ nnoremap [z] :LeaderGuide "z" nmap z [z] let g:_spacevim_mappings_z = {} + let g:_spacevim_mappings_z[''] = ['call feedkeys("z\", "n")', 'cursor line to top'] + nnoremap z z + let g:_spacevim_mappings_z['+'] = ['call feedkeys("z+", "n")', 'cursor to screen top line N'] + nnoremap z+ z+ + let g:_spacevim_mappings_z['-'] = ['call feedkeys("z-", "n")', 'cursor to screen bottom line N'] + nnoremap z- z- + let g:_spacevim_mappings_z['^'] = ['call feedkeys("z^", "n")', 'cursor to screen bottom line N'] + nnoremap z^ z^ + let g:_spacevim_mappings_z['.'] = ['call feedkeys("z.", "n")', 'cursor line to center'] + nnoremap z. z. + let g:_spacevim_mappings_z['='] = ['call feedkeys("z=", "n")', 'spelling suggestions'] + nnoremap z= z= let g:_spacevim_mappings_z['A'] = ['call feedkeys("zA", "n")', 'toggle folds recursively'] nnoremap zA zA let g:_spacevim_mappings_z['C'] = ['call feedkeys("zC", "n")', 'close folds recursively'] @@ -14,6 +26,10 @@ function! SpaceVim#mapping#z#init() abort "{{{ nnoremap zF zF let g:_spacevim_mappings_z['G'] = ['call feedkeys("zG", "n")', 'mark good spelled(update internal-wordlist)'] nnoremap zG zG + let g:_spacevim_mappings_z['H'] = ['call feedkeys("zH", "n")', 'scroll half a screenwidth to the right'] + nnoremap zH zH + let g:_spacevim_mappings_z['L'] = ['call feedkeys("zL", "n")', 'scroll half a screenwidth to the left'] + nnoremap zL zL let g:_spacevim_mappings_z['M'] = ['call feedkeys("zM", "n")', 'set `foldlevel` to zero'] nnoremap zM zM let g:_spacevim_mappings_z['N'] = ['call feedkeys("zN", "n")', 'set `foldenable`'] @@ -34,14 +50,26 @@ function! SpaceVim#mapping#z#init() abort "{{{ nnoremap zc zc let g:_spacevim_mappings_z['d'] = ['call feedkeys("zd", "n")', 'delete a fold'] nnoremap zd zd + let g:_spacevim_mappings_z['e'] = ['call feedkeys("ze", "n")', 'right scroll horizontally to cursor position'] + nnoremap ze ze + let g:_spacevim_mappings_z['f'] = ['call feedkeys("zf", "n")', 'create a fold for motion'] + nnoremap zf zf let g:_spacevim_mappings_z['g'] = ['call feedkeys("zg", "n")', 'mark good spelled'] nnoremap zg zg + let g:_spacevim_mappings_z['h'] = ['call feedkeys("zh", "n")', 'scroll screen N characters to right'] + nnoremap zh zh + let g:_spacevim_mappings_z[''] = ['call feedkeys("zh", "n")', 'scroll screen N characters to right'] + nnoremap z zh let g:_spacevim_mappings_z['i'] = ['call feedkeys("zi", "n")', 'toggle foldenable'] nnoremap zi zi let g:_spacevim_mappings_z['j'] = ['call feedkeys("zj", "n")', 'mode to start of next fold'] nnoremap zj zj let g:_spacevim_mappings_z['k'] = ['call feedkeys("zk", "n")', 'mode to end of previous fold'] nnoremap zk zk + let g:_spacevim_mappings_z['l'] = ['call feedkeys("zl", "n")', 'scroll screen N characters to left'] + nnoremap zl zl + let g:_spacevim_mappings_z[''] = ['call feedkeys("zl", "n")', 'scroll screen N characters to left'] + nnoremap z zl let g:_spacevim_mappings_z['m'] = ['call feedkeys("zm", "n")', 'subtract one from `foldlevel`'] nnoremap zm zm let g:_spacevim_mappings_z['n'] = ['call feedkeys("zn", "n")', 'reset `foldenable`'] @@ -50,6 +78,14 @@ function! SpaceVim#mapping#z#init() abort "{{{ nnoremap zo zo let g:_spacevim_mappings_z['r'] = ['call feedkeys("zr", "n")', 'add one to `foldlevel`'] nnoremap zr zr + let g:_spacevim_mappings_z.s = ['call feedkeys("zs", "n")', 'left scroll horizontally to cursor position'] + nnoremap zs zs + let g:_spacevim_mappings_z['t'] = ['call feedkeys("zt", "n")', 'cursor line at top of window'] + nnoremap zt zt + let g:_spacevim_mappings_z['v'] = ['call feedkeys("zv", "n")', 'open enough folds to view cursor line'] + nnoremap zv zv + let g:_spacevim_mappings_z['x'] = ['call feedkeys("zx", "n")', 're-apply foldlevel and do "zV"'] + nnoremap zx zx " smart scroll let g:_spacevim_mappings_z['z'] = ['call feedkeys("zz", "n")', 'smart scroll'] nnoremap zz zz diff --git a/docs/documentation.md b/docs/documentation.md index 29ab0054f..58c980ebb 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -924,12 +924,49 @@ after pressing prefix `z` in normal mode, if you do not remember the mappings, y Key Binding | Description -----------| ----------- +`z` | scroll screen N characters to left +`z+` | cursor to screen top line N +`z-` | cursor to screen bottom line N +`z.` | cursor line to center +`z` | cursor line to top +`z=` | spelling suggestions `zA` | toggle folds recursively `zC` | close folds recursively `zD` | delete folds recursively `zE` | eliminate all folds `zF` | create a fold for N lines -`zG` | mark good spelled +`zG` | mark good spelled(update internal-wordlist) +`zH` | scroll half a screenwidth to the right +`zL` | scroll half a screenwidth to the left +`zM` | set `foldlevel` to zero +`zN` | set `foldenable` +`zO` | open folds recursively +`zR` | set `foldlevel` to deepest fold +`zW` | mark wrong spelled +`zX` | re-apply `foldleve` +`z^` | cursor to screen bottom line N +`za` | toggle a fold +`zb` | redraw, cursor line at bottom +`zc` | close a fold +`zd` | delete a fold +`ze` | right scroll horizontally to cursor position +`zf` | create a fold for motion +`zg` | mark good spelled +`zh` | scroll screen N characters to right +`zi` | toggle foldenable +`zj` | mode to start of next fold +`zk` | mode to end of previous fold +`zl` | scroll screen N characters to left +`zm` | subtract one from `foldlevel` +`zn` | reset `foldenable` +`zo` | open fold +`zr` | add one to `foldlevel` +`zs` | left scroll horizontally to cursor position +`zt` | cursor line at top of window +`zv` | open enough folds to view cursor line +`zx` | re-apply foldlevel and do "zV" +`zz` | smart scroll +`z` | scroll screen N characters to right ### Auto-saving From 299cecb59ced476b82c0c202b687793c0a0dffe7 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Tue, 27 Jun 2017 14:30:39 +0800 Subject: [PATCH 18/33] Fix rust filetype detect --- filetype.vim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/filetype.vim b/filetype.vim index bfbc99031..f50283e26 100644 --- a/filetype.vim +++ b/filetype.vim @@ -1 +1,3 @@ +au BufRead,BufNewFile *.rs set filetype=rust + " vim:set et sw=2 From c225dc0b273fa8e604785491b3970f04b2ca3452 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Tue, 27 Jun 2017 15:19:48 +0800 Subject: [PATCH 19/33] Fix cursor shape --- config/neovim.vim | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/config/neovim.vim b/config/neovim.vim index 39a70d5b9..b5bccfd80 100644 --- a/config/neovim.vim +++ b/config/neovim.vim @@ -16,7 +16,14 @@ endfunction command! -range=% REPLSendSelection call REPLSend(s:GetVisual()) command! REPLSendLine call REPLSend([getline('.')]) " }}} -let $NVIM_TUI_ENABLE_CURSOR_SHAPE = g:spacevim_terminal_cursor_shape +" https://github.com/syngan/vim-vimlint/issues/102 +function! s:has(version) abort + return has(a:version) +endfunction +if !s:has('nvim-0.2.0') + let $NVIM_TUI_ENABLE_CURSOR_SHAPE = g:spacevim_terminal_cursor_shape +else +endif "silent! let &t_SI = "\]50;CursorShape=1\x7" "silent! let &t_SR = "\]50;CursorShape=2\x7" "silent! let &t_EI = "\]50;CursorShape=0\x7" From 7eff15e30a5d988e38b9f7206da1de7c0fa5f52f Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Tue, 27 Jun 2017 15:31:34 +0800 Subject: [PATCH 20/33] Fix relativenumber config close #674 --- autoload/SpaceVim.vim | 7 +++++++ autoload/SpaceVim/mapping/space.vim | 12 +++++++++--- doc/SpaceVim.txt | 3 +++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/autoload/SpaceVim.vim b/autoload/SpaceVim.vim index 8f08918c8..a3aa189de 100644 --- a/autoload/SpaceVim.vim +++ b/autoload/SpaceVim.vim @@ -36,6 +36,9 @@ lockvar g:spacevim_version " < let g:spacevim_default_indent = 2 "" +" Enable/Disable relativenumber, by default it is enabled. +let g:spacevim_relativenumber = 1 +"" " Change the max number of columns for SpaceVim. Default is 120. " > " let g:spacevim_max_column = 120 @@ -522,6 +525,10 @@ function! SpaceVim#end() abort call SpaceVim#layers#core#statusline#init() endif + if !g:spacevim_relativenumber + set norelativenumber + endif + if g:spacevim_realtime_leader_guide nnoremap :LeaderGuide get(g:, 'mapleader', '\') vnoremap :LeaderGuideVisual get(g:, 'mapleader', '\') diff --git a/autoload/SpaceVim/mapping/space.vim b/autoload/SpaceVim/mapping/space.vim index 5fabbabac..788d5b8ab 100644 --- a/autoload/SpaceVim/mapping/space.vim +++ b/autoload/SpaceVim/mapping/space.vim @@ -78,9 +78,15 @@ function! SpaceVim#mapping#space#init() abort let g:_spacevim_mappings_space.e = {'name' : '+Errors/Encoding'} let g:_spacevim_mappings_space.B = {'name' : '+Global-buffers'} - nnoremap [SPC]tn :setlocal nonumber! norelativenumber! - let g:_spacevim_mappings_space.t.n = ['setlocal nonumber! norelativenumber!', 'toggle line number'] - call SpaceVim#mapping#menu('toggle line number', '[SPC]tn', 'set nu!') + if g:spacevim_relativenumber + nnoremap [SPC]tn :setlocal nonumber! norelativenumber! + let g:_spacevim_mappings_space.t.n = ['setlocal nonumber! norelativenumber!', 'toggle line number'] + call SpaceVim#mapping#menu('toggle line number', '[SPC]tn', 'set nu!') + else + nnoremap [SPC]tn :setlocal number! + let g:_spacevim_mappings_space.t.n = ['setlocal number!', 'toggle line number'] + call SpaceVim#mapping#menu('toggle line number', '[SPC]tn', 'setlocal number!') + endif call SpaceVim#mapping#space#def('nnoremap', ['b', 'b'], 'Unite buffer', 'buffer list', 1) call extend(g:_spacevim_mappings_prefixs['[SPC]'], get(g:, '_spacevim_mappings_space', {})) call SpaceVim#mapping#space#def('nnoremap', ['r', 'l'], 'Unite resume', 'resume unite buffer', 1) diff --git a/doc/SpaceVim.txt b/doc/SpaceVim.txt index dda057eff..027db6f8b 100644 --- a/doc/SpaceVim.txt +++ b/doc/SpaceVim.txt @@ -75,6 +75,9 @@ Change the default indentation of SpaceVim. Default is 2. let g:spacevim_default_indent = 2 < + *g:spacevim_relativenumber* +Enable/Disable relativenumber, by default it is enabled. + *g:spacevim_max_column* Change the max number of columns for SpaceVim. Default is 120. > From e264a17d98696e1d5b2fd0d496615035e6c06fe8 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Tue, 27 Jun 2017 16:00:36 +0800 Subject: [PATCH 21/33] Fix guicorsor setting close #666 --- config/neovim.vim | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/config/neovim.vim b/config/neovim.vim index b5bccfd80..198bdce60 100644 --- a/config/neovim.vim +++ b/config/neovim.vim @@ -23,6 +23,16 @@ endfunction if !s:has('nvim-0.2.0') let $NVIM_TUI_ENABLE_CURSOR_SHAPE = g:spacevim_terminal_cursor_shape else + if g:spacevim_terminal_cursor_shape == 0 + " prevent nvim from changing the cursor shape + set guicursor= + elseif g:spacevim_terminal_cursor_shape == 1 + " enable non-blinking mode-sensitive cursor + set guicursor=a:block-blinkon0 + elseif g:spacevim_terminal_cursor_shape == 2 + " enable blinking mode-sensitive cursor + set guicursor=n-v-c:block-blinkon10,i-ci-ve:ver25-blinkon10,r-cr:hor20,o:hor50 + endif endif "silent! let &t_SI = "\]50;CursorShape=1\x7" "silent! let &t_SR = "\]50;CursorShape=2\x7" From 16b5e83537ed3b71f6ed5af37d0e237e49108d88 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Tue, 27 Jun 2017 16:47:43 +0800 Subject: [PATCH 22/33] Fix search_index after :noh Thanks: markzen: keeppa %s,pattern,,gn Patch 7.4.083 --- autoload/SpaceVim/layers/core/statusline.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autoload/SpaceVim/layers/core/statusline.vim b/autoload/SpaceVim/layers/core/statusline.vim index abc34f2f8..0b5e1d7bb 100644 --- a/autoload/SpaceVim/layers/core/statusline.vim +++ b/autoload/SpaceVim/layers/core/statusline.vim @@ -78,11 +78,11 @@ endfunction function! s:search_status() abort let ct = 0 let tt = 0 - let ctl = split(s:VIMCOMP.execute('.,$s/' . @/ . '//gn', 'silent!'), "\n") + 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('%s/' . @/ . '//gn', 'silent!'), "\n") + let ttl = split(s:VIMCOMP.execute('keeppatterns %s/' . @/ . '//gn', 'silent!'), "\n") if !empty(ctl) let tt = split(ttl[0])[0] endif From 62a139f4f91786c6dcfcbb20d37777224431e487 Mon Sep 17 00:00:00 2001 From: Wang Shidong Date: Thu, 18 May 2017 13:35:40 +0800 Subject: [PATCH 23/33] Create kotlin.vim --- autoload/SpaceVim/layers/lang/kotlin.vim | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 autoload/SpaceVim/layers/lang/kotlin.vim diff --git a/autoload/SpaceVim/layers/lang/kotlin.vim b/autoload/SpaceVim/layers/lang/kotlin.vim new file mode 100644 index 000000000..d4c905288 --- /dev/null +++ b/autoload/SpaceVim/layers/lang/kotlin.vim @@ -0,0 +1,15 @@ +"" +" @section lang#kotlin, layer-lang-kotlin +" @parentsection layers +" This layer is for kotlin development. + + +function! SpaceVim#layers#lang#kotlin#plugins() abort + let plugins = [] + call add(plugins, ['udalov/kotlin-vim']) + return plugins +endfunction + +function! SpaceVim#layers#lang#kotlin#config() abort + +endfunction From 1258ca4430f6dc04f9375f5a56b8b702efdb8ce2 Mon Sep 17 00:00:00 2001 From: Wang Shidong Date: Thu, 18 May 2017 13:48:14 +0800 Subject: [PATCH 24/33] Update kotlin.vim --- autoload/SpaceVim/layers/lang/kotlin.vim | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/autoload/SpaceVim/layers/lang/kotlin.vim b/autoload/SpaceVim/layers/lang/kotlin.vim index d4c905288..48693faa0 100644 --- a/autoload/SpaceVim/layers/lang/kotlin.vim +++ b/autoload/SpaceVim/layers/lang/kotlin.vim @@ -11,5 +11,26 @@ function! SpaceVim#layers#lang#kotlin#plugins() abort endfunction function! SpaceVim#layers#lang#kotlin#config() abort - +if g:spacevim_enable_neomake +" neomake support: +let g:neomake_kotlin_kotlinc_maker = { + \ 'args': ['-cp', s:classpath(), '-d', s:outputdir()], + \ 'errorformat': + \ "%E%f:%l:%c: error: %m," . + \ "%W%f:%l:%c: warning: %m," . + \ "%Eerror: %m," . + \ "%Wwarning: %m," . + \ "%Iinfo: %m," + \ } +let g:neomake_kotlin_enabled_makers = ['kotlinc'] +endif endfunction + +func! s:classpath() + +endf + +func! s:outputdir() + +endf + From 74829b85b2b2db0999b74e45db00e348d6afd74f Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Tue, 27 Jun 2017 21:30:14 +0800 Subject: [PATCH 25/33] Update doc for kotlin layer --- doc/SpaceVim.txt | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/doc/SpaceVim.txt b/doc/SpaceVim.txt index 027db6f8b..80ad29bc5 100644 --- a/doc/SpaceVim.txt +++ b/doc/SpaceVim.txt @@ -35,17 +35,18 @@ CONTENTS *SpaceVim-contents* 12. lang#elixir.............................|SpaceVim-layer-lang-elixir| 13. lang#go.....................................|SpaceVim-layer-lang-go| 14. lang#java.................................|SpaceVim-layer-lang-java| - 15. lang#ocaml...............................|SpaceVim-layer-lang-ocaml| - 16. lang#php...................................|SpaceVim-layer-lang-php| - 17. lang#puppet.............................|SpaceVim-layer-lang-puppet| - 18. lang#python.............................|SpaceVim-layer-lang-python| - 19. lang#rust.................................|SpaceVim-layer-lang-rust| - 20. lang#scala...............................|SpaceVim-layer-lang-scala| - 21. lang#tmux.................................|SpaceVim-layer-lang-tmux| - 22. lang#xml...................................|SpaceVim-layer-lang-xml| - 23. operator...................................|SpaceVim-layer-operator| - 24. shell.........................................|SpaceVim-layer-shell| - 25. tmux...........................................|SpaceVim-layer-tmux| + 15. lang#kotlin.............................|SpaceVim-layer-lang-kotlin| + 16. lang#ocaml...............................|SpaceVim-layer-lang-ocaml| + 17. lang#php...................................|SpaceVim-layer-lang-php| + 18. lang#puppet.............................|SpaceVim-layer-lang-puppet| + 19. lang#python.............................|SpaceVim-layer-lang-python| + 20. lang#rust.................................|SpaceVim-layer-lang-rust| + 21. lang#scala...............................|SpaceVim-layer-lang-scala| + 22. lang#tmux.................................|SpaceVim-layer-lang-tmux| + 23. lang#xml...................................|SpaceVim-layer-lang-xml| + 24. operator...................................|SpaceVim-layer-operator| + 25. shell.........................................|SpaceVim-layer-shell| + 26. tmux...........................................|SpaceVim-layer-tmux| 6. API........................................................|SpaceVim-api| 1. cmdlinemenu................................|SpaceVim-api-cmdlinemenu| 2. sid............................................|SpaceVim-api-vim-sid| @@ -795,6 +796,11 @@ https://github.com/google/google-java-format and set 'g:spacevim_layer_lang_java_formatter' to the path of the jar. +============================================================================== +LANG#KOTLIN *SpaceVim-layer-lang-kotlin* + +This layer is for kotlin development. + ============================================================================== LANG#OCAML *SpaceVim-layer-lang-ocaml* From f931ed08b015b6ea90cc5fbc0aa0ecb2d12160ce Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Wed, 28 Jun 2017 20:28:35 +0800 Subject: [PATCH 26/33] Fix toggle comment line --- autoload/SpaceVim/mapping/space.vim | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/autoload/SpaceVim/mapping/space.vim b/autoload/SpaceVim/mapping/space.vim index 788d5b8ab..c4ab43beb 100644 --- a/autoload/SpaceVim/mapping/space.vim +++ b/autoload/SpaceVim/mapping/space.vim @@ -72,9 +72,7 @@ function! SpaceVim#mapping#space#init() abort " " Toggles the comment state of the selected line(s). If the topmost selected " line is commented, all selected lines are uncommented and vice versa. - let g:_spacevim_mappings_space.c.c = ['cl', 'Toggle commment line(s)'] - call SpaceVim#mapping#menu('Toggle comment line(s)', '[SPC]cl', '') - nnoremap [SPC]cl :call NERDComment("n", "Toggle") + call SpaceVim#mapping#space#def('nnoremap', ['c', 'l'], 'call NERDComment("n", "Toggle")', 'Toggle comment line(s)', 1) let g:_spacevim_mappings_space.e = {'name' : '+Errors/Encoding'} let g:_spacevim_mappings_space.B = {'name' : '+Global-buffers'} From b34e3bec94acf78eea4af9d389796017f4758a72 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Tue, 27 Jun 2017 22:15:56 +0800 Subject: [PATCH 27/33] Add Achievements --- docs/documentation.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/documentation.md b/docs/documentation.md index 029940ed8..d1cc07ca1 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -1146,6 +1146,10 @@ Symbol | Description | Custom option `✖` | Error | `g:spacevim_error_symbol` `➤` | warning | `g:spacevim_warning_symbol` + + + + ## Features ### Awesome ui From 9e69df0c8513e116ba57f86bab50175d329555e5 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Tue, 27 Jun 2017 23:08:00 +0800 Subject: [PATCH 28/33] Add achievements func --- .../autoload/SpaceVim/dev/Achievements.vim | 37 +++++++++++++++++++ docs/documentation.md | 4 +- 2 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 .SpaceVim.d/autoload/SpaceVim/dev/Achievements.vim diff --git a/.SpaceVim.d/autoload/SpaceVim/dev/Achievements.vim b/.SpaceVim.d/autoload/SpaceVim/dev/Achievements.vim new file mode 100644 index 000000000..6f620196c --- /dev/null +++ b/.SpaceVim.d/autoload/SpaceVim/dev/Achievements.vim @@ -0,0 +1,37 @@ +function! s:generate_content() abort + let content = [] + let content += s:issues_ac() + return content +endfunction + +function! s:find_position() abort + let start = search('','bwnc') + let end = search('','bnwc') + return [start, end] +endfunction + +function! s:issues_ac() abort + let line = ['### issues'] + call add(line, '') + call add(line, 'Achievements | Account') + call add(line, '----- | -----') + let acc = [100, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000] + for id in acc + let issue = github#api#issues#Get_issue('SpaceVim', 'SpaceVim', id) + if has_key(issue, 'id') + let is_pr = has_key(issue, 'pull_request') + call add(line, id . 'th issue(' . (is_pr ? 'PR' : 'issue') . ') | ' . issue.user.login) + else + break + endif + endfor + return line +endfunction + +function! SpaceVim#dev#Achievements#update() + let [start, end] = s:find_position() + if start != 0 && end != 0 + exe (start + 1) . ',' . (end - 1) . 'delete' + call append(start, s:generate_content()) + endif +endfunction diff --git a/docs/documentation.md b/docs/documentation.md index d1cc07ca1..bc3ba57ff 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -1146,9 +1146,9 @@ Symbol | Description | Custom option `✖` | Error | `g:spacevim_error_symbol` `➤` | warning | `g:spacevim_warning_symbol` - + - + ## Features From c0bb57f766866363b5c5d53010584fa17c66ad65 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Tue, 27 Jun 2017 23:22:06 +0800 Subject: [PATCH 29/33] Update achievements func --- .../autoload/SpaceVim/dev/Achievements.vim | 17 ++++++++++++----- docs/documentation.md | 9 +++++++++ 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/.SpaceVim.d/autoload/SpaceVim/dev/Achievements.vim b/.SpaceVim.d/autoload/SpaceVim/dev/Achievements.vim index 6f620196c..ef1b32a59 100644 --- a/.SpaceVim.d/autoload/SpaceVim/dev/Achievements.vim +++ b/.SpaceVim.d/autoload/SpaceVim/dev/Achievements.vim @@ -1,13 +1,13 @@ function! s:generate_content() abort - let content = [] + let content = ['## Achievements', ''] let content += s:issues_ac() return content endfunction function! s:find_position() abort - let start = search('','bwnc') - let end = search('','bnwc') - return [start, end] + let start = search('^$','bwnc') + let end = search('^$','bnwc') + return sort([start, end]) endfunction function! s:issues_ac() abort @@ -20,11 +20,18 @@ function! s:issues_ac() abort let issue = github#api#issues#Get_issue('SpaceVim', 'SpaceVim', id) if has_key(issue, 'id') let is_pr = has_key(issue, 'pull_request') - call add(line, id . 'th issue(' . (is_pr ? 'PR' : 'issue') . ') | ' . issue.user.login) + call add(line, '[' . id . 'th issue(' . + \ (is_pr ? 'PR' : 'issue') . + \ ')](https://github.com/SpaceVim/SpaceVim/issues/' . id . ') | [' . issue.user.login + \ . '](https://github.com/' . issue.user.login . ')' + \ ) else break endif endfor + if line[-1] != '' + let line += [''] + endif return line endfunction diff --git a/docs/documentation.md b/docs/documentation.md index bc3ba57ff..9bb25b51b 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -79,6 +79,8 @@ title: "Documentation" * [Editing](#editing) * [Multi-Encodings](#multi-encodings) * [Errors handling](#errors-handling) +* [Achievements](#achievements) + * [issues](#issues) * [Features](#features) * [Awesome ui](#awesome-ui-1) * [Mnemonic key bindings](#mnemonic-key-bindings) @@ -1147,6 +1149,13 @@ Symbol | Description | Custom option `➤` | warning | `g:spacevim_warning_symbol` +## Achievements + +### issues + +Achievements | Account +----- | ----- +[100th issue(issue)](https://github.com/SpaceVim/SpaceVim/issues/100) | [BenBergman](https://github.com/BenBergman) From efd833054fc09c55fb034c8a6c60062b93d7bc86 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Wed, 28 Jun 2017 00:33:52 +0800 Subject: [PATCH 30/33] Add func for list stargazers --- .../autoload/SpaceVim/dev/Achievements.vim | 30 ++++++++++++++++--- docs/documentation.md | 7 +++++ 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/.SpaceVim.d/autoload/SpaceVim/dev/Achievements.vim b/.SpaceVim.d/autoload/SpaceVim/dev/Achievements.vim index ef1b32a59..62372da96 100644 --- a/.SpaceVim.d/autoload/SpaceVim/dev/Achievements.vim +++ b/.SpaceVim.d/autoload/SpaceVim/dev/Achievements.vim @@ -1,7 +1,8 @@ function! s:generate_content() abort - let content = ['## Achievements', ''] - let content += s:issues_ac() - return content + let content = ['## Achievements', ''] + let content += s:issues_ac() + let content += s:stargazers_ac() + return content endfunction function! s:find_position() abort @@ -35,10 +36,31 @@ function! s:issues_ac() abort return line endfunction +function! s:stargazers_ac() abort + let line = ['### Stars, forks and watchers'] + call add(line, '') + call add(line, 'Achievements | Account') + call add(line, '----- | -----') + let stc = [1, 100, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000] + for id in stc + if id == 1 + let user = github#api#activity#List_stargazers('SpaceVim','SpaceVim')[0] + call add(line, 'First stargazers | [' . user.login . '](https://github.com/)' . user.login) + else + endif + endfor + if line[-1] != '' + let line += [''] + endif + return line +endfunction + function! SpaceVim#dev#Achievements#update() let [start, end] = s:find_position() if start != 0 && end != 0 - exe (start + 1) . ',' . (end - 1) . 'delete' + if end - start > 1 + exe (start + 1) . ',' . (end - 1) . 'delete' + endif call append(start, s:generate_content()) endif endfunction diff --git a/docs/documentation.md b/docs/documentation.md index 9bb25b51b..5e25b88b6 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -81,6 +81,7 @@ title: "Documentation" * [Errors handling](#errors-handling) * [Achievements](#achievements) * [issues](#issues) + * [Stars, forks and watchers](#stars-forks-and-watchers) * [Features](#features) * [Awesome ui](#awesome-ui-1) * [Mnemonic key bindings](#mnemonic-key-bindings) @@ -1157,6 +1158,12 @@ Achievements | Account ----- | ----- [100th issue(issue)](https://github.com/SpaceVim/SpaceVim/issues/100) | [BenBergman](https://github.com/BenBergman) +### Stars, forks and watchers + +Achievements | Account +----- | ----- +First stargazers | [monkeydterry](https://github.com/)monkeydterry + ## Features From 985fa6e7f84a662ad1e3482289683d4c4cbde2de Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Wed, 28 Jun 2017 00:35:58 +0800 Subject: [PATCH 31/33] Fix url type --- .SpaceVim.d/autoload/SpaceVim/dev/Achievements.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.SpaceVim.d/autoload/SpaceVim/dev/Achievements.vim b/.SpaceVim.d/autoload/SpaceVim/dev/Achievements.vim index 62372da96..6a2664c65 100644 --- a/.SpaceVim.d/autoload/SpaceVim/dev/Achievements.vim +++ b/.SpaceVim.d/autoload/SpaceVim/dev/Achievements.vim @@ -45,7 +45,7 @@ function! s:stargazers_ac() abort for id in stc if id == 1 let user = github#api#activity#List_stargazers('SpaceVim','SpaceVim')[0] - call add(line, 'First stargazers | [' . user.login . '](https://github.com/)' . user.login) + call add(line, 'First stargazers | [' . user.login . '](https://github.com/' . user.login . ')') else endif endfor From 3093eb866d4e1bb1111b3b193564a6a85de36690 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Wed, 28 Jun 2017 21:08:53 +0800 Subject: [PATCH 32/33] Finish star_rc --- .SpaceVim.d/autoload/SpaceVim/dev/Achievements.vim | 12 ++++++++++++ docs/documentation.md | 6 +++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/.SpaceVim.d/autoload/SpaceVim/dev/Achievements.vim b/.SpaceVim.d/autoload/SpaceVim/dev/Achievements.vim index 6a2664c65..700d6e8fc 100644 --- a/.SpaceVim.d/autoload/SpaceVim/dev/Achievements.vim +++ b/.SpaceVim.d/autoload/SpaceVim/dev/Achievements.vim @@ -47,6 +47,18 @@ function! s:stargazers_ac() abort let user = github#api#activity#List_stargazers('SpaceVim','SpaceVim')[0] call add(line, 'First stargazers | [' . user.login . '](https://github.com/' . user.login . ')') else + let index = id % 30 + if index == 0 + let page = id/30 + let index = 30 + else + let page = id/30 + 1 + endif + let users = github#api#activity#List_stargazers('SpaceVim','SpaceVim', page) + if type(users) == type([]) && len(users) >= index + let user = users[index - 1] + call add(line, id . 'th stargazers | [' . user.login . '](https://github.com/' . user.login . ')') + endif endif endfor if line[-1] != '' diff --git a/docs/documentation.md b/docs/documentation.md index 5e25b88b6..986ba4d6b 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -1162,7 +1162,11 @@ Achievements | Account Achievements | Account ----- | ----- -First stargazers | [monkeydterry](https://github.com/)monkeydterry +First stargazers | [monkeydterry](https://github.com/monkeydterry) +100th stargazers | [naraj](https://github.com/naraj) +1000th stargazers | [icecity96](https://github.com/icecity96) +2000th stargazers | [frowhy](https://github.com/frowhy) +3000th stargazers | [purkylin](https://github.com/purkylin) From 12db8408ef2afeaca10e61503c2de15b2fdfc6f0 Mon Sep 17 00:00:00 2001 From: Ubayd Date: Wed, 28 Jun 2017 23:49:44 +0300 Subject: [PATCH 33/33] Plugin vimfiler config direction --- config/plugins/vimfiler.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/plugins/vimfiler.vim b/config/plugins/vimfiler.vim index 9a8f1a680..9bfdd8a21 100644 --- a/config/plugins/vimfiler.vim +++ b/config/plugins/vimfiler.vim @@ -8,6 +8,7 @@ let g:vimfiler_tree_closed_icon = get(g:, 'vimfiler_tree_closed_icon', '▷') let g:vimfiler_file_icon = get(g:, 'vimfiler_file_icon', '') let g:vimfiler_readonly_file_icon = get(g:, 'vimfiler_readonly_file_icon', '*') let g:vimfiler_marked_file_icon = get(g:, 'vimfiler_marked_file_icon', '√') +let g:vimfiler_direction = get(g:, 'vimfiler_direction', 'rightbelow') "let g:vimfiler_preview_action = 'auto_preview' let g:vimfiler_ignore_pattern = get(g:, 'vimfiler_ignore_pattern', [ \ '^\.git$', @@ -41,7 +42,7 @@ call vimfiler#custom#profile('default', 'context', { \ 'winminwidth' : 30, \ 'toggle' : 1, \ 'auto_expand': 1, - \ 'direction' : 'rightbelow', + \ 'direction' : g:vimfiler_direction, \ 'explorer_columns' : s:setcolum(), \ 'parent': 0, \ 'status' : 1,