diff options
-rw-r--r-- | vim/vimrc | 21 |
1 files changed, 17 insertions, 4 deletions
@@ -1171,12 +1171,25 @@ nnoremap <Leader>C xnoremap <Leader>C \ :<C-U>setlocal cursorcolumn! cursorcolumn?<CR>gv -" Leader,d inserts the local date (POSIX date) +" Set up a quick command-function pair to run a command with the UTC timezone, +" in this case, for my date-printing mappings. Is there a nicer way to do +" this? I couldn't find one. +" +function! UTC(command) abort + let tz = expand('$TZ') + let $TZ = 'UTC' + execute a:command + let $TZ = tz +endfunction +command -complete=command -nargs=1 UTC + \ call UTC(<q-args>) + +" Leader,d inserts the local date (RFC 2822) nnoremap <Leader>d - \ :read !date<CR> -" Leader,D inserts the UTC date (POSIX date) + \ :<C-U>put=strftime('%a, %d %b %Y %T %z')<CR> +" Leader,D inserts the UTC date (RFC 2822) nnoremap <Leader>D - \ :read !date -u<CR> + \ :<C-U>UTC put=strftime('%a, %d %b %Y %T %z')<CR> " Leader,e forces a buffer to be editable nnoremap <Leader>e |