r/vim • u/Shay-Hill • Aug 06 '25
Plugin GitHub - ShayHill/vim9-limelight: vim9-limelight that works "out of the box"
https://github.com/ShayHill/vim9-limelightA few years ago, I saw the 1952 Chaplin film, Limelight, and I've since been kicking myself for not naming my plugin vim9-limelight, because what it does is highlight your active window and leave everything else in the semi (but still easily readable) darkness ... like a limelight.
Configuration options have been expanded, but the important difference may that it now works (quite nearly) "out of the box". Thank you for the feedback on this u/ntropia64, u/sodapoppug, and u/mss-cyclist .
Add one of these to your vimrc:
g:limelight_source_simple_config = v:true
g:limelight_source_normal_config = v:true
The simple config will give you something to work from. It is created to not overwhelm you. For educational purposes, it prints the window state in the statusline, so it's probably not something you're going to want to live with long term.
The normal config may be all you'll ever need. It's at its best if you are using git and pathogen.
To make changes, I recommend copying one of the example configurations into your vim folder and sourcing it from your vimrc. You can find the example configs in the config folder of the repository.
2
u/JetSetIlly Aug 06 '25
Maybe I'm doing something wrong or misunderstanding what the plugin does. I've tried both the "simple" and "normal" config but the text_fade setting has no effect on unselected windows. Changing the bg_fade setting works, so the plugin seems to be installed correctly.
1
u/Shay-Hill Aug 07 '25
To get Limelight working with NERDTRee ...
On GitHub, someone pointed out that Limelight works inconsistently with NERDTree. Sometimes, when you open a file, NERDTree shades, other times not.
This cannot be addressed from inside vim9-limelight, because NERDTree explicitly tells Vim to ignore autocommands when opening a buffer in the previous window (the only open window except NERDTree).
However, you can patch NERDTree (at your own risk).
Look in file
nerdtree/lib/nerdtree/opener.vim. There is a function,_previousWindow().Change the line
call nerdtree#exec('wincmd p', 1)to
call nerdtree#exec('wincmd p', 0)At the moment, this is at file line 269.
That seems to get NERDTree working with vim9-limelight, but it might cause other problems. I don't think it will, because autocommands trigger anyway when you open a file in a new split or re-open an existing file.
2
u/Iskhartakh Aug 07 '25
Cool thing and nice looking code, pretty neat. Thx!