While Vim is my preferred editor of choice, I mostly only used the text editor with a few plugins and never really delved into scripting beyond editing my .vimrc.

After finding a few more useful Vim plugins that helped me out, I started searching for some plugins for Swift. I couldn’t find any beyond some syntax analysis and integration with SwiftLint via Syntastic, so I looked into writing my own plugin for building/testing Swift packages.

:help script and :help plugin are probably the definite resources in learning how to write Vim script. Also, I found an older IBM Developer tutorial and Learn Vimscript the Hard Way to be helpful.

Vim script isn’t too difficult to use and it has helped decipher some of the weird declarations in my .vimrc. For example, I found out why some variables start with g:some_var_name versus s:some_var_name; you can find out by doing :help internal-variables.

If you use Vim, I would seriously spend a day working on building a simple script since it helps explain a lot and can increase your Vim knowledge. Even if you’re not using Vim, I would look into how scriptable your text editor of choice is. For instance, Atom (or the fork VSCode) seems to be very scriptable as well.

I’ve started a swifty-vim plugin and it has made me appreciate how much further I can automate and simplify my workflow.

I’ve switched to Hugo for maintaining this blog from Jekyll.

Hugo is noticably faster in generating the static content. Getting Hugo installed is also considerably easier than setting up the Ruby environment.

GitHub Pages does not support Hugo directly but it is easy enough to generate the pages to publish manually.

Most of the content was quick to port with only the category/tag frontmatter needing adjustement. The layouts were the toughest to migrate and Go’s template language isn’t the easiest to pickup. Also, there are aliases that help migrate older URLs.

Besides the speed, Hugo has greater flexibility in Go’s template language, more support for complex taxonomies/categoriation/tags for content, and existing support for some blogging features such as adding social metadata which seem to be better than Jekyll’s.

1Password is one of the best password managers available today. While the iOS, macOS, Windows, and Android clients are obviously the primary clients, they also have a command line tool.

You can automate the upload of files and other secrets to 1Password via the CLI. For instance, here’s a script to zip up a directory and upload the contents:

#!/usr/bin/env bash

set -euxo pipefail

FILENAME=secrets.zip
DIR_TO_ZIP=mydir
zip -r $FILENAME $DIR_TO_ZIP

op create document $FILENAME --title="My Secrets File" --vault="Personal"

rm $FILENAME

You can then download the latest secrets file via the CLI with a little help from jq:

#!/usr/bin/env bash

set -euxo pipefail

FILENAME=secrets.zip
DOCUMENT_UUID=$(op list documents --vault="Personal" | jq -r 'sort_by(.updatedAt | fromdateiso8601) | map(select(.overview.title == "My Secrets File" and .trashed == "N")) | [ .[].uuid ] | last')

op get document $DOCUMENT_UUID > $FILENAME

unzip $FILENAME