;;; ska-global-keys.el --- global keybindings ;; Copyright (C) 2000-2002 Stefan Kamphausen ;; Author: Stefan Kamphausen ;; Time-stamp: <13-Mar-2006 10:54:41 ska> ;; Keywords: ;; This file is not part of XEmacs. ;; This program 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. ;; This program 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 this program; see the file COPYING. If not, write to the Free ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA ;; 02111-1307, USA. ;;; Commentary: ;; This sets the keybindings I want to have available in all modes. ;;; To Use: ;; put ;; (load "ska-global-keys" t nil) ;; in an init file ;;; Code: (require 'ska-utils) (require 'chb-util) (require 'll-debug) ;; My own prefix for globally available commands: C-v ;; (just like C-x and C-c for xemacs' defaults) (global-unset-key '[(control v)]) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Scrolling with keys (global-set-key '[(control up)] '(lambda () (interactive) (scroll-down 1))) (global-set-key '[(control down)] '(lambda () (interactive) (scroll-up 1))) (global-set-key '[(control \.)] 'ska-point-to-register) (global-set-key '[(control \,)] 'ska-jump-to-register) (global-set-key '[(meta control \.)] '(lambda () (interactive) (window-configuration-to-register 2))) (global-set-key '[(meta control \,)] '(lambda () (interactive) (jump-to-register 2))) (global-set-key '[(control \')] 'point-to-register) (global-set-key '[(meta \')] 'register-to-point) (global-set-key '[(control backspace)] 'backward-kill-word) (global-set-key '[(control delete)] 'kill-word) (global-set-key '[(shift prior)] 'swiss-move-line-up) (global-set-key '[(shift next)] 'swiss-move-line-down) ;(global-set-key '[(shift prior)] 'chb-next-buffer) ;(global-set-key '[(shift next)] 'chb-previous-buffer) (global-set-key '[(home)] 'chb-home) (global-set-key '[(end)] 'chb-end) (global-set-key '[(control v) (control s)] 'speedbar-get-focus) (global-set-key '[(control v) (control y)] 'ska-insert-primary-selection) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Mouse Stuff ;; SHIFT: menus (global-set-key '[(shift button2)] 'modeline-buffers-menu) (global-set-key '[(shift button3)] 'mouse-function-menu) ;; META: rectangle operations. meta button1 is default (global-set-key '[(meta button2)] 'yank-rectangle) (global-set-key '[(meta button3)] 'kill-rectangle) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; F-Keys ;; F1: keyboard macros (global-set-key '[(f1)] 'call-last-kbd-macro) (global-set-key '[(shift f1)] 'chb-start-kbd-macro) ;; F2: bookmarks (global-set-key '[(f2)] 'bookmark-set) (global-set-key '[(shift f2)] 'list-bookmarks) (global-set-key '[(control f2)] 'bookmark-jump) ;; F3 (global-set-key '[(f3)] '(lambda () (interactive) (term "/bin/bash"))) (global-set-key '[(control f3)] '(lambda () (interactive) (eshell) (insert "ls") (eshell-send-input))) ;; just to have something on shift F3 *gg* (global-set-key '[(shift f3)] 'list-buffers) ;; Buffer and Window operations (global-set-key '[(f4)] 'kill-this-buffer) (global-set-key '(shift f4) 'ska-kill-this-window) ;; remove the newly opened (help) buffer but leave windows in state (global-set-key '(control f4) '(lambda () (interactive) (kill-this-buffer) (other-window -1))) (global-set-key '[(f5)] 'delete-other-windows) (global-set-key '[(shift f5)] 'delete-window) (global-set-key '[f6] 'split-window-vertically) (global-set-key '[(shift f6)] 'split-window-horizontally) (global-set-key '[f7] 'shrink-window) (global-set-key '[(shift f7)] 'shrink-window-horizontally) (global-set-key '[f8] 'enlarge-window) (global-set-key '[(shift f8)] 'enlarge-window-horizontally) (global-set-key '[(control f7)] '(lambda () (interactive) (set-frame-height (selected-frame) (- (frame-height) 1)))) (global-set-key '[(control f8)] '(lambda () (interactive) (set-frame-height (selected-frame) (+ (frame-height) 1)))) (global-set-key '[f9] 'font-lock-fontify-buffer) ;; The function keys with higher numbers seem to be used by some ;; packages so I won't rely on them (global-set-key '[(shift f9)] 'repeat-complex-command) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Global Settings using C-v prefix (global-set-key '[(control v) (control a)] 'chb-align-to-char-in-previous-line) ;; could be handy with tpum loaded and (tpum-global-mode 1) ;;(global-set-key '[(control v) (control b)] '(lambda () ;; (interactive) ;; (popup-menu (cons ;; "Menubar" ;; current-menubar)))) (global-set-key '[(control v) (control c)] 'ispell-complete-word) (global-set-key '[(control v) (control f)] 'picklist-apropos) (global-set-key '[(control v) (control l)] 'locate) (global-set-key '[(control v) (l)] 'ska-line-to-kill-ring) (global-set-key '[(control v) (control m)] 'vm) (global-set-key '[(control v) (control n)] 'gnus) (global-set-key '[(control v) (control o)] 'occur) (global-set-key '[(control v) (control p)] 'ska-insert-path) (global-set-key '[(control v) (control r)] 'query-replace-by-example) (global-set-key '[(control v) (control t)] 'ska-insert-current-time-string) (global-set-key '[(control v) (control v)] 'll-debug-toggle-comment-region-or-line) (global-set-key '[(control v) (control x)] 'ska-insert-exec-text) (global-set-key '[(control v) (f)] 'fill-region) (global-set-key '[(control v) (g)] 'fume-prompt-function-goto) (global-set-key '[(control v) (l)] 'add-change-log-entry) (global-set-key '[(shift space)] 'dabbrev-expand) (global-set-key '[(control z)] 'yank) (global-set-key '[(control \`)] 'accelerate-menu) (global-set-key '[(meta k)] 'kill-entire-line) (global-set-key '[(iso-left-tab)] 'comint-dynamic-complete) (global-set-key '[(control t)] 'ska-electric-transpose-chars) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Heavy Default Overriding (global-set-key '[(insert)] '(lambda () (interactive) (message "use M-x overwrite-mode"))) (define-key read-file-name-must-match-map "~" 'ska-minibuffer-electric-tilde) (define-key read-file-name-map "~" 'ska-minibuffer-electric-tilde) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; A New Keyboard Layer ;; this has conflicts with my winmgr bindings, though. (global-set-key '[(super q)] '(lambda () (interactive) (insert "7"))) (global-set-key '[(super w)] '(lambda () (interactive) (insert "8"))) (global-set-key '[(super e)] '(lambda () (interactive) (insert "9"))) (global-set-key '[(super a)] '(lambda () (interactive) (insert "4"))) (global-set-key '[(super s)] '(lambda () (interactive) (insert "5"))) (global-set-key '[(super d)] '(lambda () (interactive) (insert "6"))) (global-set-key '[(super z)] '(lambda () (interactive) (insert "1"))) (global-set-key '[(super x)] '(lambda () (interactive) (insert "2"))) (global-set-key '[(super c)] '(lambda () (interactive) (insert "3"))) ;; brackets and co. (global-set-key '[(super f)] '(lambda () (interactive) (insert "("))) (global-set-key '[(super g)] '(lambda () (interactive) (insert "["))) (global-set-key '[(super h)] '(lambda () (interactive) (insert "]"))) (global-set-key '[(super j)] '(lambda () (interactive) (insert ")"))) (global-set-key '[(super v)] '(lambda () (interactive) (insert "{"))) (global-set-key '[(super n)] '(lambda () (interactive) (insert "}"))) ;; misc (global-set-key '[(super r)] '(lambda () (interactive) (insert "+"))) (global-set-key '[(super t)] '(lambda () (interactive) (insert "*"))) (global-set-key '[(super y)] '(lambda () (interactive) (insert "%"))) (global-set-key '[(super u)] '(lambda () (interactive) (insert "@"))) (global-set-key '[(super b)] '(lambda () (interactive) (insert "$"))) (global-set-key '[(super space)] '(lambda () (interactive) (insert "_"))) ;; sequences (global-set-key '[(super i)] '(lambda () (interactive) (insert "->"))) (global-set-key '[(super o)] '(lambda () (interactive) (insert "first"))) (global-set-key '[(super p)] '(lambda () (interactive) (insert "second"))) (global-set-key '[(super k)] '(lambda () (interactive) (insert "unsigned"))) (global-set-key '[(super l)] '(lambda () (interactive) (insert "|"))) (global-set-key '[(super m)] '(lambda () (interactive) (insert "frei"))) ;; umlauts (global-set-key '[(super \[)] '(lambda () (interactive) (insert "ä"))) (global-set-key '[(super \])] '(lambda () (interactive) (insert "ö"))) (global-set-key '[(super \\)] '(lambda () (interactive) (insert "ü"))) (global-set-key '[(super \{)] '(lambda () (interactive) (insert "Ä"))) (global-set-key '[(super \})] '(lambda () (interactive) (insert "Ö"))) (global-set-key '[(super \|)] '(lambda () (interactive) (insert "Ü"))) (provide 'ska-global-keys) ;;; ska-global-keys.el ends here