mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-03 02:30:03 +08:00
Add flag for space mapping
This commit is contained in:
parent
ed6d162dda
commit
fd3a26beff
@ -1,4 +1,7 @@
|
||||
function! SpaceVim#mapping#space#init() abort
|
||||
if s:has_map_to_spc()
|
||||
return
|
||||
endif
|
||||
nnoremap <silent><nowait> [SPC] :<c-u>LeaderGuide " "<CR>
|
||||
nmap <Space> [SPC]
|
||||
let g:_spacevim_mappings_space = {}
|
||||
@ -18,6 +21,9 @@ function! SpaceVim#mapping#space#init() abort
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#mapping#space#def(m, keys, cmd, desc, is_cmd) abort
|
||||
if s:has_map_to_spc()
|
||||
return
|
||||
endif
|
||||
if a:is_cmd
|
||||
let cmd = ':<C-u>' . a:cmd . '<CR>'
|
||||
let lcmd = a:cmd
|
||||
@ -37,3 +43,10 @@ function! SpaceVim#mapping#space#def(m, keys, cmd, desc, is_cmd) abort
|
||||
let g:_spacevim_mappings_space[a:keys[0]] = [lcmd, a:desc]
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:has_map_to_spc() abort
|
||||
if !exists('s:flag')
|
||||
let s:flag = !empty(maparg('<space>', '',0,1))
|
||||
endif
|
||||
return s:flag
|
||||
endfunction
|
||||
|
Loading…
Reference in New Issue
Block a user