Mapping ESC in minibuffer normal mode to keyboard-quit and autoindent woes
I like to have ESC behave like C-g in normal mode in the minibuffer, I've tried to no avail: (vimpulse-map (kbd "ESC") 'keyboard-quit) (define-key viper-minibuffer-map (kbd "ESC") 'keyboard-quit) Another issue is vimpulse messing with comment indenting. I have RET bound to comment-indent-new-line so that in a comment, pressing enter inserts a comment prefix. However, with vimpulse on, it inserts an extra tab to the new line. Eg. Initially in insert mode, cursor at | //| RET // //| RET // // //| RET // // // //| .. Any help is greatly appreciated!
On 2011-03-11 23:35 +0100, Justin Zhu wrote:
I like to have ESC behave like C-g in normal mode in the minibuffer
The most straightforward way is to disable Viper in the minibuffer: (remove-hook 'minibuffer-setup-hook 'viper-minibuffer-setup-sentinel) (defadvice viper-set-minibuffer-overlay (around vimpulse activate) nil) (defadvice viper-has-face-support-p (around vimpulse activate) nil) (define-key minibuffer-local-map (kbd "ESC") 'abort-recursive-edit) That will remove all modal functionality when using Ex.
Another issue is vimpulse messing with comment indenting. I have RET bound to comment-indent-new-line so that in a comment, pressing enter inserts a comment prefix. However, with vimpulse on, it inserts an extra tab to the new line.
This should work without binding RET yourself -- Viper binds RET to `viper-autoindent', which in Vimpulse calls `comment-indent-new-line'. I am unable to reproduce the behavior in c-mode or java-mode. What major mode are you using? Are you using the Git version of Vimpulse?
Any help is greatly appreciated!
Please note that Vimpulse is being discontinued in favor of Evil,[1] which will do everything Vimpulse does and much more. I will still provide basic support for Vimpulse to ease the transition, but once Evil hits its first release, Vimpulse is officially obsolete. [1] http://gitorious.org/evil -- Vegard
On Sat, Mar 12, 2011 at 4:19 AM, Vegard Øye <[email protected]> wrote:
On 2011-03-11 23:35 +0100, Justin Zhu wrote:
I like to have ESC behave like C-g in normal mode in the minibuffer
The most straightforward way is to disable Viper in the minibuffer:
(remove-hook 'minibuffer-setup-hook 'viper-minibuffer-setup-sentinel) (defadvice viper-set-minibuffer-overlay (around vimpulse activate) nil) (defadvice viper-has-face-support-p (around vimpulse activate) nil) (define-key minibuffer-local-map (kbd "ESC") 'abort-recursive-edit)
I like the modal editing of the minibuffer, just that it would be nice for pressing ESC multiple times to exit the minibuffer.
That will remove all modal functionality when using Ex.
Another issue is vimpulse messing with comment indenting. I have RET bound to comment-indent-new-line so that in a comment, pressing enter inserts a comment prefix. However, with vimpulse on, it inserts an extra tab to the new line.
This should work without binding RET yourself -- Viper binds RET to `viper-autoindent', which in Vimpulse calls `comment-indent-new-line'. I am unable to reproduce the behavior in c-mode or java-mode. What major mode are you using? Are you using the Git version of Vimpulse?
I'm using scala-mode with latest git version.
Any help is greatly appreciated!
Please note that Vimpulse is being discontinued in favor of Evil,[1] which will do everything Vimpulse does and much more. I will still provide basic support for Vimpulse to ease the transition, but once Evil hits its first release, Vimpulse is officially obsolete.
-- Vegard
Cool! I'm looking forward to the first release.
On 2011-03-13 07:12 +0100, Justin Zhu wrote:
I like the modal editing of the minibuffer, just that it would be nice for pressing ESC multiple times to exit the minibuffer.
Duly noted. :) I have added the behavior in commit 392fc3c. Do "git pull" to update.
Another issue is vimpulse messing with comment indenting. I have RET bound to comment-indent-new-line so that in a comment, pressing enter inserts a comment prefix.
What major mode are you using?
I'm using scala-mode with latest git version.
Okay, I can reproduce the bug now. As far as I can tell, it's independent of Vimpulse: `comment-indent-new-line' simply doesn't work well in scala-mode. I suggest using scala-mode's own `scala-newline' command instead, which you can bind with (vimpulse-define-key 'scala-mode 'insert-state (kbd "RET") 'scala-newline) That will override `viper-autoindent's binding of the RET key. -- Vegard
Thanks! On Mon, Mar 14, 2011 at 5:11 AM, Vegard Øye <[email protected]> wrote:
On 2011-03-13 07:12 +0100, Justin Zhu wrote:
I like the modal editing of the minibuffer, just that it would be nice for pressing ESC multiple times to exit the minibuffer.
Duly noted. :)
I have added the behavior in commit 392fc3c. Do "git pull" to update.
Another issue is vimpulse messing with comment indenting. I have RET bound to comment-indent-new-line so that in a comment, pressing enter inserts a comment prefix.
What major mode are you using?
I'm using scala-mode with latest git version.
Okay, I can reproduce the bug now. As far as I can tell, it's independent of Vimpulse: `comment-indent-new-line' simply doesn't work well in scala-mode. I suggest using scala-mode's own `scala-newline' command instead, which you can bind with
(vimpulse-define-key 'scala-mode 'insert-state (kbd "RET") 'scala-newline)
That will override `viper-autoindent's binding of the RET key.
-- Vegard
participants (2)
-
Justin Zhu -
Vegard Øye