From c7e16fad0358470d58b4b4e36eef471218bac0b7 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Mon, 17 Apr 2017 00:20:51 +0800 Subject: [PATCH] Add space prefix mapping --- autoload/SpaceVim.vim | 1 + autoload/SpaceVim/mapping/guide.vim | 4 +++- autoload/SpaceVim/mapping/leader.vim | 2 ++ autoload/SpaceVim/mapping/space.vim | 7 +++++++ 4 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 autoload/SpaceVim/mapping/space.vim diff --git a/autoload/SpaceVim.vim b/autoload/SpaceVim.vim index 0f601af4b..2a191785a 100644 --- a/autoload/SpaceVim.vim +++ b/autoload/SpaceVim.vim @@ -414,6 +414,7 @@ function! SpaceVim#end() abort call SpaceVim#mapping#guide#register_prefix_descriptions('', 'g:leaderGuide_map') endif call SpaceVim#mapping#leader#defindglobalMappings() + call SpaceVim#mapping#space#init() if g:spacevim_simple_mode let g:spacevim_plugin_groups = ['core'] else diff --git a/autoload/SpaceVim/mapping/guide.vim b/autoload/SpaceVim/mapping/guide.vim index 03c001af8..39c055e85 100644 --- a/autoload/SpaceVim/mapping/guide.vim +++ b/autoload/SpaceVim/mapping/guide.vim @@ -394,7 +394,7 @@ function! s:updateStatusline() abort hi! LeaderGuiderName cterm=bold gui=bold guifg=#282828 guibg=#fe8019 hi! LeaderGuiderSep2 cterm=bold gui=bold guifg=#fe8019 guibg=#3c3836 hi! LeaderGuiderFill guifg=#7c6f64 guibg=#3c3836 - exe 'setlocal statusline=%#LeaderGuiderPrompt#\ Leader\ Guide:\ ' . + exe 'setlocal statusline=%#LeaderGuiderPrompt#\ Mapping\ Guide:\ ' . \ '%#LeaderGuiderSep1#' . \ '%#LeaderGuiderName#' . \ SpaceVim#mapping#leader#getName(s:prefix_key) @@ -514,6 +514,8 @@ endif call SpaceVim#mapping#guide#register_prefix_descriptions('\', \ 'g:_spacevim_mappings') +call SpaceVim#mapping#guide#register_prefix_descriptions(' ', + \ 'g:_spacevim_mappings_space') call SpaceVim#mapping#guide#register_prefix_descriptions( \ g:spacevim_unite_leader, \ 'g:_spacevim_mappings_unite') diff --git a/autoload/SpaceVim/mapping/leader.vim b/autoload/SpaceVim/mapping/leader.vim index 72c923ecd..4846ac86c 100644 --- a/autoload/SpaceVim/mapping/leader.vim +++ b/autoload/SpaceVim/mapping/leader.vim @@ -287,6 +287,8 @@ function! SpaceVim#mapping#leader#getName(key) abort return '[unite]' elseif a:key == g:spacevim_denite_leader return '[denite]' + elseif a:key == ' ' + return '[SPC]' else return '' endif diff --git a/autoload/SpaceVim/mapping/space.vim b/autoload/SpaceVim/mapping/space.vim new file mode 100644 index 000000000..96d779163 --- /dev/null +++ b/autoload/SpaceVim/mapping/space.vim @@ -0,0 +1,7 @@ +function! SpaceVim#mapping#space#init() abort + nnoremap [SPC] :LeaderGuide " " + nmap [SPC] + let g:_spacevim_mappings_space = {} + let g:_spacevim_mappings_space.t = {'name' : 'Toggle editor visuals'} + nnoremap [SPC]tn :set nu! +endfunction