Part 8: Neovim as Part of Your Development Workflow

After another 5 months (again) I’m finally back blogging about my development setup, opps! What is Neovim? Neovim is a text editor, that you can run in your terminal. Much like vim and vi or nano. So we would run this inside our terminal emulator and Zellij. It differs from vim because you can configure it using lua vs vimscript . Some of the other unique features it had, you can now do in vim (I believe). Such as tree sitter support and LSPs. ...

How I Setup Tailwindcss LSP With Neovim & Nix (With DaisyUI)

Recently, I have been building an app (https://voxicle.app #ShamelessPlug), with tailwind and DaisyUI. I have been having issues getting the tailwind LSP to work nicely in Neovim, and only recently managed to make it work. So in this article, I will go over how I set up, assuming you are using Nix as a package manager. Why Nix? In my project, it is a go web app, so all the dependencies in the project are managed as go modules by my go.mod file. Then everything else the developer needs is set up as a dev shell. Things like the standalone tailwind CLI, I am using a nix flake which already has DaisyUI built in so it can also generate those types i.e. btn in the final styles.css (or whatever you called it). The flake is here: https://github.com/aabccd021/tailwindcss-daisyui-nix ...

TIL - Fix Telescope Ignoring Env Files

Recently I noticed when I searched using Telescope in Neovim, that I could see env.local.template but not .env.local. Where my keybinding looked like this: vim.keymap.set("n", "<leader>ff", function() builtin.find_files({ hidden = true, follow = true }) end, { desc = "Find all files" }) This was because I was ignoring the .env* paths in my gitignore, I could tell telescope to not follow the gitignore. But I would get a lot more junk when searching in Telescope. I just wanted to see certain patterns but still mostly respect the gitignore file. You can do the following: ...

TIL - How to Get Dropbar and Auto Session to Work

Original Article You can find more context on the problem here In my post last month I thought I had fixed this issue but turns out I did not. The actual fix to stop getting this error: 5108: Error executing lua [string "v:lua"]:1: attempt to call global 'dropbar' (a nil value) stack traceback: [string "v:lua"]:1: in main chunk bat /home/haseeb/.local/share/nixCats-nvim/sessions/%2Fhome%2Fhaseeb%2Fprojects%2Fvoxicle.vim | rg dropbar setlocal winbar=%{%v:lua.dropbar()%} setlocal winbar=%{%v:lua.dropbar()%} setlocal winbar=%{%v:lua.dropbar()%} We want the winbar to nil. The fix that worked for me was this: ...

TIL: How to Fix Issue With Dropbar and Auto Session

Actual Fix This fix didn’t actually work the actual fix can be found here I recently moved to dropbar from barbecue as it has been archived and kept getting a weird error for buffer open when I would reopen Neovim. I use the auto-session plugin, which loads back the previous state of NixVim when I last exited in that folder, i.e. open buffers. E5108: Error executing lua [string "v:lua"]:1: attempt to call global 'dropbar' (a nil value) stack traceback: [string "v:lua"]:1: in main chunk I noticed though I would only get this error the second time I would open Neovim, which then made think maybe it was an issue with auto-session. So I looked at the serialised file it generates so it knows what to load when we open Neovim again. Which I found at: ...

My Favourite Neovim Plugins

In this post, I will go over some of my Neovim plugins I really like that aren’t as well known. So I won’t really be talking about telescope, LSP or nvim-cmp. As most users know about these plugins and use them extensively in their configuration. oil.nvim Link: https://github.com/stevearc/oil.nvim oil.nvim creates a file explorer but as a true vim buffer, so it’s effortless to create new files and folders. We can also move files easily. Again, using all of our normal key bindings we use in Nix. ...

TIL: How to Add New Vim Plugins to nixpkgs Repository

Recently, I wanted to add a Neovim plugin to nixpkgs, so I can then add it to NixVim. I tried following the guide from the docs. However, I kept getting the following errors: nix-shell -p vimPluginsUpdater --run vim-plugins-updater error: … while calling the 'derivationStrict' builtin at /builtin/derivation.nix:9:12: (source not available) … while evaluating derivation 'shell' whose name attribute is located at /nix/store/whhzjfgalghpm34irclh01c0afynmyll-nixpkgs/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:300:7 … while evaluating attribute 'buildInputs' of derivation 'shell' at /nix/store/whhzjfgalghpm34irclh01c0afynmyll-nixpkgs/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:347:7: 346| depsHostHost = lib.elemAt (lib.elemAt dependencies 1) 0; 347| buildInputs = lib.elemAt (lib.elemAt dependencies 1) 1; | ^ 348| depsTargetTarget = lib.elemAt (lib.elemAt dependencies 2) 0; error: undefined variable 'vimPluginsUpdater' at «string»:1:107: 1| {...}@args: with import <nixpkgs> args; (pkgs.runCommandCC or pkgs.runCommand) "shell" { buildInputs = [ (vimPluginsUpdater) ]; } "" Or I was getting 429 network errors, too many requests to GitHub. ...

2023 In Summary, My Year of The Terminal

For once, I am actually doing a year in review, to go over some of the things I’ve learnt over the last year. Part of the reason is this has been probably my most transformative year since I have been a software engineer. I have become far more terminal development driven, if that is a phrase one can use. What I mean is I changed my development workflow to leverage being in the terminal more. I feel far more productive and efficient than I was at the beginning of the year, for what it’s worth ...

TIL: How to Use Open Buffers When Debugging With Neovim's DAP Plugin

TIL: How to Use Open Buffers When Debugging With Neovim’s DAP Plugin I had an issue that whilst debugging my Golang tests in Neovim, the buffer I was focusing on would always change to the breakpoint. Even when the buffer was open and visible already, say I had the code with the breakpoint on the left buffer and the tests I was starting the debugger from on the right buffer. ...

TIL: How to Debug a Test in Golang With Build Tags in Neovim

TIL: How to Debug a Test in Golang With Build Tags in Neovim I was having issues with my debugger today (well technically yesterday because I am publishing this a day later to spread out my blog posts but same difference) and it took me a few hours to realise what was going on. In my case, I was trying to debug a test written in Golang using nvim-dap-go on Neovim. ...

TIL: How to Install Neovim Nightly Using Nix Home Manager (and NixVim)

TIL: How to Install Neovim Nightly Using Nix Home Manager (and NixVim) Recently, I wanted to install the nightly version of Neovim (version 0.10) because it supports inlay hints. However, on nixpkgs the latest version of Neovim as of writing is 0.9.4. So how can we get the nightly release? Using nix/home-manager. Simple, we can use an overlay that will add the Neovim nightly package with the nightly. Assuming we are using nix flakes. ...

TIL: How to Colour Dap Breakpointed Line in Neovim

TIL: How to Colour Dap Breakpointed Line in Neovim I wanted to change the background colour of the line when it was stopped during debugging using DAP with neovim. To make it easier to see where we are currently breakpointed. We already have a highlight group called DapStopped. Which in my case is defined as: DapStopped = { bg = C.grey }. Then we need to assign the custom highlight group, the key bit being linehl for our use case. ...

TIL: How to Colour Neovim Line Numbers

TIL: How to Colour Neovim Line Numbers Recently I was trying to configure my own neovim config. I wanted the current line I was onto be coloured slighty differently and also the line number to be white. So it’s easier to see the line number and which line I was on. It was not immediately obvious how to do this and took me long to work out than I’d like to admit 😅. ...

 2023-08-24 142 words 1 min