In addition to the tips already listed on
http://www.linuxpowertop.org/known.php#gvim,
I'd like to add a few other:

Vim and Gvim both have the habit to call fsync when writing the
swapfile, to ensure that everything
is actually on disk. By default, the swapfile is updated when typing 200
characters or when nothing has been
typed for 4 seconds. When programming/typing, this causes the disk to
spin up often, or blocks it from
entering a deeper sleep state.

Likewise, by default, the 'fs' option is set, again causing a fsync
after every file write.

When on battery power (and laptop_mode is enabled) I don't want vim to
call fsync all the time;
Instead, I'm willing to loose a few minutes of work (if a kernel crash
would occur) in exchange
for longer battery life. That's why I use the following in my .vimrc.

The script tries to detect if laptop mode is enabled, and if so,
disables calling fsync
when writing the swapfile and other files. (In addition, it also changes
the colorscheme to something
with a higher contrast (compared to my default scheme), allowing me to
reduce the
backlight to save some more power)

    let s:laptopmode=readfile("/proc/sys/vm/laptop_mode", "", 1)
        if s:laptopmode[0] > 0
           set nofs
           set sws=""
           colorscheme blue
        endif
        unlet s:laptopmode


  Hope this is helpful to somebody,

  Greetings,
  Dries

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Power mailing list
[email protected]
http://www.bughost.org/mailman/listinfo/power

Reply via email to