;; 02-keys-sy.el --- Keybindings -*- Emacs-Lisp -*- ;; Copyright (C) 2007 - 2013 Steve Youngs ;; Author: Steve Youngs ;; Maintainer: Steve Youngs ;; Created: <2007-12-02> ;; Time-stamp: ;; Download: ;; HTMLised: ;; Git Repo: git clone http://git.sxemacs.org/syinit ;; Keywords: init, compile ;; This file is part of SYinit ;; Redistribution and use in source and binary forms, with or without ;; modification, are permitted provided that the following conditions ;; are met: ;; ;; 1. Redistributions of source code must retain the above copyright ;; notice, this list of conditions and the following disclaimer. ;; ;; 2. Redistributions in binary form must reproduce the above copyright ;; notice, this list of conditions and the following disclaimer in the ;; documentation and/or other materials provided with the distribution. ;; ;; 3. Neither the name of the author nor the names of any contributors ;; may be used to endorse or promote products derived from this ;; software without specific prior written permission. ;; ;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR ;; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ;; DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE ;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR ;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR ;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE ;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN ;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ;;; Commentary: ;; ;; Sets up my keybindings ;; ;; BTW, there are a number of different ways to actually set a ;; keybinding in emacs and I honestly could not tell you which way ;; is best. I don't think any one way is really any better than ;; any other. I've used most (all?) of them here in this file. ;; Whichever format you like is the right one to use. :-) ;;; Credits: ;; ;; The HTML version of this file was created with Hrvoje Niksic's ;; htmlize.el which is part of the XEmacs "text-modes" package. ;; ;;; Todo: ;; ;; ;;; Code: ;:*======================= ;:* Global key bindings (global-set-key "\C-xw" 'what-line) (global-set-key [f2] 'undo) (global-set-key [f3] 'find-file) (global-set-key [(super tab)] 'lisp-complete-symbol) (global-set-key [(meta f3)] 'view-file) (global-set-key [f5] "\M-w") (global-set-key [f6] "\C-y") (global-set-key [f7] 'save-buffer) (global-set-key [f8] 'start-kbd-macro) (global-set-key [f9] 'end-kbd-macro) (global-set-key [(control f8)] 'call-last-kbd-macro) (global-set-key [(control f5)] 'sy-extent-kill-save) (global-set-key [XF86Copy] #'copy-primary-selection) (global-set-key [XF86Cut] #'kill-primary-selection) (global-set-key [XF86Paste] #'yank-clipboard-selection) ;:*======================= ;:* compose-key tô t¥pé fünky £ïttlê chãrs (require 'x-compose) (global-set-key "\C-cm" compose-map) ;:*======================= ;:* cursor into first line with C-pageup (define-key global-map '(control prior) 'beginning-of-buffer) (define-key global-map '(control next) 'end-of-buffer) ;:*======================= ;:* Enable menubar accelerators (double-wow!) (setq menu-accelerator-enabled 'menu-fallback) (setq menu-accelerator-modifiers '(super)) (setq menu-accelerator-prefix nil) (define-key global-map [f10] 'accelerate-menu) ;:*======================= ;:* Popup window with buffer list ; from XEmacs FAQ (2.61) (defun cw-build-buffers () "Popup buffer menu." (interactive "@") (run-hooks 'activate-menubar-hook) (popup-menu (car (find-menu-item current-menubar '("Buffers"))))) (global-set-key '(control !) 'cw-build-buffers) ;:*======================= ;:* keymapping to resize frames (define-key global-map [(control x) (up)] #'shrink-window) (define-key global-map [(control x) (down)] #'enlarge-window) (define-key global-map [(control x) (left)] #'shrink-window-horizontally) (define-key global-map [(control x) (right)] #'enlarge-window-horizontally) ;:*======================= ;:* bind key to kill-whole-line (global-set-key '(control ,) 'kill-entire-line) ;:*======================= ;:* Set C-x C-b to use ibuffer (define-key global-map [(control x) (control b)] 'ibuffer) ;:*======================= ;:* OK, so just who the hell is sending those emails (define-key global-map [f12] 'from) ;:*======================= ;:* Bind the Euro to a key (define-key global-map "\C-ce" (lambda () (interactive) (insert (make-char 'latin-iso8859-15 #x24)))) ;:*======================= ;:* Toggle in/out of eshell (global-set-key (kbd "C-c s") 'eshell-toggle) ;:*======================= ;:* Extra Mouse buttons (wheel etc) ;; ;; A little bragging never hurts... SXEmacs allows you to bind up to ;; 32 mouse buttons. I'm not sure about GNU/Emacs, but XEmacs only ;; lets you bind 10 (or is it 12?). OK, I've never seen a rat that ;; had 32 buttons, but you never know what these gamer kiddies will ;; want one day. :-) (require 'mwheel) (define-key global-map [(button4)] 'mwheel-scroll) (define-key global-map [(button5)] 'mwheel-scroll) (define-key global-map [(shift button4)] 'mwheel-scroll) (define-key global-map [(shift button5)] 'mwheel-scroll) (define-key global-map [(button9)] 'beginning-of-buffer) (define-key global-map [(button8)] 'end-of-buffer) (define-key global-map [(button10)] 'recenter) ;:*======================= ;:* Numeric keypad (define-key key-translation-map [kp-divide] [?/]) (define-key key-translation-map [kp-multiply] [?*]) (define-key key-translation-map [kp-subtract] [?-]) (define-key key-translation-map [kp-add] [?+]) (define-key key-translation-map [kp-enter] [?\r]) (define-key key-translation-map [kp-decimal] [?.]) (define-key key-translation-map [kp-begin] [begin]) (define-key key-translation-map [kp-home] [home]) (define-key key-translation-map [kp-end] [end]) (define-key key-translation-map [kp-next] [next]) (define-key key-translation-map [kp-prior] [prior]) (define-key key-translation-map [kp-left] [left]) (define-key key-translation-map [kp-right] [right]) (define-key key-translation-map [kp-up] [up]) (define-key key-translation-map [kp-down] [down]) (define-key key-translation-map [kp-insert] [insert]) (define-key key-translation-map [kp-delete] [delete]) (define-key key-translation-map [kp-0] [?0]) (define-key key-translation-map [kp-1] [?1]) (define-key key-translation-map [kp-2] [?2]) (define-key key-translation-map [kp-3] [?3]) (define-key key-translation-map [kp-4] [?4]) (define-key key-translation-map [kp-5] [?5]) (define-key key-translation-map [kp-6] [?6]) (define-key key-translation-map [kp-7] [?7]) (define-key key-translation-map [kp-8] [?8]) (define-key key-translation-map [kp-9] [?9]) ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: (message "Key maps set successfully")