mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-24 05:40:05 +08:00
Add iedit mode
This commit is contained in:
parent
7172142bba
commit
c05f014429
1
autoload/SpaceVim/layers/.#core.vim
Symbolic link
1
autoload/SpaceVim/layers/.#core.vim
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
wsdjeg@archlinux.1673:1515496422
|
@ -20,7 +20,7 @@ function! SpaceVim#mapping#space#init() abort
|
|||||||
let g:_spacevim_mappings_space.n = {'name' : '+Narrow/Numbers'}
|
let g:_spacevim_mappings_space.n = {'name' : '+Narrow/Numbers'}
|
||||||
let g:_spacevim_mappings_space.q = {'name' : '+Quit'}
|
let g:_spacevim_mappings_space.q = {'name' : '+Quit'}
|
||||||
let g:_spacevim_mappings_space.l = {'name' : '+Language Specified'}
|
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.r = {'name' : '+Registers/rings/resume'}
|
||||||
let g:_spacevim_mappings_space.d = {'name' : '+Debug'}
|
let g:_spacevim_mappings_space.d = {'name' : '+Debug'}
|
||||||
if s:has_map_to_spc()
|
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',
|
call SpaceVim#mapping#space#def('nnoremap', ['s', 'c'], 'noh',
|
||||||
\ 'clear search highlight', 1)
|
\ '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
|
" Getting help
|
||||||
let g:_spacevim_mappings_space.h.d = {'name' : '+help-describe'}
|
let g:_spacevim_mappings_space.h.d = {'name' : '+help-describe'}
|
||||||
call SpaceVim#mapping#space#def('nnoremap', ['h', 'd', 'b'],
|
call SpaceVim#mapping#space#def('nnoremap', ['h', 'd', 'b'],
|
||||||
|
50
autoload/SpaceVim/plugins/iedit.vim
Normal file
50
autoload/SpaceVim/plugins/iedit.vim
Normal file
@ -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
|
@ -86,12 +86,16 @@ description: "General documentation about how to using SpaceVim, including the q
|
|||||||
- [Searching the web](#searching-the-web)
|
- [Searching the web](#searching-the-web)
|
||||||
- [Searching on the fly](#searching-on-the-fly)
|
- [Searching on the fly](#searching-on-the-fly)
|
||||||
- [Persistent highlighting](#persistent-highlighting)
|
- [Persistent highlighting](#persistent-highlighting)
|
||||||
|
- [Highlight current symbol](#highlight-current-symbol)
|
||||||
- [Editing](#editing)
|
- [Editing](#editing)
|
||||||
- [Paste text](#paste-text)
|
- [Paste text](#paste-text)
|
||||||
- [Auto-indent pasted text](#auto-indent-pasted-text)
|
- [Auto-indent pasted text](#auto-indent-pasted-text)
|
||||||
- [Text manipulation commands](#text-manipulation-commands)
|
- [Text manipulation commands](#text-manipulation-commands)
|
||||||
- [Text insertion commands](#text-insertion-commands)
|
- [Text insertion commands](#text-insertion-commands)
|
||||||
- [Increase/Decrease numbers](#increasedecrease-numbers)
|
- [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)
|
- [Commenting](#commenting)
|
||||||
- [Multi-Encodings](#multi-encodings)
|
- [Multi-Encodings](#multi-encodings)
|
||||||
- [Errors handling](#errors-handling)
|
- [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`.
|
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
|
### Editing
|
||||||
|
|
||||||
#### Paste text
|
#### 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).
|
**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
|
#### Commenting
|
||||||
|
|
||||||
Comments are handled by [nerdcommenter](https://github.com/scrooloose/nerdcommenter), it’s bound to the following keys.
|
Comments are handled by [nerdcommenter](https://github.com/scrooloose/nerdcommenter), it’s bound to the following keys.
|
||||||
|
Loading…
Reference in New Issue
Block a user