[nvim] move colorscheme to a file in runtimepath

This commit is contained in:
Dmytro Meleshko 2019-09-06 00:37:09 +03:00
parent 5182a6f1de
commit bdfdba8e88
4 changed files with 14 additions and 27 deletions

View file

@ -2,9 +2,9 @@
import _theme as theme
print("let my_colorscheme_name = '{}'".format(theme.name))
print("let my_colorscheme_base16_name = '{}'".format(theme.base16_name))
print("let my_colorscheme_base16_colors = [")
print("let dotfiles_colorscheme_name = '{}'".format(theme.name))
print("let dotfiles_colorscheme_base16_name = '{}'".format(theme.base16_name))
print("let dotfiles_colorscheme_base16_colors = [")
gui_to_cterm_mapping = [0, 18, 19, 8, 20, 7, 21, 15, 1, 16, 3, 2, 6, 4, 5, 17]
for colors_pair in zip(theme.base16_colors, gui_to_cterm_mapping):
print("\\ {{'gui': '{}', 'cterm': '{:>02}'}},".format(*colors_pair))

View file

@ -1,6 +1,6 @@
let my_colorscheme_name = 'base16-eighties'
let my_colorscheme_base16_name = 'eighties'
let my_colorscheme_base16_colors = [
let dotfiles_colorscheme_name = 'base16-eighties'
let dotfiles_colorscheme_base16_name = 'eighties'
let dotfiles_colorscheme_base16_colors = [
\ {'gui': '#2d2d2d', 'cterm': '00'},
\ {'gui': '#393939', 'cterm': '18'},
\ {'gui': '#515151', 'cterm': '19'},

View file

@ -4,35 +4,17 @@
" Color definitions {{{
execute 'source' fnameescape(g:nvim_dotfiles_dir.'/../colorschemes/out/nvim.vim')
let s:colors = g:my_colorscheme_base16_colors
let s:theme_name = g:my_colorscheme_name
let s:base16_theme_name = g:my_colorscheme_base16_name
unlet g:my_colorscheme_name g:my_colorscheme_base16_name g:my_colorscheme_base16_colors
if empty($BASE16_SHELL) || !filereadable($BASE16_SHELL.'/scripts/base16-'.s:base16_theme_name.'.sh') || &termguicolors
if empty($BASE16_SHELL) || !filereadable($BASE16_SHELL.'/scripts/base16-'.g:dotfiles_colorscheme_base16_name.'.sh') || &termguicolors
set termguicolors
else
" call system(shellescape($BASE16_SHELL.'/scripts/base16-'.s:base16_theme_name.'.sh'))
endif
" }}}
" Neovim terminal colors {{{
let s:i = 0
for s:color in [0x0, 0x8, 0xB, 0xA, 0xD, 0xE, 0xC, 0x5, 0x3, 0x8, 0xB, 0xA, 0xD, 0xE, 0xC, 0x7]
let g:terminal_color_{s:i} = s:colors[s:color].gui
let s:i += 1
endfor
unlet s:i
let g:terminal_color_background = g:terminal_color_0
let g:terminal_color_foreground = g:terminal_color_5
" }}}
" Theme setup {{{
hi clear
syntax reset
let g:colors_name = s:theme_name
let g:colors_name = g:dotfiles_colorscheme_name
" }}}
" Highlighting function {{{
@ -40,6 +22,7 @@
return type(a:value) == v:t_number
endfunction
let s:colors = g:dotfiles_colorscheme_base16_colors
function s:hi(group, fg, bg, attr, guisp)
let l:args = ''
if a:fg isnot ''

View file

@ -2,10 +2,14 @@ let g:nvim_dotfiles_dir = expand('<sfile>:p:h')
let g:vim_ide = get(g:, 'vim_ide', 0)
for s:name in ['plugins', 'editing', 'interface', 'colorscheme', 'files', 'completion', 'terminal', 'git']
let &runtimepath = g:nvim_dotfiles_dir.','.&runtimepath
for s:name in ['plugins', 'editing', 'interface', 'files', 'completion', 'terminal', 'git']
execute 'source' fnameescape(g:nvim_dotfiles_dir.'/lib/'.s:name.'.vim')
endfor
colorscheme dotfiles
for s:path in globpath(g:nvim_dotfiles_dir.'/lib/languages', '*', 0, 1)
execute 'source' fnameescape(s:path)
endfor