home *** CD-ROM | disk | FTP | other *** search
- ;;;; loadkeys.jl -- Set up standard keybindings
- ;;; Copyright (C) 1993, 1994 John Harper <jsh@ukc.ac.uk>
-
- ;;; This file is part of Jade.
-
- ;;; Jade 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.
-
- ;;; Jade 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 Jade; see the file COPYING. If not, write to
- ;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-
- (setq
- global-keymap (make-keytab)
- ctrl-x-keymap (make-keytab)
- ctrl-x-4-keymap (make-keylist)
- esc-keymap (make-keytab)
- ctrl-c-keymap nil
- unbound-key-hook nil
- keymap-path (cons global-keymap nil)
- close-gadget-hook (cons 'close-window nil))
-
- (set-buffer-variable 'keymap-path)
- (set-buffer-variable 'buffer-keymap)
- (set-buffer-variable 'ctrl-c-keymap)
- (set-buffer-variable 'unbound-key-hook)
-
- (setq
- mark-1 (make-mark)
- mark-2 (make-mark)
- mark-3 (make-mark))
-
- (bind-keys global-keymap
- "up" 'goto-prev-line
- "down" 'goto-next-line
- "left" 'goto-left-char
- "right" 'goto-right-char
- "shift-up" '(progn (set-auto-mark) (goto (pos nil 1)))
- "shift-down" '(progn (set-auto-mark) (goto (pos nil (file-length))))
- "shift-left" 'goto-line-start
- "shift-right" 'goto-line-end
- "ctrl-up" 'prev-screen
- "ctrl-down" 'next-screen
- "ctrl-left" '(goto (left-char 40))
- "ctrl-right" '(goto (right-char 40))
- "meta-left" '(goto (backward-word))
- "meta-right" '(goto (forward-word))
- "meta-up" '(goto (prev-paragraph))
- "meta-down" '(goto (next-paragraph))
- "ctrl-tab" '(insert "\t")
- "shift-tab" 'goto-prev-tab
- "tab" 'goto-next-tab
- "return" 'split-line
- "backspace" '(delete-area (prev-char) (cursor-pos))
- "del" '(delete-area (cursor-pos) (next-char))
- "shift-backspace" '(write-clip 0 (cut-area (line-start) (cursor-pos)))
- "shift-del" '(write-clip 0 (cut-area (cursor-pos) (line-end)))
- "ctrl-del" '(write-clip 0 (cut-area (line-start) (line-start (next-line))))
- "ctrl-@" 'set-auto-mark
- "ctrl-a" 'goto-line-start
- "ctrl-b" 'goto-prev-char
- "ctrl-c" '(setq next-keymap-path '(ctrl-c-keymap))
- "ctrl-d" '(delete-area (cursor-pos) (next-char))
- "ctrl-e" 'goto-line-end
- "ctrl-f" 'goto-next-char
- "ctrl-h" 'help
- "ctrl-i" 'insert-block
- "ctrl-j" 'goto-line
- "ctrl-k" 'kill-line
- "ctrl-m" 'block-toggle
- "ctrl-M" 'toggle-rect-blocks
- "meta-m" '(block-start (cursor-pos))
- "meta-M" '(block-end (cursor-pos))
- "ctrl-n" 'goto-next-line
- "ctrl-o" '(progn (split-line) (goto (prev-char)))
- "ctrl-p" 'goto-prev-line
- "ctrl-r" '(search-backward nil)
- "ctrl-R" '(search-backward t)
- "ctrl-s" '(search-forward nil)
- "ctrl-S" '(search-forward t)
- "ctrl-u" 'add-command-arg
- "ctrl-U" 'clear-command-args
- "ctrl-v" 'next-screen
- "ctrl-w" '(write-clip 0 (cut-block))
- "ctrl-x" '(setq next-keymap-path '(ctrl-x-keymap))
- "ctrl-y" '(insert (read-clip 0))
- "ctrl-Y" '(insert-rect (read-clip 0))
- "ctrl-z" 'delete-block
- "ctrl-." 'rotate-buffers-forward
- "ctrl-," 'rotate-buffers-backward
- "ctrl-space" 'mark-region
- "ctrl-]" 'abort-recursive-edit
- "escape" '(setq next-keymap-path '(esc-keymap))
- "help" 'help
- "F1" '(goto-mark mark-1)
- "F2" '(goto-mark mark-2)
- "F3" '(goto-mark mark-3)
- "shift-F1" '(set-mark mark-1 (cursor-pos) (current-buffer))
- "shift-F2" '(set-mark mark-2 (cursor-pos) (current-buffer))
- "shift-F3" '(set-mark mark-3 (cursor-pos) (current-buffer))
- "lmb-click1" '(goto (mouse-pos))
- "lmb-click2" 'block-toggle
- "lmb-move" '(goto (mouse-pos))
- "rmb-click1" '(if (window-asleep-p) (unsleep-window) (sleep-window))
- "shift-lmb-click1" 'block-kill
- )
- (bind-keys ctrl-x-keymap
- "ctrl-c" 'save-and-quit
- "ctrl-f" 'find-file
- "ctrl-l" 'downcase-block
- "ctrl-r" 'find-file-read-only
- "ctrl-s" 'save-file
- "ctrl-u" 'upcase-block
- "ctrl-v" 'find-alternate-file
- "ctrl-w" 'save-file-as
- "ctrl-x" 'swap-cursor-and-auto-mark
- "0" 'close-window
- "1" 'close-other-windows
- "2" 'open-window
- "4" '(setq next-keymap-path '(ctrl-x-4-keymap))
- "5" 'open-window
- "b" 'switch-to-buffer
- "h" '(progn (block-kill) (block-start (file-start)) (block-end (file-end)))
- "i" 'insert-file
- "k" 'kill-buffer
- "o" '(set-current-window (next-window) t)
- "q" '(set-buffer-read-only nil (not (buffer-read-only-p)))
- "s" 'save-some-buffers
- "`" 'next-error
- )
- (bind-keys ctrl-x-4-keymap
- "ctrl-f" '(in-other-window (find-file))
- "a" '(in-other-window (add-change-log-entry))
- "b" '(in-other-window (switch-to-buffer))
- "f" '(in-other-window (find-file))
- "h" '(in-other-window (help) (help-help))
- "i" '(in-other-window (info))
- "`" '(in-other-window (next-error))
- )
- (bind-keys esc-keymap
- "escape" '(prin1 (eval (read (cons 0 (prompt "Eval: ")))) t)
- "ctrl-c" '(throw 'exit nil)
- "!" '(system (prompt "System: "))
- "<" '(progn (set-auto-mark) (goto-file-start))
- ">" '(progn (set-auto-mark) (goto-file-end))
- "@" 'mark-word
- "a" 'add-change-log-entry
- "b" '(goto (backward-word))
- "d" '(write-clip 0 (cut-area (cursor-pos) (forward-word)))
- "f" '(goto (forward-word))
- "h" 'mark-paragraph
- "i" '(insert "\t")
- "l" 'downcase-word
- "m" '(goto (indent-pos))
- "n" '(progn (set-auto-mark) (goto (match-brackets)))
- "p" '(simple-replace nil)
- "P" '(simple-replace t)
- "u" 'upcase-word
- "v" 'prev-screen
- "w" '(write-clip 0 (copy-block))
- "x" 'command-prompt
- "[" '(goto (prev-paragraph))
- "]" '(goto (next-paragraph))
- "~" '(set-buffer-modified nil nil)
- "tab" 'goto-next-tab
- "delete" '(write-clip 0 (cut-area (cursor-pos) (forward-word)))
- "backspace" '(write-clip 0 (cut-area (backward-word) (cursor-pos)))
- "help" '(if (window-asleep-p) (unsleep-window) (sleep-window))
- )
-