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.

112 lines
3.6 KiB

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