Enjoy the detours!

100DaysToOffload

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...

Now we are getting pretty with dressing.nvim. Which is basically making the input of code-refactor.lua look nice.

Config

return {
	"stevearc/dressing.nvim",
	dependencies = {
		"nvim-telescope/telescope.nvim",
	},
	config = function()
		require("dressing").setup({
			select = {
				telescope = require("telescope.themes").get_cursor(),
			},
		})
	end,
}

Besides improving the input of code-refactor.lua, this plugin isn't doing anything special in my setup. So I could basically remove the select config for telescope. I always thought it will improve it. 🀷


71 of #100DaysToOffload

#log #neovim

Thoughts? Discuss...