If you don’t have a preferred plugin helper, consider trying vim-plug, which can be installed (on Unix-like systems) with:
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
Having installed vim-plug, snow can be installed by adding the following to the top of your vimrc...
call plug#begin('~/.vim/plugged')
Plug 'nightsense/snow'
call plug#end()
...then restarting vim, followed by running :PlugUpdate
(at the vim command line).
For a snow day, add the following to vimrc:
colorscheme snow
set background=light
For a snowy evening:
colorscheme snow
set background=dark
To set the background automatically based on the time at which vim is launched:
colorscheme snow
if strftime('%H') >= 7 && strftime('%H') < 19
set background=light
else
set background=dark
endif
...which activates the light version of snow during the day (defined here as 7AM-7PM), dark version at night.
The night-and-day plugin can switch themes and/or backgrounds automatically, using absolute or sun-relative time.
snow comes with themes for airline and lightline, which can be activated with the following vimrc code:
airline | lightline | |
light | let g:airline_theme='snow_light' |
let g:lightline = { 'colorscheme': 'snow_light' } |
dark | let g:airline_theme='snow_dark' |
let g:lightline = { 'colorscheme': 'snow_dark' } |
Status line themes can be added to the time-based snippet above:
colorscheme snow
if strftime('%H') >= 7 && strftime('%H') < 19
set background=light
let g:lightline = { 'colorscheme': 'snow_light' }
else
set background=dark
let g:lightline = { 'colorscheme': 'snow_dark' }
endif
Terminals/multiplexers with true-color support (see list) can display the exact snow colors.
In most cases, the only vimrc setting you need is:
set termguicolors
In some cases you'll also need:
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
If termguicolors
is not set, terminal vim will fall back to an xterm-color approximation of snow.
To set mode-specific cursor shapes in terminal vim, see the Vim Tips Wiki.
For instance, to set cursor shapes in vte-compatible terminals, you could add to vimrc:
let &t_SI = "\<Esc>[6 q"
let &t_SR = "\<Esc>[4 q"
let &t_EI = "\<Esc>[2 q"
...which sets the cursor to a vertical line for insert mode, underline for replace mode, and block for normal mode.