Alright, I’m writing and another Vim micro plugin to automatically switch between `bg=light` and `bg=dark` based on macOS’s dark mode.
Follow along for some live-micro-blogging! 🧵
https://twitter.com/jkreeftmeijer/status/1353692576424067072
$ git push origin main
https://github.com/jeffkreeftmeijer/vim-nightfall 🖐🎤
That’s it for now! Please take it for a spin and let me know if you find something I can improve on.
Have a smart configuration in your ~/.vimrc yourself? Turn it into a plugin! A good place to start (and the source of most of my VimL-fu) is https://learnvimscriptthehardway.stevelosh.com.
First things first. We need to know when to switch the background color. We’ll check `defaults read -g AppleInterfaceStyle`, which produces `Dark\n` when macOS’s dark mode is turned on.
In Vim, as a boolean:
:echom system("defaults read -g AppleInterfaceStyle") == "Dark\n"