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