![]() It assumes that you have a light and dark profile set up. I have another script for GNOME Terminal doing something similar. Probably not let you write into that socket. Exercise for the reader I guess - I don’t particularlyĬare because I rarely run Neovim as root, but I expect this would crashĪnd burn if there were Neovim running as any user other than you. That when you switch theme, it’ll not just affect new Neovim instances, but also Update set_light_theme and set_dark_theme to call it. import glob import os from pynvim import attach # TODO : should probably only try to do this to *my* neovim instances for dir in glob.glob( '/tmp/nvim*'): socket = os.path.join( dir, '0') nvim = attach( "socket", path =socket) mand( "call UpdateThemeFromGnome()") #!/usr/bin/python # Updates the theme on all running Neovim instances. It’ll use pynvim to connect to running Neovim instances and run the function " With disabled night mode, value seems to be to 'default' on my system.Ĭall UpdateThemeFromGnome() update_nvim_theme_from_gnomeĬreate this script somewhere and chmod x it. ![]() Let color_scheme = substitute(color_scheme, "'", "", "g") Let color_scheme = substitute(color_scheme, "\n", "", "") ![]() " remove newline character from color_scheme Let color_scheme = system('gsettings get color-scheme') " Called on theme switches by set_light_theme, set_dark_theme scripts. " Will later be picked up when setting up Solarized colors. " Done early to prefer flashing of the wrong theme before this runs. " Set color theme to light/dark based on current system preferences. It’ll read the current setting from gsettings and update Vim’s background to Open ~/.config/nvim/init.vim and add this hunk somewhere near the top. I use the vim-colors-solarized plugin which addsīoth light and dark variants, toggled by set background=light or dark. In my particular case, I like Solarized colors, which I haveĮverywhere I can (VSCode, Neovim, gnome-terminal, even this site - as of now). Point Night Theme Switcher to run those when the theme is changed. Light/dark scriptsĬreate a pair of scripts, set_light_theme and set_dark_theme, put them This extension lets you attach scripts to when the theme is changed. Install the Night Theme Switcher GNOME extension. Pip install pynvim absl-py dbus-python Shared setup Night Theme Switcher ![]()
0 Comments
Leave a Reply. |