aprotyas / aprotyas.github.io

Personal website
https://aprotyas.github.io
MIT License
3 stars 0 forks source link

MacOS shorts: Change `vim` background based on system theme (light/dark) #25

Closed aprotyas closed 3 years ago

aprotyas commented 3 years ago

Specifically, put words around the following snippet:

" Ah, brilliant AppleScript...
let theme = system('defaults read -g AppleInterfaceStyle')
if theme =~ 'Dark'
  set background = dark
else
  set background = light
endif

Might also be beneficial to talk about the similar-in-spirit feature - for the terminal - provided by the iTerm 3.5.0 beta.

aprotyas commented 3 years ago

As a bonus, might want to talk about bat's interoperability with system themes in MacOS through the export of the following alias:

alias bat="bat --theme=\$(defaults read -globalDomain AppleInterfaceStyle &> /dev/null && echo <light-theme> || echo <dark-theme>)"