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.

107 lines
3.2 KiB

  1. ;;; prelude-global-keybindings.el --- Emacs Prelude: some useful keybindings.
  2. ;;
  3. ;; Copyright (c) 2011 Bozhidar Batsov
  4. ;;
  5. ;; Author: Bozhidar Batsov <bozhidar.batsov@gmail.com>
  6. ;; URL: http://www.emacswiki.org/cgi-bin/wiki/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. ;; You know, like Readline.
  29. (global-set-key (kbd "C-M-h") 'backward-kill-word)
  30. ;; Align your code in a pretty way.
  31. (global-set-key (kbd "C-x \\") 'align-regexp)
  32. ;; Font size
  33. (define-key global-map (kbd "C-+") 'text-scale-increase)
  34. (define-key global-map (kbd "C--") 'text-scale-decrease)
  35. ;; Window switching. (C-x o goes to the next window)
  36. (global-set-key (kbd "C-x O") (lambda ()
  37. (interactive)
  38. (other-window -1))) ;; back one
  39. ;; Indentation help
  40. (global-set-key (kbd "C-x ^") 'join-line)
  41. ;; Start proced in a similar manner to dired
  42. (global-set-key (kbd "C-x p") 'proced)
  43. ;; Start eshell or switch to it if it's active.
  44. (global-set-key (kbd "C-x m") 'eshell)
  45. ;; Start a new eshell even if one is active.
  46. (global-set-key (kbd "C-x M") (lambda () (interactive) (eshell t)))
  47. ;; Start a regular shell if you prefer that.
  48. (global-set-key (kbd "C-x M-m") 'shell)
  49. ;; If you want to be able to M-x without meta
  50. (global-set-key (kbd "C-x C-m") 'execute-extended-command)
  51. ;; A complementary binding to the apropos-command(C-h a)
  52. (global-set-key (kbd "C-h A") 'apropos)
  53. ;; Activate occur easily inside isearch
  54. (define-key isearch-mode-map (kbd "C-o")
  55. (lambda () (interactive)
  56. (let ((case-fold-search isearch-case-fold-search))
  57. (occur (if isearch-regexp
  58. isearch-string
  59. (regexp-quote isearch-string))))))
  60. ;; use hippie-expand instead of dabbrev
  61. (global-set-key (kbd "M-/") 'hippie-expand)
  62. ;; replace buffer-menu with ibuffer
  63. (global-set-key (kbd "C-x C-b") 'ibuffer)
  64. ;; toggle menu-bar visibility
  65. (global-set-key (kbd "<f12>") 'menu-bar-mode)
  66. ;; real Emacs hackers don't use the arrow keys
  67. (global-unset-key [up])
  68. (global-unset-key [down])
  69. (global-unset-key [left])
  70. (global-unset-key [right])
  71. ;; use M-f and M-b instead
  72. (global-unset-key [M-left])
  73. (global-unset-key [M-right])
  74. (global-set-key (kbd "C-x g") 'magit-status)
  75. (global-set-key (kbd "C-=") 'er/expand-region)
  76. (global-set-key (kbd "C-c w") (make-repeatable-command 'er/expand-region))
  77. (global-set-key (kbd "C-c h") 'helm-mini)
  78. (provide 'prelude-global-keybindings)
  79. ;;; prelude-global-keybindings.el ends here