1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-04-14 23:49:19 +08:00

Add SPC t m d for toggle date

This commit is contained in:
wsdjeg 2017-11-19 13:19:57 +08:00
parent 252203d393
commit b3f42b34e8
4 changed files with 26 additions and 10 deletions

View File

@ -5,6 +5,10 @@ function! s:self.current_time() abort
return strftime('%I:%M %p')
endfunction
function! s:self.current_date() abort
return strftime('%a %b %d')
endfunction
function! SpaceVim#api#time#get() abort
return deepcopy(s:self)

View File

@ -147,6 +147,22 @@ function! s:time() abort
return ' ' . s:TIME.current_time() . ' '
endfunction
function! s:date() abort
return ' ' . s:TIME.current_date() . ' '
endfunction
function! s:whitespace() abort
let ln = search('\s\+$', 'n')
if ln != 0
return ' trailing[' . ln . '] '
else
return ''
endif
endfunction
let s:registed_sections = {
\ 'winnr' : function('s:winnr'),
@ -158,6 +174,8 @@ let s:registed_sections = {
\ 'cursorpos' : function('s:cursorpos'),
\ 'percentage' : function('s:percentage'),
\ 'time' : function('s:time'),
\ 'date' : function('s:date'),
\ 'whitespace' : function('s:whitespace'),
\ }
function! s:battery_status() abort
@ -243,16 +261,6 @@ else
endfunction
endif
function! s:whitespace() abort
let ln = search('\s\+$', 'n')
if ln != 0
return ' trailing[' . ln . '] '
else
return ''
endif
endfunction
function! s:filesize() abort
let l:size = getfsize(bufname('%'))
@ -444,6 +452,8 @@ function! SpaceVim#layers#core#statusline#config() abort
\ 'toggle the major mode', 1)
call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'b'], 'call SpaceVim#layers#core#statusline#toggle_section("battery status")',
\ 'toggle the battery status', 1)
call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'd'], 'call SpaceVim#layers#core#statusline#toggle_section("date")',
\ 'toggle the date', 1)
call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 't'], 'call SpaceVim#layers#core#statusline#toggle_section("time")',
\ 'toggle the time', 1)
call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'p'], 'call SpaceVim#layers#core#statusline#toggle_section("cursorpos")',

View File

@ -519,6 +519,7 @@ let g:spacevim_guifont = 'DejaVu\ Sans\ Mono\ for\ Powerline\ 11'
| `SPC t m n` | toggle the cat! (if colors layer is declared in your dotfile)(TODO) |
| `SPC t m p` | 显示/隐藏鼠标位置信息 |
| `SPC t m t` | 显示/隐藏时间 |
| `SPC t m d` | 显示/隐藏日期 |
| `SPC t m T` | 显示/隐藏状态栏 |
| `SPC t m v` | 显示/隐藏版本控制信息 |

View File

@ -444,6 +444,7 @@ Some elements can be dynamically toggled:
| `SPC t m n` | toggle the cat! (if colors layer is declared in your dotfile)(TODO) |
| `SPC t m p` | toggle the cursor position |
| `SPC t m t` | toggle the time |
| `SPC t m d` | toggle the date |
| `SPC t m T` | toggle the mode line itself |
| `SPC t m v` | toggle the version control info |