diff --git a/autoload/SpaceVim/layers/edit.vim b/autoload/SpaceVim/layers/edit.vim index 7b8274c9e..b55c7b87b 100644 --- a/autoload/SpaceVim/layers/edit.vim +++ b/autoload/SpaceVim/layers/edit.vim @@ -17,7 +17,6 @@ function! SpaceVim#layers#edit#plugins() abort \ ['tpope/vim-surround'], \ ['tpope/vim-repeat'], \ ['junegunn/vim-emoji'], - \ ['terryma/vim-multiple-cursors', { 'loadconf' : 1, 'merged' : 0}], \ ['terryma/vim-expand-region', { 'loadconf' : 1}], \ ['kana/vim-textobj-user'], \ ['kana/vim-textobj-indent'], diff --git a/autoload/SpaceVim/mapping/space.vim b/autoload/SpaceVim/mapping/space.vim index be4f96476..aaa23d877 100644 --- a/autoload/SpaceVim/mapping/space.vim +++ b/autoload/SpaceVim/mapping/space.vim @@ -503,8 +503,10 @@ function! SpaceVim#mapping#space#init() abort xnoremap SpaceVim-plugin-iedit :call SpaceVim#plugins#iedit#start(1) call SpaceVim#mapping#space#def('nmap', ['s', 'e'], 'SpaceVim-plugin-iedit', \ 'start iedit mode', 0, 1) - call SpaceVim#mapping#space#def('nnoremap', ['s', 'h'], 'call SpaceVim#plugins#highlight#start()', + call SpaceVim#mapping#space#def('nnoremap', ['s', 'H'], 'call SpaceVim#plugins#highlight#start(1)', \ 'highlight all symbols', 1) + call SpaceVim#mapping#space#def('nnoremap', ['s', 'h'], 'call SpaceVim#plugins#highlight#start(0)', + \ 'highlight current symbols', 1) " Getting help let g:_spacevim_mappings_space.h.d = {'name' : '+help-describe'} call SpaceVim#mapping#space#def('nnoremap', ['h', 'd', 'b'], diff --git a/autoload/SpaceVim/plugins/highlight.vim b/autoload/SpaceVim/plugins/highlight.vim index 2f0870144..5dc06b807 100644 --- a/autoload/SpaceVim/plugins/highlight.vim +++ b/autoload/SpaceVim/plugins/highlight.vim @@ -110,8 +110,11 @@ function! s:init() abort endfunction " }}} +" use SPC s H to highlight all symbol on default range. +" use SPC s h to highlight current symbol on default range. + " public API func: start Highlight mode {{{ -function! SpaceVim#plugins#highlight#start() abort +function! SpaceVim#plugins#highlight#start(current) abort let curpos = getcurpos() let save_reg_k = @k normal! viw"ky diff --git a/autoload/SpaceVim/plugins/iedit.vim b/autoload/SpaceVim/plugins/iedit.vim index 38a4497ac..f0f1cfa7a 100644 --- a/autoload/SpaceVim/plugins/iedit.vim +++ b/autoload/SpaceVim/plugins/iedit.vim @@ -149,6 +149,7 @@ endfunction let s:toggle_stack = {} +" here is a list of normal command which can be handled by idedit function! s:handle_normal(char) abort silent! call s:remove_cursor_highlight() if a:char ==# 105 " i @@ -156,6 +157,16 @@ function! s:handle_normal(char) abort let w:spacevim_iedit_mode = s:mode let w:spacevim_statusline_mode = 'ii' redrawstatus! + elseif a:char == 73 " I + let s:mode = 'i' + let w:spacevim_iedit_mode = s:mode + let w:spacevim_statusline_mode = 'ii' + for i in range(len(s:cursor_stack)) + let s:cursor_stack[i].cursor = matchstr(s:cursor_stack[i].begin . s:cursor_stack[i].cursor . s:cursor_stack[i].end, '^.') + let s:cursor_stack[i].end = substitute(s:cursor_stack[i].begin . s:cursor_stack[i].cursor . s:cursor_stack[i].end , '^.', '', 'g') + let s:cursor_stack[i].begin = '' + endfor + redrawstatus! elseif a:char == 9 " if index(keys(s:toggle_stack), s:index . '') == -1 call extend(s:toggle_stack, {s:index : [s:stack[s:index], s:cursor_stack[s:index]]}) @@ -176,6 +187,16 @@ function! s:handle_normal(char) abort let s:cursor_stack[i].end = substitute(s:cursor_stack[i].end, '^.', '', 'g') endfor redrawstatus! + elseif a:char == 65 " A + let s:mode = 'i' + let w:spacevim_iedit_mode = s:mode + let w:spacevim_statusline_mode = 'ii' + for i in range(len(s:cursor_stack)) + let s:cursor_stack[i].begin = s:cursor_stack[i].begin . s:cursor_stack[i].cursor . s:cursor_stack[i].end + let s:cursor_stack[i].cursor = '' + let s:cursor_stack[i].end = '' + endfor + redrawstatus! elseif a:char ==# "\" || a:char == 104 for i in range(len(s:cursor_stack)) if !empty(s:cursor_stack[i].begin) @@ -281,7 +302,11 @@ function! s:handle_insert(char) abort redraw! redrawstatus! return - elseif a:char == 23 " + elseif a:char == 23 " ctrl-w : remove last word + for i in range(len(s:cursor_stack)) + let s:cursor_stack[i].begin = substitute(s:cursor_stack[i].begin, '\S*\s*$', '', 'g') + endfor + elseif a:char == 21 " Ctrl-u for i in range(len(s:cursor_stack)) let s:cursor_stack[i].begin = '' endfor diff --git a/config/plugins/vim-multiple-cursors.vim b/config/plugins/vim-multiple-cursors.vim index cde4b0905..e69de29bb 100644 --- a/config/plugins/vim-multiple-cursors.vim +++ b/config/plugins/vim-multiple-cursors.vim @@ -1,39 +0,0 @@ -if g:spacevim_autocomplete_method ==# 'ycm' - function! s:disable_autocomplete() abort - - endfunction - function! s:enable_autocomplete() abort - - endfunction -elseif g:spacevim_autocomplete_method ==# 'neocomplete' - function! s:disable_autocomplete() abort - NeoCompleteLock - endfunction - function! s:enable_autocomplete() abort - NeoCompleteUnlock - endfunction -elseif g:spacevim_autocomplete_method ==# 'neocomplcache' "{{{ - function! s:disable_autocomplete() abort - NeoComplCacheDisable - endfunction - function! s:enable_autocomplete() abort - NeoComplCacheEnable - endfunction -elseif g:spacevim_autocomplete_method ==# 'deoplete' - function! s:disable_autocomplete() abort - call deoplete#disable() - endfunction - function! s:enable_autocomplete() abort - call deoplete#enable() - endfunction -endif -" Called once right before you start selecting multiple cursors -function! Multiple_cursors_before() - call s:disable_autocomplete() -endfunction - -" Called once only when the multiple selection is canceled (default ) -function! Multiple_cursors_after() - call s:enable_autocomplete() -endfunction -" vim:set et sw=2 cc=80: diff --git a/doc/SpaceVim.txt b/doc/SpaceVim.txt index 19b217ff0..f9fe1a0c4 100644 --- a/doc/SpaceVim.txt +++ b/doc/SpaceVim.txt @@ -67,16 +67,17 @@ CONTENTS *SpaceVim-contents* 22. lang#ocaml...............................|SpaceVim-layer-lang-ocaml| 23. lang#php...................................|SpaceVim-layer-lang-php| 24. lang#pony.................................|SpaceVim-layer-lang-pony| - 25. lang#puppet.............................|SpaceVim-layer-lang-puppet| - 26. lang#python.............................|SpaceVim-layer-lang-python| - 27. lang#rust.................................|SpaceVim-layer-lang-rust| - 28. lang#scala...............................|SpaceVim-layer-lang-scala| - 29. lang#xml...................................|SpaceVim-layer-lang-xml| - 30. operator...................................|SpaceVim-layer-operator| - 31. shell.........................................|SpaceVim-layer-shell| - 32. tmux...........................................|SpaceVim-layer-tmux| - 33. tools#dash...............................|SpaceVim-layer-tools-dash| - 34. tools#zeal...............................|SpaceVim-layer-tools-zeal| + 25. lang#processing.....................|SpaceVim-layer-lang-processing| + 26. lang#puppet.............................|SpaceVim-layer-lang-puppet| + 27. lang#python.............................|SpaceVim-layer-lang-python| + 28. lang#rust.................................|SpaceVim-layer-lang-rust| + 29. lang#scala...............................|SpaceVim-layer-lang-scala| + 30. lang#xml...................................|SpaceVim-layer-lang-xml| + 31. operator...................................|SpaceVim-layer-operator| + 32. shell.........................................|SpaceVim-layer-shell| + 33. tmux...........................................|SpaceVim-layer-tmux| + 34. tools#dash...............................|SpaceVim-layer-tools-dash| + 35. tools#zeal...............................|SpaceVim-layer-tools-zeal| 7. API........................................................|SpaceVim-api| 1. cmdlinemenu................................|SpaceVim-api-cmdlinemenu| 2. data#dict....................................|SpaceVim-api-data-dict| @@ -1255,6 +1256,29 @@ Requirements: ============================================================================== LANG#PONY *SpaceVim-layer-lang-pony* +============================================================================== +LANG#PROCESSING *SpaceVim-layer-lang-processing* + +This layer is for Processing development: https://processing.org + +This is based on the work from https://github.com/sophacles/vim-processing + +Requirements: + + 1. You will need a copy of processing-java. The best way to do this is to + get a copy of the Processing IDE from https://processing.org/download/ + + Once you have it, run it, and then select Tools -> install +"processing-java" + +MAPPINGS + +> + Mode Key Function + ----------------------------------------------- + normal SPC l r execute current sketch +< + ============================================================================== LANG#PUPPET *SpaceVim-layer-lang-puppet* diff --git a/docs/cn/layers/edit.md b/docs/cn/layers/edit.md index be5ea0168..1078e2d12 100644 --- a/docs/cn/layers/edit.md +++ b/docs/cn/layers/edit.md @@ -12,6 +12,7 @@ lang: cn - [功能特性](#功能特性) - [模块选项](#模块选项) - [快捷键](#快捷键) + - [多光标支持](#多光标支持) @@ -40,7 +41,7 @@ lang: cn | ------------------ | ---------------------- | | `SPC x a {分隔符}` | 基于分隔符进行文本对齐 | -**默认的分隔符:** +默认的分隔符: - `=`: 对齐 `===`, `==`, `!=`, `>=` 等 - `&`: 对齐 `&` @@ -60,6 +61,11 @@ lang: cn - `o`: 对齐 `+ - * / % ^` 等 - `r`: 对齐用户输入的正则表达式 +### 多光标支持 + +在 Visual 模式下可使用 Ctrl+n 按键选择下一个匹配位置。此时文档中所有匹配项都会被高亮,选中的匹配位置会有特殊高亮。 +可使用 Ctrl+x 按键跳过当前位置。 + | 快捷键 | 功能描述 | | ----------- | ------------------------------------ | | `SPC x j c` | 居中对齐当前段落 | @@ -70,3 +76,4 @@ lang: cn | `SPC x u` | 将选中字符串转为小写 | | `SPC x U` | 将选中字符串转为大写 | | `SPC x w c` | 统计选中区域的单词数 | +