feat: added vim compatability efc6f570
Steve · 2026-09-09 19:16 3 file(s) · +269 −11
README.md +38 −4
2 2
3 3
![cover](https://files.stevedylan.dev/darkmatter-nvim.png)
4 4
5 -
A colorscheme adapted from base16-black-metal-bathory
5 +
A colorscheme adapted from base16-black-metal-bathory. Works in both Neovim and Vim 8+.
6 6
7 7
## Features
8 8
9 +
- Works in Neovim and Vim from a single `colorscheme darkmatter`
9 10
- Support for Neovim's built-in LSP
10 11
- Treesitter highlighting
11 12
- Plugin integrations:
18 19
  - LSP semantic tokens
19 20
  - mini.completion
20 21
  - nvim-dap-ui
22 +
- 256-color terminal fallback for Vim without `termguicolors`
21 23
22 24
## Installation
23 25
45 47
}
46 48
```
47 49
50 +
### Vim
51 +
52 +
Using [vim-plug](https://github.com/junegunn/vim-plug):
53 +
54 +
```vim
55 +
Plug 'stevedylandev/darkmatter-nvim'
56 +
```
57 +
58 +
Or with Vim's built-in package support:
59 +
60 +
```sh
61 +
git clone https://github.com/stevedylandev/darkmatter-nvim \
62 +
  ~/.vim/pack/plugins/start/darkmatter-nvim
63 +
```
64 +
48 65
## Usage
49 66
50 -
Simply set the colorscheme in your Neovim configuration:
67 +
Set the colorscheme in your Neovim configuration:
51 68
52 69
```lua
53 70
vim.cmd('colorscheme darkmatter')
54 71
```
55 72
73 +
Or in your `.vimrc`:
74 +
75 +
```vim
76 +
colorscheme darkmatter
77 +
```
78 +
56 79
If you don't see colors, make sure you have true color support enabled:
57 80
58 81
```lua
59 82
vim.opt.termguicolors = true
60 83
```
61 84
85 +
```vim
86 +
set termguicolors
87 +
```
88 +
89 +
Vim will fall back to the nearest 256-color approximations if `termguicolors`
90 +
is off or unsupported.
91 +
62 92
## Configuration
63 93
64 -
You can configure the colorscheme by passing options to the setup function:
94 +
The plugin integrations are Neovim-only. You can configure them by passing
95 +
options to the setup function:
65 96
66 97
```lua
67 -
require('darkmatter').setup({
98 +
require('darkmatter-colorscheme').setup(require('colors.darkmatter'), {
68 99
  -- All options default to true
69 100
  telescope = true,          -- Telescope plugin
70 101
  telescope_borders = false, -- Telescope borders
78 109
  dapui = true,              -- nvim-dap-ui plugin
79 110
})
80 111
```
112 +
113 +
Note that `setup()` takes the palette as its first argument and the options
114 +
table as its second.
81 115
82 116
## Credits
83 117
colors/darkmatter.vim +225 −6
1 +
" darkmatter
2 +
" A colorscheme adapted from base16-black-metal-bathory
3 +
" URL: https://github.com/stevedylandev/darkmatter-nvim
4 +
"
5 +
" Works in both Neovim and Vim 8+. Neovim is handed off to the Lua
6 +
" implementation, which adds Treesitter, LSP and plugin integrations. Vim gets
7 +
" the pure Vimscript definitions below.
8 +
1 9
hi clear
10 +
if exists('syntax_on')
11 +
  syntax reset
12 +
endif
13 +
14 +
set background=dark
2 15
let g:colors_name = 'darkmatter'
3 -
lua require('darkmatter-colorscheme').setup({
4 -
    \ base00 = '#121113', base01 = '#121212', base02 = '#222222', base03 = '#333333',
5 -
    \ base04 = '#999999', base05 = '#c1c1c1', base06 = '#999999', base07 = '#c1c1c1',
6 -
    \ base08 = '#5f8787', base09 = '#aaaaaa', base0A = '#e78a53', base0B = '#fbcb97',
7 -
    \ base0C = '#aaaaaa', base0D = '#888888', base0E = '#999999', base0F = '#444444'
8 -
    \})
16 +
17 +
" Neovim gets the Lua implementation, which adds Treesitter, LSP and plugin
18 +
" integrations on top of these same colors. The palette lives in
19 +
" lua/colors/darkmatter.lua.
20 +
if has('nvim')
21 +
  lua require('darkmatter-colorscheme').setup(require('colors.darkmatter'))
22 +
  finish
23 +
endif
24 +
25 +
" ---------------------------------------------------------------------------
26 +
" Vim
27 +
" ---------------------------------------------------------------------------
28 +
29 +
" Line continuations below need Vim's default 'cpoptions'.
30 +
let s:save_cpo = &cpoptions
31 +
set cpoptions&vim
32 +
33 +
" Each entry is [gui hex, nearest xterm-256 index]. The cterm values are
34 +
" approximations so the scheme still reads correctly in a 256 color terminal
35 +
" without 'termguicolors'.
36 +
let s:p = {
37 +
      \ 'base00': ['#121113', '233'],
38 +
      \ 'base01': ['#121212', '233'],
39 +
      \ 'base02': ['#222222', '235'],
40 +
      \ 'base03': ['#333333', '236'],
41 +
      \ 'base04': ['#999999', '246'],
42 +
      \ 'base05': ['#c1c1c1', '250'],
43 +
      \ 'base06': ['#999999', '246'],
44 +
      \ 'base07': ['#c1c1c1', '250'],
45 +
      \ 'base08': ['#5f8787', '66'],
46 +
      \ 'base09': ['#aaaaaa', '248'],
47 +
      \ 'base0A': ['#e78a53', '173'],
48 +
      \ 'base0B': ['#fbcb97', '222'],
49 +
      \ 'base0C': ['#aaaaaa', '248'],
50 +
      \ 'base0D': ['#888888', '102'],
51 +
      \ 'base0E': ['#999999', '246'],
52 +
      \ 'base0F': ['#444444', '238'],
53 +
      \ }
54 +
55 +
" s:hi(group, fg, bg, attr, sp) -- an empty string means NONE.
56 +
"
57 +
" Every field is written out explicitly rather than skipped, so that Vim's
58 +
" built-in defaults for a group can never show through a partial definition
59 +
" (e.g. Visual's cterm=reverse, or SpellBad's bright ctermbg). This also
60 +
" mirrors Neovim's nvim_set_hl(), which replaces a group outright.
61 +
function! s:hi(group, fg, bg, attr, sp) abort
62 +
  let l:fg = empty(a:fg) ? ['NONE', 'NONE'] : s:p[a:fg]
63 +
  let l:bg = empty(a:bg) ? ['NONE', 'NONE'] : s:p[a:bg]
64 +
  let l:attr = empty(a:attr) ? 'NONE' : a:attr
65 +
  " undercurl needs a GUI or 'termguicolors'; degrade to underline in cterm
66 +
  let l:cattr = substitute(l:attr, 'undercurl', 'underline', 'g')
67 +
68 +
  execute 'highlight' a:group
69 +
        \ 'guifg=' . l:fg[0] 'ctermfg=' . l:fg[1]
70 +
        \ 'guibg=' . l:bg[0] 'ctermbg=' . l:bg[1]
71 +
        \ 'gui=' . l:attr 'cterm=' . l:cattr 'term=' . l:cattr
72 +
        \ 'guisp=' . (empty(a:sp) ? 'NONE' : s:p[a:sp][0])
73 +
endfunction
74 +
75 +
" Vim editor colors
76 +
call s:hi('Normal',        'base05', 'base00', '',     '')
77 +
call s:hi('Bold',          '',       '',       'bold', '')
78 +
call s:hi('Debug',         'base08', '',       '',     '')
79 +
call s:hi('Directory',     'base0D', '',       '',     '')
80 +
call s:hi('Error',         'base08', 'base00', '',     '')
81 +
call s:hi('ErrorMsg',      'base08', 'base00', '',     '')
82 +
call s:hi('Exception',     'base08', '',       '',     '')
83 +
call s:hi('FoldColumn',    'base0C', 'base00', '',     '')
84 +
call s:hi('Folded',        'base03', 'base01', '',     '')
85 +
call s:hi('IncSearch',     'base01', 'base09', '',     '')
86 +
call s:hi('CurSearch',     'base01', 'base09', '',     '')
87 +
call s:hi('Italic',        '',       '',       'italic', '')
88 +
call s:hi('Macro',         'base08', '',       '',     '')
89 +
call s:hi('MatchParen',    '',       'base03', '',     '')
90 +
call s:hi('ModeMsg',       'base0B', '',       '',     '')
91 +
call s:hi('MoreMsg',       'base0B', '',       '',     '')
92 +
call s:hi('Question',      'base0D', '',       '',     '')
93 +
call s:hi('Search',        'base01', 'base0A', '',     '')
94 +
call s:hi('Substitute',    'base01', 'base0A', '',     '')
95 +
call s:hi('SpecialKey',    'base03', '',       '',     '')
96 +
call s:hi('TooLong',       'base08', '',       '',     '')
97 +
call s:hi('Underlined',    'base08', '',       '',     '')
98 +
call s:hi('Visual',        '',       'base02', '',     '')
99 +
call s:hi('VisualNOS',     'base08', '',       '',     '')
100 +
call s:hi('WarningMsg',    'base08', '',       '',     '')
101 +
call s:hi('WildMenu',      'base08', 'base0A', '',     '')
102 +
call s:hi('Title',         'base0D', '',       '',     '')
103 +
call s:hi('Conceal',       'base0D', 'base00', '',     '')
104 +
call s:hi('Cursor',        'base00', 'base05', '',     '')
105 +
call s:hi('NonText',       'base03', '',       '',     '')
106 +
call s:hi('Whitespace',    'base03', '',       '',     '')
107 +
call s:hi('LineNr',        'base04', 'base00', '',     '')
108 +
call s:hi('LineNrAbove',   'base04', 'base00', '',     '')
109 +
call s:hi('LineNrBelow',   'base04', 'base00', '',     '')
110 +
call s:hi('SignColumn',    'base04', 'base00', '',     '')
111 +
call s:hi('StatusLine',    'base05', 'base02', '',     '')
112 +
call s:hi('StatusLineNC',  'base04', 'base01', '',     '')
113 +
call s:hi('StatusLineTerm',   'base05', 'base02', '',     '')
114 +
call s:hi('StatusLineTermNC', 'base04', 'base01', '',     '')
115 +
call s:hi('VertSplit',     'base05', 'base00', '',     '')
116 +
call s:hi('ColorColumn',   '',       'base01', '',     '')
117 +
call s:hi('CursorColumn',  '',       'base01', '',     '')
118 +
call s:hi('CursorLine',    '',       'base01', '',     '')
119 +
call s:hi('CursorLineNr',  'base04', 'base01', '',     '')
120 +
call s:hi('QuickFixLine',  '',       'base01', '',     '')
121 +
call s:hi('Pmenu',         'base05', 'base01', '',     '')
122 +
call s:hi('PmenuSel',      'base01', 'base05', '',     '')
123 +
call s:hi('PmenuSbar',     '',       'base02', '',     '')
124 +
call s:hi('PmenuThumb',    '',       'base05', '',     '')
125 +
call s:hi('TabLine',       'base03', 'base01', '',     '')
126 +
call s:hi('TabLineFill',   'base03', 'base01', '',     '')
127 +
call s:hi('TabLineSel',    'base0B', 'base01', '',     '')
128 +
call s:hi('ToolbarLine',   '',       'base02', '',     '')
129 +
call s:hi('ToolbarButton', 'base05', 'base03', 'bold', '')
130 +
call s:hi('Terminal',      'base05', 'base00', '',     '')
131 +
call s:hi('debugPC',       '',       'base01', '',     '')
132 +
call s:hi('debugBreakpoint', 'base08', 'base00', '',   '')
133 +
134 +
" Standard syntax highlighting
135 +
call s:hi('Boolean',      'base09', '', '',     '')
136 +
call s:hi('Character',    'base08', '', '',     '')
137 +
call s:hi('Comment',      'base03', '', '',     '')
138 +
call s:hi('Conditional',  'base0E', '', '',     '')
139 +
call s:hi('Constant',     'base09', '', '',     '')
140 +
call s:hi('Define',       'base0E', '', '',     '')
141 +
call s:hi('Delimiter',    'base0F', '', '',     '')
142 +
call s:hi('Float',        'base09', '', '',     '')
143 +
call s:hi('Function',     'base0D', '', '',     '')
144 +
call s:hi('Identifier',   'base08', '', '',     '')
145 +
call s:hi('Include',      'base0D', '', '',     '')
146 +
call s:hi('Keyword',      'base0E', '', '',     '')
147 +
call s:hi('Label',        'base0A', '', '',     '')
148 +
call s:hi('Number',       'base09', '', '',     '')
149 +
call s:hi('Operator',     'base0E', '', '',     '')
150 +
call s:hi('PreProc',      'base0A', '', '',     '')
151 +
call s:hi('Repeat',       'base0A', '', '',     '')
152 +
call s:hi('Special',      'base0C', '', '',     '')
153 +
call s:hi('SpecialChar',  'base0F', '', '',     '')
154 +
call s:hi('Statement',    'base08', '', '',     '')
155 +
call s:hi('StorageClass', 'base0A', '', '',     '')
156 +
call s:hi('String',       'base0B', '', '',     '')
157 +
call s:hi('Structure',    'base0E', '', '',     '')
158 +
call s:hi('Tag',          'base0A', '', '',     '')
159 +
call s:hi('Type',         'base0A', '', '',     '')
160 +
call s:hi('Typedef',      'base0A', '', '',     '')
161 +
call s:hi('Todo',         'base0A', 'base01', '', '')
162 +
call s:hi('Ignore',       'base03', '', '',     '')
163 +
164 +
" Diff highlighting
165 +
call s:hi('DiffAdd',      'base0B', 'base00', '', '')
166 +
call s:hi('DiffChange',   'base03', 'base00', '', '')
167 +
call s:hi('DiffDelete',   'base08', 'base00', '', '')
168 +
call s:hi('DiffText',     'base0D', 'base00', '', '')
169 +
call s:hi('DiffAdded',    'base0B', 'base00', '', '')
170 +
call s:hi('DiffFile',     'base08', 'base00', '', '')
171 +
call s:hi('DiffNewFile',  'base0B', 'base00', '', '')
172 +
call s:hi('DiffLine',     'base0D', 'base00', '', '')
173 +
call s:hi('DiffRemoved',  'base08', 'base00', '', '')
174 +
175 +
" Git highlighting
176 +
call s:hi('gitcommitOverflow',      'base08', '', '',     '')
177 +
call s:hi('gitcommitSummary',       'base0B', '', '',     '')
178 +
call s:hi('gitcommitComment',       'base03', '', '',     '')
179 +
call s:hi('gitcommitUntracked',     'base03', '', '',     '')
180 +
call s:hi('gitcommitDiscarded',     'base03', '', '',     '')
181 +
call s:hi('gitcommitSelected',      'base03', '', '',     '')
182 +
call s:hi('gitcommitHeader',        'base0E', '', '',     '')
183 +
call s:hi('gitcommitSelectedType',  'base0D', '', '',     '')
184 +
call s:hi('gitcommitUnmergedType',  'base0D', '', '',     '')
185 +
call s:hi('gitcommitDiscardedType', 'base0D', '', '',     '')
186 +
call s:hi('gitcommitBranch',        'base09', '', 'bold', '')
187 +
call s:hi('gitcommitUntrackedFile', 'base0A', '', '',     '')
188 +
call s:hi('gitcommitUnmergedFile',  'base08', '', 'bold', '')
189 +
call s:hi('gitcommitDiscardedFile', 'base08', '', 'bold', '')
190 +
call s:hi('gitcommitSelectedFile',  'base0B', '', 'bold', '')
191 +
192 +
" GitGutter highlighting
193 +
call s:hi('GitGutterAdd',          'base0B', 'base00', '', '')
194 +
call s:hi('GitGutterChange',       'base0D', 'base00', '', '')
195 +
call s:hi('GitGutterDelete',       'base08', 'base00', '', '')
196 +
call s:hi('GitGutterChangeDelete', 'base0E', 'base00', '', '')
197 +
198 +
" Spelling highlighting
199 +
call s:hi('SpellBad',   '', '', 'undercurl', 'base08')
200 +
call s:hi('SpellLocal', '', '', 'undercurl', 'base0C')
201 +
call s:hi('SpellCap',   '', '', 'undercurl', 'base0D')
202 +
call s:hi('SpellRare',  '', '', 'undercurl', 'base0E')
203 +
204 +
" Statusline user groups
205 +
call s:hi('User1', 'base08', 'base02', '',     '')
206 +
call s:hi('User2', 'base0E', 'base02', '',     '')
207 +
call s:hi('User3', 'base05', 'base02', '',     '')
208 +
call s:hi('User4', 'base0C', 'base02', '',     '')
209 +
call s:hi('User5', 'base05', 'base02', '',     '')
210 +
call s:hi('User6', 'base05', 'base01', '',     '')
211 +
call s:hi('User7', 'base05', 'base02', '',     '')
212 +
call s:hi('User8', 'base00', 'base02', '',     '')
213 +
call s:hi('User9', 'base00', 'base02', '',     '')
214 +
215 +
" Colors for :terminal
216 +
let g:terminal_ansi_colors = [
217 +
      \ s:p['base00'][0], s:p['base08'][0], s:p['base0B'][0], s:p['base0A'][0],
218 +
      \ s:p['base0D'][0], s:p['base0E'][0], s:p['base0C'][0], s:p['base05'][0],
219 +
      \ s:p['base03'][0], s:p['base08'][0], s:p['base0B'][0], s:p['base0A'][0],
220 +
      \ s:p['base0D'][0], s:p['base0E'][0], s:p['base0C'][0], s:p['base07'][0],
221 +
      \ ]
222 +
223 +
delfunction s:hi
224 +
unlet s:p
225 +
226 +
let &cpoptions = s:save_cpo
227 +
unlet s:save_cpo
doc/colorscheme.txt +6 −1
1 -
*darkmatter-nvim.txt* Neovim colorscheme based on base16-black-metal-bathory
1 +
*darkmatter-nvim.txt* Vim/Neovim colorscheme based on base16-black-metal-bathory
2 2
3 3
Author:  Steve Simkins (stevedylandev) <hello@stevedylan.dev>
4 4
9 9
>
10 10
    :colorscheme darkmatter
11 11
<
12 +
The same command works in both Vim 8+ and Neovim. Neovim additionally loads
13 +
the Lua implementation, which adds Treesitter, LSP and plugin highlights.
14 +
15 +
For true colors, enable 'termguicolors'.  Without it, Vim falls back to the
16 +
nearest 256-color approximations of the palette.
12 17
13 18
vim:tw=78:ts=8:ft=help:norl: