commit 91660c39f6ea528900c0eebe4b9ee4e41421a1a8 (patch)
parent d50adcb4ef5359c67faa44cb1930eae90734b5cb
Author: Alex Karle <alex@karle.co>
Date: Wed, 31 Jul 2019 00:33:37 -0400
vim/colors: add colorscheme for the Linux Virtual Console
I've been playing around a lot recently in the Linux Virtual Console (no
X server). Having Vim colors (at the bare minimum for functional stuff
like visual mode / search highlight) is important.
I tried to get gruvbox to work, but in the end I needed to build off
something much simpler that made no assumptions about how many colors
were available--so, this 8 color theme builds off of the "default"
theme, which Vim detects properly to be 8 colors if in the VC and
everything should "just work".
Note that NeoVim does not acknowledge t_Co=8 mode, so this theme will
likely break in NeoVim in the VC (but should be fine in a X terminal
emulator).
Diffstat:
2 files changed, 29 insertions(+), 19 deletions(-)
diff --git a/vim/colors/vc.vim b/vim/colors/vc.vim
@@ -0,0 +1,16 @@
+" colors/vc.vim
+"
+" An adaptation of the default colorscheme for the Linux Virtual Console
+" (also just my preferred 'default' should there be no gruvbox installed)
+"
+" Preferred Setup:
+" ================
+" - Vim 8.1 (NeoVim insists on setting &t_Co to 256 / dropped t_XX settings)
+" - &t_Co == 8
+" - TERM=linux (default VC) or TERM=tmux/screen
+" - Base 8-color pallete from gruvbox
+" - bg=light
+hi! StatusLine cterm=NONE ctermfg=0 ctermbg=7
+hi! StatusLineNC cterm=NONE ctermfg=0 ctermbg=7
+hi! Folded cterm=NONE ctermfg=3 ctermbg=0
+hi! LineNr cterm=NONE ctermfg=7 ctermbg=0
diff --git a/vim/vimrc b/vim/vimrc
@@ -89,37 +89,31 @@ set noequalalways " Don't resize split on open/close event
set listchars=space:·,tab:>–,trail:~,eol:¬
" COLORSCHEME
-" if can use truecolor, do
-if (has("termguicolors") || has('gui_running')) &&
- \ filereadable(s:vimdir . "/pack/mine/start/gruvbox/colors/gruvbox.vim")
+" Only gruv if you can handle it
+if exists("$DISPLAY") &&
+ \ (has("termguicolors") || has('gui_running')) &&
+ \ filereadable(s:vimdir . "/pack/mine/start/gruvbox/colors/gruvbox.vim")
+
set termguicolors
colorscheme gruvbox
" See :h xterm-true-color for tmux+termguicolors
- if &term =~# '^tmux'
+ if &term =~# '^tmux' || &term =~# '^st'
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
endif
-else
- colorscheme desert
-endif
-
-set background=dark " seems to need to be after gruvbox
-" Allow cursor to change shape: https://stackoverflow.com/questions/6488683
-let &t_SI = "\e[6 q"
-let &t_EI = "\e[2 q"
+ set background=dark
-" auto commands (grouped so that re-sourcing vimrc doesn't cause duplicates!)
-if has('autocmd')
- augroup MyCustomAucmds
- " removes all autocmds from this group (needed when re-sourcing)
+ augroup CurLineToggle
autocmd!
-
- " Set cursor line when in insert mode (to indicate insert mode)
autocmd InsertEnter,InsertLeave * set cul!
- augroup END " goes back to default augroup
+ augroup END
+else
+ set background=light
+ colorscheme vc
endif
+
" }}}
" KEY MAPPINGS {{{