I suggest moving "compilation-mode" from emacs state to motion state and bind "c" to `recompile' (was "g"). (eval-after-load 'compile '(progn (evil-define-key 'motion compilation-mode-map "c" 'recompile))) At least this has been working greate for me. I also suggest adding command-history-mode and calendar-mode to motion state, how do you guys think? York
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
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.
Different from Dired mode, the compilation-mode has very few key bindings and that's the reason why I thought Motion State is the best in this case. And by re-binding "recompile" to "c" (was "g") we can still use the extremely hany "gg" command. My two cents.
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".
So, are you suggesting adding some new mechanism for this? That will be even better I believe.
On 2011-08-20 16:38 +0200, York Zhao wrote:
Different from Dired mode, the compilation-mode has very few key bindings and that's the reason why I thought Motion State is the best in this case. And by re-binding "recompile" to "c" (was "g") we can still use the extremely hany "gg" command.
I see. I added compilation-mode to `evil-motion-state-modes' in commit 89b6d35 (as well as calendar-mode and command-history-mode), although without the rebinding. I think rebinding should be kept to a minimum to make things predictable. -- Vegard
participants (2)
-
Vegard Øye -
York Zhao