How I use vimwiki in neovim

This post is currently in-progress, and is more of a brain-dump right now. But I like to share as often as I can otherwise I’d never share anything 🙂

Please view the official Vimwiki Github repository for up-to-date details of Vimwiki usage and installation. This page just documents my own processes at the time.

Installation

Add the following to plugins.lua

use "vimwiki/vimwiki"

Run the following two commands separately in the neovim command line:

:PackerSync
:PackerInstall

Close and re-open Neovim.

How I configure Vimwiki

I have 2 separate wikis set up in my Neovim.

One for my personal homepage and one for my commonplace site.

I set these up by adding the following in my dotfiles, at the following position: $NEOVIM_CONFIG_ROOT/after/plugin/vimwiki.lua. So for me that would be ~/.config/nvim/after/plugin/vimwiki.lua.

You could also put this command inside the config function in your plugins.lua file, where you require the vimwiki plugin. I just tend to put all my plugin-specific settings in their own “after/plugin” files for organisation.

vim.cmd([[
  let wiki_1 = {}
  let wiki_1.path = '~/vimwiki/website/'
  let wiki_1.html_template = '~/vimwiki/website_html/'
  let wiki_2 = {}
  let wiki_2.path = '~/vimwiki/commonplace/'
  let wiki_2.html_template = '~/vimwiki/commonplace_html/'
  let g:vimwiki_list = [wiki_1, wiki_2]
  call vimwiki#vars#init()
]])

The path keys tell vimwiki where to plave the root index.wiki file for each wiki you configure.

The html_template keys tell vimwiki where to place the compiled html files (when running the :VimwikiAll2HTML command).

I keep them separate as I am deploying them to separate domains on my server.

When I want to open and edit my website wiki, I enter 1<leader>ww.

When I want to open and edit my commonplace wiki, I enter 2<leader>ww.

Pressing those key bindings for the first time will ask you if you want the directories creating.

How I use vimwiki

At the moment, my usage is standard to what is described in the Github repository linked at the top of this page.

When I develop any custom workflows I’ll add them here.

Deployment

Setting up a server to deploy to is outside the scope of this post, but hope to write up a quick guide soon.

I run the following command from within vim on one of my wiki index pages, to export that entire wiki to html files:

:VimwikiAll2HTML

I then SCP the compiled HTML files to my server. Here is an example scp command that you can modify with your own paths:

scp -r ~/vimwiki/website_html/* your_user@your-domain.test:/var/www/website/public_html

For the best deployment experience, I recommend setting up ssh key authentication to your server.

For bonus points I also add a bash / zsh alias to wrap that scp command.

Status

The Internet Archive / Wayback Machine (http://web.archive.org/) is absolutely incredible. It has saved most of my old posts and pages. Been spending a week or so rescuing those posts and bringing them back.

Website under construction

I’ve always believed that people should own and control their own place on the web. That is, if they want to.

I have actively kept a personal website for myself for about 10 years now.

Gosh… 10 years…

In that time I have moved between about 5 different domain names, different focus topics, and different reasoning behind why I want to publish online.

I have finally settled now on this domain that you are now on – davidpeach.me.

I’m also in the process of recovering my old posts that have been thrown by the wayside as I have dicked about changing domain names etc over the years.

A mixture of Twitter archives, manual database backups I have kept, and some new sources I will be incorporating, mean I am finally going to settle down in this place online I am now calling home.

I am also re-implementing aspects of the Indieweb movement for content ownership and communicating that to other websites.

I owe a big thank you to Chris Aldrich too. As it was his website I came across that inspired me to bring my website back to what I have always wanted it to be. Hopefully, thanks to the indieweb helper plugins I have installed, Chris may just get notified on his website and post a reply back — from his website over to mine using the webmention protocol.

Migrating my website to Statamic

I love Laravel.

I also really like WordPress, for what it is. So when it came to originally putting my personal site together I just wanted to get a simple WordPress site together.

I have attempted to build my own website and blog in Laravel from scratch multiple times over the years. I even stuck with a build for a while but ultimately went back to WordPress.

My issue was only down to the fact that I wanted to write more in my own time and found I spent most my time tinkering.

But I really love Laravel.

So imagine my joy when I came across Statamic. Statamic is a CMS package that can be installed into a Laravel site and just works seamlessly alongside you Laravel code.

I am in the process of rebuilding my personal site and will be getting it live as soon as I can.

I think I will migrate my current site to a new domain, something like “davidpeach.me”, and then use the 4042302 technique to ensure my old posts are still found as I migrate the posts over.

I’m really looking forward to getting creative with Statamic and then layering on all of the excellent Laravel features as a way to learn as much, and refresh my mind, about my favourite framework.

Status

Oh golly I just found the back up of my old website with loads and loads of old posts I thought Id lost. 💚

Setting up my own labs

I’m going to begin setting up my own “labs” area to play around with various web technologies.

For the longest time now I have been holding myself back quite a bit by only really learning technologies around current roles at the time and for my own personal site. This has mainly revolved around Laravel and to a lesser extent WordPress.

Whilst I will continue to love both of those projects, I do want to start pushing myself to learn things that are completely out of my comfort zone.

I will also begin writing more about my learning, discoveries and new things that excite me in web development — something I haven’t done for a long while.

If I start rebuilding my website in Laravel yet again, I really need to see it through and commit to it. If the last couple of weeks have taught me anything it’s that I love working with Laravel.

Let’s see how this goes.

Status

Finally got my site to use the roots wordpress structure. Composer dependency management and deployment with laravel forge. 🤓

Status

Finally finished porting my site over to Laravel 5.1. I’d been avoiding it. Got there in the end. Now to start cleaning up my code.

Status

Really excited about my redesigned website. A lot more focused it feels. Hoping to get it out by mid week next week.