Added v-workflow post
	
		
			
	
		
	
	
		
			
				
	
				ci/woodpecker/push/woodpecker Pipeline was successful
				
					Details
				
			
		
	
				
					
				
			
				
	
				ci/woodpecker/push/woodpecker Pipeline was successful
				
					Details
				
			
		
	
							parent
							
								
									fd71b872b5
								
							
						
					
					
						commit
						f35e256f2d
					
				| 
						 | 
				
			
			@ -0,0 +1,83 @@
 | 
			
		|||
---
 | 
			
		||||
title: "My V Workflow"
 | 
			
		||||
date: 2022-04-27T22:13:04+02:00
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
While I'm trying to find time to work on
 | 
			
		||||
[Vieter](https://git.rustybever.be/Chewing_Bever/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](https://neovim.io/), the great Vim fork, ran inside my [st
 | 
			
		||||
build](https://git.rustybever.be/Chewing_Bever/st). 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](https://git.rustybever.be/Chewing_Bever/dotfiles/src/branch/master/.config/nvim)
 | 
			
		||||
& 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](https://github.com/vlang/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](https://git.rustybever.be/Chewing_Bever/v/src/branch/master/PKGBUILD))
 | 
			
		||||
& publish this package to my personal Vieter instance. Then, using this
 | 
			
		||||
compiler package, I periodically build & package VLS
 | 
			
		||||
([PKGBUILD](https://git.rustybever.be/bur/vieter-vls/src/branch/main/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](https://git.rustybever.be/Chewing_Bever/vieter/src/branch/dev/Makefile))
 | 
			
		||||
that do everything I need, e.g. compile, lint, test etc. Using the
 | 
			
		||||
[toggleterm](https://github.com/akinsho/toggleterm.nvim) 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
 | 
			
		||||
		Loading…
	
		Reference in New Issue