[implementations-list] issue with viper-escape-to-emacs
Hello, with the new vimpulse, I have a problem escaping back to emacs mode. I need this option to run some traditional 'M-x' functions. Up to now I used: (define-key viper-vi-global-user-map (kbd "\\\\") 'viper-escape-to-emacs) Unfortunately, this does not work anymore, as using M(Esc) for the next command cancels this escape and inserts the second of the backslash into the buffer... Would be nice, if you have a hint! Regards! Fabian
Date: Thu, 1 Apr 2010 14:06:14 +0200 From: [email protected]
Hello,
with the new vimpulse, I have a problem escaping back to emacs mode. I need this option to run some traditional 'M-x' functions. Up to now I used:
(define-key viper-vi-global-user-map (kbd "\\\\") 'viper-escape-to-emacs)
Unfortunately, this does not work anymore, as using M(Esc) for the next command cancels this escape and inserts the second of the backslash into the buffer...
I'm sorry, but I can't reproduce this. What M-x functions do you need Emacs state for? And why do you rebind `viper-escape-to-emacs' from \ to \\? Please provide more details. :) Anyway, a quick workaround: C-z toggles Emacs state indefinitely. When you are done running the necessary commands, press C-z to go back to vi state again. Vegard _________________________________________________________________ Windows Live™ Mail. Flere kontoer på ett sted. http://download.live.com/wlmail
Thanks for the quick reply! On 04/01/2010 02:55 PM, Vegard Øye wrote:
Date: Thu, 1 Apr 2010 14:06:14 +0200 From: [email protected]
Hello,
with the new vimpulse, I have a problem escaping back to emacs mode. I need this option to run some traditional 'M-x' functions. Up to now I used:
(define-key viper-vi-global-user-map (kbd "\\\\") 'viper-escape-to-emacs)
Unfortunately, this does not work anymore, as using M(Esc) for the next command cancels this escape and inserts the second of the backslash into the buffer...
I'm sorry, but I can't reproduce this. What M-x functions do you need Emacs state for? And why do you rebind `viper-escape-to-emacs' from \ to \\? Please provide more details. :) I need it for functions like to include entries in the bibtex-file and e.g. replacing strings in a file. I rebind it, as I have some other keybindings to \t, \e , \] and \,
Anyway, a quick workaround: C-z toggles Emacs state indefinitely. When you are done running the necessary commands, press C-z to go back to vi state again.
Yes, I know this, but that's not really comfortable. Regards! Fabian
Date: Thu, 1 Apr 2010 15:04:07 +0200 From: [email protected]
(define-key viper-vi-global-user-map (kbd "\\\\") 'viper-escape-to-emacs)
Unfortunately, this does not work anymore, as using M(Esc) for the next command cancels this escape and inserts the second of the backslash into the buffer...
I'm sorry, but I can't reproduce this. What M-x functions do you need Emacs state for? And why do you rebind `viper-escape-to-emacs' from \ to \\? Please provide more details. :)
I need it for functions like to include entries in the bibtex-file and e.g. replacing strings in a file. I rebind it, as I have some other keybindings to \t, \e , \] and \,
Right. What are the precise keystrokes (M-x view-lossage)? What does your .emacs file look like (position of the line above)? What version of Emacs are you using? I can't help you before I observe the same behavior in my own editor. By the way, Emacs' M-% (`query-replace') and M-x replace-regexp both work fine in vi state for me. Am I missing something? Vegard _________________________________________________________________ Nye Windows 7: PCen som passer for deg. Finn ut mer. http://windows.microsoft.com/shop
On 04/01/2010 03:25 PM, Vegard Øye wrote:
Date: Thu, 1 Apr 2010 15:04:07 +0200 From: [email protected]
(define-key viper-vi-global-user-map (kbd "\\\\") 'viper-escape-to-emacs)
Unfortunately, this does not work anymore, as using M(Esc) for the next command cancels this escape and inserts the second of the backslash into the buffer... I'm sorry, but I can't reproduce this. What M-x functions do you need Emacs state for? And why do you rebind `viper-escape-to-emacs' from \ to \\? Please provide more details. :) I need it for functions like to include entries in the bibtex-file and e.g. replacing strings in a file. I rebind it, as I have some other keybindings to \t, \e , \] and \,
Right. What are the precise keystrokes (M-x view-lossage)? What does your .emacs file look like (position of the line above)? What version of Emacs are you using? I can't help you before I observe the same behavior in my own editor.
Currently, I have this, which should affect vim/viper/vimpluse... in my .emacs: (require 'redo) (require 'rect-mark) (setq viper-mode t) ; enable Viper at load time (setq viper-ex-style-editing nil) ; can backspace past start of insert / line (require 'viper) ; load Viper ;(setq vimpulse-experimental nil) ; don't load bleeding edge code (see 6. installation instruction) (require 'vimpulse) ; load Vimpulse (setq woman-use-own-frame nil) ; don't create new frame for manpages (setq woman-use-topic-at-point t) ; don't prompt upon K key (manpage display) (require 'rect) (defun my-sequence-rectangle (first incr format) "Insert increasing numbers at beginning of each line." (interactive (list (if current-prefix-arg (prefix-numeric-value current-prefix-arg) (string-to-number (read-string "Start value: (0) " nil nil "0"))) (string-to-number (read-string "Increment: (1) " nil nil "1")) (read-string "Format: (%d) "))) (when (= (length format) 0) (setq format "%d")) (apply-on-rectangle (lambda (start-col end-col count-var) (move-to-column start-col) (insert (format format (eval count-var))) (set count-var (+ (eval count-var) incr))) (region-beginning) (region-end) 'first) (vimpulse-visual-mode -1)) ;(load "vimpulseext") ;(defmacro vimpulse-region-command (function) ; `(lambda () ; (interactive) ; (,function (vimpulse-get-vs-start) (vimpulse-get-vs-end)) ; (vimpulse-visual-mode nil))) ;(define-key viper-vi-global-user-map "\\\]" (vimpulse-region-command comment-region)) ;//(define-key viper-vi-global-user-map "\\," (vimpulse-region-command uncomment-region)) (vimpulse-vmap (kbd "M-%") 'query-replace) ;; (define-key viper-vi-global-user-map (kbd "\\\]") 'comment-region) ;; (define-key viper-vi-global-user-map (kbd "\\,") 'uncomment-region) (vimpulse-vmap (kbd "\\\]") 'comment-region) (vimpulse-vmap (kbd "\\,") 'uncomment-region) (vimpulse-vmap (kbd "M-n") 'my-sequence-rectangle) (vimpulse-vmap (kbd "G") 'end-of-buffer) (vimpulse-map (kbd "\\\\") 'viper-escape-to-emacs) (define-key viper-vi-global-user-map (kbd "\\\\") 'viper-escape-to-emacs) (define-key ctl-x-map "r\C-@" 'rm-set-mark) (define-key ctl-x-map [?r ?\C-\ ] 'rm-set-mark) (define-key ctl-x-map "r\C-x" 'rm-exchange-point-and-mark) (define-key ctl-x-map "r\C-w" 'rm-kill-region) (define-key ctl-x-map "r\M-w" 'rm-kill-ring-save) (define-key global-map [S-down-mouse-1] 'rm-mouse-drag-region) (define-key viper-vi-global-user-map (kbd "qq") 'fill-paragraph) (define-key viper-vi-global-user-map (kbd "qr") 'fill-region) (define-key viper-vi-global-user-map (kbd "C-h") 'tabbar-backward-tab) (define-key viper-vi-global-user-map (kbd "C-l") 'tabbar-forward-tab) ;(define-key viper-vi-global-user-map (kbd "\C-t\C-t") 'align-dwim) (define-key viper-vi-global-user-map (kbd "\\x") 'xterm) ;(define-key viper-vi-global-user-map (kbd "\\x") 'xterm_python) (define-key viper-vi-global-user-map (kbd "\\C") 'log-edit-done) (define-key viper-vi-global-user-map (kbd "\\c") 'cvs-update) ;(global-set-key [f12] '(lambda () (define-key viper-vi-global-user-map (kbd "\\c") '(lambda () (interactive) (cvs-examine (file-name-directory (buffer-file-name)) '("-d" "-P")))) (define-key viper-vi-global-user-map (kbd "\\T") 'align) (define-key viper-vi-global-user-map (kbd "\\i") 'ispell-word) (define-key viper-vi-global-user-map (kbd "\\I") 'ispell-change-dictionary) (define-key viper-vi-global-user-map (kbd "\\e") 'flyspell-mode) (define-key viper-vi-global-user-map (kbd "\\l") 'org-export-region-as-latex) (define-key viper-vi-global-user-map (kbd "\\L") 'org-export-as-latex) (define-key viper-vi-global-user-map (kbd "\\h") 'org-export-region-as-html) (define-key viper-vi-global-user-map (kbd "\\H") 'org-export-as-html) (define-key viper-vi-global-user-map (kbd "\\f") 'make-frame) (define-key viper-vi-global-user-map (kbd "\\F") 'find-file-at-point) (define-key viper-vi-global-user-map (kbd "\\t") 'my-toggle-window-state) (define-key viper-vi-global-user-map (kbd "\\r") 'org-export-region-as-html) (define-key viper-vi-global-user-map (kbd "\\d") 'dired-jump) (define-key viper-vi-global-user-map (kbd "\\D") 'dired-jump-other-window) (define-key viper-vi-global-user-map (kbd "\\b") 'bibtex_pfm_move) (define-key viper-vi-global-user-map (kbd "\\?1") 'my-toggle-window-state) (define-key viper-vi-global-user-map (kbd "C-l") 'preview-at-point) (global-set-key (kbd "C-c p") 'preview-at-point) (define-key viper-vi-global-user-map (kbd "\\S") 'allout-show-all) (define-key viper-vi-global-user-map (kbd "\\s") 'allout-show-current-entry) (define-key viper-vi-global-user-map (kbd "C-p") 'outline-previous-visible-heading) (define-key viper-vi-global-user-map (kbd "C-n") 'outline-next-visible-heading) (define-key viper-vi-global-user-map (kbd "C-e") 'org-export) I am using GNU Emacs 23.1.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.16.1) on kubuntu/karmic. The problem arises with any function, I have to call with M-x (btw I have to use 'Escape' for M as I have a lot of Alt-keybindings for my window manager).
By the way, Emacs' M-% (`query-replace') and M-x replace-regexp both work fine in vi state for me. Am I missing something?
As mentioned above... I have to use Esc. Fabian
Hi again, Fabian! I /think/ I fixed the problem in the latest revision. Would you please check it out and report if there's any difference? :) Vegard _________________________________________________________________ Windows 7: Se direkte-TV fra den bærbare PCen. Finn ut mer. http://windows.microsoft.com/windows-7
Hi Vegard, yes, you did... works nice! Thanks a lot! Fabian On 04/01/2010 07:44 PM, Vegard Øye wrote:
Hi again, Fabian!
I /think/ I fixed the problem in the latest revision. Would you please check it out and report if there's any difference? :)
Vegard _________________________________________________________________ Windows 7: Se direkte-TV fra den bærbare PCen. Finn ut mer. http://windows.microsoft.com/windows-7 _______________________________________________ implementations-list mailing list [email protected] https://lists.ourproject.org/cgi-bin/mailman/listinfo/implementations-list
Fabian Braennstroem <f.braennstroem <at> gmx.de> writes:
Hi Vegard,
yes, you did... works nice! Thanks a lot!
Fabian On 04/01/2010 07:44 PM, Vegard ?ye wrote:
Hi again, Fabian!
I /think/ I fixed the problem in the latest revision. Would you please check it out and report if there's any difference? :)
Vegard _________________________________________________________________ Windows 7: Se direkte-TV fra den b?rbare PCen. Finn ut mer. http://windows.microsoft.com/windows-7 _______________________________________________ implementations-list mailing list implementations-list at lists.ourproject.org https://lists.ourproject.org/cgi-bin/mailman/listinfo/implementations-list
Hi Vegard, I am using vimpluse 0.5, there are some custom mapping on my emacs (on windows/work machine) for copy/paste (yank) so to faciliate my work flow from different windows apps, binding them through autohotkey. so the question is switching to emacs mode through C-z, my own settings are gone, some thoughts to address this issue? thanks, here are my mappings: (global-set-key (kbd "C-v") 'yank) ;; remap ctrl-v to paste the other issue is that I mapped C-h to back delete, and map help to my 'menu key+h', is there another good map for back-delete? thanks (global-set-key [(control h)] 'delete-backward-char) (global-set-key [(hyper h)] 'help-command) Best regards, Isaac
Isaac <ip <at> cbmny.us> writes:
(global-set-key (kbd "C-v") 'yank) ;; remap ctrl-v to paste
I got a work around in autohotkey, to remap my middle mouse click from
sending
C-V to send C-y if the the current window is emacs, so far it seems works fine.
Hello, I am still trying to remap c-z (to make it undo, but use C-\ for toggling), any suggestions to do it efficiently? my try doesn't work :( ;(vimpulse-imap (kbd "C-\\") 'viper-exit-insert-state) ;(vimpulse-map (kbd "C-\\") 'viper-toggle-key-acton) thanks
On 2011-04-22 20:36 +0200, Isaac wrote:
Hello, I am still trying to remap c-z (to make it undo, but use C-\ for toggling), any suggestions to do it efficiently?
For "ESC" and "C-z", Viper defines a set of "intercept maps" which have precedence over all other maps. This should do what you want: (define-key viper-vi-intercept-map "\C-\\" 'viper-toggle-key-action) (define-key viper-vi-intercept-map "\C-z" 'undo-tree-undo) (define-key viper-emacs-intercept-map "\C-\\" 'viper-change-state-to-vi) (define-key viper-emacs-intercept-map "\C-z" 'undo-tree-undo) -- Vegard
Vegard Øye <vegard_oye <at> hotmail.com> writes:
On 2011-04-22 20:36 +0200, Isaac wrote:
Hello, I am still trying to remap c-z (to make it undo, but use C-\ for toggling), any suggestions to do it efficiently?
For "ESC" and "C-z", Viper defines a set of "intercept maps" which have precedence over all other maps. This should do what you want:
(define-key viper-vi-intercept-map "\C-\\" 'viper-toggle-key-action) (define-key viper-vi-intercept-map "\C-z" 'undo-tree-undo) (define-key viper-emacs-intercept-map "\C-\\" 'viper-change-state-to-vi) (define-key viper-emacs-intercept-map "\C-z" 'undo-tree-undo)
Hi Vegard, this resolved the issue that I have, thanks! I just added two additional lines (vimpulse-imap "\C-z" 'undo-tree-undo) (vimpulse-imap "\C-\\" 'viper-change-state-to-vi) so that in the vimpulse insert mode they are also mapped correctedly. Best regards, Isaac
participants (3)
-
Fabian Braennstroem -
Isaac -
Vegard Øye