annotate lisp/emulation/viper-keym.el @ 87272:3cad137a4fe8

revert-buffer docstring fix
author Vinicius Jose Latorre <viniciusjl@ig.com.br>
date Wed, 12 Dec 2007 11:25:21 +0000
parents 696a6b8decff
children 107ccd98fa12 53108e6cea98
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14233
396316e5fbe6 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1 ;;; viper-keym.el --- Viper keymaps
13337
84acc3adcd63 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 12696
diff changeset
2
64701
34bd8e434dd7 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64215
diff changeset
3 ;; Copyright (C) 1994, 1995, 1996, 1997, 2000, 2001, 2002, 2003, 2004,
75346
7a3f13e2dd57 Add 2007 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 73740
diff changeset
4 ;; 2005, 2006, 2007 Free Software Foundation, Inc.
11288
d1f620273acb Add copyright.
Karl Heuer <kwzh@gnu.org>
parents: 10789
diff changeset
5
42602
633233bf2bbf 2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 39215
diff changeset
6 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
39215
8dccf2552307 2001-09-09 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 38514
diff changeset
7
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
9
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
78218
ac0efac52065 Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents: 75389
diff changeset
12 ;; the Free Software Foundation; either version 3, or (at your option)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
13 ;; any later version.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
14
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
18 ;; GNU General Public License for more details.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
19
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
64085
18a818a2ee7c Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 62963
diff changeset
22 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18a818a2ee7c Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 62963
diff changeset
23 ;; Boston, MA 02110-1301, USA.
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
24
38414
67b464da13ec Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 26263
diff changeset
25 ;;; Commentary:
67b464da13ec Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 26263
diff changeset
26
67b464da13ec Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 26263
diff changeset
27 ;;; Code:
14909
7ff1df13b124 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14581
diff changeset
28
18047
1b06411ccc04 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16766
diff changeset
29 ;; compiler pacifier
18289
3a43376db2be new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18172
diff changeset
30 (defvar viper-always)
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
31 (defvar viper-current-state)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
32 (defvar viper-mode-string)
18839
1405083241e8 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18289
diff changeset
33 (defvar viper-expert-level)
19462
a3240ad2e954 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 19079
diff changeset
34 (defvar viper-ex-style-editing)
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
35 (defvar viper-ex-style-motion)
18047
1b06411ccc04 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16766
diff changeset
36 ;; end pacifier
1b06411ccc04 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16766
diff changeset
37
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
38 (require 'viper-util)
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
39
86247
fc93e9674475 * progmodes/python.el (info-lookup-maybe-add-help):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 84906
diff changeset
40 (declare-function viper-ex "viper-ex" (arg &optional string))
fc93e9674475 * progmodes/python.el (info-lookup-maybe-add-help):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 84906
diff changeset
41 (declare-function viper-normalize-minor-mode-map-alist "viper-cmd" ())
fc93e9674475 * progmodes/python.el (info-lookup-maybe-add-help):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 84906
diff changeset
42 (declare-function viper-set-mode-vars-for "viper-cmd" (state))
18047
1b06411ccc04 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16766
diff changeset
43
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
44 ;;; Variables
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
45
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 42602
diff changeset
46
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 42602
diff changeset
47 ;;; Emacs keys in other states.
18047
1b06411ccc04 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16766
diff changeset
48
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
49 (defcustom viper-want-emacs-keys-in-insert t
18047
1b06411ccc04 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16766
diff changeset
50 "*Set to nil if you want complete Vi compatibility in insert mode.
18839
1405083241e8 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18289
diff changeset
51 Complete compatibility with Vi is not recommended for power use of Viper."
1405083241e8 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18289
diff changeset
52 :type 'boolean
1405083241e8 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18289
diff changeset
53 :group 'viper)
18047
1b06411ccc04 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16766
diff changeset
54
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
55 (defcustom viper-want-emacs-keys-in-vi t
18047
1b06411ccc04 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16766
diff changeset
56 "*Set to nil if you want complete Vi compatibility in Vi mode.
18839
1405083241e8 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18289
diff changeset
57 Full Vi compatibility is not recommended for power use of Viper."
1405083241e8 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18289
diff changeset
58 :type 'boolean
1405083241e8 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18289
diff changeset
59 :group 'viper)
18047
1b06411ccc04 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16766
diff changeset
60
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
61 (defcustom viper-no-multiple-ESC t
18047
1b06411ccc04 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16766
diff changeset
62 "*If true, multiple ESC in Vi mode will cause bell to ring.
1b06411ccc04 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16766
diff changeset
63 This is set to t on a windowing terminal and to 'twice on a dumb
26263
4f315ca65976 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 21940
diff changeset
64 terminal (unless the user level is 1, 2, or 5). On a dumb terminal, this
18047
1b06411ccc04 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16766
diff changeset
65 enables cursor keys and is generally more convenient, as terminals usually
1b06411ccc04 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16766
diff changeset
66 don't have a convenient Meta key.
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
67 Setting viper-no-multiple-ESC to nil will allow as many multiple ESC,
18839
1405083241e8 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18289
diff changeset
68 as is allowed by the major mode in effect."
1405083241e8 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18289
diff changeset
69 :type 'boolean
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 42602
diff changeset
70 :group 'viper)
18047
1b06411ccc04 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16766
diff changeset
71
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
72 (defcustom viper-want-ctl-h-help nil
19891
f20c96ca3bc8 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 19863
diff changeset
73 "*If non-nil, C-h gets bound to help-command; otherwise, C-h gets the usual Vi bindings."
18839
1405083241e8 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18289
diff changeset
74 :type 'boolean
1405083241e8 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18289
diff changeset
75 :group 'viper)
16136
de1340e6ddb4 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14909
diff changeset
76
de1340e6ddb4 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14909
diff changeset
77
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
78 ;;; Keymaps
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
79
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
80 ;; Keymaps for vital things like \e and C-z.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
81 ;; Not for users
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
82 (defvar viper-vi-intercept-map (make-sparse-keymap))
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
83 (defvar viper-insert-intercept-map (make-sparse-keymap))
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
84 (defvar viper-emacs-intercept-map (make-sparse-keymap))
12696
dbbeba770da4 (vip-overriding-map): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12140
diff changeset
85
14233
396316e5fbe6 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
86 ;; keymap used to zap all keymaps other than function-key-map,
396316e5fbe6 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
87 ;; device-function-key-map, etc.
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
88 (defvar viper-overriding-map (make-sparse-keymap))
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 42602
diff changeset
89
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
90 (viper-deflocalvar viper-vi-local-user-map (make-sparse-keymap)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
91 "Keymap for user-defined local bindings.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
92 Useful for changing bindings such as ZZ in certain major modes.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
93 For instance, in letter-mode, one may want to bind ZZ to
26263
4f315ca65976 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 21940
diff changeset
94 mh-send-letter. In a newsreader such as gnus, tin, or rn, ZZ could be bound
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
95 to save-buffers-kill-emacs then post article, etc.")
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 42602
diff changeset
96 (put 'viper-vi-local-user-map 'permanent-local t)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
97
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
98 (defvar viper-vi-global-user-map (make-sparse-keymap)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
99 "Keymap for user-defined global bindings.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
100 These bindings are seen in all Viper buffers.")
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
101
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
102 (defvar viper-vi-basic-map (make-keymap)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
103 "This is the main keymap in effect in Viper's Vi state.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
104 This map is global, shared by all buffers.")
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
105
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
106 (defvar viper-vi-kbd-map (make-sparse-keymap)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
107 "This keymap keeps keyboard macros defined via the :map command.")
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
108
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
109 (defvar viper-vi-diehard-map (make-sparse-keymap)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
110 "This keymap is in use when the user asks Viper to simulate Vi very closely.
26263
4f315ca65976 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 21940
diff changeset
111 This happens when viper-expert-level is 1 or 2. See viper-set-expert-level.")
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 42602
diff changeset
112
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
113
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
114 (viper-deflocalvar viper-insert-local-user-map (make-sparse-keymap)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
115 "Auxiliary map for per-buffer user-defined keybindings in Insert state.")
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 42602
diff changeset
116 (put 'viper-insert-local-user-map 'permanent-local t)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
117
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
118 (defvar viper-insert-global-user-map (make-sparse-keymap)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
119 "Auxiliary map for global user-defined bindings in Insert state.")
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
120
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
121 (defvar viper-insert-basic-map (make-sparse-keymap)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
122 "The basic insert-mode keymap.")
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
123
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
124 (defvar viper-insert-diehard-map (make-keymap)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
125 "Map used when user wants vi-style keys in insert mode.
26263
4f315ca65976 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 21940
diff changeset
126 Most of the Emacs keys are suppressed. This map overshadows
4f315ca65976 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 21940
diff changeset
127 viper-insert-basic-map. Not recommended, except for novice users.")
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
128
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
129 (defvar viper-insert-kbd-map (make-sparse-keymap)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
130 "This keymap keeps VI-style kbd macros for insert mode.")
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
131
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
132 (defvar viper-replace-map (make-sparse-keymap)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
133 "Map used in Viper's replace state.")
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 42602
diff changeset
134
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
135 (defvar viper-emacs-global-user-map (make-sparse-keymap)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
136 "Auxiliary map for global user-defined bindings in Emacs state.")
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
137
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
138 (defvar viper-emacs-kbd-map (make-sparse-keymap)
73740
e4023799fd63 (viper-emacs-kbd-map, viper-toggle-key): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents: 68648
diff changeset
139 "This keymap keeps Vi-style kbd macros for Emacs mode.")
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 42602
diff changeset
140
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
141 (viper-deflocalvar viper-emacs-local-user-map (make-sparse-keymap)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
142 "Auxiliary map for local user-defined bindings in Emacs state.")
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 42602
diff changeset
143 (put 'viper-emacs-local-user-map 'permanent-local t)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
144
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
145 ;; This keymap should stay empty
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
146 (defvar viper-empty-keymap (make-sparse-keymap))
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
147
12140
75379a19c5d5 Changed vip-*-frame-* to *-frame-*, incorporated overlay strings,
Karl Heuer <kwzh@gnu.org>
parents: 11288
diff changeset
148 ;; This was the main Vi mode in old versions of VIP which may have been
26263
4f315ca65976 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 21940
diff changeset
149 ;; extensively used by VIP users. We declare it as a global var
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
150 ;; and, after .viper is loaded, we add this keymap to viper-vi-basic-map.
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
151 (defvar viper-mode-map (make-sparse-keymap))
12140
75379a19c5d5 Changed vip-*-frame-* to *-frame-*, incorporated overlay strings,
Karl Heuer <kwzh@gnu.org>
parents: 11288
diff changeset
152
64215
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
153 ;; Some important keys used in viper
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
154 (defcustom viper-toggle-key [(control ?z)] ; "\C-z"
73740
e4023799fd63 (viper-emacs-kbd-map, viper-toggle-key): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents: 68648
diff changeset
155 "The key used to change states from Emacs to Vi and back.
64215
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
156 In insert mode, this key also functions as Meta.
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
157
73740
e4023799fd63 (viper-emacs-kbd-map, viper-toggle-key): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents: 68648
diff changeset
158 Enter as a sexp. Examples: \"\\C-z\", [(control ?z)]."
64215
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
159 :type 'sexp
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
160 :group 'viper
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
161 :set (lambda (symbol value)
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
162 (let ((old-value (if (boundp 'viper-toggle-key)
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
163 viper-toggle-key
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
164 [(control ?z)])))
84906
afc4adbe0af6 (viper-toggle-key, viper-ESC-key): Use `mapc' rather than `mapcar'.
Juanma Barranquero <lekktu@gmail.com>
parents: 82140
diff changeset
165 (mapc
64215
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
166 (lambda (buf)
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
167 (save-excursion
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
168 (set-buffer buf)
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
169 (when (and (boundp 'viper-insert-basic-map)
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
170 (keymapp viper-insert-basic-map))
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
171 (when old-value
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
172 (define-key viper-insert-basic-map old-value nil))
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
173 (define-key viper-insert-basic-map value 'viper-escape-to-vi))
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
174 (when (and (boundp 'viper-vi-intercept-map)
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
175 (keymapp viper-vi-intercept-map))
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
176 (when old-value
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
177 (define-key viper-vi-intercept-map old-value nil))
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
178 (define-key
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
179 viper-vi-intercept-map value 'viper-toggle-key-action))
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
180 (when (and (boundp 'viper-emacs-intercept-map)
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
181 (keymapp viper-emacs-intercept-map))
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
182 (define-key viper-emacs-intercept-map old-value nil)
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
183 (define-key
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
184 viper-emacs-intercept-map value 'viper-change-state-to-vi))
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
185 ))
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
186 (buffer-list))
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
187 (set-default symbol value)
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
188 )))
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
189
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
190 (defcustom viper-quoted-insert-key "\C-v"
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
191 "The key used to quote special characters when inserting them in Insert state."
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
192 :type 'string
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
193 :group 'viper)
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
194
67116
e1bb7e4a4413 2005-11-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64701
diff changeset
195 (defcustom viper-ESC-key (if (viper-window-display-p) [(escape)] "\e")
64215
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
196 "Key used to ESC.
67116
e1bb7e4a4413 2005-11-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64701
diff changeset
197 Enter as a sexp. Examples: \"\\e\", [(escape)].
e1bb7e4a4413 2005-11-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64701
diff changeset
198 If running in a terminal, [(escape)] is not understood, so must use \"\\e\"."
64215
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
199 :type 'sexp
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
200 :group 'viper
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
201 :set (lambda (symbol value)
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
202 (let ((old-value (if (boundp 'viper-ESC-key)
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
203 viper-ESC-key
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
204 [(escape)])))
84906
afc4adbe0af6 (viper-toggle-key, viper-ESC-key): Use `mapc' rather than `mapcar'.
Juanma Barranquero <lekktu@gmail.com>
parents: 82140
diff changeset
205 (mapc
64215
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
206 (lambda (buf)
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
207 (save-excursion
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
208 (set-buffer buf)
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
209 (when (and (boundp 'viper-insert-intercept-map)
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
210 (keymapp viper-insert-intercept-map))
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
211 (when old-value
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
212 (define-key viper-insert-intercept-map old-value nil))
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
213 (define-key
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
214 viper-insert-intercept-map value 'viper-intercept-ESC-key))
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
215 (when (and (boundp 'viper-vi-intercept-map)
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
216 (keymapp viper-vi-intercept-map))
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
217 (when old-value
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
218 (define-key viper-vi-intercept-map old-value nil))
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
219 (define-key
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
220 viper-vi-intercept-map value 'viper-intercept-ESC-key))
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
221 ))
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
222 (buffer-list))
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
223 (set-default symbol value)
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
224 )))
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
225
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
226
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
227 ;;; Variables used by minor modes
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
228
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 42602
diff changeset
229 ;; Association list of the form
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
230 ;; ((major-mode . keymap) (major-mode . keymap) ...)
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
231 ;; Viper uses these keymaps to make user-requested adjustments
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
232 ;; to its Vi state in various major modes.")
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
233 (defvar viper-vi-state-modifier-alist nil)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
234
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 42602
diff changeset
235 ;; Association list of the form
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
236 ;; ((major-mode . keymap) (major-mode . keymap) ...)
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
237 ;; Viper uses these keymaps to make user-requested adjustments
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
238 ;; to its Insert state in various major modes.")
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
239 (defvar viper-insert-state-modifier-alist nil)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
240
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 42602
diff changeset
241 ;; Association list of the form
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
242 ;; ((major-mode . keymap) (major-mode . keymap) ...)
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
243 ;; Viper uses these keymaps to make user-requested adjustments
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
244 ;; to its Emacs state in various major modes.
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
245 (defvar viper-emacs-state-modifier-alist nil)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
246
64215
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
247 ;; The list of viper keymaps. Set by viper-normalize-minor-mode-map-alist
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
248 (viper-deflocalvar viper--key-maps nil)
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
249 (viper-deflocalvar viper--intercept-key-maps nil)
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
250
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
251 ;; Tells viper-add-local-keys to create a new viper-vi-local-user-map for new
26263
4f315ca65976 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 21940
diff changeset
252 ;; buffers. Not a user option.
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
253 (viper-deflocalvar viper-need-new-vi-local-map t "")
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
254 (put 'viper-need-new-vi-local-map 'permanent-local t)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
255
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
256 ;; Tells viper-add-local-keys to create a new viper-insert-local-user-map for
26263
4f315ca65976 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 21940
diff changeset
257 ;; new buffers. Not a user option.
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
258 (viper-deflocalvar viper-need-new-insert-local-map t "")
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
259 (put 'viper-need-new-insert-local-map 'permanent-local t)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
260
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
261 ;; Tells viper-add-local-keys to create a new viper-emacs-local-user-map for
26263
4f315ca65976 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 21940
diff changeset
262 ;; new buffers. Not a user option.
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
263 (viper-deflocalvar viper-need-new-emacs-local-map t "")
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
264 (put 'viper-need-new-emacs-local-map 'permanent-local t)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
265
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
266
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
267
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
268 ;; Insert mode keymap
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
269
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
270 ;; for novice users, pretend you are the real vi.
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
271 (define-key viper-insert-diehard-map "\t" 'viper-insert-tab)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
272 (define-key viper-insert-diehard-map "\C-a" 'self-insert-command)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
273 (define-key viper-insert-diehard-map "\C-b" 'self-insert-command)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
274 (define-key viper-insert-diehard-map "\C-c" 'viper-change-state-to-vi)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
275 (define-key viper-insert-diehard-map "\C-e" 'self-insert-command)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
276 (define-key viper-insert-diehard-map "\C-f" 'self-insert-command)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
277 (define-key viper-insert-diehard-map "\C-g" 'self-insert-command)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
278 (define-key viper-insert-diehard-map "\C-i" 'self-insert-command)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
279 (define-key viper-insert-diehard-map "\C-k" 'self-insert-command)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
280 (define-key viper-insert-diehard-map "\C-l" 'self-insert-command)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
281 (define-key viper-insert-diehard-map "\C-n" 'self-insert-command)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
282 (define-key viper-insert-diehard-map "\C-o" 'self-insert-command)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
283 (define-key viper-insert-diehard-map "\C-p" 'self-insert-command)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
284 (define-key viper-insert-diehard-map "\C-q" 'self-insert-command)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
285 (define-key viper-insert-diehard-map "\C-r" 'self-insert-command)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
286 (define-key viper-insert-diehard-map "\C-s" 'self-insert-command)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
287 (define-key viper-insert-diehard-map "\C-u" 'viper-erase-line)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
288 (define-key viper-insert-diehard-map "\C-x" 'self-insert-command)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
289 (define-key viper-insert-diehard-map "\C-y" 'self-insert-command)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
290 (define-key viper-insert-diehard-map "\C-z" 'self-insert-command)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
291 (define-key viper-insert-diehard-map "\C-]" 'self-insert-command)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
292 (define-key viper-insert-diehard-map "\C-_" 'self-insert-command)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
293
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
294 (let ((i ?\ ))
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
295 (while (<= i ?~)
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
296 (define-key viper-insert-diehard-map (make-string 1 i) 'self-insert-command)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
297 (setq i (1+ i))))
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
298
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
299 ;; Insert mode map when user wants emacs style
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
300 (define-key viper-insert-basic-map "\C-d" 'viper-backward-indent)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
301 (define-key viper-insert-basic-map "\C-w" 'viper-delete-backward-word)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
302 (define-key viper-insert-basic-map "\C-t" 'viper-forward-indent)
62963
fcacef2ed810 2005-06-03 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 62440
diff changeset
303 (define-key viper-insert-basic-map viper-quoted-insert-key 'quoted-insert)
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
304 (define-key viper-insert-basic-map "\C-?" 'viper-del-backward-char-in-insert)
19891
f20c96ca3bc8 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 19863
diff changeset
305 (define-key viper-insert-basic-map [backspace] 'viper-del-backward-char-in-insert)
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
306 (define-key viper-insert-basic-map "\C-\\" 'viper-alternate-Meta-key)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
307 (define-key viper-insert-basic-map viper-toggle-key 'viper-escape-to-vi)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
308 (define-key viper-insert-basic-map "\C-c\M-p"
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
309 'viper-insert-prev-from-insertion-ring)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
310 (define-key viper-insert-basic-map "\C-c\M-n"
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
311 'viper-insert-next-from-insertion-ring)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
312
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
313
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
314 ;; Replace keymap
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
315 (define-key viper-replace-map "\C-t" 'viper-forward-indent)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
316 (define-key viper-replace-map "\C-j" 'viper-replace-state-carriage-return)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
317 (define-key viper-replace-map "\C-m" 'viper-replace-state-carriage-return)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
318 (define-key viper-replace-map "\C-?" 'viper-del-backward-char-in-replace)
19891
f20c96ca3bc8 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 19863
diff changeset
319 (define-key viper-replace-map [backspace] 'viper-del-backward-char-in-replace)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
320
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
321
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
322
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
323 ;; Vi keymaps
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
324
26263
4f315ca65976 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 21940
diff changeset
325 (define-key viper-vi-basic-map "\C-^" (lambda ()
4f315ca65976 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 21940
diff changeset
326 (interactive) (viper-ex nil "e#")))
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
327 (define-key viper-vi-basic-map "\C-b" 'viper-scroll-screen-back)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
328 (define-key viper-vi-basic-map "\C-d" 'viper-scroll-up)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
329 (define-key viper-vi-basic-map "\C-e" 'viper-scroll-up-one)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
330 (define-key viper-vi-basic-map "\C-f" 'viper-scroll-screen)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
331 (define-key viper-vi-basic-map "\C-m" 'viper-next-line-at-bol)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
332 (define-key viper-vi-basic-map "\C-u" 'viper-scroll-down)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
333 (define-key viper-vi-basic-map "\C-y" 'viper-scroll-down-one)
81331
c3779fe5830e 2007-06-12 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 75389
diff changeset
334 ;;(define-key viper-vi-basic-map "\C-s" 'viper-isearch-forward)
c3779fe5830e 2007-06-12 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 75389
diff changeset
335 ;;(define-key viper-vi-basic-map "\C-r" 'viper-isearch-backward)
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
336 (define-key viper-vi-basic-map "\C-c/" 'viper-toggle-search-style)
26263
4f315ca65976 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 21940
diff changeset
337 (define-key viper-vi-basic-map "\C-c\C-g" 'viper-info-on-file)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
338
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
339 (define-key viper-vi-basic-map "\C-c\M-p" 'viper-prev-destructive-command)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
340 (define-key viper-vi-basic-map "\C-c\M-n" 'viper-next-destructive-command)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
341
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
342
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
343 (define-key viper-vi-basic-map " " 'viper-forward-char)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
344 (define-key viper-vi-basic-map "!" 'viper-command-argument)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
345 (define-key viper-vi-basic-map "\"" 'viper-command-argument)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
346 (define-key viper-vi-basic-map "#" 'viper-command-argument)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
347 (define-key viper-vi-basic-map "$" 'viper-goto-eol)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
348 (define-key viper-vi-basic-map "%" 'viper-paren-match)
26263
4f315ca65976 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 21940
diff changeset
349 (define-key viper-vi-basic-map "&" (lambda ()
4f315ca65976 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 21940
diff changeset
350 (interactive) (viper-ex nil "&")))
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
351 (define-key viper-vi-basic-map "'" 'viper-goto-mark-and-skip-white)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
352 (define-key viper-vi-basic-map "(" 'viper-backward-sentence)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
353 (define-key viper-vi-basic-map ")" 'viper-forward-sentence)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
354 (define-key viper-vi-basic-map "*" 'call-last-kbd-macro)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
355 (define-key viper-vi-basic-map "+" 'viper-next-line-at-bol)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
356 (define-key viper-vi-basic-map "," 'viper-repeat-find-opposite)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
357 (define-key viper-vi-basic-map "-" 'viper-previous-line-at-bol)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
358 (define-key viper-vi-basic-map "." 'viper-repeat)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
359 (define-key viper-vi-basic-map "/" 'viper-search-forward)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
360
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
361 (define-key viper-vi-basic-map "0" 'viper-beginning-of-line)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
362 (define-key viper-vi-basic-map "1" 'viper-digit-argument)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
363 (define-key viper-vi-basic-map "2" 'viper-digit-argument)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
364 (define-key viper-vi-basic-map "3" 'viper-digit-argument)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
365 (define-key viper-vi-basic-map "4" 'viper-digit-argument)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
366 (define-key viper-vi-basic-map "5" 'viper-digit-argument)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
367 (define-key viper-vi-basic-map "6" 'viper-digit-argument)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
368 (define-key viper-vi-basic-map "7" 'viper-digit-argument)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
369 (define-key viper-vi-basic-map "8" 'viper-digit-argument)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
370 (define-key viper-vi-basic-map "9" 'viper-digit-argument)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
371
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
372 (define-key viper-vi-basic-map ":" 'viper-ex)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
373 (define-key viper-vi-basic-map ";" 'viper-repeat-find)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
374 (define-key viper-vi-basic-map "<" 'viper-command-argument)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
375 (define-key viper-vi-basic-map "=" 'viper-command-argument)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
376 (define-key viper-vi-basic-map ">" 'viper-command-argument)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
377 (define-key viper-vi-basic-map "?" 'viper-search-backward)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
378 (define-key viper-vi-basic-map "@" 'viper-register-macro)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
379
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
380 (define-key viper-vi-basic-map "A" 'viper-Append)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
381 (define-key viper-vi-basic-map "B" 'viper-backward-Word)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
382 (define-key viper-vi-basic-map "C" 'viper-change-to-eol)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
383 (define-key viper-vi-basic-map "D" 'viper-kill-line)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
384 (define-key viper-vi-basic-map "E" 'viper-end-of-Word)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
385 (define-key viper-vi-basic-map "F" 'viper-find-char-backward)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
386 (define-key viper-vi-basic-map "G" 'viper-goto-line)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
387 (define-key viper-vi-basic-map "H" 'viper-window-top)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
388 (define-key viper-vi-basic-map "I" 'viper-Insert)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
389 (define-key viper-vi-basic-map "J" 'viper-join-lines)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
390 (define-key viper-vi-basic-map "K" 'viper-nil)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
391 (define-key viper-vi-basic-map "L" 'viper-window-bottom)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
392 (define-key viper-vi-basic-map "M" 'viper-window-middle)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
393 (define-key viper-vi-basic-map "N" 'viper-search-Next)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
394 (define-key viper-vi-basic-map "O" 'viper-Open-line)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
395 (define-key viper-vi-basic-map "P" 'viper-Put-back)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
396 (define-key viper-vi-basic-map "Q" 'viper-query-replace)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
397 (define-key viper-vi-basic-map "R" 'viper-overwrite)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
398 (define-key viper-vi-basic-map "S" 'viper-substitute-line)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
399 (define-key viper-vi-basic-map "T" 'viper-goto-char-backward)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
400 (define-key viper-vi-basic-map "U" 'viper-undo)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
401 (define-key viper-vi-basic-map "V" 'find-file-other-window)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
402 (define-key viper-vi-basic-map "W" 'viper-forward-Word)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
403 (define-key viper-vi-basic-map "X" 'viper-delete-backward-char)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
404 (define-key viper-vi-basic-map "Y" 'viper-yank-line)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
405 (define-key viper-vi-basic-map "ZZ" 'viper-save-kill-buffer)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
406
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
407 (define-key viper-vi-basic-map "\\" 'viper-escape-to-emacs)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
408 (define-key viper-vi-basic-map "[" 'viper-brac-function)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
409 (define-key viper-vi-basic-map "]" 'viper-ket-function)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
410 (define-key viper-vi-basic-map "\C-\\" 'viper-alternate-Meta-key)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
411 (define-key viper-vi-basic-map "^" 'viper-bol-and-skip-white)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
412 (define-key viper-vi-basic-map "`" 'viper-goto-mark)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
413
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
414 (define-key viper-vi-basic-map "a" 'viper-append)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
415 (define-key viper-vi-basic-map "b" 'viper-backward-word)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
416 (define-key viper-vi-basic-map "c" 'viper-command-argument)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
417 (define-key viper-vi-basic-map "d" 'viper-command-argument)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
418 (define-key viper-vi-basic-map "e" 'viper-end-of-word)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
419 (define-key viper-vi-basic-map "f" 'viper-find-char-forward)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
420 (define-key viper-vi-basic-map "g" 'viper-nil)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
421 (define-key viper-vi-basic-map "h" 'viper-backward-char)
19891
f20c96ca3bc8 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 19863
diff changeset
422 (define-key viper-vi-basic-map [backspace] 'viper-backward-char)
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
423 (define-key viper-vi-basic-map "i" 'viper-insert)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
424 (define-key viper-vi-basic-map "j" 'viper-next-line)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
425 (define-key viper-vi-basic-map "k" 'viper-previous-line)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
426 (define-key viper-vi-basic-map "l" 'viper-forward-char)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
427 (define-key viper-vi-basic-map "m" 'viper-mark-point)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
428 (define-key viper-vi-basic-map "n" 'viper-search-next)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
429 (define-key viper-vi-basic-map "o" 'viper-open-line)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
430 (define-key viper-vi-basic-map "p" 'viper-put-back)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
431 (define-key viper-vi-basic-map "q" 'viper-nil)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
432 (define-key viper-vi-basic-map "r" 'viper-replace-char)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
433 (define-key viper-vi-basic-map "s" 'viper-substitute)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
434 (define-key viper-vi-basic-map "t" 'viper-goto-char-forward)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
435 (define-key viper-vi-basic-map "u" 'viper-undo)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
436 (define-key viper-vi-basic-map "v" 'find-file)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
437 (define-key viper-vi-basic-map "\C-v" 'find-file-other-frame)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
438 (define-key viper-vi-basic-map "w" 'viper-forward-word)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
439 (define-key viper-vi-basic-map "x" 'viper-delete-char)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
440 (define-key viper-vi-basic-map "y" 'viper-command-argument)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
441 (define-key viper-vi-basic-map "zH" 'viper-line-to-top)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
442 (define-key viper-vi-basic-map "zM" 'viper-line-to-middle)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
443 (define-key viper-vi-basic-map "zL" 'viper-line-to-bottom)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
444 (define-key viper-vi-basic-map "z\C-m" 'viper-line-to-top)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
445 (define-key viper-vi-basic-map "z." 'viper-line-to-middle)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
446 (define-key viper-vi-basic-map "z-" 'viper-line-to-bottom)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
447
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
448 (define-key viper-vi-basic-map "{" 'viper-backward-paragraph)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
449 (define-key viper-vi-basic-map "|" 'viper-goto-col)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
450 (define-key viper-vi-basic-map "}" 'viper-forward-paragraph)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
451 (define-key viper-vi-basic-map "~" 'viper-toggle-case)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
452 (define-key viper-vi-basic-map "\C-?" 'viper-backward-char)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
453 (define-key viper-vi-basic-map "_" 'viper-nil)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
454
26263
4f315ca65976 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 21940
diff changeset
455 ;;; This is viper-vi-diehard-map. Used when viper-vi-diehard-minor-mode is on.
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
456
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
457 (define-key viper-vi-diehard-map "\C-a" 'viper-nil)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
458 (define-key viper-vi-diehard-map "\C-c" 'viper-nil)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
459 (define-key viper-vi-diehard-map "\C-g" 'viper-info-on-file)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
460 (define-key viper-vi-diehard-map "\C-i" 'viper-nil)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
461 (define-key viper-vi-diehard-map "\C-k" 'viper-nil)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
462 (define-key viper-vi-diehard-map "\C-l" 'redraw-display)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
463 (define-key viper-vi-diehard-map "\C-n" 'viper-next-line)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
464 (define-key viper-vi-diehard-map "\C-o" 'viper-nil)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
465 (define-key viper-vi-diehard-map "\C-p" 'viper-previous-line)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
466 (define-key viper-vi-diehard-map "\C-q" 'viper-nil)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
467 (define-key viper-vi-diehard-map "\C-r" 'redraw-display)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
468 (define-key viper-vi-diehard-map "\C-s" 'viper-nil)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
469 (define-key viper-vi-diehard-map "\C-t" 'viper-nil)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
470 (define-key viper-vi-diehard-map "\C-v" 'viper-nil)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
471 (define-key viper-vi-diehard-map "\C-w" 'viper-nil)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
472 (define-key viper-vi-diehard-map "@" 'viper-nil)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
473 (define-key viper-vi-diehard-map "_" 'viper-nil)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
474 (define-key viper-vi-diehard-map "*" 'viper-nil)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
475 (define-key viper-vi-diehard-map "#" 'viper-nil)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
476 (define-key viper-vi-diehard-map "\C-_" 'viper-nil)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
477 (define-key viper-vi-diehard-map "\C-]" 'viper-nil) ; This is actually tags.
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
478
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
479
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
480 ;;; Minibuffer keymap
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 42602
diff changeset
481
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
482
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
483 (defvar viper-minibuffer-map (make-sparse-keymap)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
484 "Keymap used to modify keys when Minibuffer is in Insert state.")
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 42602
diff changeset
485
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
486 (define-key viper-minibuffer-map "\C-m" 'viper-exit-minibuffer)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
487 (define-key viper-minibuffer-map "\C-j" 'viper-exit-minibuffer)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
488
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
489 ;; Map used to read Ex-style commands.
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
490 (defvar viper-ex-cmd-map (make-sparse-keymap))
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
491 (define-key viper-ex-cmd-map " " 'ex-cmd-read-exit)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
492 (define-key viper-ex-cmd-map "\t" 'ex-cmd-complete)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
493
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
494 ;; Keymap for reading file names in Ex-style commands.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
495 (defvar ex-read-filename-map (make-sparse-keymap))
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
496 (define-key ex-read-filename-map " " 'viper-complete-filename-or-exit)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
497 (define-key ex-read-filename-map "!" 'viper-handle-!)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
498
16136
de1340e6ddb4 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14909
diff changeset
499 ;; Some other maps
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
500 (defvar viper-slash-and-colon-map (make-sparse-keymap)
16136
de1340e6ddb4 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14909
diff changeset
501 "This map redefines `/' and `:' to behave as in Vi.
de1340e6ddb4 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14909
diff changeset
502 Useful in some modes, such as Gnus, MH, etc.")
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
503 (define-key viper-slash-and-colon-map ":" 'viper-ex)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
504 (define-key viper-slash-and-colon-map "/" 'viper-search-forward)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
505
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
506 (defvar viper-comint-mode-modifier-map (make-sparse-keymap)
16136
de1340e6ddb4 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14909
diff changeset
507 "This map modifies comint mode.")
38514
10482dd382e7 * viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 38414
diff changeset
508 (define-key viper-comint-mode-modifier-map "\C-m" 'viper-exec-key-in-emacs)
10482dd382e7 * viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 38414
diff changeset
509 (define-key viper-comint-mode-modifier-map "\C-d" 'viper-exec-key-in-emacs)
16136
de1340e6ddb4 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14909
diff changeset
510
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
511 (defvar viper-dired-modifier-map (make-sparse-keymap)
16136
de1340e6ddb4 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14909
diff changeset
512 "This map modifies Dired behavior.")
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
513 (define-key viper-dired-modifier-map ":" 'viper-ex)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
514 (define-key viper-dired-modifier-map "/" 'viper-search-forward)
16136
de1340e6ddb4 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14909
diff changeset
515
60168
d96e54250eea * viper-cmd.el (viper-prefix-commands): make into a defconst.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 52401
diff changeset
516 (defvar viper-gnus-modifier-map (make-sparse-keymap)
d96e54250eea * viper-cmd.el (viper-prefix-commands): make into a defconst.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 52401
diff changeset
517 "This map modifies Gnus behavior.")
d96e54250eea * viper-cmd.el (viper-prefix-commands): make into a defconst.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 52401
diff changeset
518 (define-key viper-gnus-modifier-map ":" 'viper-ex)
d96e54250eea * viper-cmd.el (viper-prefix-commands): make into a defconst.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 52401
diff changeset
519
16136
de1340e6ddb4 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14909
diff changeset
520
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
521
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
522 ;;; Code
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
523
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
524 (defun viper-add-local-keys (state alist)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
525 "Override some vi-state or insert-state bindings in the current buffer.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
526 The effect is seen in the current buffer only.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
527 Useful for customizing mailer buffers, gnus, etc.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
528 STATE is 'vi-state, 'insert-state, or 'emacs-state
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
529 ALIST is of the form ((key . func) (key . func) ...)
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
530 Normally, this would be called from a hook to a major mode or
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
531 on a per buffer basis.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
532 Usage:
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
533 (viper-add-local-keys state '((key-str . func) (key-str . func)...)) "
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 42602
diff changeset
534
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
535 (let (map)
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
536 (cond ((eq state 'vi-state)
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
537 (if viper-need-new-vi-local-map
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
538 (setq viper-vi-local-user-map (make-sparse-keymap)))
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
539 (setq viper-need-new-vi-local-map nil
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
540 map viper-vi-local-user-map))
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
541 ((eq state 'insert-state)
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
542 (if viper-need-new-insert-local-map
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
543 (setq viper-insert-local-user-map (make-sparse-keymap)))
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
544 (setq viper-need-new-insert-local-map nil
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
545 map viper-insert-local-user-map))
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
546 ((eq state 'emacs-state)
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
547 (if viper-need-new-emacs-local-map
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
548 (setq viper-emacs-local-user-map (make-sparse-keymap)))
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
549 (setq viper-need-new-emacs-local-map nil
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
550 map viper-emacs-local-user-map))
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 42602
diff changeset
551 (t
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
552 (error
26263
4f315ca65976 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 21940
diff changeset
553 "Invalid state in viper-add-local-keys: %S. Valid states: vi-state, insert-state or emacs-state" state)))
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
554
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
555 (viper-modify-keymap map alist)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
556 (viper-normalize-minor-mode-map-alist)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
557 (viper-set-mode-vars-for viper-current-state)))
14233
396316e5fbe6 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
558
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
559 (defun viper-zap-local-keys ()
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
560 "Unconditionally reset Viper viper-*-local-user-map's.
64215
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64085
diff changeset
561 Rarely useful, but if you made a mistake by switching to a mode that adds
16136
de1340e6ddb4 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14909
diff changeset
562 undesirable local keys, e.g., comint-mode, then this function can restore
de1340e6ddb4 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14909
diff changeset
563 sanity."
14233
396316e5fbe6 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
564 (interactive)
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
565 (setq viper-vi-local-user-map (make-sparse-keymap)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
566 viper-need-new-vi-local-map nil
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
567 viper-insert-local-user-map (make-sparse-keymap)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
568 viper-need-new-insert-local-map nil
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
569 viper-emacs-local-user-map (make-sparse-keymap)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
570 viper-need-new-emacs-local-map nil)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
571 (viper-normalize-minor-mode-map-alist))
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 42602
diff changeset
572
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
573
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
574 (defun viper-modify-major-mode (mode state keymap)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
575 "Modify key bindings in a major-mode in a Viper state using a keymap.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
576
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
577 If the default for a major mode is emacs-state, then modifications to this
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
578 major mode may not take effect until the buffer switches state to Vi,
26263
4f315ca65976 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 21940
diff changeset
579 Insert or Emacs. If this happens, add viper-change-state-to-emacs to this
4f315ca65976 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 21940
diff changeset
580 major mode's hook. If no such hook exists, you may have to put an advice on
4f315ca65976 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 21940
diff changeset
581 the function that invokes the major mode. See viper-set-hooks for hints.
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
582
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
583 The above needs not to be done for major modes that come up in Vi or Insert
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
584 state by default.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
585
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
586 Arguments: (major-mode viper-state keymap)"
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
587 (let ((alist
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
588 (cond ((eq state 'vi-state) 'viper-vi-state-modifier-alist)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
589 ((eq state 'insert-state) 'viper-insert-state-modifier-alist)
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
590 ((eq state 'emacs-state) 'viper-emacs-state-modifier-alist)))
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
591 elt)
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
592 (if (setq elt (assoc mode (eval alist)))
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
593 (set alist (delq elt (eval alist))))
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
594 (set alist (cons (cons mode keymap) (eval alist)))
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 42602
diff changeset
595
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
596 ;; Normalization usually doesn't help here, since one needs to
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
597 ;; normalize in the actual buffer where changes to the keymap are
26263
4f315ca65976 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 21940
diff changeset
598 ;; to take place. However, it doesn't hurt, and it helps whenever this
21940
f7e788ea680b new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 20206
diff changeset
599 ;; function is actually called from within the affected buffer.
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
600 (viper-normalize-minor-mode-map-alist)
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 42602
diff changeset
601
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
602 (viper-set-mode-vars-for viper-current-state)))
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
603
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 42602
diff changeset
604
12140
75379a19c5d5 Changed vip-*-frame-* to *-frame-*, incorporated overlay strings,
Karl Heuer <kwzh@gnu.org>
parents: 11288
diff changeset
605 ;; Displays variables that control Viper's keymaps
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
606 (defun viper-debug-keymaps ()
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
607 (interactive)
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
608 (with-output-to-temp-buffer " *viper-debug*"
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
609 (princ (format "Buffer name: %s\n\n" (buffer-name)))
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
610 (princ "Variables: \n")
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
611 (princ (format "major-mode: %S\n" major-mode))
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
612 (princ (format "viper-current-state: %S\n" viper-current-state))
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
613 (princ (format "viper-mode-string: %S\n\n" viper-mode-string))
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
614 (princ (format "viper-vi-intercept-minor-mode: %S\n"
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
615 viper-vi-intercept-minor-mode))
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
616 (princ (format "viper-insert-intercept-minor-mode: %S\n"
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
617 viper-insert-intercept-minor-mode))
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
618 (princ (format "viper-emacs-intercept-minor-mode: %S\n"
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
619 viper-emacs-intercept-minor-mode))
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
620 (princ (format "viper-vi-minibuffer-minor-mode: %S\n"
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
621 viper-vi-minibuffer-minor-mode))
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
622 (princ (format "viper-insert-minibuffer-minor-mode: %S\n\n"
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
623 viper-insert-minibuffer-minor-mode))
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
624 (princ (format "viper-vi-local-user-minor-mode: %S\n"
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
625 viper-vi-local-user-minor-mode))
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
626 (princ (format "viper-vi-global-user-minor-mode: %S\n"
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
627 viper-vi-global-user-minor-mode))
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
628 (princ (format "viper-vi-kbd-minor-mode: %S\n" viper-vi-kbd-minor-mode))
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
629 (princ (format "viper-vi-state-modifier-minor-mode: %S\n"
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
630 viper-vi-state-modifier-minor-mode))
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
631 (princ (format "viper-vi-diehard-minor-mode: %S\n"
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
632 viper-vi-diehard-minor-mode))
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
633 (princ (format "viper-vi-basic-minor-mode: %S\n" viper-vi-basic-minor-mode))
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
634 (princ (format "viper-replace-minor-mode: %S\n" viper-replace-minor-mode))
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
635 (princ (format "viper-insert-local-user-minor-mode: %S\n"
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
636 viper-insert-local-user-minor-mode))
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
637 (princ (format "viper-insert-global-user-minor-mode: %S\n"
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
638 viper-insert-global-user-minor-mode))
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
639 (princ (format "viper-insert-kbd-minor-mode: %S\n"
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 42602
diff changeset
640 viper-insert-kbd-minor-mode))
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
641 (princ (format "viper-insert-state-modifier-minor-mode: %S\n"
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
642 viper-insert-state-modifier-minor-mode))
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
643 (princ (format "viper-insert-diehard-minor-mode: %S\n"
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
644 viper-insert-diehard-minor-mode))
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
645 (princ (format "viper-insert-basic-minor-mode: %S\n"
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
646 viper-insert-basic-minor-mode))
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
647 (princ (format "viper-emacs-local-user-minor-mode: %S\n"
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
648 viper-emacs-local-user-minor-mode))
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
649 (princ (format "viper-emacs-kbd-minor-mode: %S\n"
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
650 viper-emacs-kbd-minor-mode))
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
651 (princ (format "viper-emacs-global-user-minor-mode: %S\n"
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
652 viper-emacs-global-user-minor-mode))
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
653 (princ (format "viper-emacs-state-modifier-minor-mode: %S\n"
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
654 viper-emacs-state-modifier-minor-mode))
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 42602
diff changeset
655
18839
1405083241e8 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18289
diff changeset
656 (princ (format "\nviper-expert-level %S\n" viper-expert-level))
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
657 (princ (format "viper-no-multiple-ESC %S\n" viper-no-multiple-ESC))
18289
3a43376db2be new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18172
diff changeset
658 (princ (format "viper-always %S\n" viper-always))
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
659 (princ (format "viper-ex-style-motion %S\n"
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
660 viper-ex-style-motion))
19462
a3240ad2e954 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 19079
diff changeset
661 (princ (format "viper-ex-style-editing %S\n"
a3240ad2e954 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 19079
diff changeset
662 viper-ex-style-editing))
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
663 (princ (format "viper-want-emacs-keys-in-vi %S\n"
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 42602
diff changeset
664 viper-want-emacs-keys-in-vi))
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
665 (princ (format "viper-want-emacs-keys-in-insert %S\n"
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 42602
diff changeset
666 viper-want-emacs-keys-in-insert))
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
667 (princ (format "viper-want-ctl-h-help %S\n" viper-want-ctl-h-help))
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 42602
diff changeset
668
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
669 (princ "\n\n\n")
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
670 (princ (format "Default value for minor-mode-map-alist: \n%S\n\n"
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
671 (default-value 'minor-mode-map-alist)))
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
672 (princ (format "Actual value for minor-mode-map-alist: \n%S\n"
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
673 minor-mode-map-alist))
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
674 ))
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 42602
diff changeset
675
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
676
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
677 ;;; Keymap utils
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 42602
diff changeset
678
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 42602
diff changeset
679 (defun viper-add-keymap (mapsrc mapdst)
26263
4f315ca65976 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 21940
diff changeset
680 "Add contents of mapsrc to mapdst. It is assumed that mapsrc is sparse."
42602
633233bf2bbf 2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 39215
diff changeset
681 (viper-cond-compile-for-xemacs-or-emacs
633233bf2bbf 2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 39215
diff changeset
682 ;; xemacs
633233bf2bbf 2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 39215
diff changeset
683 (map-keymap (lambda (key binding) (define-key mapdst key binding))
633233bf2bbf 2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 39215
diff changeset
684 mapsrc)
633233bf2bbf 2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 39215
diff changeset
685 ;; emacs
633233bf2bbf 2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 39215
diff changeset
686 (mapcar (lambda (p) (define-key mapdst (vector (car p)) (cdr p)))
633233bf2bbf 2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 39215
diff changeset
687 (cdr mapsrc))
633233bf2bbf 2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 39215
diff changeset
688 ))
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 42602
diff changeset
689
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
690 (defun viper-modify-keymap (map alist)
26263
4f315ca65976 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 21940
diff changeset
691 "Modifies MAP with bindings specified in the ALIST. The alist has the
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
692 form ((key . function) (key . function) ... )."
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 42602
diff changeset
693 (mapcar (lambda (p) (define-key map (eval (car p)) (cdr p)))
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
694 alist))
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
695
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
696
86980
696a6b8decff (top-level): Don't load viper-util when compiling. Move provide
Glenn Morris <rgm@gnu.org>
parents: 86520
diff changeset
697 (provide 'viper-keym)
696a6b8decff (top-level): Don't load viper-util when compiling. Move provide
Glenn Morris <rgm@gnu.org>
parents: 86520
diff changeset
698
696a6b8decff (top-level): Don't load viper-util when compiling. Move provide
Glenn Morris <rgm@gnu.org>
parents: 86520
diff changeset
699
18839
1405083241e8 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18289
diff changeset
700 ;;; Local Variables:
19079
dfbef8117c6a new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18839
diff changeset
701 ;;; eval: (put 'viper-deflocalvar 'lisp-indent-hook 'defun)
18839
1405083241e8 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18289
diff changeset
702 ;;; End:
1405083241e8 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18289
diff changeset
703
1405083241e8 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18289
diff changeset
704
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49598
diff changeset
705 ;;; arch-tag: 43af4b2f-0bea-400b-889e-221ebc00acb1
38414
67b464da13ec Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 26263
diff changeset
706 ;;; viper-keym.el ends here