VimWiki Mobile Setup

I recently made a video on my switch from Obsidian to Vimwiki. So far, I’ve been more than pleased. It’s always good to get away from proprietary software, especially when they are unnecessarily built on Electron.

However, I did get a comment on that video about the lack of a mobile option. That didn’t really bother me at first. I’m actually intentionally moving away from using my phone as a productivity device. But I do have an iPad that I occasionally like to write on, and I needed a way to access my notes there as well. At the moment, it’s working quite well. In fact, I’m writing this blog post on my iPad!

How it works…

My basic set up has three parts:

  1. My main computer
  2. Blink shell for iPad
  3. A local server

Strictly speaking, the server is not necessary. You could just ssh into your main computer from your terminal client on iOS (I recommend Blink, but there are several options). This would make the process much simpler from a networking standpoint, but it requires that your main computer be up and running. I wanted to be able to use VimWiki totally independently, so that’s where the server comes in.

My “home server” is just an old, crappy laptop (this one), but you could always use something better. If you don’t want to worry about the hardware, you could just use a VPS. I have thousands of notes, but since they’re all plain text, they amount to less than 50M. So you could run a tiny VPS on something like Linode and have plenty of headroom for whatever else you want to throw on it. It also probably doesn’t hurt to have offsite backups.

Setting Up Syncthing

Syncthing on a headless server is a little convoluted, but once you get it up and running, maintenence is minimal. First, you need to have a server up and running. Mine is running Debian 11.

Installing Syncthing

Then, install Syncthing with apt (or your distro’s package manager). If you’re on Arch, Syncthing is already in your repositories.

Add pgp key:

sudo curl -s -o /usr/share/keyrings/syncthing-archive-keyring.gpg https://syncthing.net/release-key.gpg

Add the stable channel:

echo "deb [signed-by=/usr/share/keyrings/syncthing-archive-keyring.gpg] https://apt.syncthing.net/ syncthing stable" | sudo tee /etc/apt/sources.list.d/syncthing.list

Add the candidate channel

echo "deb [signed-by=/usr/share/keyrings/syncthing-archive-keyring.gpg] https://apt.syncthing.net/ syncthing candidate" | sudo tee /etc/apt/sources.list.d/syncthing.list

Install syncthing:

sudo apt-get update && sudo apt-get install syncthing

Accessing Syncthing

Now that you’ve got Syncthing installed, you have to figure out how to access it. While Syncthing does have some limited CLI tools, you really need to get on the web GUI to configure everything. You should only have to do this once. After it’s set up, the CLI should be sufficient.

For your initial set up, you’ll want to ssh into your server from your main computer. Use this command:

ssh -L 9988:localhost:8384 <user>@<serverip>

Theoretically, you should be able to use port 8384 instead of port 9988 (which is just a random port), but I couldn’t get mine to work that way for some reason. This should work just fine. Once you’re in, run the command “syncthing.” Open your browser and go to https://localhost:9988 (your server GUI) and https://localhost:8384 (your main computer GUI) to link up the devices. Look for the “Add a Remote Device Button.” Then, share your notes folder between the two. Check the Syncthing docs if you want more information on how to sync your documents.

After you’ve configured syncing, just close the terminal. Don’t kill Syncthing. I believe you can run Syncthing as a system service, but I’ve found this method unreliable. I prefer to just start it manually as we’ve already done. If you need to access the GUI again, just use the ssh command from above and open it up in your web browser.

Final Notes

Now you’re done! Well, mostly. You’re probably also going to want to copy over your .vimrc to make sure all your plugins are working. If you use Plug, everything should install assuming you have Plug set to install automatically.

Relevant Links