2012-04-17 17:47:05 +03:00
|
|
|
;;; prelude-global-keybindings.el --- Emacs Prelude: some useful keybindings.
|
|
|
|
;;
|
2017-01-04 01:20:26 +02:00
|
|
|
;; Copyright © 2011-2017 Bozhidar Batsov
|
2012-04-17 17:47:05 +03:00
|
|
|
;;
|
|
|
|
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
|
2013-03-07 09:57:33 +02:00
|
|
|
;; URL: https://github.com/bbatsov/prelude
|
2012-04-17 17:47:05 +03:00
|
|
|
;; 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:
|
|
|
|
|
|
|
|
;; Align your code in a pretty way.
|
|
|
|
(global-set-key (kbd "C-x \\") 'align-regexp)
|
|
|
|
|
|
|
|
;; Font size
|
2012-10-05 10:15:30 +03:00
|
|
|
(global-set-key (kbd "C-+") 'text-scale-increase)
|
|
|
|
(global-set-key (kbd "C--") 'text-scale-decrease)
|
2012-04-17 17:47:05 +03: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
|
|
|
|
|
|
|
|
;; Indentation help
|
2016-05-03 06:14:31 +03:00
|
|
|
(global-set-key (kbd "C-^") 'crux-top-join-line)
|
2012-04-17 17:47:05 +03:00
|
|
|
;; Start proced in a similar manner to dired
|
2014-05-28 14:17:26 +03:00
|
|
|
(unless (eq system-type 'darwin)
|
|
|
|
(global-set-key (kbd "C-x p") 'proced))
|
2012-04-17 17:47:05 +03:00
|
|
|
|
|
|
|
;; Start eshell or switch to it if it's active.
|
|
|
|
(global-set-key (kbd "C-x m") 'eshell)
|
|
|
|
|
|
|
|
;; Start a new eshell even if one is active.
|
|
|
|
(global-set-key (kbd "C-x M") (lambda () (interactive) (eshell t)))
|
|
|
|
|
|
|
|
;; Start a regular shell if you prefer that.
|
|
|
|
(global-set-key (kbd "C-x M-m") 'shell)
|
|
|
|
|
|
|
|
;; If you want to be able to M-x without meta
|
2013-08-10 20:56:36 +03:00
|
|
|
(global-set-key (kbd "C-x C-m") 'smex)
|
2012-04-17 17:47:05 +03:00
|
|
|
|
2012-10-05 10:15:30 +03:00
|
|
|
;; A complementary binding to the apropos-command (C-h a)
|
|
|
|
(define-key 'help-command "A" 'apropos)
|
2012-04-17 17:47:05 +03:00
|
|
|
|
2014-05-27 10:22:51 +03:00
|
|
|
;; A quick major mode help with discover-my-major
|
|
|
|
(define-key 'help-command (kbd "C-m") 'discover-my-major)
|
|
|
|
|
2014-05-26 19:02:46 +03:00
|
|
|
(define-key 'help-command (kbd "C-f") 'find-function)
|
|
|
|
(define-key 'help-command (kbd "C-k") 'find-function-on-key)
|
|
|
|
(define-key 'help-command (kbd "C-v") 'find-variable)
|
|
|
|
(define-key 'help-command (kbd "C-l") 'find-library)
|
2013-03-12 14:58:44 +02:00
|
|
|
|
2014-11-13 15:58:28 +02:00
|
|
|
(define-key 'help-command (kbd "C-i") 'info-display-manual)
|
|
|
|
|
2015-02-07 12:46:05 +02:00
|
|
|
;; replace zap-to-char functionaity with the more powerful zop-to-char
|
2015-02-07 12:47:31 +02:00
|
|
|
(global-set-key (kbd "M-z") 'zop-up-to-char)
|
|
|
|
(global-set-key (kbd "M-Z") 'zop-to-char)
|
2012-12-26 10:38:03 +02:00
|
|
|
|
2013-04-08 18:50:05 +03:00
|
|
|
;; kill lines backward
|
|
|
|
(global-set-key (kbd "C-<backspace>") (lambda ()
|
|
|
|
(interactive)
|
2013-04-09 14:43:48 +03:00
|
|
|
(kill-line 0)
|
|
|
|
(indent-according-to-mode)))
|
2013-04-08 18:50:05 +03:00
|
|
|
|
2016-05-03 06:14:31 +03:00
|
|
|
(global-set-key [remap kill-whole-line] 'crux-kill-whole-line)
|
2013-04-09 15:18:08 +03:00
|
|
|
|
2012-04-17 17:47:05 +03:00
|
|
|
;; Activate occur easily inside isearch
|
2015-07-06 11:01:18 +03:00
|
|
|
(define-key isearch-mode-map (kbd "C-o") 'isearch-occur)
|
2012-04-17 17:47:05 +03:00
|
|
|
|
|
|
|
;; use hippie-expand instead of dabbrev
|
|
|
|
(global-set-key (kbd "M-/") 'hippie-expand)
|
|
|
|
|
|
|
|
;; replace buffer-menu with ibuffer
|
|
|
|
(global-set-key (kbd "C-x C-b") 'ibuffer)
|
|
|
|
|
2013-07-26 17:36:18 +03:00
|
|
|
(unless (fboundp 'toggle-frame-fullscreen)
|
|
|
|
(global-set-key (kbd "<f11>") 'prelude-fullscreen))
|
|
|
|
|
2012-04-17 17:47:05 +03:00
|
|
|
;; toggle menu-bar visibility
|
|
|
|
(global-set-key (kbd "<f12>") 'menu-bar-mode)
|
|
|
|
|
|
|
|
(global-set-key (kbd "C-x g") 'magit-status)
|
2015-06-27 17:19:57 +03:00
|
|
|
(global-set-key (kbd "C-x M-g") 'magit-dispatch-popup)
|
2012-04-17 17:47:05 +03:00
|
|
|
|
|
|
|
(global-set-key (kbd "C-=") 'er/expand-region)
|
|
|
|
|
2015-05-22 08:51:32 +03:00
|
|
|
(global-set-key (kbd "C-c j") 'avy-goto-word-or-subword-1)
|
|
|
|
(global-set-key (kbd "s-.") 'avy-goto-word-or-subword-1)
|
2014-09-13 17:35:59 +03:00
|
|
|
(global-set-key (kbd "s-w") 'ace-window)
|
2014-05-15 17:11:49 +03:00
|
|
|
|
2012-04-17 17:47:05 +03:00
|
|
|
(provide 'prelude-global-keybindings)
|
|
|
|
|
|
|
|
;;; prelude-global-keybindings.el ends here
|