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.

121 lines
4.0 KiB

  1. ;; You know, like Readline.
  2. (global-set-key (kbd "C-M-h") 'backward-kill-word)
  3. ;; Align your code in a pretty way.
  4. (global-set-key (kbd "C-x \\") 'align-regexp)
  5. ;; Perform general cleanup.
  6. (global-set-key (kbd "C-c n") 'cleanup-buffer)
  7. ;; Font size
  8. (define-key global-map (kbd "C-+") 'text-scale-increase)
  9. (define-key global-map (kbd "C--") 'text-scale-decrease)
  10. ;; Jump to a definition in the current file. (This is awesome.)
  11. (global-set-key (kbd "M-i") 'ido-goto-symbol)
  12. ;; File finding
  13. (global-set-key (kbd "C-x M-f") 'ido-find-file-other-window)
  14. (global-set-key (kbd "C-x C-M-f") 'projectile-jump-to-project-file)
  15. (global-set-key (kbd "C-x f") 'recentf-ido-find-file)
  16. (global-set-key (kbd "C-c r") 'bury-buffer)
  17. (global-set-key (kbd "M-`") 'file-cache-minibuffer-complete)
  18. ;; Window switching. (C-x o goes to the next window)
  19. (global-set-key (kbd "C-x O") (lambda ()
  20. (interactive)
  21. (other-window -1))) ;; back one
  22. ;; Indentation help
  23. (global-set-key (kbd "C-x ^") 'join-line)
  24. (global-set-key (kbd "C-M-\\") 'indent-region-or-buffer)
  25. ;; Start proced in a similar manner to dired
  26. (global-set-key (kbd "C-x p") 'proced)
  27. ;; Start eshell or switch to it if it's active.
  28. (global-set-key (kbd "C-x m") 'eshell)
  29. ;; Start a new eshell even if one is active.
  30. (global-set-key (kbd "C-x M") (lambda () (interactive) (eshell t)))
  31. ;; Start a regular shell if you prefer that.
  32. (global-set-key (kbd "C-x M-m") 'shell)
  33. ;; If you want to be able to M-x without meta
  34. (global-set-key (kbd "C-x C-m") 'execute-extended-command)
  35. ;; Fetch the contents at a URL, display it raw.
  36. (global-set-key (kbd "C-x C-h") 'view-url)
  37. ;; A complementary binding to the apropos-command(C-h a)
  38. (global-set-key (kbd "C-h A") 'apropos)
  39. ;; Should be able to eval-and-replace anywhere.
  40. (global-set-key (kbd "C-c e") 'eval-and-replace)
  41. ;; Magit rules!
  42. (global-set-key (kbd "C-x g") 'magit-status)
  43. ;; Activate occur easily inside isearch
  44. (define-key isearch-mode-map (kbd "C-o")
  45. (lambda () (interactive)
  46. (let ((case-fold-search isearch-case-fold-search))
  47. (occur (if isearch-regexp
  48. isearch-string
  49. (regexp-quote isearch-string))))))
  50. ;; cycle through buffers
  51. (global-set-key (kbd "<C-tab>") 'bury-buffer)
  52. ;; use hippie-expand instead of dabbrev
  53. (global-set-key (kbd "M-/") 'hippie-expand)
  54. ;; spell check Bulgarian text
  55. (global-set-key (kbd "C-c B")
  56. (lambda()(interactive)
  57. (ispell-change-dictionary "bulgarian")
  58. (flyspell-buffer)))
  59. ;; replace buffer-menu with ibuffer
  60. (global-set-key (kbd "C-x C-b") 'ibuffer)
  61. ;; interactive text replacement
  62. (global-set-key (kbd "C-c C-r") 'iedit-mode)
  63. ;; swap windows
  64. (global-set-key (kbd "C-c s") 'swap-windows)
  65. ;; duplicate the current line or region
  66. (global-set-key (kbd "C-c d") 'duplicate-current-line-or-region)
  67. ;; rename buffer & visited file
  68. (global-set-key (kbd "C-c r") 'rename-file-and-buffer)
  69. ;; open an ansi-term buffer
  70. (global-set-key (kbd "C-x t") 'visit-term-buffer)
  71. ;; toggle input method
  72. (global-set-key (kbd "C-\\") 'toggle-bulgarian-input-method)
  73. ;; search with google
  74. (global-set-key (kbd "C-c g") 'google)
  75. ;; toggle menu-bar visibility
  76. (global-set-key (kbd "<f12>") 'menu-bar-mode)
  77. ;; real Emacs hackers don't use the arrow keys
  78. (global-set-key (kbd "<up>") (lambda ()
  79. (interactive)
  80. (message "Arrow key navigation is disabled. Use C-p instead.")))
  81. (global-set-key (kbd "<down>") (lambda ()
  82. (interactive)
  83. (message "Arrow key navigation is disabled. Use C-n instead.")))
  84. (global-set-key (kbd "<left>") (lambda ()
  85. (interactive)
  86. (message "Arrow key navigation is disabled. Use C-b instead.")))
  87. (global-set-key (kbd "<right>") (lambda ()
  88. (interactive)
  89. (message "Arrow key navigation is disabled. Use C-f instead.")))
  90. (provide 'global-keybindings-prelude)