www-gem words

Choose/switch your theme easily: nvim-base16

Published on

vim The first thing you do to feel yourself home with your preferred applications is to theme them. The issue with choosing the right theme is that it can quickly becomes tedious to test one theme after the other. It would be nice to have a list of themes from which you can choose from and apply a given theme in a single command. That’s what nvim-base16 is for in neovim.

At time of writing, nvim-base16 allows you to choose from 232 themes. Yes, two hundreds and thirty two !!! To temporary apply a theme and see if you like it, simply type : colorscheme base16 and hit Tab. The gigantic list of theme will popup, you choose one, and click Enter. Don’t like it? Retype the command and choose another theme.
Once, you find the perfect theme for you, guess what? Add the line colorscheme *theme_name* in your vimrc or vim.cmd [[ colorscheme *theme_name* ]] in your init.lua file and the theme will be applied automatically on startup.

As often, here is the bonus tips section.

in vimrc

hi highlight_name guifg=#E69138 # if you use a console version of (neo)vim with set notermguicolors
hi highlight_name ctermfg=#E69138 # if you use (neo)vim in console with set termguicolors and the console is capable of TrueColor

in init.lua

vim.api.nvim_set_hl( 0, "highlight_name", { fg = "#a07bcc", italic=true } )

You can retrieve the highlight_name by looking at :help highlight-groups

in vimrc

hi Normal bg=none
hi NormalFloat bg=none
hi NormalNC bg=none
hi LineNr bg=none
hi SignColumn bg=none
hi FoldColumn bg=none

As in the previous code, replace bg with ctermbg or guibg depending on your config.

in init.lua

vim.api.nvim_set_hl( 0, "Normal", { bg = "none" } )
vim.api.nvim_set_hl( 0, "NormalFloat", { bg = "none" } )
vim.api.nvim_set_hl( 0, "NormalNC", { bg = "none" } )
vim.api.nvim_set_hl( 0, "LineNr", { bg = "none" } )
vim.api.nvim_set_hl( 0, "SignColumn", { bg = "none" } )
vim.api.nvim_set_hl( 0, "FoldColumn", { bg = "none" } )

Thanks for your read. Hope it's been useful to you.


Interact with this post using Mastodon or

Comment on wwwgem's post

Copy and paste this URL into the search field of your favourite Fediverse app or the web interface of your Mastodon server.

✄ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈

More food for thoughts? Check other posts about: #Vim