Add A Background Image To Neovim With A .lua Config File
I like background images in my terminal. When I switched to using a `.lua`` file I wasn't sure how to set it up to show the image. The solution was to add these two lines to `~/.config/nvim/init.lua`lua`.
vim.cmd.highlight({ "Normal", "guibg=NONE" })
vim.cmd.highlight({ "Normal", "ctermbg=NONE" })
Those settings change the Neovim background to transparent
to show your image
-
This doesn't add an image directly to Neovim. It simply makes Neovim's background transparent to show whatever your terminal background is. You'll need to have one setup there in order to see it
-
The config lines need to be below any `vim.cmd.colorscheme`lua` settings. (I just threw them at the very bottom of the file)
-
If you have a color scheme/theme running it will continue to work as expected with the exception of the background color. I colorize images to fit the themes so things continue to match
-
I'm not sure when `ctermbg`` comes into play. It may not be necessary, but it doesn't seem to be hurting anything