keydefs.el
来自「A framework written in Java for implemen」· EL 代码 · 共 650 行 · 第 1/2 页
EL
650 行
;;; keydefs.el --- Define standard keybindings.;; Copyright (C) 1992-4, 1997 Free Software Foundation, Inc.;; Copyright (C) 2000 Ben Wing.;; Maintainer: XEmacs Development Team;; Keywords: internal, dumped;; This file is part of XEmacs.;; XEmacs is free software; you can redistribute it and/or modify it;; under the terms of the GNU General Public License as published by;; the Free Software Foundation; either version 2, or (at your option);; any later version.;; XEmacs is distributed in the hope that it will be useful, but;; WITHOUT ANY WARRANTY; without even the implied warranty of;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU;; General Public License for more details.;; You should have received a copy of the GNU General Public License;; along with XEmacs; see the file COPYING. If not, write to the ;; Free Software Foundation, 59 Temple Place - Suite 330,;; Boston, MA 02111-1307, USA.;; All the global bindings should be here so that one can reload things;; like files.el without trashing one's personal bindings.;;; Synched up with: Not synched with FSF.;;; Commentary:;; This file is dumped with XEmacs;;; Code:(defgroup keyboard nil "Input from the keyboard." :group 'environment);;;; created by C code;;(defvar global-map (current-global-map) "\;;Default global keymap mapping XEmacs keyboard input into commands.;;The value is a keymap which is usually (but not necessarily) XEmacs's;;global map.");;;; created by C code;;(defvar esc-map (symbol-function 'ESC-prefix) "\;;Default keymap for ESC (meta) commands.;;The normal global definition of the character ESC indirects to this keymap.");;(set-keymap-name global-map 'global-map);;(set-keymap-name esc-map 'ESC-prefix)(define-prefix-command 'Control-X-prefix t)(defvar ctl-x-map (symbol-function 'Control-X-prefix) "\Default keymap for C-x commands.The normal global definition of the character C-x indirects to this keymap.")(define-key global-map "\C-x" 'Control-X-prefix)(define-prefix-command 'ctl-x-4-prefix t)(defvar ctl-x-4-map (symbol-function 'ctl-x-4-prefix) "\Keymap for subcommands of C-x 4")(define-key global-map "\C-x4" 'ctl-x-4-prefix)(define-prefix-command 'ctl-x-5-prefix t)(defvar ctl-x-5-map (symbol-function 'ctl-x-5-prefix) "\Keymap for subcommands of C-x 5")(define-key global-map "\C-x5" 'ctl-x-5-prefix)#|(define-prefix-command 'mode-specific-command-prefix t)(defvar mode-specific-map (symbol-function 'mode-specific-command-prefix) "\Keymap for characters following C-c.")(define-key global-map "\C-c" 'mode-specific-command-prefix);; FSFmacs buffer.c(define-key global-map "\C-xb" 'switch-to-buffer)(define-key global-map "\C-xk" 'kill-buffer)(define-key global-map "\C-x\C-b" 'list-buffers)(put 'erase-buffer 'disabled t) ;from buffer.c;; FSFmacs casefiddle.c(define-key global-map "\C-x\C-u" 'upcase-region);; This is silly with zmacs regions;(put 'upcase-region 'disabled t)(define-key global-map "\C-x\C-l" 'downcase-region);; This is silly with zmacs regions;(put 'downcase-region 'disabled t)(define-key global-map "\M-u" 'upcase-region-or-word)(define-key global-map "\M-l" 'downcase-region-or-word)(define-key global-map "\M-c" 'capitalize-region-or-word)|#;; FSFmacs cmds.c(let ((n 33)) (while (<= n 255) (if (not (= n 127)) (define-key global-map n 'self-insert-command)) (setq n (1+ n))))(define-key global-map " " 'self-insert-command)(define-key global-map "\C-a" 'beginning-of-line)(define-key global-map "\C-b" 'backward-char-command)(define-key global-map "\C-e" 'end-of-line)(define-key global-map "\C-f" 'forward-char-command)(define-key global-map "\C-d" 'delete-char);; FSFmacs files.el(define-key global-map "\C-x\C-f" 'find-file)(define-key global-map "\C-x\C-q" 'toggle-read-only)(define-key global-map "\C-x\C-r" 'find-file-read-only)(define-key global-map "\C-x\C-v" 'find-alternate-file)(define-key global-map "\C-x\C-s" 'save-buffer)(define-key global-map "\C-xs" 'save-some-buffers)(define-key global-map "\C-x\C-w" 'write-file)(define-key global-map "\C-xi" 'insert-file)(define-key global-map "\M-~" 'not-modified)(define-key global-map "\C-x\C-d" 'list-directory)(define-key global-map "\C-x\C-c" 'save-buffers-kill-emacs)(define-key global-map "\C-x4f" 'find-file-other-window)(define-key global-map "\C-x4r" 'find-file-read-only-other-window)(define-key global-map "\C-x4\C-f" 'find-file-other-window)(define-key global-map "\C-x4b" 'switch-to-buffer-other-window)(define-key global-map "\C-x4\C-o" 'display-buffer)(define-key global-map "\C-x5b" 'switch-to-buffer-other-frame)(define-key global-map "\C-x5f" 'find-file-other-frame)(define-key global-map "\C-x5\C-f" 'find-file-other-frame)(define-key global-map "\C-x5r" 'find-file-read-only-other-frame);; FSFmacs frame.c;FSFmacs has these. It's probably a good idea to provide ways of hooking;these events, but it's unlikely that it's a good idea to do it this way.;Just provide a hook, like the existing `select-frame-hook',;`deselect-frame-hook', `map-frame-hook', and `unmap-frame-hook'.;#### ergo need hooks for delete-frame and iconify-frame;(define-key global-map 'switch-frame 'handle-switch-frame);(define-key global-map 'delete-frame 'handle-delete-frame);(define-key global-map 'iconify-frame 'ignore-event);(define-key global-map 'make-frame-visible 'ignore-event);; FSFmacs frame.el;; New FSF19 bindings: C-x 5 as prefix for window commands(define-key global-map "\C-x52" 'make-frame)(define-key global-map "\C-x50" 'delete-frame)(define-key global-map "\C-x5o" 'other-frame);; FSFmacs help.el(define-key global-map (vector help-char) 'help-command)(define-key global-map 'help 'help-command)(define-key global-map 'f1 'help-command);; FSFmacs indent.el;;(define-key global-map "\t" 'self-insert-command)(define-key global-map "\t" 'indent-for-tab-command)(define-key global-map "\M-\C-\\" 'indent-region)(define-key global-map "\C-x\t" 'indent-rigidly)(define-key global-map "\M-i" 'tab-to-tab-stop);; XEmacs addition:(define-key global-map [(shift tab)] 'tab-to-tab-stop);; FSFmacs isearch.el(define-key global-map "\C-s" 'isearch-forward)(define-key global-map "\C-r" 'isearch-backward)(define-key global-map "\M-\C-s" 'isearch-forward-regexp)(define-key global-map "\M-\C-r" 'isearch-backward-regexp);; FSFmacs keyboard.c(define-key global-map "\C-z" 'suspend-emacs-or-iconify-frame)(define-key global-map "\C-x\C-z" 'suspend-or-iconify-emacs);; FSFmacs loaddefs.el;; New FSF19 bindings: C-x n as a prefix for narrowing commands.(define-key global-map "\C-xn" (make-sparse-keymap 'narrowing-prefix))(put 'narrow-to-region 'disabled t)(define-key global-map "\C-xnn" 'narrow-to-region)(define-key global-map "\C-xnw" 'widen)(define-key global-map "\C-xnd" 'narrow-to-defun);; Old v18 bindings;(define-key global-map "\C-xn" 'narrow-to-region);(define-key global-map "\C-xw" 'widen);;;(define-key global-map "\C-j" 'newline-and-indent)(define-key global-map "\C-m" 'newline)(define-key global-map 'return 'newline)(define-key global-map 'enter 'newline)(define-key global-map "\C-o" 'open-line)(define-key global-map "\M-\C-o" 'split-line)(define-key global-map "\C-q" 'quoted-insert)(define-key global-map "\M-^" 'delete-indentation)(define-key global-map "\M-\\" 'delete-horizontal-space)(define-key global-map "\M-m" 'back-to-indentation)(define-key global-map "\C-x\C-o" 'delete-blank-lines)(define-key global-map "\M- " 'just-one-space)(define-key global-map "\M-z" 'zap-to-char)(define-key global-map "\M-=" 'count-lines-region)(define-key global-map "\C-x=" 'what-cursor-position)(define-key global-map "\M-:" 'eval-expression);; Define ESC ESC : like ESC : for people who type ESC ESC out of habit.(define-key global-map "\M-\e:" 'eval-expression);(define-key global-map "\M-\e" 'eval-expression);; Do we really need to disable this now that it is harder to type;; by accident?;; (put 'eval-expression 'disabled t);; Changed from C-x ESC so that function keys work following C-x.(define-key global-map "\C-x\e\e" 'repeat-complex-command);(define-key global-map "\C-x\e" 'repeat-complex-command);; From Emacs 20.(define-key global-map "\C-x\M-:" 'repeat-complex-command)(define-key global-map "\C-xu" 'advertised-undo);; Many people are used to typing C-/ on X terminals and getting C-_.(define-key global-map '(control /) 'undo)(define-key global-map "\C-_" 'undo)(define-key global-map "\M-!" 'shell-command)(define-key global-map "\M-|" 'shell-command-on-region)(define-key global-map "\C-u" 'universal-argument);; Make Control-0 - Control-9 set the prefix argument, like Meta-0.(let ((i ?0)) (while (<= i ?9) (define-key global-map (list 'meta i) 'digit-argument) (define-key global-map (list 'control i) 'digit-argument) (define-key global-map (list 'control 'meta i) 'digit-argument) (setq i (1+ i))))(define-key global-map '(meta -) 'negative-argument)(define-key global-map '(control -) 'negative-argument)(define-key global-map '(control meta -) 'negative-argument)(define-key global-map "\C-k" 'kill-line)(define-key global-map '(control K) 'historical-kill-line)(define-key global-map "\C-w" 'kill-region)(define-key global-map "\M-w" 'kill-ring-save)(define-key global-map "\M-\C-w" 'append-next-kill)(define-key global-map "\C-y" 'yank)(define-key global-map "\M-y" 'yank-pop);; Old v18 binding;(define-key global-map "\C-xa" 'append-to-buffer)(define-key global-map "\C-@" 'set-mark-command);; Many people are used to typing C-SPC and getting C-@.(define-key global-map '(control ? ) 'set-mark-command)(define-key global-map "\C-x\C-x" 'exchange-point-and-mark)(define-key global-map "\C-x\C-@" 'pop-global-mark);(define-key global-map [(control x) (control ? )] 'pop-global-mark)(define-key global-map "\C-n" 'next-line)(define-key global-map "\C-p" 'previous-line);(define-key global-map "\C-x\C-n" 'set-goal-column);; XEmacs:;;; Many people have said they rarely use this feature, and often type;;; it by accident. Maybe it shouldn't even be on a key.;;; Done. -hniksic;(put 'set-goal-column 'disabled t);;(define-key global-map [menu] 'execute-extended-command);;(define-key global-map [find] 'search-forward)(define-key global-map "\C-t" 'transpose-chars)(define-key global-map "\M-t" 'transpose-words)(define-key global-map "\M-\C-t" 'transpose-sexps)(define-key global-map "\C-x\C-t" 'transpose-lines)(define-key global-map "\M-;" 'indent-for-comment)(define-key global-map "\M-j" 'indent-new-comment-line)(define-key global-map "\M-\C-j" 'indent-new-comment-line)(define-key global-map "\C-x;" 'set-comment-column)(define-key global-map "\C-xf" 'set-fill-column)(define-key global-map "\C-x$" 'set-selective-display)(define-key global-map "\M-@" 'mark-word)(define-key global-map "\M-f" 'forward-word)(define-key global-map "\M-b" 'backward-word)(define-key global-map "\M-d" 'kill-word)(define-key global-map "\M-<" 'beginning-of-buffer)(define-key global-map "\M->" 'end-of-buffer)(define-key global-map "\C-xh" 'mark-whole-buffer)(define-key global-map "\M-\\" 'delete-horizontal-space)(define-key global-map "\M-\C-f" 'forward-sexp)(define-key global-map "\M-\C-b" 'backward-sexp)(define-key global-map "\M-\C-u" 'backward-up-list)(define-key global-map "\M-\C-@" 'mark-sexp)(define-key global-map "\M-\C-d" 'down-list)(define-key global-map "\M-\C-k" 'kill-sexp)(define-key global-map "\M-\C-n" 'forward-list)(define-key global-map "\M-\C-p" 'backward-list)(define-key global-map "\M-\C-a" 'beginning-of-defun)(define-key global-map "\M-\C-e" 'end-of-defun)(define-key global-map "\M-\C-h" 'mark-defun)(define-key global-map "\M-\(" 'insert-parentheses)(define-key global-map "\M-\)" 'move-past-close-and-reindent)(define-key global-map "\M-\t" 'lisp-complete-symbol)(define-key global-map "\C-x/" 'point-to-register)(define-key global-map "\C-xj" 'jump-to-register)(define-key global-map "\C-xx" 'copy-to-register)(define-key global-map "\C-xg" 'insert-register);; Old v18 binding;(define-key global-map "\C-xr" 'copy-rectangle-to-register);; New FSF19 bindings: C-x r as a prefix for register commands(define-key global-map "\C-xr" (make-sparse-keymap 'rectangle-prefix))(define-key global-map "\C-xr\C-@" 'point-to-register)(define-key global-map "\C-xr " 'point-to-register)(define-key global-map "\C-xrj" 'jump-to-register)(define-key global-map "\C-xrs" 'copy-to-register)(define-key global-map "\C-xrx" 'copy-to-register)(define-key global-map "\C-xri" 'insert-register)(define-key global-map "\C-xrg" 'insert-register)(define-key global-map "\C-xrr" 'copy-rectangle-to-register)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?