vim-schemer

Vim plugin to make writing colorschemes easier by providing a clean slate, and using a simpler/more readable syntax.
git clone git://git.alex.balgavy.eu:vim-schemer.git
Log | Files | Refs | README | LICENSE

README.md (4685B)


      1 # Schemer: a Vim colorscheme generator
      2 ## What?
      3 This plugin defines a much simpler language for writing colorschemes, and generates a Vim colorscheme file automatically, including all necessary boilerplate.
      4 Unlike many other such plugins, Schemer gives you an empty slate: if you don't define anything in your colorscheme, you get an empty colorscheme (as opposed to the default colors that Vim uses).
      5 It's written in Vim script, and has no external dependencies.
      6 
      7 It consists of:
      8 * a new filetype, 'schemer', with the extension '.schemer'
      9 * a command, `SchemerGenerate`, to generate a '.vim' colorscheme file from a '.schemer' file (only accessible in files with the 'schemer' filetype)
     10 * an autocommand for the Schemer filetype, to run `:SchemerGenerate` and switch to the colorscheme automatically, whenever a Schemer file is saved. Can be disabled by setting `g:schemer_no_autocmd`.
     11 * two `<Plug>` mappings, with no default key mapping:
     12     * `<Plug>SchemerSynstack` to echo the highlight groups of the word under the cursor
     13     * `<Plug>SchemerEdit` to open the '.schemer' file for the current colorscheme. Assumes the '.schemer' file is in ~/.vim/colors.
     14 
     15 The main idea of Schemer is to allow users to define a 'palette' (natural-language aliases for colors), then define the highlighting of a few 'main' elements of Vim using that palette, and finally link the highlighting of any other elements to those main elements.
     16 
     17 Note:
     18 * This plugin is not meant to be compatible with everything that can run Vim.
     19 * It also may not be compatible with everyone's Vim or terminal emulator.
     20   It works for me (iTerm2 on macOS & xst on Regolith Linux), but it may take some poking to make it work for you.
     21 * If you don't set `termguicolors`, the colors used will be approximations; that's fine for me, but might not be fine for you.
     22 * It's also likely slower and less efficient than it could be.
     23 * The generated colorscheme may also take longer to load, as it includes additional logic to ensure that highlight groups are getting cleared properly (though this has not been an issue for me).
     24 
     25 ## Why?
     26 I like making my own colorschemes, I don't like dealing with Vim's syntax.
     27 I wanted something simpler and more intuitive.
     28 
     29 Here are some specific examples from my colorscheme, comparing Schemer syntax and Vim syntax.
     30 
     31 ### Example: incsearch
     32 Vim colorscheme syntax
     33 
     34 ```vim
     35 hi Incsearch guifg=NONE guibg=#b7d1b0 ctermfg=NONE ctermbg=151 cterm=bold gui=bold
     36 ```
     37 
     38 Schemer syntax:
     39 
     40 ```schemer
     41 Incsearch NONE, #b7d1b0. bold
     42 ```
     43 
     44 ### Example: link label, storageclass, and typedef to structure
     45 Vim colorscheme syntax
     46 
     47 ```vim
     48 hi! link typedef structure
     49 hi! link label structure
     50 hi! link typedef structure
     51 ```
     52 
     53 Schemer syntax:
     54 
     55 ```schemer
     56 link label,storageclass,typedef structure
     57 ```
     58 
     59 ### A full colorscheme example
     60 Overall, Vim's syntax for colorscheme definitions feels repetitive to me, and I can't always remember the necessary boilerplate, so I made this.
     61 A Schemer colorscheme definition is as simple as:
     62 
     63 ```schemer
     64 background dark
     65 palette:
     66     text #333333,
     67     bg #e4e4e4,
     68     comment #f5f5f5.
     69 
     70 Normal text, bg
     71 Comment comment, bg. italic
     72 link statusline,statuslinenc normal
     73 ```
     74 
     75 In my opinion, much more readable and writable than Vimscript.
     76 
     77 You can also set `g:terminal_ansi_colors` with the `ansi:` keyword:
     78 
     79 ```schemer
     80 ansi: #eff0f3, #125394, #145a9c, #1562c0, #2182e1, #2377e1, #3c68e6, #0a0c0f, #525963, #125394, #145a9c, #1562c0, #2182e1, #2377e1, #3c68e6, #0a0c0f
     81 ```
     82 
     83 ## Other alternatives
     84 There are a few alternative colorscheme generators.
     85 I took a look at [RNB](https://github.com/romainl/vim-rnb), but it didn't feel right for me, for a few reasons.
     86 It depends on Ruby, and I'd rather not have any dependencies.
     87 Also, it still feels too detailed, and there's too much writing.
     88 That sounds like a childish complaint, but I wanted to make writing colorschemes as simple as possible for me.
     89 Having to specify the details of every color without actually needing that level of control was too much.
     90 
     91 Another option is [colortemplate](https://github.com/lifepillar/vim-colortemplate), which is pretty close to what I want.
     92 However, I found that it's a bit too much for my purposes, and I prefer my syntax.
     93 It's just too much boilerplate for me; I understand that has to be there to ensure functionality on everyone's computer, hence I'm not making any guarantees about Schemer working for everyone.
     94 
     95 If you want something that gives you more control, more compatibility, and a richer syntax, I'd recommend colortemplate or RNB.
     96 This plugin is mainly for me.
     97 It might not make sense for you, and you might prefer the control you get from other colorscheme generators, which is fine.