Emacs config utilizing prelude as a base
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

122 lines
4.0 KiB

14 years ago
14 years ago
14 years ago
14 years ago
14 years ago
14 years ago
14 years ago
14 years ago
14 years ago
14 years ago
14 years ago
14 years ago
  1. ;;; prelude-global-keybindings.el --- Emacs Prelude: some useful keybindings.
  2. ;;
  3. ;; Copyright © 2011-2015 Bozhidar Batsov
  4. ;;
  5. ;; Author: Bozhidar Batsov <bozhidar@batsov.com>
  6. ;; URL: https://github.com/bbatsov/prelude
  7. ;; Version: 1.0.0
  8. ;; Keywords: convenience
  9. ;; This file is not part of GNU Emacs.
  10. ;;; Commentary:
  11. ;; Lots of useful keybindings.
  12. ;;; License:
  13. ;; This program is free software; you can redistribute it and/or
  14. ;; modify it under the terms of the GNU General Public License
  15. ;; as published by the Free Software Foundation; either version 3
  16. ;; of the License, or (at your option) any later version.
  17. ;;
  18. ;; This program is distributed in the hope that it will be useful,
  19. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. ;; GNU General Public License for more details.
  22. ;;
  23. ;; You should have received a copy of the GNU General Public License
  24. ;; along with GNU Emacs; see the file COPYING. If not, write to the
  25. ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  26. ;; Boston, MA 02110-1301, USA.
  27. ;;; Code:
  28. ;; Align your code in a pretty way.
  29. (global-set-key (kbd "C-x \\") 'align-regexp)
  30. ;; Font size
  31. (global-set-key (kbd "C-+") 'text-scale-increase)
  32. (global-set-key (kbd "C--") 'text-scale-decrease)
  33. ;; Window switching. (C-x o goes to the next window)
  34. (global-set-key (kbd "C-x O") (lambda ()
  35. (interactive)
  36. (other-window -1))) ;; back one
  37. ;; Indentation help
  38. (global-set-key (kbd "C-^") 'prelude-top-join-line)
  39. ;; Start proced in a similar manner to dired
  40. (unless (eq system-type 'darwin)
  41. (global-set-key (kbd "C-x p") 'proced))
  42. ;; Start eshell or switch to it if it's active.
  43. (global-set-key (kbd "C-x m") 'eshell)
  44. ;; Start a new eshell even if one is active.
  45. (global-set-key (kbd "C-x M") (lambda () (interactive) (eshell t)))
  46. ;; Start a regular shell if you prefer that.
  47. (global-set-key (kbd "C-x M-m") 'shell)
  48. ;; If you want to be able to M-x without meta
  49. (global-set-key (kbd "C-x C-m") 'smex)
  50. ;; A complementary binding to the apropos-command (C-h a)
  51. (define-key 'help-command "A" 'apropos)
  52. ;; A quick major mode help with discover-my-major
  53. (define-key 'help-command (kbd "C-m") 'discover-my-major)
  54. (define-key 'help-command (kbd "C-f") 'find-function)
  55. (define-key 'help-command (kbd "C-k") 'find-function-on-key)
  56. (define-key 'help-command (kbd "C-v") 'find-variable)
  57. (define-key 'help-command (kbd "C-l") 'find-library)
  58. (define-key 'help-command (kbd "C-i") 'info-display-manual)
  59. ;; replace zap-to-char functionaity with the more powerful zop-to-char
  60. (global-set-key (kbd "M-z") 'zop-up-to-char)
  61. (global-set-key (kbd "M-Z") 'zop-to-char)
  62. ;; kill lines backward
  63. (global-set-key (kbd "C-<backspace>") (lambda ()
  64. (interactive)
  65. (kill-line 0)
  66. (indent-according-to-mode)))
  67. (global-set-key [remap kill-whole-line] 'prelude-kill-whole-line)
  68. ;; Activate occur easily inside isearch
  69. (define-key isearch-mode-map (kbd "C-o")
  70. (lambda () (interactive)
  71. (let ((case-fold-search isearch-case-fold-search))
  72. (occur (if isearch-regexp
  73. isearch-string
  74. (regexp-quote isearch-string))))))
  75. ;; use hippie-expand instead of dabbrev
  76. (global-set-key (kbd "M-/") 'hippie-expand)
  77. ;; replace buffer-menu with ibuffer
  78. (global-set-key (kbd "C-x C-b") 'ibuffer)
  79. (unless (fboundp 'toggle-frame-fullscreen)
  80. (global-set-key (kbd "<f11>") 'prelude-fullscreen))
  81. ;; toggle menu-bar visibility
  82. (global-set-key (kbd "<f12>") 'menu-bar-mode)
  83. (global-set-key (kbd "C-x g") 'magit-status)
  84. (global-set-key (kbd "C-x M-g") 'magit-dispatch-popup)
  85. (global-set-key (kbd "C-=") 'er/expand-region)
  86. (global-set-key (kbd "C-c j") 'avy-goto-word-or-subword-1)
  87. (global-set-key (kbd "s-.") 'avy-goto-word-or-subword-1)
  88. (global-set-key (kbd "s-w") 'ace-window)
  89. (provide 'prelude-global-keybindings)
  90. ;;; prelude-global-keybindings.el ends here