-
Notifications
You must be signed in to change notification settings - Fork 0
Custom Themer block
undermouse edited this page Sep 4, 2022
·
3 revisions
Custom Themer block allows you to inject your own code into files, allowing to create fully customizable templates for each file.
Custom blocks are usefull when need to place additional logic inside your config file besides just variables. It example below, you can see I inject code that applies theme for nvim and lightline. So when I call themer set dracula, Nvim will have dracula theme
files:
nvim:
# Let's assume you've already defined a themer block inside of init.vim
path: "~/.config/nvim/init.vim"
comment: "\""
format: "let <key> = \"<value>\""
# This is the custom Themer block
custom: |
" Setup Nvim colors with Themer
" <name> is the current theme:
<import ~/.config/nvim/theme_<name>_setup>
colorscheme <name>
let g:lightline = {
\ 'colorscheme': '<name>'
\ }
" Will place all variables definitions from the current theme, according
" to `format` (see above `custom` block`)
" This is basically the default themer block
<vars>As you can see, you can use some variables inside of custom block:
-
<name>contains a name for the current theme you've defined insidethemesblock. -
<vars>is a default themer block that would've injected without custom block, it's built based on theformatsetting -
<var>, wherevaris anything that map to variable inside theme (e.g. ). It's not like<vars>, you'll just get a value from this call - Import allows you to inject other files inside your custom block. Read more about this here
- When using
ignoreandonly, changes made by this properties will only affect<vars>variable. This means even if you ignore a variable, it still can be accessible:
ignore: ["fg"]
custom: |
# Vars will not have "fg" variable when it gets expanded
<vars>
# But you can still bring it inside like this:
foreground = <fg>