comparison lisp/viper/viper-keym.el @ 14:9ee227acff29 r19-15b90

Import from CVS: tag r19-15b90
author cvs
date Mon, 13 Aug 2007 08:48:42 +0200
parents bcdc7deadc19
children 0293115a14e9
comparison
equal deleted inserted replaced
13:13c6d0aaafe5 14:9ee227acff29
18 ;; along with GNU Emacs; see the file COPYING. If not, write to the 18 ;; along with GNU Emacs; see the file COPYING. If not, write to the
19 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, 19 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 ;; Boston, MA 02111-1307, USA. 20 ;; Boston, MA 02111-1307, USA.
21 21
22 ;; Code 22 ;; Code
23
24 (provide 'viper-keym)
25
26 ;; compiler pacifier
27 (defvar vip-always)
28 (defvar vip-current-state)
29 (defvar vip-mode-string)
30 (defvar vip-expert-level)
31 (defvar vip-ex-style-editing-in-insert)
32 (defvar vip-ex-style-motion)
33
34 (eval-when-compile
35 (let ((load-path (cons "." load-path)))
36 (or (featurep 'viper-util)
37 (load "viper-util.el" nil nil 'nosuffix))
38 ))
39 ;; end pacifier
23 40
24 (require 'viper-util) 41 (require 'viper-util)
25 42
26 ;;; Variables 43 ;;; Variables
27 44
33 50
34 (defvar vip-ESC-key "\e" 51 (defvar vip-ESC-key "\e"
35 "Key used to ESC. 52 "Key used to ESC.
36 Must be set in .vip file or prior to loading Viper. 53 Must be set in .vip file or prior to loading Viper.
37 This setting cannot be changed interactively.") 54 This setting cannot be changed interactively.")
55
56 ;;; Emacs keys in other states.
57
58 (defvar vip-want-emacs-keys-in-insert t
59 "*Set to nil if you want complete Vi compatibility in insert mode.
60 Complete compatibility with Vi is not recommended for power use of Viper.")
61
62 (defvar vip-want-emacs-keys-in-vi t
63 "*Set to nil if you want complete Vi compatibility in Vi mode.
64 Full Vi compatibility is not recommended for power use of Viper.")
65
66 (defvar vip-no-multiple-ESC t
67 "*If true, multiple ESC in Vi mode will cause bell to ring.
68 This is set to t on a windowing terminal and to 'twice on a dumb
69 terminal (unless the user level is 1, 2, or 5). On a dumb terminal, this
70 enables cursor keys and is generally more convenient, as terminals usually
71 don't have a convenient Meta key.
72 Setting vip-no-multiple-ESC to nil will allow as many multiple ESC,
73 as is allowed by the major mode in effect.")
74
75 (defvar vip-want-ctl-h-help nil
76 "*If t then C-h is bound to help-command in insert mode, if nil then it is
77 bound to delete-backward-char.")
38 78
39 79
40 ;;; Keymaps 80 ;;; Keymaps
41 81
42 ;; Keymaps for vital things like \e and C-z. 82 ;; Keymaps for vital things like \e and C-z.
333 (define-key vip-vi-basic-map "|" 'vip-goto-col) 373 (define-key vip-vi-basic-map "|" 'vip-goto-col)
334 (define-key vip-vi-basic-map "}" 'vip-forward-paragraph) 374 (define-key vip-vi-basic-map "}" 'vip-forward-paragraph)
335 (define-key vip-vi-basic-map "~" 'vip-toggle-case) 375 (define-key vip-vi-basic-map "~" 'vip-toggle-case)
336 (define-key vip-vi-basic-map "\C-?" 'vip-backward-char) 376 (define-key vip-vi-basic-map "\C-?" 'vip-backward-char)
337 (define-key vip-vi-basic-map "_" 'vip-nil) 377 (define-key vip-vi-basic-map "_" 'vip-nil)
338 378
339 ;;; Escape from Emacs to Vi for one command 379 ;;; Escape from Emacs to Vi for one command
340 (global-set-key "\C-c\\" 'vip-escape-to-vi) ; everywhere 380 (global-set-key "\C-c\\" 'vip-escape-to-vi) ; everywhere
341 381
342 ;;; This is vip-vi-diehard-map. Used when vip-vi-diehard-minor-mode is on. 382 ;;; This is vip-vi-diehard-map. Used when vip-vi-diehard-minor-mode is on.
343 383
439 (vip-normalize-minor-mode-map-alist) 479 (vip-normalize-minor-mode-map-alist)
440 (vip-set-mode-vars-for vip-current-state))) 480 (vip-set-mode-vars-for vip-current-state)))
441 481
442 (defun vip-zap-local-keys () 482 (defun vip-zap-local-keys ()
443 "Unconditionally reset Viper vip-*-local-user-map's. 483 "Unconditionally reset Viper vip-*-local-user-map's.
444 Rarely useful, but if you made a mistake by switching to a mode that adds 484 Rarely useful, but if u made a mistake by switching to a mode that adds
445 undesirable local keys, e.g., comint-mode, then this function can restore 485 undesirable local keys, e.g., comint-mode, then this function can restore
446 sanity." 486 sanity."
447 (interactive) 487 (interactive)
448 (setq vip-vi-local-user-map (make-sparse-keymap) 488 (setq vip-vi-local-user-map (make-sparse-keymap)
449 vip-need-new-vi-local-map nil 489 vip-need-new-vi-local-map nil
577 (mapcar (function (lambda (p) 617 (mapcar (function (lambda (p)
578 (define-key map (eval (car p)) (cdr p)))) 618 (define-key map (eval (car p)) (cdr p))))
579 alist)) 619 alist))
580 620
581 621
582 (provide 'viper-keym)
583
584 ;;; viper-keym.el ends here 622 ;;; viper-keym.el ends here