Adapt to dark/light mode

This commit is contained in:
Loic Nageleisen 2024-10-18 20:11:44 +02:00
parent c3e9c4e745
commit daec0e9249
Signed by: lloeki
GPG key ID: D05DAEE6889F94C2
2 changed files with 35 additions and 14 deletions

View file

@ -18,6 +18,9 @@ Plug 'olivertaylor/vacme'
Plug 'pbrisbin/vim-colors-off'
Plug 'ikaros/smpl-vim'
" Detect dark/light mode
Plug 'vimpostor/vim-lumen'
" External tool integration
Plug 'tpope/vim-bundler' " bundler + gem-ctags
Plug 'tpope/vim-fugitive' " git

46
vimrc
View file

@ -41,23 +41,23 @@ let g:airline_symbols.linenr = ''
let g:airline_symbols.branch = '⎇'
let g:airline_symbols.whitespace = ''
" Terminal behavior and appearance
if !has('gui_running')
set showtabline=1 "automatic tab bar
set mouse=n "mouse support
if has("mouse_sgr")
set ttymouse=sgr
end
"set background=light
function! DetectMode()
if has('macunix') && $TERM_PROGRAM == 'Apple_Terminal'
let s:mode = system('defaults read -g AppleInterfaceStyle')
if v:shell_error
set background=light
else
set background=dark
endif
endif
endfunction
if $SSH_CLIENT
colorscheme smpl
else
if &background == 'light'
function! ApplyMode()
" set theme
if &background ==# 'light'
colorscheme nofrils-light
else
"colorscheme nofrils-dark
colorscheme nofrils-light
colorscheme nofrils-dark
endif
"use terminal background
@ -72,9 +72,27 @@ if !has('gui_running')
hi statement ctermbg=none
hi LineNr ctermbg=none
endif
endfunction
" Terminal behavior and appearance
if !has('gui_running')
set showtabline=1 "automatic tab bar
set mouse=n "mouse support
if has("mouse_sgr")
set ttymouse=sgr
end
if $SSH_CLIENT
colorscheme smpl
else
call DetectMode()
call ApplyMode()
endif
endif
au User LumenLight call ApplyMode()
au User LumenDark call ApplyMode()
" Appearance tweaks
hi VertSplit cterm=NONE gui=NONE
set fillchars+=vert:│