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

feat(help): add key binding to display current time

close https://github.com/SpaceVim/SpaceVim/issues/4510
This commit is contained in:
wsdjeg 2022-01-01 22:30:05 +08:00
parent 6dbd97087f
commit a15ad8b98e

View File

@ -7,6 +7,7 @@
"=============================================================================
let s:BUF = SpaceVim#api#import('vim#buffer')
let s:TIME = SpaceVim#api#import('time')
let s:file = expand('<sfile>:~')
let s:funcbeginline = expand('<slnum>') + 1
@ -579,6 +580,17 @@ function! SpaceVim#mapping#space#init() abort
call SpaceVim#mapping#space#def('nnoremap', ['h', 'd', 'k'],
\ 'call SpaceVim#plugins#help#describe_key()',
\ 'describe-key-bindings', 1)
let s:lnum = expand('<slnum>') + 3
call SpaceVim#mapping#space#def('nnoremap', ['h', 'd', 't'], 'call call('
\ . string(function('s:describe_current_time'))
\ . ', [])', ['describe-current-time',
\ [
\ 'SPC h d t is to display current time.',
\ '',
\ 'Definition: ' . s:file . ':' . s:lnum,
\ ]
\ ]
\ , 1)
call SpaceVim#custom#SPC('nnoremap', ['a', 'o'], 'call SpaceVim#plugins#todo#list()', 'open-todo-manager', 1)
endfunction
@ -800,6 +812,11 @@ function! s:previous_buffer() abort
endtry
endfunction
function! s:describe_current_time() abort
let time = s:TIME.current_date() . ' ' . s:TIME.current_time()
echo time
endfunction
" function() wrapper
if v:version > 703 || v:version == 703 && has('patch1170')
function! s:_function(fstr) abort