On 2011-08-20 15:18 +0200, York Zhao wrote:
I suggest moving "compilation-mode" from emacs state to motion state and bind "c" to `recompile' (was "g"). ... I also suggest adding command-history-mode and calendar-mode to motion state, how do you guys think?
Indeed. Instead of listing all non-editing modes in `evil-emacs-state-modes', a better setting would in many cases be to make the mode come up in Motion state, but with priority /over/ Motion state's bindings. The keymap order then becomes: <compilation-mode bindings> <Motion state bindings> The point is that we get all of compilation-mode's bindings without having to disable Evil's keymaps entirely. This is actually how Dired is set up, although it comes up in Normal state instead of Motion state. In some cases, one may want to add a custom set of bindings on top of that to protect "h", "j", "k" and "l": <vi bindings for "h"/"j"/"k"/"l"> <compilation-mode bindings> <Motion state bindings> Replacement bindings for "h", "j", "k" and "l" can be added too: <vi bindings for "h"/"j"/"k"/"l" plus replacement bindings> <compilation-mode bindings> <Motion state bindings> All of this this could be automated with a function (with the exception of replacement bindings, which have to be chosen carefully). The function would take the mode's keymap as an argument and set it up like above, and maybe provide an ADD-HJKL option for protecting the "core motions". -- Vegard