1 year ago for day 73, 2020 with 599 words.

Very explicit things

Playing around with the plugins I wanted to use, I figured out why many of the features I needed were not working. An hour and a half of fiddling with my ~/.vimrc I'm able to do have a somewhat working first iteration of a setup.

  1. For syntax highlighting, one has to specifically enable it with syntax on

  2. Markdown files are defined as having the .markdown extension as to avoid confusion with other files using .md, so if I want Vim to interpret .md as a Markdown file, I need to specifically set that as the filetype with autocmd BufRead,BufNew *.md set filetype=markdown

  3. Word counts are surprisingly not straightforward! There are many ways I could go about it, including calling a shell command for counting words by first writing the file and then running wc (e.g. :w !wc). A somewhat nicer alternative is using the wordcount() value available in newer versions of Vim, that can be used in the statusline, but that doesn't work with Goyo - so I decided to use a custom command: command Wrd :echo wordcount().words (apparently, custom commands need to start with a capital letter). It's not exactly the user experience I was looking for, i.e. a live count, but it's good enough for me to have a rough estimate of the number of words (as it does count every word-char between word boundaries, including #), at least until I can figure out something more suitable for my writing needs.

  4. Limelight was properly installed and working, but because of my custom terminal colors, it couldn't figure out how to dim the paragraphs I'm not currently editing. Adding a global variable for the plugin fixed the issue let g:limelight_conceal_ctermfg = 'DarkGray' (also! I can inspect variable values with :echo, which makes it way easier to debug issues). The plugin itself sometimes behaves differently than I would expect, but most of the time it gives me a nice focused environment with the current text highlighted. I wanted to make it prettier and spent ~20 minutes wildly searching for a custom foreground font color until I realized the screenshot I saw in someone's blog post is showing their actual color scheme and not some additional plugin-specific setting. That was a tad embarrassing, but at least I know what's up now.

  5. Adding leader key shortcuts is pretty neat! I can now enable Goyo with \gy by adding nnoremap <Leader>gy :Goyo<CR>. I also automatically enable Limelight when entering the focused Goyo mode with autocmd! User GoyoEnter Limelight (I also have the reverse for disabling both).

  6. Comments in ~/.vimrc are " not #. This bit me more times than I care to admit.

  7. To navigate in the Goyo mode, it's better to use gj and gk for navigating, as the lines get automagically wrapped and regular j and k no longer work. I may consider remapping the regular keys, as it would be the behaviour I want most of the time. Or, at least remapping them for writing longer-form text.

On one hand, it feels awkward setting it up took me about 1.5h of research, trial and error. On the other, I shouldn't really be surprised. Vim is pretty old and powerful, there are multiple ways of doing the same thing and the interwebs is full of people's opinions on what's the right way (usually, their way).

I'm happy that I showed up for another experiment and I'm slowly getting used to working in Vim. It's going to help me be way more comfy with it and improve my day-to-day work experience.


Start writing today, for free

Write Together is a safe space to blog, think, feel, and share together. Learn to write, or find a new home for your words, and join our passionate community.

Sign up Learn more
User Photo

By Alicja

drawsplainer, ukulele player, immigrant

Get Alicja's newsletter

Almost there! Check your inbox and click the link to confirm.

Subscribe to Alicja's latest writing to get it right in your inbox.