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 'pbrisbin/vim-colors-off'
Plug 'ikaros/smpl-vim' Plug 'ikaros/smpl-vim'
" Detect dark/light mode
Plug 'vimpostor/vim-lumen'
" External tool integration " External tool integration
Plug 'tpope/vim-bundler' " bundler + gem-ctags Plug 'tpope/vim-bundler' " bundler + gem-ctags
Plug 'tpope/vim-fugitive' " git 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.branch = '⎇'
let g:airline_symbols.whitespace = '' let g:airline_symbols.whitespace = ''
" Terminal behavior and appearance function! DetectMode()
if !has('gui_running') if has('macunix') && $TERM_PROGRAM == 'Apple_Terminal'
set showtabline=1 "automatic tab bar let s:mode = system('defaults read -g AppleInterfaceStyle')
set mouse=n "mouse support if v:shell_error
if has("mouse_sgr") set background=light
set ttymouse=sgr else
end set background=dark
"set background=light endif
endif
endfunction
if $SSH_CLIENT function! ApplyMode()
colorscheme smpl " set theme
else if &background ==# 'light'
if &background == 'light'
colorscheme nofrils-light colorscheme nofrils-light
else else
"colorscheme nofrils-dark colorscheme nofrils-dark
colorscheme nofrils-light
endif endif
"use terminal background "use terminal background
@ -72,9 +72,27 @@ if !has('gui_running')
hi statement ctermbg=none hi statement ctermbg=none
hi LineNr ctermbg=none hi LineNr ctermbg=none
endif 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
endif endif
au User LumenLight call ApplyMode()
au User LumenDark call ApplyMode()
" Appearance tweaks " Appearance tweaks
hi VertSplit cterm=NONE gui=NONE hi VertSplit cterm=NONE gui=NONE
set fillchars+=vert:│ set fillchars+=vert:│