1 hour ago · Tech · hide · 0 comments

Since diving back into [Neo]vim, I’ve been working with my Obsidian vault from the terminal. One feature I’ve been missing from the Obsidian app is text highlighting: text surrounded by two equals signs, ==like this==, gets a highlighter effect. Turns out this is super easy to add to Neovim (and probably Vim too, but haven’t gotten there yet). The config looks like this: -- Define the syntax match for text between == vim.cmd([[ syntax match markdownHighlight /==.\{-}==/ ]]) -- Define the styling vim.api.nvim_set_hl(0, "markdownHighlight", { bg = "#3c3836", fg = "#fabd2f", bold = true, }) And here’s the result: The hardest part was picking the colors! Which I want to keep playing with. This config goes in ~/.config/nvim/after/ftplugin/markdown.lua. That might look weird if you’re new to Vim, but it’s the standard path for config that applies only to Markdown files. It’s named that way because it’s applied after the global Markdown plugin, which is called a “filetype plugin” (ftplugin).…

No comments yet. Log in to reply on the Fediverse. Comments will appear here.