Currently I have my vim set up to update the statuslline based on what mode the editor is in. Like if I'm in insert mode then the statusline turns red. Magenta in replace mode. Green in command mode.
" statusline setup
set laststatus=2
set statusline=\
\ %F\ \|\ %h%w%m%r\ \|\ %=%(\|\ L\:\ %l\ \|\ C\:\ %c%V\ \|\ %=\ %P\ %)
hi statusline cterm=none ctermbg=green ctermfg=black
function! InsertStatuslineColor(mode)
if a:mode=='i'
hi statusline ctermbg=red
elseif a:mode=='r'
hi statusline ctermbg=magenta
else
hi statusline ctermbg=red
endif
endfunction
au InsertEnter * call InsertStatuslineColor(v:insertmode)
au InsertChange * call InsertStatuslineColor(v:insertmode)
au InsertLeave * hi statusline ctermbg=green
hi statusline ctermbg=green
I'd like to know if it's possible have vim update an external file based on what mode the editor is currently in. For instance, is it possible to have it change the statusline color and then also perform a shell command in the background? My ultimate goal here is to have my led backlit keyboard match the color of the statusline. I can achieve these color switches via cli like:
echo "FF00FF" > /sys/class/leds/system76::kbd_backlight/color_left
Is there a way to work this into my .vimrc to achieve my goal or nah?
:
command line it'll be the same thing). There should be many answers that give you guidance on that.