mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-03 02:20:05 +08:00
Add iedit mode
This commit is contained in:
parent
de4067f43c
commit
3bca249e1f
@ -578,7 +578,18 @@ 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]
|
||||
let iedit_mode = get(w:, 'spacevim_iedit_mode', '')
|
||||
if !empty(iedit_mode)
|
||||
if iedit_mode ==# 'n'
|
||||
exe 'hi! SpaceVim_statusline_a ctermbg=' . t[8][3] . ' ctermfg=' . t[8][2] . ' guibg=' . t[8][1] . ' guifg=' . t[8][0]
|
||||
elseif iedit_mode ==# 'i'
|
||||
exe 'hi! SpaceVim_statusline_a ctermbg=' . t[7][3] . ' ctermfg=' . t[7][2] . ' guibg=' . t[7][1] . ' guifg=' . t[7][0]
|
||||
else
|
||||
exe 'hi! SpaceVim_statusline_a ctermbg=' . t[0][2] . ' ctermfg=' . t[0][3] . ' guibg=' . t[0][1] . ' guifg=' . t[0][0]
|
||||
endif
|
||||
else
|
||||
exe 'hi! SpaceVim_statusline_a ctermbg=' . t[0][2] . ' ctermfg=' . t[0][3] . ' guibg=' . t[0][1] . ' guifg=' . t[0][0]
|
||||
endif
|
||||
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'
|
||||
|
@ -7,6 +7,8 @@
|
||||
" \ [ i_guifg, i_guibg, i_ctermfg, i_ctermbg],
|
||||
" \ [ v_guifg, v_guibg, v_ctermfg, v_ctermbg],
|
||||
" \ [ r_guifg, r_guibg, r_ctermfg, r_ctermbg],
|
||||
" \ [ ii_guifg, ii_guibg, ii_ctermfg, ii_ctermbg],
|
||||
" \ [ in_guifg, in_guibg, in_ctermfg, in_ctermbg],
|
||||
" \ ]
|
||||
|
||||
let s:yellow = 'ctermfg=214 guifg=#fabd2f'
|
||||
@ -22,5 +24,7 @@ function! SpaceVim#mapping#guide#theme#gruvbox#palette() abort
|
||||
\ ['#282828', '#83a598', 235, 109],
|
||||
\ ['#282828', '#fe8019', 235, 208],
|
||||
\ ['#282828', '#8ec07c', 235, 108],
|
||||
\ ['#282828', '#689d6a', 235, 72],
|
||||
\ ['#282828', '#8f3f71', 235, 132],
|
||||
\ ]
|
||||
endfunction
|
||||
|
@ -13,6 +13,8 @@ function! SpaceVim#plugins#iedit#start()
|
||||
let save_tve = &t_ve
|
||||
setlocal t_ve=
|
||||
let s:mode = 'n'
|
||||
let w:spacevim_iedit_mode = s:mode
|
||||
redrawstatus!
|
||||
while 1
|
||||
let char = getchar()
|
||||
redraw!
|
||||
@ -22,6 +24,8 @@ function! SpaceVim#plugins#iedit#start()
|
||||
call s:handle(s:mode, char)
|
||||
endif
|
||||
endwhile
|
||||
let s:mode = ''
|
||||
let w:spacevim_iedit_mode = s:mode
|
||||
let &t_ve = save_tve
|
||||
endfunction
|
||||
|
||||
@ -38,6 +42,8 @@ endfunction
|
||||
function! s:handle_normal(char) abort
|
||||
if a:char ==# 105
|
||||
let s:mode = 'i'
|
||||
let w:spacevim_iedit_mode = s:mode
|
||||
redrawstatus!
|
||||
endif
|
||||
echom s:mode . '--' . a:char
|
||||
endfunction
|
||||
@ -45,6 +51,8 @@ endfunction
|
||||
function! s:handle_insert(char) abort
|
||||
if a:char == 27
|
||||
let s:mode = 'n'
|
||||
let w:spacevim_iedit_mode = s:mode
|
||||
redrawstatus!
|
||||
endif
|
||||
echom s:mode . '--' . a:char
|
||||
endfunction
|
||||
|
@ -1393,12 +1393,9 @@ In transient state:
|
||||
|
||||
SpaceVim uses powerful iedit mode to quick edit multiple occurrences of a symbol or selection.
|
||||
|
||||
**Two new modes:**
|
||||
**Two new modes:** `iedit-Normal`/`idite-Insert`
|
||||
|
||||
`iedit-Normal`
|
||||
`idite-Insert`
|
||||
|
||||
The defalut color for iedit is `red`/`green`.
|
||||
The defalut color for iedit is `red`/`green` which is based on the current colorscheme.
|
||||
|
||||
##### iedit states key bindings
|
||||
|
||||
@ -1408,6 +1405,24 @@ The defalut color for iedit is `red`/`green`.
|
||||
| ----------- | ---------------- | ------------ |
|
||||
| `SPC s e` | normal or visual | iedit-Normal |
|
||||
|
||||
**In iedit-Normal mode:**
|
||||
|
||||
`iedit-Normal` mode inherits from `Normal` mode, the following key bindings are specific to `iedit-Normal` mode.
|
||||
|
||||
| Key Binding | Description |
|
||||
| ----------- | ------------------------------------------------------------------------------- |
|
||||
| `Esc` | go back to `Normal` mode |
|
||||
| `I` | go to the beginning of the current occurrence and switch to `iedit-Insert` mode |
|
||||
| `A` | go to the end of the current occurrence and switch to `iedit-Insert` mode |
|
||||
| `i` | switch to `iedit-Insert` mode, same as `i` |
|
||||
| `a` | switch to `iedit-Insert` mode, same as `a` |
|
||||
|
||||
**In iedit-Insert mode:**
|
||||
|
||||
| Key Binding | Description |
|
||||
| ----------- | ------------------------------ |
|
||||
| `Esc` | go back to `iedit-Normal` mode |
|
||||
|
||||
##### Examples
|
||||
|
||||
#### Commenting
|
||||
|
Loading…
Reference in New Issue
Block a user