2011-10-08 23:05:06 +03:00
|
|
|
;;; prelude-global-keybindings.el --- Emacs Prelude: some useful keybindings.
|
|
|
|
;;
|
|
|
|
;; Copyright (c) 2011 Bozhidar Batsov
|
|
|
|
;;
|
|
|
|
;; Author: Bozhidar Batsov <bozhidar.batsov@gmail.com>
|
|
|
|
;; URL: http://www.emacswiki.org/cgi-bin/wiki/Prelude
|
|
|
|
;; Version: 1.0.0
|
|
|
|
;; Keywords: convenience
|
|
|
|
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
;; Lots of useful keybindings.
|
|
|
|
|
|
|
|
;;; License:
|
|
|
|
|
|
|
|
;; 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 3
|
|
|
|
;; of the License, 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 GNU Emacs; see the file COPYING. If not, write to the
|
|
|
|
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
;; Boston, MA 02110-1301, USA.
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
2011-11-27 13:47:34 +02:00
|
|
|
;; You know, like Readline.
|
|
|
|
(global-set-key (kbd "C-M-h") 'backward-kill-word)
|
2011-10-07 23:25:37 +03:00
|
|
|
|
2011-11-27 13:47:34 +02:00
|
|
|
;; Align your code in a pretty way.
|
|
|
|
(global-set-key (kbd "C-x \\") 'align-regexp)
|
2011-10-07 23:25:37 +03:00
|
|
|
|
2011-11-27 13:47:34 +02:00
|
|
|
;; Font size
|
|
|
|
(define-key global-map (kbd "C-+") 'text-scale-increase)
|
|
|
|
(define-key global-map (kbd "C--") 'text-scale-decrease)
|
2011-10-07 23:25:37 +03:00
|
|
|
|
2011-11-27 13:47:34 +02:00
|
|
|
;; Window switching. (C-x o goes to the next window)
|
|
|
|
(global-set-key (kbd "C-x O") (lambda ()
|
|
|
|
(interactive)
|
|
|
|
(other-window -1))) ;; back one
|
2011-10-07 23:25:37 +03:00
|
|
|
|
2011-11-27 13:47:34 +02:00
|
|
|
;; Indentation help
|
|
|
|
(global-set-key (kbd "C-x ^") 'join-line)
|
2011-10-07 23:25:37 +03:00
|
|
|
|
2011-11-27 13:47:34 +02:00
|
|
|
;; Start proced in a similar manner to dired
|
|
|
|
(global-set-key (kbd "C-x p") 'proced)
|
2011-10-07 23:25:37 +03:00
|
|
|
|
2011-11-27 13:47:34 +02:00
|
|
|
;; Start eshell or switch to it if it's active.
|
|
|
|
(global-set-key (kbd "C-x m") 'eshell)
|
2011-10-07 23:25:37 +03:00
|
|
|
|
2011-11-27 13:47:34 +02:00
|
|
|
;; Start a new eshell even if one is active.
|
|
|
|
(global-set-key (kbd "C-x M") (lambda () (interactive) (eshell t)))
|
2011-10-07 23:25:37 +03:00
|
|
|
|
2011-11-27 13:47:34 +02:00
|
|
|
;; Start a regular shell if you prefer that.
|
|
|
|
(global-set-key (kbd "C-x M-m") 'shell)
|
2011-10-07 23:25:37 +03:00
|
|
|
|
2011-11-27 13:47:34 +02:00
|
|
|
;; If you want to be able to M-x without meta
|
|
|
|
(global-set-key (kbd "C-x C-m") 'execute-extended-command)
|
2011-10-07 23:25:37 +03:00
|
|
|
|
2011-11-27 13:47:34 +02:00
|
|
|
;; A complementary binding to the apropos-command(C-h a)
|
|
|
|
(global-set-key (kbd "C-h A") 'apropos)
|
2011-10-07 23:25:37 +03:00
|
|
|
|
2011-11-27 13:47:34 +02:00
|
|
|
;; Activate occur easily inside isearch
|
|
|
|
(define-key isearch-mode-map (kbd "C-o")
|
|
|
|
(lambda () (interactive)
|
|
|
|
(let ((case-fold-search isearch-case-fold-search))
|
|
|
|
(occur (if isearch-regexp
|
|
|
|
isearch-string
|
|
|
|
(regexp-quote isearch-string))))))
|
2011-10-07 23:25:37 +03:00
|
|
|
|
2011-11-27 13:47:34 +02:00
|
|
|
;; use hippie-expand instead of dabbrev
|
|
|
|
(global-set-key (kbd "M-/") 'hippie-expand)
|
2011-10-07 23:25:37 +03:00
|
|
|
|
2011-11-27 13:47:34 +02:00
|
|
|
;; replace buffer-menu with ibuffer
|
|
|
|
(global-set-key (kbd "C-x C-b") 'ibuffer)
|
2011-10-07 23:25:37 +03:00
|
|
|
|
2011-11-27 13:47:34 +02:00
|
|
|
;; toggle menu-bar visibility
|
|
|
|
(global-set-key (kbd "<f12>") 'menu-bar-mode)
|
2011-10-15 13:04:02 +03:00
|
|
|
|
2011-11-27 13:47:34 +02:00
|
|
|
;; real Emacs hackers don't use the arrow keys
|
2012-02-23 16:39:06 +02:00
|
|
|
(global-unset-key [up])
|
|
|
|
(global-unset-key [down])
|
|
|
|
(global-unset-key [left])
|
|
|
|
(global-unset-key [right])
|
|
|
|
|
|
|
|
;; use M-f and M-b instead
|
|
|
|
(global-unset-key [M-left])
|
|
|
|
(global-unset-key [M-right])
|
2011-10-07 23:25:37 +03:00
|
|
|
|
2012-02-14 13:08:53 +02:00
|
|
|
(global-set-key (kbd "C-x g") 'magit-status)
|
|
|
|
|
2012-03-13 17:20:19 +02:00
|
|
|
(global-set-key (kbd "C-=") 'er/expand-region)
|
2012-03-09 16:20:46 +02:00
|
|
|
(global-set-key (kbd "C-c w") (make-repeatable-command 'er/expand-region))
|
|
|
|
|
2012-04-04 18:50:34 +03:00
|
|
|
(global-set-key (kbd "C-c h") 'helm-mini)
|
2012-03-13 17:20:19 +02:00
|
|
|
|
2011-10-08 23:05:06 +03:00
|
|
|
(provide 'prelude-global-keybindings)
|
|
|
|
|
|
|
|
;;; prelude-global-keybindings.el ends here
|