home ~ socials ~ projects ~ rss

Highlight The Current Line Of Text In Neovim With A .lua Config File

June 2023

I saw TJ DeVries streaming on Twitch with Neovim setup to highlight the current line of text. It made it easier to see where the cursor is when jumping around a file. I updated my ~/.config/nvim/init.lua file with these lines to turn on the highlighter.

vim.o.cursorline = true
vim.o.culopt = 'line'

Notes

  • I've never been a fan of highlighted lines. They tend to add so much contrast they are distracting. But, I think it'll be easier for chat to see on stream.
  • The line highlight I have now is actually working nicely. I've got a transparent background and the line color is very close to the base background. The effect is that you can see the image I have for the background everywhere except for the current line. It's very pleasant.
  • The `vim.o.cursorline = truelua is what turns the lighting on. Using vim.o.culopt = 'line' sets up the highlight to only show in the content section and not on the line numbers. I like that look better.
end of line
Share link:
https://www.alanwsmith.com/en/2r/wq/g3/wa/?highlight-the-current-line-of-text-in-neovim-with-a-lua-config-file