aboutsummaryrefslogtreecommitdiff
path: root/ui.vim
blob: 15da6731547ad1c81e3cdbcccf21abcf8003333a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
"{ UI-related settings
"{{ General settings about colors
" Enable true colors support. Do not set this option if your terminal does not
" support true colors! For a comprehensive list of terminals supporting true
" colors, see https://github.com/termstandard/colors and
" https://gist.github.com/XVilka/8346728.
if match($TERM, '^xterm.*') != -1 || exists('g:started_by_firenvim')
  set termguicolors
endif
" Use dark background
set background=dark
"}}

"{{ Colorscheme settings
let s:candidate_theme = ['gruvbox8', 'srcery', 'badwolf', 'deus', 'happy_hacking', 'solarized8',
      \ 'monokai', 'gotham', 'vim_one', 'material', 'onedark']
let s:idx = utils#RandInt(0, len(s:candidate_theme)-1)
let s:theme = s:candidate_theme[s:idx]

let s:my_theme_dict = {}

function! s:my_theme_dict.srcery() dict abort
  colorscheme srcery
endfunction

function! s:my_theme_dict.gruvbox8() dict abort
  " We should check if theme exists before using it, otherwise you will get
  " error message when starting Nvim
  if utils#HasColorscheme('gruvbox8')
    " Italic options should be put before colorscheme setting,
    " see https://github.com/morhetz/gruvbox/wiki/Terminal-specific#1-italics-is-disabled
    let g:gruvbox_italics=1
    let g:gruvbox_italicize_strings=1
    let g:gruvbox_filetype_hi_groups = 0
    let g:gruvbox_plugin_hi_groups = 0
    colorscheme gruvbox8_hard
  else
    colorscheme desert
  endif
endfunction

function! s:my_theme_dict.srcery() dict abort
  if utils#HasColorscheme('srcery')
    colorscheme srcery
  else
    colorscheme desert
  endif
endfunction

function! s:my_theme_dict.badwolf() dict abort
  if utils#HasColorscheme('badwolf')
    let g:badwolf_darkgutter = 0
    " Make the tab line lighter than the background.
    let g:badwolf_tabline = 2
    colorscheme badwolf
  else
    colorscheme desert
  endif
endfunction

function! s:my_theme_dict.deus() dict abort
  if utils#HasColorscheme('deus')
    colorscheme deus
  else
    colorscheme desert
  endif
endfunction

function! s:my_theme_dict.happy_hacking() dict abort
  if utils#HasColorscheme('happy_hacking')
    colorscheme happy_hacking
  else
    colorscheme desert
  endif
endfunction

function! s:my_theme_dict.solarized8() dict abort
  if utils#HasColorscheme('solarized8')
    let g:solarized_term_italics=1
    let g:solarized_visibility='high'
    colorscheme solarized8_flat
  else
    colorscheme desert
  endif
endfunction

function! s:my_theme_dict.monokai() dict abort
  if utils#HasColorscheme('monokai')
    colorscheme monokai
  else
    colorscheme desert
  endif
endfunction

function! s:my_theme_dict.gotham() dict abort
  if utils#HasColorscheme('gotham')
    colorscheme gotham
  else
    colorscheme desert
  endif
endfunction

function! s:my_theme_dict.vim_one() dict abort
  if utils#HasColorscheme('one')
    let g:one_allow_italics = 1
    colorscheme one
  else
    colorscheme desert
  endif
endfunction

function! s:my_theme_dict.material() dict abort
  if utils#HasColorscheme('material')
    let g:material_terminal_italics = 1
    " theme_style can be 'default', 'dark' or 'palenight'
    let g:material_theme_style = 'default'
    colorscheme material
  else
    colorscheme desert
  endif
endfunction

function! s:my_theme_dict.onedark() dict abort
  if utils#HasColorscheme('onedark')
    let g:onedark_terminal_italics = 1
    colorscheme onedark
  else
    colorscheme desert
  endif
endfunction

function! s:my_theme_dict.neodark() dict abort
  if utils#HasColorscheme('neodark')
    colorscheme neodark
  else
    colorscheme desert
  endif
endfunction

" execute printf('call s:my_theme_dict.%s()', s:theme)
execute printf('call s:my_theme_dict.%s()', 'material')
"}}
"}