Enjoy the detours!

log

Theoretically, today should be entirely different. The kids should be in child care. My wife and I should work. I should do workout. Which I miss since we started our vacation more than 2 weeks ago.

Instead, the kids and I are sick with the Flu. What a nice way to start into the new year. ๐Ÿ˜ท Every 2โ€“3 years, I get so sick that I canโ€™t do anything. Besides lying in bed or on the couch. Which I never do. When I lie on the couch, my wife knows that Iโ€™m sick. Itโ€™s not unusual that I get sick. But for the most time, itโ€™s just an annoying part of the day. I drink some ginger tea and everything is fine. But now, with fever, itโ€™s a complete different level of sickness.

I hope that this will not interrupt my #100DaysToOffload. My plan was also to start with #TheMonthProject, but I donโ€™t see me starting in this week. ๐Ÿ˜ฉ


81 of #100DaysToOffload
#log
Thoughts? Discuss...

With nvim-treesitter, I have a lot going on in my config. Let's split it up a bit.

The basic treesitter config is mostly the default from their GitHub page but trimmed down. Because I will not have โ€œjavascriptโ€ to be ignored on install and also don't need to disable highlights. The other thing I use, which was before the playground, to show the treesitter objects under my cursor. Which is helpful for developing colorschemes.

Weiterlesen...

We are back from vacation. After Christmas, we took the train ๐Ÿš… to Amsterdam ๐ŸŒท for a vacation and to escape the usual New Year's Eve ceremonies.

A child watching the water on a

Weiterlesen...

lualine.nvim is one of the plugins, where I did a lot of configuration and like how it works. It is there and doesn't stand in my way.

I use 5 sections. On the left, the current mode I'm in. (Normal|Insert|Visual|Replace) followed by the file type icon provided by web-devicons. In the center is the filename with the relative path. On the right are diagnostics, to see quickly if there are warnings or errors in the file. The file format is following the diagnostics and I can't remember, why I have them there. Maybe a legacy. ๐Ÿ˜… As last, some information, where my cursor in the file is.

On top, I've also added my custom colorscheme to lualine.

It's simple and enough for me. ๐Ÿ˜Ž

Config

return {
	"nvim-lualine/lualine.nvim",
	dependencies = {
		"kyazdani42/nvim-web-devicons",
		{ dir = "~/workspace/kong" },
	},
	config = function()
		local theme = require("kong.colors")
		local custom_fname = require("lualine.components.filename"):extend()
		local highlight = require("lualine.highlight")
		local default_status_colors = { saved = theme.g50, modified = theme.special }

		function custom_fname:init(options)
			custom_fname.super.init(self, options)
			self.status_colors = {
				saved = highlight.create_component_highlight_group(
					{ fg = default_status_colors.saved },
					"filename_status_saved",
					self.options
				),
				modified = highlight.create_component_highlight_group(
					{ fg = default_status_colors.modified },
					"filename_status_modified",
					self.options
				),
			}
			if self.options.color == nil then
				self.options.color = ""
			end
		end

		function custom_fname:update_status()
			local data = custom_fname.super.update_status(self)
			data = highlight.component_format_highlight(
				vim.bo.modified and self.status_colors.modified or self.status_colors.saved
			) .. data
			return data
		end

		require("lualine").setup({
			options = {
				theme = "kong",
				section_separators = "",
				component_separators = "",
				globalstatus = true,
			},
			sections = {
				lualine_a = { "mode" },
				lualine_b = {
					{
						"filetype",
						colored = false,
						icon_only = true,
						padding = { left = 2, right = 2 },
					},
				},
				lualine_c = {
					"%=",
					{
						custom_fname,
						file_status = true,
						path = 1,
					},
				},
				lualine_x = { "diff", "diagnostics" },
				lualine_y = {
					{
						"fileformat",
						padding = { left = 2, right = 2 },
					},
				},
				lualine_z = { "progress", "location" },
			},
		})
	end,
}

78 of #100DaysToOffload

#log #neovim

Thoughts? Discuss...

My #8 is one of the oldest plugins I've used. vim-startify is hard to replace. I've tested some replacements written in Lua, but was not satisfied with the results. One of the problems was, that you have to configure a lot or read into the configuration to get the status-quo of vim-startify. And in the end, I was fine to continue use of vim-startify, despite it was not written in Lua. ๐Ÿ‘Œ

Config

return {
	"mhinz/vim-startify",
	config = function()
		vim.g.startify_relative_path = 1
		vim.g.startify_change_to_dir = 0
		vim.g.startify_fortune_use_unicode = 1
		vim.g.startify_update_oldfiles = 1
		vim.g.startify_use_env = 1
	end,
}

77 of #100DaysToOffload

#log #neovim

Thoughts? Discuss...

nvim-lint is another null-ls replacement. It helps me by running eslint_d if I enter a file or create a new one. That's it. ๐Ÿ˜Ž

Config

return {
	"mfussenegger/nvim-lint",
	event = {
		"BufReadPre",
		"BufNewFile",
	},
	config = function()
		local lint = require("lint")

		lint.linters_by_ft = {
			javascript = { "eslint_d" },
			typescript = { "eslint_d" },
			javascriptreact = { "eslint_d" },
			typescriptreact = { "eslint_d" },
		}

		lint.linters.eslint_d.args = {
			"--no-warn-ignored", -- https://github.com/mfussenegger/nvim-lint/issues/462
			"--format",
			"json",
			"--stdin",
			"--stdin-filename",
			function()
				return vim.api.nvim_buf_get_name(0)
			end,
		}

		local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true })

		vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
			group = lint_augroup,
			callback = function()
				lint.try_lint()
			end,
		})
	end,
}

76 of #100DaysToOffload

#log #neovim

Thoughts? Discuss...

I wish you all a happy new year and a good start.

Letโ€™s make some progress in 2025 and learn from our mistakes in 2024. ๐Ÿ’ช


75 of #100DaysToOffload

#log

Thoughts? Discuss...

glow.nvim is a neat little helper if you write a lot of Markdown. For example, CHANGELOG.md, README.md files inside your project or a static blog. You can just render a preview in your Neovim instance. :)

Config

return {
	"ellisonleao/glow.nvim",
	keys = {
		{ "<leader>p", ":Glow<cr>" },
	},
	config = function()
		require("glow").setup({
			install_path = "/opt/homebrew/bin/glow",
		})
	end,
}

74 of #100DaysToOffload

#log #neovim

Thoughts? Discuss...

gitsigns.nvim is one of those little plugins, which has a clean, minimal UI and is there when you need it. I'm using it to see where in the file I made changes. If I don't want them anymore, I can simply remove them. Or I'm fine with them, I can stage them. No bloated UI required. There is also a small feature, like in VScode, you can show a blame as ghost text on the current line.

Config

return {
	"lewis6991/gitsigns.nvim",
	dependencies = { "nvim-lua/plenary.nvim" },
	opts = {
		current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame`
		current_line_blame_opts = {
			delay = 200,
		},
		on_attach = function(bufnr)
			local gitsigns = require("gitsigns")

			local function map(mode, l, r, opts)
				opts = opts or {}
				opts.buffer = bufnr
				vim.keymap.set(mode, l, r, opts)
			end

			-- Navigation
			map("n", "gj", function()
				if vim.wo.diff then
					vim.cmd.normal({ "gj", bang = true })
				else
					gitsigns.nav_hunk("next")
				end
			end)

			map("n", "gk", function()
				if vim.wo.diff then
					vim.cmd.normal({ "gk", bang = true })
				else
					gitsigns.nav_hunk("prev")
				end
			end)

			-- Actions
			map("n", "<leader>hs", gitsigns.stage_hunk)
			map("v", "<leader>hs", function()
				gitsigns.stage_hunk({ vim.fn.line("."), vim.fn.line("v") })
			end)
			map("n", "<leader>hr", gitsigns.reset_hunk)
			map("v", "<leader>hr", function()
				gitsigns.reset_hunk({ vim.fn.line("."), vim.fn.line("v") })
			end)
			map("n", "<leader>hS", gitsigns.stage_buffer)
			map("n", "<leader>hu", gitsigns.undo_stage_hunk)
			map("n", "<leader>hR", gitsigns.reset_buffer)
			map("n", "<leader>hp", gitsigns.preview_hunk)
			map("n", "<leader>hb", function()
				gitsigns.blame_line({ full = true })
			end)
			map("n", "<leader>tb", gitsigns.toggle_current_line_blame)
			map("n", "<leader>hd", gitsigns.diffthis)
			map("n", "<leader>hD", function()
				gitsigns.diffthis("~")
			end)
			map("n", "<leader>td", gitsigns.toggle_deleted)

			-- Text object
			map({ "o", "x" }, "ih", ":<C-U>Gitsigns select_hunk<CR>")
		end,
	},
}

73 of #100DaysToOffload

#log #neovim

Thoughts? Discuss...

I love prettier, therefore, I need a plugin which runs prettier on file save for me. For this job, I'm using conform.nvim. This runs formatter like prettier, prettierd or stylua on my files.

Config

return {
	"stevearc/conform.nvim",
	event = { "BufReadPre", "BufNewFile" },
	config = function()
		local conform = require("conform")

		conform.setup({
			formatters_by_ft = {
				javascript = { "prettier" },
				typescript = { "prettier" },
				javascriptreact = { "prettier" },
				typescriptreact = { "prettier" },
				css = { "prettier" },
				html = { "prettier" },
				json = { "prettier" },
				yaml = { "prettier" },
				markdown = { "prettier" },
				graphql = { "prettier" },
				pug = { "prettier" },
				lua = { "stylua" },
			},
			format_on_save = {
				lsp_format = "fallback",
				async = false,
			},
		})
	end,
}

Before, I was using null-ls, which is not maintained anymore. And with conform.nvim I've found a good replacement. :)


72 of #100DaysToOffload

#log #neovim

Thoughts? Discuss...