46 days ago · Tech · hide · Fediverse post

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

Commenting on Bubbles has been removed. Why? If you want to talk about this post, write to the author, use the comments on their blog if it has them, or reply with a "RE:" post on your own blog. Suggestions? feedback@bubbles.town