aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2019-06-10 10:22:15 +1200
committerTom Ryder <tom@sanctum.geek.nz>2019-06-10 10:22:15 +1200
commitc505e7a735a3a4c1a0b579487a24f233bde47632 (patch)
treee2c3e70b2aa4a9069717cfd8ae446bb187fe7782
parentMerge branch 'release/v5.29.0' (diff)
parentBump VERSION (diff)
downloaddotfiles-5.30.0.tar.gz (sig)
dotfiles-5.30.0.zip
Merge branch 'release/v5.30.0'v5.30.0
* release/v5.30.0: Inline a set-run-restore command triplet Document what appears to be a Vim v8.1 bug Rename Date() to PutDate() to make func clearer Factor out date printing into function Use strftime() for date printing Arrange abbreviations in columns
-rw-r--r--VERSION4
-rw-r--r--vim/vimrc46
2 files changed, 35 insertions, 15 deletions
diff --git a/VERSION b/VERSION
index e531a040..3658643d 100644
--- a/VERSION
+++ b/VERSION
@@ -1,2 +1,2 @@
-tejr dotfiles v5.29.0
-Sun Jun 9 20:59:12 UTC 2019
+tejr dotfiles v5.30.0
+Sun Jun 9 22:22:15 UTC 2019
diff --git a/vim/vimrc b/vim/vimrc
index bd66a019..a501bd88 100644
--- a/vim/vimrc
+++ b/vim/vimrc
@@ -1171,12 +1171,32 @@ nnoremap <Leader>C
xnoremap <Leader>C
\ :<C-U>setlocal cursorcolumn! cursorcolumn?<CR>gv
-" Leader,d inserts the local date (POSIX date)
+" Print an RFC2822-compliant date string
+command PutDate
+ \ put=strftime('%a, %d %b %Y %T %z')
+
+" 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.
+"
+" This presently seems to be broken in v8.1.1487; the timezone first chosen
+" seems to 'stick' permanently. I haven't worked out why yet. Using the new
+" getenv() and setenv() functions does not seem to fix it. It works fine in
+" Debian GNU/Linux's packaged v8.0.x.
+"
+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>PutDate<CR>
+" Leader,D inserts the UTC date (RFC 2822)
nnoremap <Leader>D
- \ :read !date -u<CR>
+ \ :<C-U>UTC PutDate<CR>
" Leader,e forces a buffer to be editable
nnoremap <Leader>e
@@ -1393,12 +1413,12 @@ nnoremap <Leader><Tab>
\ :<C-U>setlocal autoindent! autoindent?<CR>
" Some useful abbreviations
-inoreabbrev tr@ tom@sanctum.geek.nz
-inoreabbrev tr/ <https://sanctum.geek.nz/>
-
-" Things I almsot always type wrnog
-inoreabbrev almsot almost
-inoreabbrev wrnog wrong
-inoreabbrev Fielding Feilding
-inoreabbrev THe The
-inoreabbrev THere There
+inoreabbrev tr@ tom@sanctum.geek.nz
+inoreabbrev tr/ <https://sanctum.geek.nz/>
+
+" THe things I almsot always type wrnog
+inoreabbrev almsot almost
+inoreabbrev wrnog wrong
+inoreabbrev Fielding Feilding
+inoreabbrev THe The
+inoreabbrev THere There