| 3 | | ;; Copyright (C) 1994, 95, 96, 97, 2000, 01, 02, 2005 Free Software Foundation, Inc. |
|---|
| | 3 | ;; Copyright (C) 1994, 1995, 1996, 1997, 2000, 2001, 2002, 2003, 2004, |
|---|
| | 4 | ;; 2005 Free Software Foundation, Inc. |
|---|
| 21 | | ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
|---|
| 22 | | ;; Boston, MA 02111-1307, USA. |
|---|
| | 22 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
|---|
| | 23 | ;; Boston, MA 02110-1301, USA. |
|---|
| 53 | | (defcustom viper-toggle-key "\C-z" |
|---|
| 54 | | "The key used to change states from emacs to Vi and back. |
|---|
| 55 | | In insert mode, this key also functions as Meta. |
|---|
| 56 | | Must be set in .viper file or prior to loading Viper. |
|---|
| 57 | | This setting cannot be changed interactively." |
|---|
| 58 | | :type 'string |
|---|
| 59 | | :group 'viper) |
|---|
| 60 | | |
|---|
| 61 | | (defcustom viper-quoted-insert-key "\C-v" |
|---|
| 62 | | "The key used to quote special characters when inserting them in Insert state." |
|---|
| 63 | | :type 'string |
|---|
| 64 | | :group 'viper) |
|---|
| 65 | | |
|---|
| 66 | | (defcustom viper-ESC-key "\e" |
|---|
| 67 | | "Key used to ESC. |
|---|
| 68 | | Must be set in .viper file or prior to loading Viper. |
|---|
| 69 | | This setting cannot be changed interactively." |
|---|
| 70 | | :type 'string |
|---|
| 71 | | :group 'viper) |
|---|
| | 161 | ;; Some important keys used in viper |
|---|
| | 162 | (defcustom viper-toggle-key [(control ?z)] ; "\C-z" |
|---|
| | 163 | "The key used to change states from emacs to Vi and back. |
|---|
| | 164 | In insert mode, this key also functions as Meta. |
|---|
| | 165 | |
|---|
| | 166 | Enter as a sexp. Examples: \"\\C-z\", [(control ?z)]." |
|---|
| | 167 | :type 'sexp |
|---|
| | 168 | :group 'viper |
|---|
| | 169 | :set (lambda (symbol value) |
|---|
| | 170 | (let ((old-value (if (boundp 'viper-toggle-key) |
|---|
| | 171 | viper-toggle-key |
|---|
| | 172 | [(control ?z)]))) |
|---|
| | 173 | (mapcar |
|---|
| | 174 | (lambda (buf) |
|---|
| | 175 | (save-excursion |
|---|
| | 176 | (set-buffer buf) |
|---|
| | 177 | (when (and (boundp 'viper-insert-basic-map) |
|---|
| | 178 | (keymapp viper-insert-basic-map)) |
|---|
| | 179 | (when old-value |
|---|
| | 180 | (define-key viper-insert-basic-map old-value nil)) |
|---|
| | 181 | (define-key viper-insert-basic-map value 'viper-escape-to-vi)) |
|---|
| | 182 | (when (and (boundp 'viper-vi-intercept-map) |
|---|
| | 183 | (keymapp viper-vi-intercept-map)) |
|---|
| | 184 | (when old-value |
|---|
| | 185 | (define-key viper-vi-intercept-map old-value nil)) |
|---|
| | 186 | (define-key |
|---|
| | 187 | viper-vi-intercept-map value 'viper-toggle-key-action)) |
|---|
| | 188 | (when (and (boundp 'viper-emacs-intercept-map) |
|---|
| | 189 | (keymapp viper-emacs-intercept-map)) |
|---|
| | 190 | (define-key viper-emacs-intercept-map old-value nil) |
|---|
| | 191 | (define-key |
|---|
| | 192 | viper-emacs-intercept-map value 'viper-change-state-to-vi)) |
|---|
| | 193 | )) |
|---|
| | 194 | (buffer-list)) |
|---|
| | 195 | (set-default symbol value) |
|---|
| | 196 | ))) |
|---|
| | 197 | |
|---|
| | 198 | (defcustom viper-quoted-insert-key "\C-v" |
|---|
| | 199 | "The key used to quote special characters when inserting them in Insert state." |
|---|
| | 200 | :type 'string |
|---|
| | 201 | :group 'viper) |
|---|
| | 202 | |
|---|
| | 203 | (defcustom viper-ESC-key [(escape)] ; "\e" |
|---|
| | 204 | "Key used to ESC. |
|---|
| | 205 | Enter as a sexp. Examples: \"\\e\", [(escape)]." |
|---|
| | 206 | :type 'sexp |
|---|
| | 207 | :group 'viper |
|---|
| | 208 | :set (lambda (symbol value) |
|---|
| | 209 | (let ((old-value (if (boundp 'viper-ESC-key) |
|---|
| | 210 | viper-ESC-key |
|---|
| | 211 | [(escape)]))) |
|---|
| | 212 | (mapcar |
|---|
| | 213 | (lambda (buf) |
|---|
| | 214 | (save-excursion |
|---|
| | 215 | (set-buffer buf) |
|---|
| | 216 | (when (and (boundp 'viper-insert-intercept-map) |
|---|
| | 217 | (keymapp viper-insert-intercept-map)) |
|---|
| | 218 | (when old-value |
|---|
| | 219 | (define-key viper-insert-intercept-map old-value nil)) |
|---|
| | 220 | (define-key |
|---|
| | 221 | viper-insert-intercept-map value 'viper-intercept-ESC-key)) |
|---|
| | 222 | (when (and (boundp 'viper-vi-intercept-map) |
|---|
| | 223 | (keymapp viper-vi-intercept-map)) |
|---|
| | 224 | (when old-value |
|---|
| | 225 | (define-key viper-vi-intercept-map old-value nil)) |
|---|
| | 226 | (define-key |
|---|
| | 227 | viper-vi-intercept-map value 'viper-intercept-ESC-key)) |
|---|
| | 228 | )) |
|---|
| | 229 | (buffer-list)) |
|---|
| | 230 | (set-default symbol value) |
|---|
| | 231 | ))) |
|---|
| | 232 | |
|---|