1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 13:10:04 +08:00

Add frequency func

This commit is contained in:
wsdjeg 2017-04-03 12:52:09 +08:00
parent 7024e5754d
commit ab55eff7ce
3 changed files with 33 additions and 0 deletions

View File

@ -85,6 +85,9 @@ let g:spacevim_plugin_bundle_dir
" let g:spacevim_realtime_leader_guide = 1
" <
let g:spacevim_realtime_leader_guide = 0
""
" Enable/Disable key frequency catching of SpaceVim.
let g:spacevim_enable_key_frequency = 1
let g:spacevim_autocomplete_method = ''
let g:spacevim_enable_cursorcolumn = 0
""

View File

@ -0,0 +1,27 @@
let s:data = {}
function! SpaceVim#mapping#frequency#update(key) abort
if has_key(s:data, a:key)
let s:data[a:key] += 1
else
let s:data[a:key] = 1
endif
endfunction
function! SpaceVim#mapping#frequency#view(keys) abort
if type(a:keys) == 1
echo 'The frequency of ' . a:keys . ' is ' . s:get(a:keys)
elseif type(a:keys) == 3
for key in a:keys
call SpaceVim#mapping#frequency#view(key)
endfor
endif
endfunction
function! s:get(key) abort
if has_key(s:data, a:key)
return s:data[a:key]
else
return 0
endif
endfunction

View File

@ -116,6 +116,9 @@ Enable/Disable realtime leader guide. Default is 0.
let g:spacevim_realtime_leader_guide = 1
<
*g:spacevim_enable_key_frequency*
Enable/Disable key frequency catching of SpaceVim.
*g:spacevim_enable_neomake*
SpaceVim default checker is neomake. If you want to use syntastic, use:
>