I would like to be able to get the current usual mode of vim inside a vim script (and not only inside the statusline). I need this functionality to build a vim script linked with ruby script to be able to change keyboard keys colors depend of vim current mode and motion state. My problem is that vim doesn't know to provide his mode state inside vim script (only inside statusline), or i failed to get it. I think it should have a point there to make vim better by provide a helpful mode() function who can really provide vim current mode (not only in normal mode and not only for statusline).
This way dev's users would be able without pain to build script to recognize current vim mode and then build interactive script. Also, i'm now able to get FocusGained (i'm not Windows user, my OS is archlinux and sometimes FreeBSD) with adding ugly/tricky vimscript and i think this point can also be increase for vim source code to be not only for gvim or Windows users.
Try to imagine you want to create a script for color rgb keyboard keys to show currenty mode and aviable keys to hit depend on mode and motion/other state... how to do that if FocusGained and mode() only works for some very limited situations ?