Skip to content

Commit

Permalink
feat(help): add key binding to display current time
Browse files Browse the repository at this point in the history
  • Loading branch information
wsdjeg committed Jan 1, 2022
1 parent 6dbd970 commit a15ad8b
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions autoload/SpaceVim/mapping/space.vim
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a15ad8b

Please sign in to comment.