Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

But you'll have to restart the terminal for that, right?


Yup! I'm in the same boat as you - need to switch between light and dark theme due to the switch between outdoor/indoor. I run xterm in openbox, with specific placements (geometry setting) for a specific xterm window session. I ended up writing a script to place the xterm windows exactly where I want them so that I don't have to worry about restarting xterm windows and losing the spatial context. It's a hairy perl script that started life about 8 years ago I think. I have two openbox menu configured to start my xterm windows - one for black and one for white background. It also sets an environment variable there so that vim knows what colorscheme to use when it starts. So everytime I switch between indoor/outdoor I do a ":mksession!|quit", followed by alt+f4 to close the xterm window and then hit the openbox menu to reopen the just closed xterm window with the new background color, and resume my vim session with the color scheme adapted to the current background color. I bet using a modern IDE you can get this done with just one or two keystroke heh.


Nice to hear someone is having the same problem as me :). Your solution sounds nice, you still have to restart things but you kind of automated that part. Maybe I'll end up doing the same, for now I'll try to explore more possibilities. For example, `help remote.txt` could help.


Well, you can use this and not restart the terminal https://github.com/sos4nt/dynamic-colors


Thanks, will check it out!


Use a modern terminal?


Using a more modern terminal won't make vim magically change it's color scheme.


Nothing magical about it, but yes it will.

Or rather, vim doesn't need to change its color scheme in order to be displayed in a completely different set of colors, which is what he's talking about. If you change the color mapping of your terminal and vim doesn't immediately reflect that, then your terminal is not applying those changes to that window/tab.


Fair enough, I just tried it out and it indeed works, I was a bit ignorant ;).

I'll see if this will work out for me. Don't know what any pitfalls could be by setting the color scheme in the terminal. At least it's annoying if you use different terminals on different systems, you'll have to configure them separately, you can't put it in your dotfiles repos or something. Thanks anyway, will look into it!


I keep my terminal's settings in my dotfiles repo... It opens by default in what I've set as the default. I can change on a case by case basis if I want.


It does for me.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: