jmtd → log → Vimwiki
At the start of the year I begun keeping a daily diary for work as a simple text file. I've used various other approaches for this over the years, including many paper diaries and more complex digital systems. One great advantage of the one-page text file was it made assembling my weekly status report email very quick, nearly just a series of copies and pastes. But of course there are drawbacks and room for improvement.
vimwiki is a personal wiki plugin for the vim
and
neovim
editors. I've tried to look at it before, years ago, but I found it too
invasive, changing key bindings and display settings for any use of vim
, and
I use vim
a lot.
I decided to give it another look. The trigger was actually something
completely unrelated: Steve Losh's blog post "Coming Home to
vim". I've
been using vim
for around 17 years but I still learned some new things from
that blog post. In particular, I've never bothered to Use The Leader for user-specific shortcuts.
The Leader, to me, feels like a namespace that plugins should not touch: it's
like the /usr/local
of shortcut keys, a space for the local user only. Vimwiki's
default bindings include several incorporating the Leader. Of course since I didn't
use the leader, those weren't the ones that bothered me: It turns out I regularly
use carriage return and backspace for moving the cursor around in normal mode, and
Vimwiki steals both of those. It also truncates the display of (what it thinks are)
URIs. It turns out I really prefer to see exactly what's in the file I'm editing.
I haven't used vim
folds since I first switched to it, despite them being why
I switched.
Disabling all the default bindings and URI concealing stuff and Vimwiki is now much less invasive and I can explore its features at my own pace:
let g:vimwiki_key_mappings = { 'all_maps': 0, }
let g:vimwiki_conceallevel = 0
let g:vimwiki_url_maxsave = 0
Followed by explicitly configuring the bindings I want. I'm letting it steal carriage return. And yes, I've used some Leader bindings after all.
nnoremap <leader>ww :VimwikiIndex<cr>
nnoremap <leader>wi :VimwikiDiaryIndex<cr>
nnoremap <leader>wd :VimwikiMakeDiaryNote<cr>
nnoremap <CR> :VimwikiFollowLink<cr>
nnoremap <Tab> :VimwikiNextLink<cr>
nnoremap <S-Tab> :VimwikiPrevLink<cr>
nnoremap <C-Down> :VimwikiDiaryNextDay<cr>
nnoremap <C-Up> :VimwikiDiaryPrevDay<cr>
,wd
(my leader) now brings me straight to today's diary page, and I can create
separate, non-diary pages for particular work items (e.g. a Ticket reference) that
will span more than one day, and keep all the relevant stuff in one place.
Comments