diff --git a/autoload/SpaceVim/layers/.#core.vim b/autoload/SpaceVim/layers/.#core.vim new file mode 120000 index 000000000..c7a61e096 --- /dev/null +++ b/autoload/SpaceVim/layers/.#core.vim @@ -0,0 +1 @@ +wsdjeg@archlinux.1673:1515496422 \ No newline at end of file diff --git a/autoload/SpaceVim/mapping/space.vim b/autoload/SpaceVim/mapping/space.vim index 71bc1404d..23b2abbeb 100644 --- a/autoload/SpaceVim/mapping/space.vim +++ b/autoload/SpaceVim/mapping/space.vim @@ -20,7 +20,7 @@ function! SpaceVim#mapping#space#init() abort let g:_spacevim_mappings_space.n = {'name' : '+Narrow/Numbers'} let g:_spacevim_mappings_space.q = {'name' : '+Quit'} let g:_spacevim_mappings_space.l = {'name' : '+Language Specified'} - let g:_spacevim_mappings_space.s = {'name' : '+Searching'} + let g:_spacevim_mappings_space.s = {'name' : '+Searching/Symbol'} let g:_spacevim_mappings_space.r = {'name' : '+Registers/rings/resume'} let g:_spacevim_mappings_space.d = {'name' : '+Debug'} if s:has_map_to_spc() @@ -282,6 +282,9 @@ function! SpaceVim#mapping#space#init() abort call SpaceVim#mapping#space#def('nnoremap', ['s', 'c'], 'noh', \ 'clear search highlight', 1) + "Symbol + call SpaceVim#mapping#space#def('nnoremap', ['s', 'e'], 'call SpaceVim#plugins#iedit#start()', + \ 'start iedit mode', 1, 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/iedit.vim b/autoload/SpaceVim/plugins/iedit.vim new file mode 100644 index 000000000..1e9bd7d3b --- /dev/null +++ b/autoload/SpaceVim/plugins/iedit.vim @@ -0,0 +1,50 @@ +"============================================================================= +" iedit.vim --- iedit mode for SpaceVim +" Copyright (c) 2016-2017 Shidong Wang & Contributors +" Author: Shidong Wang < wsdjeg at 163.com > +" URL: https://spacevim.org +" License: MIT license +"============================================================================= + +let s:stack = [] +let s:mode = '' + +function! SpaceVim#plugins#iedit#start() + let save_tve = &t_ve + setlocal t_ve= + let s:mode = 'n' + while 1 + let char = getchar() + redraw! + if s:mode ==# 'n' && char == 27 + break + else + call s:handle(s:mode, char) + endif + endwhile + let &t_ve = save_tve +endfunction + + +function! s:handle(mode, char) abort + if a:mode ==# 'n' + call s:handle_normal(a:char) + elseif a:mode ==# 'i' + call s:handle_insert(a:char) + endif +endfunction + + +function! s:handle_normal(char) abort + if a:char ==# 105 + let s:mode = 'i' + endif + echom s:mode . '--' . a:char +endfunction + +function! s:handle_insert(char) abort + if a:char == 27 + let s:mode = 'n' + endif + echom s:mode . '--' . a:char +endfunction diff --git a/docs/documentation.md b/docs/documentation.md index 376083509..37183a6aa 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -86,12 +86,16 @@ description: "General documentation about how to using SpaceVim, including the q - [Searching the web](#searching-the-web) - [Searching on the fly](#searching-on-the-fly) - [Persistent highlighting](#persistent-highlighting) + - [Highlight current symbol](#highlight-current-symbol) - [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) - [Increase/Decrease numbers](#increasedecrease-numbers) + - [Replace text with iedit](#replace-text-with-iedit) + - [iedit states key bindings](#iedit-states-key-bindings) + - [Examples](#examples) - [Commenting](#commenting) - [Multi-Encodings](#multi-encodings) - [Errors handling](#errors-handling) @@ -1281,6 +1285,8 @@ key binding in FlyGrep buffer: SpaceVim uses `g:spacevim_search_highlight_persist` to keep the searched expression highlighted until the next search. It is also possible to clear the highlighting by pressing `SPC s c` or executing the ex command `:noh`. +#### Highlight current symbol + ### Editing #### Paste text @@ -1383,6 +1389,27 @@ In transient state: **Tips:** you can increase or decrease a value by more that once by using a prefix argument (i.e. `10 SPC n +` will add 10 to the number under point). +#### Replace text with iedit + +SpaceVim uses powerful iedit mode to quick edit multiple occurrences of a symbol or selection. + +**Two new modes:** + +`iedit-Normal` +`idite-Insert` + +The defalut color for iedit is `red`/`green`. + +##### iedit states key bindings + +**State transitions:** + +| Key Binding | From | to | +| ----------- | ---------------- | ------------ | +| `SPC s e` | normal or visual | iedit-Normal | + +##### Examples + #### Commenting Comments are handled by [nerdcommenter](https://github.com/scrooloose/nerdcommenter), it’s bound to the following keys.