Vim Tips Wiki
(Clean.)
Tag: rollback
m (Reverted edits by 106.117.76.21 (talk | block) to last version by JohnBeckett)
(One intermediate revision by one other user not shown)

Revision as of 14:58, 16 September 2015

Proposed tip Please edit this page to improve it, or add your comments below (do not use the discussion page).

Please use new tips to discuss whether this page should be a permanent tip, or whether it should be merged to an existing tip.
created March 8, 2012 · complexity basic · version 7.0

This tip adjusts the brightness of the display when Vim gains or loses focus on Mac OS X systems. This is not related to the brightness of the colorscheme.

Procedure

I like my display on full brightness with a dark colorscheme when coding. When switching from full screen Vim to a browser window or a terminal, the display settings make the screen far too bright. To avoid that, the following procedure sets the screen brightness to full when Vim gains focus, then sets the screen to half brightness when Vim loses focus.

Download the command line brightness tool from here.

Then add the following commands to your vimrc.

:au FocusGained * :!brightness 1
:au FocusLost * :!brightness 0.5

Comments

Tip could be improved if the tool were improved to report the current brightness setting so it can be restored. Also you probably only want this to happen if in fullscreen mode, so could possibly be improved there (if there is a way for Vim to detect it is full screened).