Enjoy the detours!

100DaysToOffload

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

The second plugin I want to show is code-refactor.lua. Which is a neat little helper for JS/TS Projects without the need for an LSP.

Config

return {
	"jdrupal-dev/code-refactor.nvim",
	dependencies = { "nvim-treesitter/nvim-treesitter" },
	keys = {
		{ "<leader>a", "<cmd>CodeActions all<CR>", desc = "Show code-refactor.nvim (not LSP code actions)" },
	},
	config = function()
		require("code-refactor").setup()
	end,
}

The config is nothing special. Just changed the key to <leader>a. Which opens a small floating window with possible code-actions.

Because I work 99% of the time in a React.js environment where arrow functions are used everywhere, it is handy to have a code action where I can toggle it into a normal function.


70 of #100DaysToOffload

#log #neovim

Thoughts? Discuss...

Watched the third movie today with my oldest. We were there at noon. The theater was empty. Only us. I don’t know what I expected, but an empty on a Christmas Day so early was not on my list. I expected that at least 2–3 people would be there.

The movie itself was what I expected. We had a lot of fun watching it. A bit too long because my son was starting to run at ¾ of the movie. He sprinted to the cinema screen and back to me multiple times. But for the finale, he was back in his seat.

After watching the Knuckles Spinoff Series, we missed Wade Whiple a bit. He had only a tiny role in this movie. But Knuckles alone made us love enough. 😂

I’m glad that Jim Carrey came back to his role as Dr. Robotnik. After the second movie, he said that he is considering retirement. Lucky us that they made the script good enough for him and that he had a double role. It was insanely well-made. In the trailer, I thought there were entirely different people. However, in the movie, they gave a subtle hint that Carrey is playing both roles. 😂

At the end, I’m excited about the fourth movie. I hope that Jim Carrey will also be in it. Because he is the soul of all 3 movies so far.


69 of #100DaysToOffload

#log #movies

Thoughts? Discuss...

I'm thinking of creating a challenge for January. Something like #JanuaryOfProgress or #31DaysOfProgress.

The challenge here is, for a given time, perhaps a Month, working around 30 minutes a day on a project of choice and posting about the progress.

An Idea could be, using the January, which has 31 Days. Every day, doing around 31 minutes of work on a project. Maybe your own or an open-source project.

Another Idea is to not limit it to X minutes each day, instead just make progress somewhere and post it on your blog or social media. Perhaps changing your eating habit, doing more activities like walking, jogging or just excessive more. As long as you make progress, it will be fine. :)

For me, I plan to make progress on my side-projects. And for a long time, I had that in my mind of doing minimum 30 minutes a day on a project. It doesn't matter what, coding for 30 min or just documenting stuff. There should be progress. No matter what.


68 of #100DaysToOffload

#log #progress #challenge

Thoughts? Discuss...

I came across this quote in my notes but couldn't find its source. But I really like this perspective on learning. It shouldn't be a problem to make mistakes while learning.

This aligns perfectly with my Practice-driven development idea. 😎


67 of #100DaysToOffload

#log

Thoughts? Discuss...

Coming from Alacritty, Tmux and Hack, I’m now in WezTerm and trying to find a new Font because Hack isn't working well there.

Weiterlesen...

The more I use git worktree, the more use cases I find. But what is git worktree? Basically, it takes a copy of your project and creates a new folder with the copy. So that you can work in parallel on the same project, without the need to stash or commit your current changes.

A good use case is, for example, when you are working on feature X and your boss found a bug in your application which needs to be fixed as soon as possible. You tell your boss: “No problem, I'll fix it right away”. You don't need to close your editor, stop the dev server or stash your changes. With git worktree you create a copy of your project into a new branch. Now you can work in parallel on both branches, without juggling with unsaved files.

One new use case, I've found, was while working on a client's project. Usually, we need a VPN to get data into the local dev server. My plan was, to have Storybook running and the main site on localhost, to compare components. The task here was, to rewrite the components from Styled-Components to Linaria CSS. Unfortunately, the VPN had connection issues and I required a different way. So, I've created a new worktree and ran a second Storybook server. Now I was able to compare the components because I had the new files running on one server and the old files on a second. 🥳

To get have an easier life working with git worktree, I've created some git aliases:

[alias]
    ....
    wt = worktree
    wa = worktree add
    wr = worktree remove
    wl = worktree list
    ...

65 of #100DaysToOffload

#log #git #dev

Thoughts? Discuss...