Created
December 15, 2018 03:54
-
-
Save johnelliott/e9d74409cfd825bf48894d20c0690895 to your computer and use it in GitHub Desktop.
vim macOS dark mode example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" capture the current interface style | |
let g:apple_interface_style=system("defaults read -g AppleInterfaceStyle") | |
" run code based on the current interface style | |
if g:apple_interface_style ==? "dark\n" | |
set bg=dark | |
elseif g:apple_interface_style ==? "light\n" | |
set bg=light | |
endif | |
" add leader commands to change after vim starts | |
nn <leader>d :!osascript -e "tell application \"System Events\" to tell appearance preferences to set dark mode to true"<CR><CR> | |
nn <leader>l :!osascript -e "tell application \"System Events\" to tell appearance preferences to set dark mode to false"<CR><CR> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment