1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-03 05:50:05 +08:00

Add highlight state

This commit is contained in:
wsdjeg 2018-01-10 23:42:37 +08:00
parent d236e77e2f
commit 133b921c0f
2 changed files with 43 additions and 0 deletions

View File

@ -285,6 +285,8 @@ function! SpaceVim#mapping#space#init() abort
"Symbol
call SpaceVim#mapping#space#def('nnoremap', ['s', 'e'], 'call SpaceVim#plugins#iedit#start()',
\ 'start iedit mode', 1, 1)
call SpaceVim#mapping#space#def('nnoremap', ['s', 'h'], 'call SpaceVim#plugins#highlight#start()',
\ 'highlight all symbols', 1)
" Getting help
let g:_spacevim_mappings_space.h.d = {'name' : '+help-describe'}
call SpaceVim#mapping#space#def('nnoremap', ['h', 'd', 'b'],

View File

@ -0,0 +1,41 @@
"=============================================================================
" highlight.vim --- highlight mode for SpaceVim
" Copyright (c) 2016-2017 Shidong Wang & Contributors
" Author: Shidong Wang < wsdjeg at 163.com >
" URL: https://spacevim.org
" License: MIT license
"=============================================================================
function! SpaceVim#plugins#highlight#start()
let state = SpaceVim#api#import('transient_state')
call state.set_title('Highlight Transient State')
call state.defind_keys(
\ {
\ 'layout' : 'vertical split',
\ 'left' : [
\ ],
\ 'right' : [
\ ],
\ }
\ )
call state.open()
endfunction
" function() wrapper
if v:version > 703 || v:version == 703 && has('patch1170')
function! s:_function(fstr) abort
return function(a:fstr)
endfunction
else
function! s:_SID() abort
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$')
endfunction
let s:_s = '<SNR>' . s:_SID() . '_'
function! s:_function(fstr) abort
return function(substitute(a:fstr, 's:', s:_s, 'g'))
endfunction
endif