Skip to content

Instantly share code, notes, and snippets.

@skejeton
Created June 8, 2022 12:50
Show Gist options
  • Save skejeton/346b185b77fdb3eff7a9d2b050cb31ee to your computer and use it in GitHub Desktop.
Save skejeton/346b185b77fdb3eff7a9d2b050cb31ee to your computer and use it in GitHub Desktop.
Vim colorscheme uses handmade-hero.vim as a base
set background=dark
hi clear
if exists("syntax_on")
syntax reset
endif
let colors_name = "handmade-hero"
function! s:HL(group, fg, ...)
" Arguments: group, guifg, guibg, gui, guisp
" foreground
let fg = a:fg
" background
if a:0 >= 1
let bg = a:1
else
let bg = s:none
endif
" emphasis
if a:0 >= 2 && strlen(a:2)
let emstr = a:2
else
let emstr = 'NONE,'
endif
" special fallback
if a:0 >= 3
if g:gruvbox_guisp_fallback != 'NONE'
let fg = a:3
endif
" bg fallback mode should invert higlighting
if g:gruvbox_guisp_fallback == 'bg'
let emstr .= 'inverse,'
endif
endif
let histring = [ 'hi', a:group,
\ 'guifg=' . fg[0], 'ctermfg=' . fg[1],
\ 'guibg=' . bg[0], 'ctermbg=' . bg[1],
\ 'gui=' . emstr[:-2], 'cterm=' . emstr[:-2]
\ ]
" special
if a:0 >= 3
call add(histring, 'guisp=' . a:3[0])
endif
execute join(histring, ' ')
endfunction
" Colors
let s:c1 = ['#11291f', 234]
let s:c2 = ['#e5b083', 180]
let s:c3 = ['#bab349', 143]
let s:c4 = ['#66d191', 78]
let s:c5 = ['#876f59', 95]
let s:c6 = ['#fc9c49', 215]
let s:back = s:c1
let s:default = s:c2
let s:margin = s:c1
let s:margin_hover = s:c1
let s:margin_active = s:c5
let s:cursor = s:c4
let s:highlight = s:c6
let s:at_highlight = s:c1
let s:mark = s:c3
let s:comment = s:c5
let s:keyword = s:c4
let s:string = s:c3
let s:constant = s:c6
let s:preproc = s:c5
let s:special = s:c6
let s:bar = s:c3
let s:bar_active = s:c4
let s:base = s:c1
let s:none = ['NONE', 'NONE']
let s:underline = 'underline,'
call s:HL('Normal', s:default, s:back)
call s:HL('Special', s:special, s:back)
call s:HL('Visual', s:at_highlight, s:highlight)
call s:HL('Search', s:at_highlight, s:highlight)
call s:HL('IncSearch', s:at_highlight, s:highlight)
" The column separating vertically split windows
call s:HL('VertSplit', s:margin_active, s:margin)
" Current match in wildmenu completion
hi! link WildMenu Search
" Error messages on the command line
call s:HL('ErrorMsg', s:special, s:back)
" Line number for :number and :# commands
call s:HL('LineNr', s:default, s:back)
call s:HL('CursorLineNr', s:keyword, s:back)
" Tilde (~)
call s:HL('NonText', s:back, s:back)
" Character under cursor
call s:HL('Cursor', s:back, s:cursor)
call s:HL('Comment', s:comment)
call s:HL('Todo', s:special, s:back)
" Generic statement
call s:HL('Statement', s:keyword)
" if, then, else, endif, swicth, etc.
hi! link Conditional Statement
" for, do, while, etc.
hi! link Repeat Statement
" case, default, etc.
hi! link Label Statement
" try, catch, throw
hi! link Exception Statement
" sizeof, "+", "*", etc.
hi! link Operator Normal
" Any other keyword
hi! link Keyword Statement
" Variable name
hi! link Identifier Normal
" Function name
hi! link Function Statement
" Generic preprocessor
call s:HL('PreProc', s:preproc)
" Preprocessor #include
hi! link Include PreProc
" Preprocessor #define
hi! link Define PreProc
" Same as Define
hi! link Macro PreProc
" Preprocessor #if, #else, #endif, etc.
hi! link PreCondit PreProc
" Generic string
call s:HL('String', s:string)
" Generic constant
call s:HL('Constant', s:constant)
" Character constant: 'c', '/n'
hi! link Character Constant
" Boolean constant: TRUE, false
hi! link Boolean Constant
" Number constant: 234, 0xff
hi! link Number Constant
" Floating point constant: 2.3e10
hi! link Float Constant
" Generic type
hi! link Type Statement
" static, register, volatile, etc
hi! link StorageClass Statement
" struct, union, enum, etc.
hi! link Structure Statement
" typedef
hi! link Typedef Statement
" Completion Menu
if version >= 700
" Popup menu: normal item
call s:HL('Pmenu', s:default, s:back)
" Popup menu: selected item
hi! link PmenuSel Search
endif
" Tab
call s:HL('TabLine', s:base, s:bar)
call s:HL('TabLineSel', s:base, s:bar_active)
call s:HL('TabLineFill', s:base, s:bar)
" Sneak
autocmd ColorScheme handmade-hero hi! link Sneak Search
autocmd ColorScheme handmade-hero hi! link SneakLabel Search
" Vim Multiple Cursors
hi! link multiple_cursors_cursor Cursor
hi! link multiple_cursors_visual Visual
" Markdown
hi! link markdownH1 Statement
hi! link markdownH2 Statement
hi! link markdownH3 Statement
hi! link markdownLinkText Statement
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment