1 ;;; viper-keym.el --- main Viper keymaps
3 ;; Copyright (C) 1994, 1995 Free Software Foundation, Inc.
5 ;; This file is part of GNU Emacs.
7 ;; GNU Emacs is free software; you can redistribute it and/or modify
8 ;; it under the terms of the GNU General Public License as published by
9 ;; the Free Software Foundation; either version 2, or (at your option)
12 ;; GNU Emacs is distributed in the hope that it will be useful,
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;; GNU General Public License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with GNU Emacs; see the file COPYING. If not, write to
19 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
28 ;; Keymaps for vital things like \e and C-z.
30 (defvar vip-vi-intercept-map
(make-sparse-keymap))
31 (defvar vip-insert-intercept-map
(make-sparse-keymap))
32 (defvar vip-emacs-intercept-map
(make-sparse-keymap))
34 ;; keymap used to zap all keymaps other than function-key-map,
35 ;; devide-function-key-map, etc.
36 (defvar vip-overriding-map
(make-sparse-keymap))
38 (vip-deflocalvar vip-vi-local-user-map
(make-sparse-keymap)
39 "Keymap for user-defined local bindings.
40 Useful for changing bindings such as ZZ in certain major modes.
41 For instance, in letter-mode, one may want to bind ZZ to
42 mh-send-letter. In a newsreader such as gnus, tin, or rn, ZZ could be bound
43 to save-buffers-kill-emacs then post article, etc.")
44 (put 'vip-vi-local-user-map
'permanent-local t
)
46 (defvar vip-vi-global-user-map
(make-sparse-keymap)
47 "Keymap for user-defined global bindings.
48 These bindings are seen in all Viper buffers.")
50 (defvar vip-vi-basic-map
(make-keymap)
51 "This is the main keymap in effect in Viper's Vi state.
52 This map is global, shared by all buffers.")
54 (defvar vip-vi-kbd-map
(make-sparse-keymap)
55 "This keymap keeps keyboard macros defined via the :map command.")
57 (defvar vip-vi-diehard-map
(make-sparse-keymap)
58 "This keymap is in use when the user asks Viper to simulate Vi very closely.
59 This happens when vip-expert-level is 1 or 2. See vip-set-expert-level.")
62 (vip-deflocalvar vip-insert-local-user-map
(make-sparse-keymap)
63 "Auxiliary map for per-buffer user-defined keybindings in Insert state.")
64 (put 'vip-insert-local-user-map
'permanent-local t
)
66 (defvar vip-insert-global-user-map
(make-sparse-keymap)
67 "Auxiliary map for global user-defined bindings in Insert state.")
69 (defvar vip-insert-basic-map
(make-sparse-keymap)
70 "The basic insert-mode keymap.")
72 (defvar vip-insert-diehard-map
(make-keymap)
73 "Map used when user wants vi-style keys in insert mode.
74 Most of the Emacs keys are suppressed. This map overshadows
75 vip-insert-basic-map. Not recommended, except for novice users.")
77 (defvar vip-insert-kbd-map
(make-sparse-keymap)
78 "This keymap keeps VI-style kbd macros for insert mode.")
80 (defvar vip-replace-map
(make-sparse-keymap)
81 "Map used in Viper's replace state.")
83 (defvar vip-emacs-global-user-map
(make-sparse-keymap)
84 "Auxiliary map for global user-defined bindings in Emacs state.")
86 (defvar vip-emacs-kbd-map
(make-sparse-keymap)
87 "This keymap keeps Vi-style kbd macros for emacs mode.")
89 (vip-deflocalvar vip-emacs-local-user-map
(make-sparse-keymap)
90 "Auxiliary map for local user-defined bindings in Emacs state.")
91 (put 'vip-emacs-local-user-map
'permanent-local t
)
93 ;; This keymap should stay empty
94 (defvar vip-empty-keymap
(make-sparse-keymap))
96 ;; This was the main Vi mode in old versions of VIP which may have been
97 ;; extensively used by VIP users. We declare it as a global var
98 ;; and, after .vip is loaded, we add this keymap to vip-vi-basic-map.
99 (defvar vip-mode-map
(make-sparse-keymap))
102 ;;; Variables used by minor modes
104 ;; Association list of the form
105 ;; ((major-mode . keymap) (major-mode . keymap) ...)
106 ;; Viper uses these keymaps to make user-requested adjustments
107 ;; to its Vi state in various major modes.")
108 (defvar vip-vi-state-modifier-alist nil
)
110 ;; Association list of the form
111 ;; ((major-mode . keymap) (major-mode . keymap) ...)
112 ;; Viper uses these keymaps to make user-requested adjustments
113 ;; to its Insert state in various major modes.")
114 (defvar vip-insert-state-modifier-alist nil
)
116 ;; Association list of the form
117 ;; ((major-mode . keymap) (major-mode . keymap) ...)
118 ;; Viper uses these keymaps to make user-requested adjustments
119 ;; to its Emacs state in various major modes.
120 (defvar vip-emacs-state-modifier-alist nil
)
122 ;; Tells vip-add-local-keys to create a new vip-vi-local-user-map for new
123 ;; buffers. Not a user option.
124 (vip-deflocalvar vip-need-new-vi-local-map t
"")
125 (put 'vip-need-new-vi-local-map
'permanent-local t
)
127 ;; Tells vip-add-local-keys to create a new vip-insert-local-user-map for new
128 ;; buffers. Not a user option.
129 (vip-deflocalvar vip-need-new-insert-local-map t
"")
130 (put 'vip-need-new-insert-local-map
'permanent-local t
)
132 ;; Tells vip-add-local-keys to create a new vip-emacs-local-user-map for new
133 ;; buffers. Not a user option.
134 (vip-deflocalvar vip-need-new-emacs-local-map t
"")
135 (put 'vip-need-new-emacs-local-map
'permanent-local t
)
139 ;; Insert mode keymap
141 ;; for novice users, pretend you are the real vi.
142 (define-key vip-insert-diehard-map
"\t" 'vip-insert-tab
)
143 (define-key vip-insert-diehard-map
"\C-a" 'self-insert-command
)
144 (define-key vip-insert-diehard-map
"\C-b" 'self-insert-command
)
145 (define-key vip-insert-diehard-map
"\C-c" 'vip-change-state-to-vi
)
146 (define-key vip-insert-diehard-map
"\C-e" 'self-insert-command
)
147 (define-key vip-insert-diehard-map
"\C-f" 'self-insert-command
)
148 (define-key vip-insert-diehard-map
"\C-g" 'self-insert-command
)
149 (define-key vip-insert-diehard-map
"\C-i" 'self-insert-command
)
150 (define-key vip-insert-diehard-map
"\C-k" 'self-insert-command
)
151 (define-key vip-insert-diehard-map
"\C-l" 'self-insert-command
)
152 (define-key vip-insert-diehard-map
"\C-n" 'self-insert-command
)
153 (define-key vip-insert-diehard-map
"\C-o" 'self-insert-command
)
154 (define-key vip-insert-diehard-map
"\C-p" 'self-insert-command
)
155 (define-key vip-insert-diehard-map
"\C-q" 'self-insert-command
)
156 (define-key vip-insert-diehard-map
"\C-r" 'self-insert-command
)
157 (define-key vip-insert-diehard-map
"\C-s" 'self-insert-command
)
158 (define-key vip-insert-diehard-map
"\C-u" 'vip-erase-line
)
159 (define-key vip-insert-diehard-map
"\C-x" 'self-insert-command
)
160 (define-key vip-insert-diehard-map
"\C-y" 'self-insert-command
)
161 (define-key vip-insert-diehard-map
"\C-z" 'self-insert-command
)
162 (define-key vip-insert-diehard-map
"\C-]" 'self-insert-command
)
163 (define-key vip-insert-diehard-map
"\C-_" 'self-insert-command
)
167 (define-key vip-insert-diehard-map
(make-string 1 i
) 'self-insert-command
)
170 ;; Insert mode map when user wants emacs style
171 (define-key vip-insert-basic-map
"\C-d" 'vip-backward-indent
)
172 (define-key vip-insert-basic-map
"\C-w" 'vip-delete-backward-word
)
173 (define-key vip-insert-basic-map
"\C-t" 'vip-forward-indent
)
174 (define-key vip-insert-basic-map
175 (if vip-xemacs-p
[(shift tab
)] [S-tab
]) 'vip-insert-tab
)
176 (define-key vip-insert-basic-map
"\C-v" 'quoted-insert
)
177 (define-key vip-insert-basic-map
"\C-?" 'vip-del-backward-char-in-insert
)
178 (define-key vip-insert-basic-map
"\C-c\M-p"
179 'vip-insert-prev-from-insertion-ring
)
180 (define-key vip-insert-basic-map
"\C-c\M-n"
181 'vip-insert-next-from-insertion-ring
)
185 (define-key vip-replace-map
"\C-t" 'vip-forward-indent
)
186 (define-key vip-replace-map
"\C-j" 'vip-replace-state-exit-cmd
)
187 (define-key vip-replace-map
"\C-m" 'vip-replace-state-exit-cmd
)
188 (define-key vip-replace-map
"\C-?" 'vip-del-backward-char-in-replace
)
194 (define-key vip-vi-basic-map
"\C-^"
195 (function (lambda () (interactive) (vip-ex "e#"))))
196 (define-key vip-vi-basic-map
"\C-b" 'vip-scroll-back
)
197 (define-key vip-vi-basic-map
"\C-d" 'vip-scroll-up
)
198 (define-key vip-vi-basic-map
"\C-e" 'vip-scroll-up-one
)
199 (define-key vip-vi-basic-map
"\C-f" 'vip-scroll
)
200 (define-key vip-vi-basic-map
"\C-m" 'vip-next-line-at-bol
)
201 (define-key vip-vi-basic-map
"\C-u" 'vip-scroll-down
)
202 (define-key vip-vi-basic-map
"\C-y" 'vip-scroll-down-one
)
203 (define-key vip-vi-basic-map
"\C-s" 'vip-isearch-forward
)
204 (define-key vip-vi-basic-map
"\C-r" 'vip-isearch-backward
)
205 ;(define-key vip-vi-basic-map "\C-\\" 'universal-argument)
206 (define-key vip-vi-basic-map
"\C-c/" 'vip-toggle-search-style
)
207 (define-key vip-vi-basic-map
"\C-cg" 'vip-info-on-file
)
209 (define-key vip-vi-basic-map
"\C-c\M-p" 'vip-prev-destructive-command
)
210 (define-key vip-vi-basic-map
"\C-c\M-n" 'vip-next-destructive-command
)
213 (define-key vip-vi-basic-map
" " 'vip-forward-char
)
214 (define-key vip-vi-basic-map
"!" 'vip-command-argument
)
215 (define-key vip-vi-basic-map
"\"" 'vip-command-argument
)
216 (define-key vip-vi-basic-map
"#" 'vip-command-argument
)
217 (define-key vip-vi-basic-map
"$" 'vip-goto-eol
)
218 (define-key vip-vi-basic-map
"%" 'vip-paren-match
)
219 (define-key vip-vi-basic-map
"&"
220 (function (lambda () (interactive) (vip-ex "&"))))
221 (define-key vip-vi-basic-map
"'" 'vip-goto-mark-and-skip-white
)
222 (define-key vip-vi-basic-map
"(" 'vip-backward-sentence
)
223 (define-key vip-vi-basic-map
")" 'vip-forward-sentence
)
224 (define-key vip-vi-basic-map
"*" 'call-last-kbd-macro
)
225 (define-key vip-vi-basic-map
"+" 'vip-next-line-at-bol
)
226 (define-key vip-vi-basic-map
"," 'vip-repeat-find-opposite
)
227 (define-key vip-vi-basic-map
"-" 'vip-previous-line-at-bol
)
228 (define-key vip-vi-basic-map
"." 'vip-repeat
)
229 (define-key vip-vi-basic-map
"/" 'vip-search-forward
)
231 (define-key vip-vi-basic-map
"0" 'vip-beginning-of-line
)
232 (define-key vip-vi-basic-map
"1" 'vip-digit-argument
)
233 (define-key vip-vi-basic-map
"2" 'vip-digit-argument
)
234 (define-key vip-vi-basic-map
"3" 'vip-digit-argument
)
235 (define-key vip-vi-basic-map
"4" 'vip-digit-argument
)
236 (define-key vip-vi-basic-map
"5" 'vip-digit-argument
)
237 (define-key vip-vi-basic-map
"6" 'vip-digit-argument
)
238 (define-key vip-vi-basic-map
"7" 'vip-digit-argument
)
239 (define-key vip-vi-basic-map
"8" 'vip-digit-argument
)
240 (define-key vip-vi-basic-map
"9" 'vip-digit-argument
)
242 (define-key vip-vi-basic-map
":" 'vip-ex
)
243 (define-key vip-vi-basic-map
";" 'vip-repeat-find
)
244 (define-key vip-vi-basic-map
"<" 'vip-command-argument
)
245 (define-key vip-vi-basic-map
"=" 'vip-command-argument
)
246 (define-key vip-vi-basic-map
">" 'vip-command-argument
)
247 (define-key vip-vi-basic-map
"?" 'vip-search-backward
)
248 (define-key vip-vi-basic-map
"@" 'vip-register-macro
)
250 (define-key vip-vi-basic-map
"A" 'vip-Append
)
251 (define-key vip-vi-basic-map
"B" 'vip-backward-Word
)
252 (define-key vip-vi-basic-map
"C" 'vip-change-to-eol
)
253 (define-key vip-vi-basic-map
"D" 'vip-kill-line
)
254 (define-key vip-vi-basic-map
"E" 'vip-end-of-Word
)
255 (define-key vip-vi-basic-map
"F" 'vip-find-char-backward
)
256 (define-key vip-vi-basic-map
"G" 'vip-goto-line
)
257 (define-key vip-vi-basic-map
"H" 'vip-window-top
)
258 (define-key vip-vi-basic-map
"I" 'vip-Insert
)
259 (define-key vip-vi-basic-map
"J" 'vip-join-lines
)
260 (define-key vip-vi-basic-map
"K" 'vip-nil
)
261 (define-key vip-vi-basic-map
"L" 'vip-window-bottom
)
262 (define-key vip-vi-basic-map
"M" 'vip-window-middle
)
263 (define-key vip-vi-basic-map
"N" 'vip-search-Next
)
264 (define-key vip-vi-basic-map
"O" 'vip-Open-line
)
265 (define-key vip-vi-basic-map
"P" 'vip-Put-back
)
266 (define-key vip-vi-basic-map
"Q" 'vip-query-replace
)
267 (define-key vip-vi-basic-map
"R" 'vip-overwrite
)
268 (define-key vip-vi-basic-map
"S" 'vip-substitute-line
)
269 (define-key vip-vi-basic-map
"T" 'vip-goto-char-backward
)
270 (define-key vip-vi-basic-map
"U" 'vip-undo
)
271 (define-key vip-vi-basic-map
"V" 'find-file-other-window
)
272 (define-key vip-vi-basic-map
"W" 'vip-forward-Word
)
273 (define-key vip-vi-basic-map
"X" 'vip-delete-backward-char
)
274 (define-key vip-vi-basic-map
"Y" 'vip-yank-line
)
275 (define-key vip-vi-basic-map
"ZZ" 'vip-save-kill-buffer
)
277 (define-key vip-vi-basic-map
"\\" 'vip-escape-to-emacs
)
278 (define-key vip-vi-basic-map
"[" 'vip-brac-function
)
279 (define-key vip-vi-basic-map
"]" 'vip-ket-function
)
280 (define-key vip-vi-basic-map
"_" 'vip-alternate-ESC
)
281 (define-key vip-vi-basic-map
"^" 'vip-bol-and-skip-white
)
282 (define-key vip-vi-basic-map
"`" 'vip-goto-mark
)
284 (define-key vip-vi-basic-map
"a" 'vip-append
)
285 (define-key vip-vi-basic-map
"b" 'vip-backward-word
)
286 (define-key vip-vi-basic-map
"c" 'vip-command-argument
)
287 (define-key vip-vi-basic-map
"d" 'vip-command-argument
)
288 (define-key vip-vi-basic-map
"e" 'vip-end-of-word
)
289 (define-key vip-vi-basic-map
"f" 'vip-find-char-forward
)
290 (define-key vip-vi-basic-map
"g" 'vip-nil
)
291 (define-key vip-vi-basic-map
"h" 'vip-backward-char
)
292 (define-key vip-vi-basic-map
"i" 'vip-insert
)
293 (define-key vip-vi-basic-map
"j" 'vip-next-line
)
294 (define-key vip-vi-basic-map
"k" 'vip-previous-line
)
295 (define-key vip-vi-basic-map
"l" 'vip-forward-char
)
296 (define-key vip-vi-basic-map
"m" 'vip-mark-point
)
297 (define-key vip-vi-basic-map
"n" 'vip-search-next
)
298 (define-key vip-vi-basic-map
"o" 'vip-open-line
)
299 (define-key vip-vi-basic-map
"p" 'vip-put-back
)
300 (define-key vip-vi-basic-map
"q" 'vip-nil
)
301 (define-key vip-vi-basic-map
"r" 'vip-replace-char
)
302 (define-key vip-vi-basic-map
"s" 'vip-substitute
)
303 (define-key vip-vi-basic-map
"t" 'vip-goto-char-forward
)
304 (define-key vip-vi-basic-map
"u" 'vip-undo
)
305 (define-key vip-vi-basic-map
"v" 'find-file
)
306 (define-key vip-vi-basic-map
"\C-v" 'find-file-other-frame
)
307 (define-key vip-vi-basic-map
"w" 'vip-forward-word
)
308 (define-key vip-vi-basic-map
"x" 'vip-delete-char
)
309 (define-key vip-vi-basic-map
"y" 'vip-command-argument
)
310 (define-key vip-vi-basic-map
"zH" 'vip-line-to-top
)
311 (define-key vip-vi-basic-map
"zM" 'vip-line-to-middle
)
312 (define-key vip-vi-basic-map
"zL" 'vip-line-to-bottom
)
313 (define-key vip-vi-basic-map
"z\C-m" 'vip-line-to-top
)
314 (define-key vip-vi-basic-map
"z." 'vip-line-to-middle
)
315 (define-key vip-vi-basic-map
"z-" 'vip-line-to-bottom
)
317 (define-key vip-vi-basic-map
"{" 'vip-backward-paragraph
)
318 (define-key vip-vi-basic-map
"|" 'vip-goto-col
)
319 (define-key vip-vi-basic-map
"}" 'vip-forward-paragraph
)
320 (define-key vip-vi-basic-map
"~" 'vip-toggle-case
)
321 (define-key vip-vi-basic-map
"\C-?" 'vip-backward-char
)
323 ;;; Escape from Emacs to Vi for one command
324 (global-set-key "\M-\C-z" 'vip-escape-to-vi
) ;; in emacs-state
326 ;;; This is vip-vi-diehard-map. Used when vip-vi-diehard-minor-mode is on.
328 (define-key vip-vi-diehard-map
"\C-a" 'vip-nil
)
329 (define-key vip-vi-diehard-map
"\C-c" 'vip-nil
)
330 (define-key vip-vi-diehard-map
"\C-g" 'vip-info-on-file
)
331 (define-key vip-vi-diehard-map
"\C-i" 'vip-nil
)
332 (define-key vip-vi-diehard-map
"\C-k" 'vip-nil
)
333 (define-key vip-vi-diehard-map
"\C-l" 'redraw-display
)
334 (define-key vip-vi-diehard-map
"\C-n" 'vip-next-line
)
335 (define-key vip-vi-diehard-map
"\C-o" 'vip-nil
)
336 (define-key vip-vi-diehard-map
"\C-p" 'vip-previous-line
)
337 (define-key vip-vi-diehard-map
"\C-q" 'vip-nil
)
338 (define-key vip-vi-diehard-map
"\C-r" 'redraw-display
)
339 (define-key vip-vi-diehard-map
"\C-s" 'vip-nil
)
340 (define-key vip-vi-diehard-map
"\C-t" 'vip-nil
)
341 (define-key vip-vi-diehard-map
"\C-v" 'vip-nil
)
342 (define-key vip-vi-diehard-map
"\C-w" 'vip-nil
)
343 (define-key vip-vi-diehard-map
"@" 'vip-nil
)
344 (define-key vip-vi-diehard-map
"*" 'vip-nil
)
345 (define-key vip-vi-diehard-map
"#" 'vip-nil
)
346 (define-key vip-vi-diehard-map
"\C-_" 'vip-nil
)
347 (define-key vip-vi-diehard-map
"\C-]" 'vip-nil
);; This is actually tags.
350 ;;; Minibuffer keymap
353 (defvar vip-minibuffer-map
(make-sparse-keymap)
354 "Keymap used to modify keys when Minibuffer is in Insert state.")
356 (define-key vip-minibuffer-map
"\C-m" 'vip-exit-minibuffer
)
357 (define-key vip-minibuffer-map
"\C-j" 'vip-exit-minibuffer
)
359 ;; Map used to read Ex-style commands.
360 (defvar vip-ex-cmd-map
(make-sparse-keymap))
361 (define-key vip-ex-cmd-map
" " 'ex-cmd-read-exit
)
362 (define-key vip-ex-cmd-map
"\t" 'ex-cmd-complete
)
364 ;; Keymap for reading file names in Ex-style commands.
365 (defvar ex-read-filename-map
(make-sparse-keymap))
366 (define-key ex-read-filename-map
" " 'vip-complete-filename-or-exit
)
373 (defun vip-add-local-keys (state alist
)
374 "Override some vi-state or insert-state bindings in the current buffer.
375 The effect is seen in the current buffer only.
376 Useful for customizing mailer buffers, gnus, etc.
377 STATE is 'vi-state, 'insert-state, or 'emacs-state
378 ALIST is of the form ((key . func) (key . func) ...)
379 Normally, this would be called from a hook to a major mode or
380 on a per buffer basis.
382 (vip-add-local-keys state '((key-str . func) (key-str . func)...)) "
385 (cond ((eq state
'vi-state
)
386 (if vip-need-new-vi-local-map
387 (setq vip-vi-local-user-map
(make-sparse-keymap)))
388 (setq vip-need-new-vi-local-map nil
389 map vip-vi-local-user-map
))
390 ((eq state
'insert-state
)
391 (if vip-need-new-insert-local-map
392 (setq vip-insert-local-user-map
(make-sparse-keymap)))
393 (setq vip-need-new-insert-local-map nil
394 map vip-insert-local-user-map
))
395 ((eq state
'emacs-state
)
396 (if vip-need-new-emacs-local-map
397 (setq vip-emacs-local-user-map
(make-sparse-keymap)))
398 (setq vip-need-new-emacs-local-map nil
399 map vip-emacs-local-user-map
))
402 "Invalid state in vip-add-local-keys: %S. Valid states: vi-state, insert-state or emacs-state" state
)))
404 (vip-modify-keymap map alist
)
405 (vip-normalize-minor-mode-map-alist)
406 (vip-set-mode-vars-for vip-current-state
)))
409 (defun vip-modify-major-mode (mode state keymap
)
410 "Modify key bindings in a major-mode in a Viper state using a keymap.
412 If the default for a major mode is emacs-state, then modifications to this
413 major mode may not take effect until the buffer switches state to Vi,
414 Insert or Emacs. If this happens, add vip-change-state-to-emacs to this
415 major mode's hook. If no such hook exists, you may have to put an advice on
416 the function that invokes the major mode. See vip-set-hooks for hints.
418 The above needs not to be done for major modes that come up in Vi or Insert
421 Arguments: (major-mode vip-state keymap)"
423 (cond ((eq state
'vi-state
) 'vip-vi-state-modifier-alist
)
424 ((eq state
'insert-state
) 'vip-insert-state-modifier-alist
)
425 ((eq state
'emacs-state
) 'vip-emacs-state-modifier-alist
)))
427 (if (setq elt
(assoc mode
(eval alist
)))
428 (set alist
(delq elt
(eval alist
))))
429 (set alist
(cons (cons mode keymap
) (eval alist
)))
431 ;; Normalization usually doesn't help here, since one needs to
432 ;; normalize in the actual buffer where changes to the keymap are
433 ;; to take place. However, it doesn't hurt, and it helps whenever this
434 ;; function is actually called from within the right buffer.
435 (vip-normalize-minor-mode-map-alist)
437 (vip-set-mode-vars-for vip-current-state
)))
440 ;; Displays variables that control Viper's keymaps
441 (defun vip-debug-keymaps ()
443 (with-output-to-temp-buffer " *vip-debug*"
444 (princ (format "Buffer name: %s\n\n" (buffer-name)))
445 (princ "Variables: \n")
446 (princ (format "major-mode: %S\n" major-mode
))
447 (princ (format "vip-current-state: %S\n" vip-current-state
))
448 (princ (format "vip-mode-string: %S\n\n" vip-mode-string
))
449 (princ (format "vip-vi-intercept-minor-mode: %S\n"
450 vip-vi-intercept-minor-mode
))
451 (princ (format "vip-insert-intercept-minor-mode: %S\n"
452 vip-insert-intercept-minor-mode
))
453 (princ (format "vip-emacs-intercept-minor-mode: %S\n"
454 vip-emacs-intercept-minor-mode
))
455 (princ (format "vip-vi-minibuffer-minor-mode: %S\n"
456 vip-vi-minibuffer-minor-mode
))
457 (princ (format "vip-insert-minibuffer-minor-mode: %S\n\n"
458 vip-insert-minibuffer-minor-mode
))
459 (princ (format "vip-vi-local-user-minor-mode: %S\n"
460 vip-vi-local-user-minor-mode
))
461 (princ (format "vip-vi-global-user-minor-mode: %S\n"
462 vip-vi-global-user-minor-mode
))
463 (princ (format "vip-vi-kbd-minor-mode: %S\n" vip-vi-kbd-minor-mode
))
464 (princ (format "vip-vi-state-modifier-minor-mode: %S\n"
465 vip-vi-state-modifier-minor-mode
))
466 (princ (format "vip-vi-diehard-minor-mode: %S\n"
467 vip-vi-diehard-minor-mode
))
468 (princ (format "vip-vi-basic-minor-mode: %S\n" vip-vi-basic-minor-mode
))
469 (princ (format "vip-replace-minor-mode: %S\n" vip-replace-minor-mode
))
470 (princ (format "vip-insert-local-user-minor-mode: %S\n"
471 vip-insert-local-user-minor-mode
))
472 (princ (format "vip-insert-global-user-minor-mode: %S\n"
473 vip-insert-global-user-minor-mode
))
474 (princ (format "vip-insert-kbd-minor-mode: %S\n"
475 vip-insert-kbd-minor-mode
))
476 (princ (format "vip-insert-state-modifier-minor-mode: %S\n"
477 vip-insert-state-modifier-minor-mode
))
478 (princ (format "vip-insert-diehard-minor-mode: %S\n"
479 vip-insert-diehard-minor-mode
))
480 (princ (format "vip-insert-basic-minor-mode: %S\n"
481 vip-insert-basic-minor-mode
))
482 (princ (format "vip-emacs-local-user-minor-mode: %S\n"
483 vip-emacs-local-user-minor-mode
))
484 (princ (format "vip-emacs-kbd-minor-mode: %S\n"
485 vip-emacs-kbd-minor-mode
))
486 (princ (format "vip-emacs-global-user-minor-mode: %S\n"
487 vip-emacs-global-user-minor-mode
))
488 (princ (format "vip-emacs-state-modifier-minor-mode: %S\n"
489 vip-emacs-state-modifier-minor-mode
))
491 (princ (format "\nvip-expert-level %S\n" vip-expert-level
))
492 (princ (format "vip-no-multiple-ESC %S\n" vip-no-multiple-ESC
))
493 (princ (format "vip-always %S\n" vip-always
))
494 (princ (format "vip-ex-style-motion %S\n"
495 vip-ex-style-motion
))
496 (princ (format "vip-ex-style-editing-in-insert %S\n"
497 vip-ex-style-editing-in-insert
))
498 (princ (format "vip-want-emacs-keys-in-vi %S\n"
499 vip-want-emacs-keys-in-vi
))
500 (princ (format "vip-want-emacs-keys-in-insert %S\n"
501 vip-want-emacs-keys-in-insert
))
502 (princ (format "vip-want-ctl-h-help %S\n" vip-want-ctl-h-help
))
505 (princ (format "Default value for minor-mode-map-alist: \n%S\n\n"
506 (default-value 'minor-mode-map-alist
)))
507 (princ (format "Actual value for minor-mode-map-alist: \n%S\n"
508 minor-mode-map-alist
))
514 (defun vip-add-keymap (mapsrc mapdst
)
515 "Add contents of mapsrc to mapdst. It is assumed that mapsrc is sparse."
517 (map-keymap (function (lambda (key binding
)
518 (define-key mapdst key binding
)))
521 (function (lambda (p)
522 (define-key mapdst
(vector (car p
)) (cdr p
))
526 (defun vip-modify-keymap (map alist
)
527 "Modifies MAP with bindings specified in the ALIST. The alist has the
528 form ((key . function) (key . function) ... )."
529 (mapcar (function (lambda (p)
530 (define-key map
(eval (car p
)) (cdr p
))))
534 (provide 'viper-keym
)
536 ;;; viper-keym.el ends here