site/content/blog/v-workflow/index.md

3.5 KiB

title date
My V Workflow 2022-04-27T22:13:04+02:00

While I'm trying to find time to work on Vieter (college is killing me right now), I figured I could describe my current workflow for developing Vieter, and in general, V!

I've always been a rather minimal developer, preferring simplicity & lightweight programs over lots of smart IDE features. While this mentality doesn't work for all languages, V's simplicity allows me to write it without any smart features whatsoever!

Tools

Neovim

We can't do any coding without a text editor of course. My weapon of choice is Neovim, the great Vim fork, ran inside my st build. My main reason for choosing Neovim over Vim (besides the more active development) is the Lua, LSP & Treesitter support.

I try to keep my config & list of plugins rather short by following the basic rule of only adding a plugin if I find it adds actual value to my setup. If the plugin or setting only adds a gimmick that I don't actively use, I probably won't add it.

VLS

Thanks to the LSP support in Neovim I'm able to use VLS (V Language Server). This gives me better autocomplete, useful suggestions & error messages, all without ever having to run the compiler myself!

Treesitter

The VLS repo also comes with grammar definitions for treesitter. This allows me to import this into Neovim, providing me with better code highlighting using my treesitter-compatible theme.

Compiler mirror

I don't like it when things break without my permission. While it's a very good thing that V is so actively developed, it does make programs rather sensitive to change & can cause stuff to break after a compiler update. This is why I maintain my own mirror of the compiler which I update regularly. Thanks to this, I have full control over how frequently my compiler updates, providing me with a level of stability on both my laptops & in my CI that can't be obtained when blindly following the master branch.

Packaging for Arch Linux

My distro of choice for all my devices is EndeavourOS, an Arch-based distro (well, it's basically just a very good installer ;p). Thanks to this uniformity, it's very easy for me to package my compiler mirror, VLS & the treesitter grammar.

For the compiler, I build packages inside my CI (PKGBUILD) & publish this package to my personal Vieter instance. Then, using this compiler package, I periodically build & package VLS (PKGBUILD). This is to make sure my VLS build is compatible with my compiler version. The PKGBUILD also shows how to compile the treesitter grammar separately from VLS.

Workflow

Just like my config, my way of working is rather simple. I really like working in the terminal, so I usually write small Makefiles (example) that do everything I need, e.g. compile, lint, test etc. Using the toggleterm plugin, I spawn terminals inside Neovim & use make to do everything else!

Outro

I'm not too sure how to end this post. I hope it might help someone who's struggling to find a setup that works, or perhaps the links to my PKGBUILDs could come in handy for someone ;p