Guest User

Untitled

a guest
Jul 22nd, 2013
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.25 KB | None | 0 0
  1. (add-hook 'ruby-mode-hook
  2. (lambda () (define-key ruby-mode-map (kbd "M-/") 'rsense-complete)))
  3.  
  4. ;; You know, like Readline.
  5. (global-set-key (kbd "C-M-h") 'backward-kill-word)
  6.  
  7. ;; Align your code in a pretty way.
  8. (global-set-key (kbd "C-x \") 'align-regexp)
  9.  
  10. ;; Perform general cleanup.
  11. (global-set-key (kbd "C-c n") 'cleanup-buffer)
  12.  
  13. ;; Font size
  14. (define-key global-map (kbd "C-+") 'text-scale-increase)
  15. (define-key global-map (kbd "C--") 'text-scale-decrease)
  16.  
  17. ;; Jump to a definition in the current file. (This is awesome.)
  18. (global-set-key (kbd "C-x C-i") 'ido-imenu)
  19.  
  20. ;; File finding
  21. (global-set-key (kbd "C-x M-f") 'ido-find-file-other-window)
  22. (global-set-key (kbd "C-x C-M-f") 'find-file-in-project)
  23. (global-set-key (kbd "C-x f") 'recentf-ido-find-file)
  24. (global-set-key (kbd "C-c r") 'bury-buffer)
  25. (global-set-key (kbd "M-`") 'file-cache-minibuffer-complete)
  26.  
  27. ;; Window switching. (C-x o goes to the next window)
  28. (global-set-key (kbd "C-x O") (lambda ()
  29. (interactive)
  30. (other-window -1))) ;; back one
  31.  
  32. ;; Indentation help
  33. (global-set-key (kbd "C-x ^") 'join-line)
  34. (global-set-key (kbd "C-M-\") 'indent-region-or-buffer)
  35.  
  36. ;; Start proced in a similar manner to dired
  37. (global-set-key (kbd "C-x p") 'proced)
  38.  
  39. ;; Start eshell or switch to it if it's active.
  40. (global-set-key (kbd "C-x m") 'eshell)
  41.  
  42. ;; Start a new eshell even if one is active.
  43. (global-set-key (kbd "C-x M") (lambda () (interactive) (eshell t)))
  44.  
  45. ;; Start a regular shell if you prefer that.
  46. (global-set-key (kbd "C-x M-m") 'shell)
  47.  
  48. ;; If you want to be able to M-x without meta
  49. (global-set-key (kbd "C-x C-m") 'execute-extended-command)
  50.  
  51. ;; Fetch the contents at a URL, display it raw.
  52. (global-set-key (kbd "C-x C-h") 'view-url)
  53.  
  54. ;; Help should search more than just commands
  55. (global-set-key (kbd "C-h a") 'apropos)
  56.  
  57. ;; Should be able to eval-and-replace anywhere.
  58. (global-set-key (kbd "C-c e") 'eval-and-replace)
  59.  
  60. ;; Magit rules!
  61. (global-set-key (kbd "C-x g") 'magit-status)
  62.  
  63. ;; Activate occur easily inside isearch
  64. (define-key isearch-mode-map (kbd "C-o")
  65. (lambda () (interactive)
  66. (let ((case-fold-search isearch-case-fold-search))
  67. (occur (if isearch-regexp
  68. isearch-string
  69. (regexp-quote isearch-string))))))
  70.  
  71. ;; cycle through buffers
  72. (global-set-key (kbd "<C-tab>") 'bury-buffer)
  73.  
  74. ;; use hippie-expand instead of dabbrev
  75. (global-set-key (kbd "M-/") 'hippie-expand)
  76.  
  77. ;; spell check Bulgarian text
  78. (global-set-key (kbd "C-c B")
  79. (lambda()(interactive)
  80. (ispell-change-dictionary "bulgarian")
  81. (flyspell-buffer)))
  82.  
  83. ;; replace buffer-menu with ibuffer
  84. (global-set-key (kbd "C-x C-b") 'ibuffer)
  85.  
  86. ;; interactive text replacement
  87. (global-set-key (kbd "C-c C-r") 'iedit-mode)
  88.  
  89. ;; swap windows
  90. (global-set-key (kbd "C-c s") 'swap-windows)
  91.  
  92. ;; duplicate the current line or region
  93. (global-set-key (kbd "C-c d") 'duplicate-current-line-or-region)
  94.  
  95. ;; rename buffer & visited file
  96. (global-set-key (kbd "C-c r") 'rename-file-and-buffer)
  97.  
  98. ;; open an ansi-term buffer
  99. (global-set-key (kbd "C-x t") 'visit-term-buffer)
  100.  
  101. ;; toggle input method
  102. (global-set-key (kbd "C-\") 'toggle-bulgarian-input-method)
  103.  
  104. ;; search with google
  105. (global-set-key (kbd "C-c g") 'google)
  106.  
  107. ;; toggle menu-bar visibility
  108. (global-set-key (kbd "<f12>") (lambda () (interactive) (menu-bar-mode)))
  109.  
  110. (global-unset-key "C-l")
  111. (defvar ctl-l-map (make-keymap)
  112. "Keymap for local bindings and functions, prefixed by (^L)")
  113. (define-key global-map "C-l" 'Control-L-prefix)
  114. (fset 'Control-L-prefix ctl-l-map)
  115.  
  116. (define-key ctl-l-map "C-l" 'redraw-display)
  117. (define-key ctl-l-map "l" 'recenter)
  118.  
  119. (define-key ctl-l-map "g" 'goto-line)
  120. (define-key ctl-l-map "r" 'replace-string)
  121. (define-key ctl-l-map "R" 'replace-regexp)
  122. (define-key ctl-l-map "q" 'query-replace)
  123. (define-key ctl-l-map "Q" 'query-replace-regexp)
  124. (define-key ctl-l-map "o" 'overwrite-mode)
  125. (define-key ctl-l-map "C-w" 'kill-rectangle)
  126. (define-key ctl-l-map "C-y" 'yank-rectangle)
  127. (define-key ctl-l-map "h" 'command-history)
  128. (define-key ctl-l-map "w" 'write-region)
  129. (define-key ctl-l-map "r" 'electric-replace-string)
  130. (define-key ctl-l-map "er" 'replace-string)
  131. (define-key ctl-l-map "T" 'delete-trailing-whitespace)
  132. (define-key ctl-l-map "C" 'describe-char)
  133. (define-key ctl-l-map "W" 'ediff-regions-wordwise)
  134. (define-key ctl-l-map "L" 'ediff-regions-linewise)
  135. (define-key ctl-l-map "C-f" 'facemenu-remove-all)
  136. (define-key ctl-l-map "C-c" 'calendar)
  137. (define-key ctl-l-map "m" 'not-modified) ;; already at M-~
  138. (define-key ctl-l-map "C-q" 'fill-region)
  139. (define-key ctl-l-map "u" 'set-buffer-file-coding-system)
  140. (define-key ctl-l-map [?C-2] 'transient-mark-mode)
  141. (define-key ctl-l-map "C-@" 'transient-mark-mode)
  142. (define-key ctl-l-map "C-n" 'linum-mode)
  143. (define-key ctl-l-map "C-s" 'isearch-forward-regexp)
  144. (define-key ctl-l-map "C-r" 'isearch-backward-regexp)a
  145. (define-key ctl-l-map "U" 'browse-url)
  146. (define-key ctl-l-map "F" 'browse-url-of-file)
  147. (define-key ctl-l-map "C-u" 'undo-only)
  148.  
  149. ;;;;;;;; remapping of keys ;;;;;;;;;;;;;;;
  150.  
  151. (global-set-key "C-cg" 'goto-line)
  152. ;C-c u untabifies...yuck!
  153. (global-set-key "C-cu" 'untabify)
  154. ;Regex replace
  155. (global-set-key "C-x%" `query-replace-regexp)
  156. ;;Backward-kill-line is defined later on in this file.
  157. (global-set-key "M-k" `backward-kill-line)
  158.  
  159. (global-set-key "C-xC-j" 'eval-print-last-sexp)
  160. ;;M-up/down -> start/end of buffer. Yay!
  161. (global-set-key (kbd "M-<up>") 'beginning-of-buffer)
  162. (global-set-key (kbd "M-<down>") 'end-of-buffer)
  163. (global-set-key (kbd "M-[") 'beginning-of-buffer)
  164. (global-set-key (kbd "M-]") 'end-of-buffer)
  165.  
  166. ;;remap movement keys to get rid of emacs pinky
  167. ;Jump back and forth by 5.
  168. (global-set-key "C-n" '(lambda () (interactive) (forward-line 5)))
  169. (global-set-key "C-p" '(lambda () (interactive) (forward-line -5)))
  170. (global-set-key "M-a" 'move-beginning-of-line)
  171. (global-set-key "M-e" 'move-end-of-line)
  172. (global-set-key "M-n" 'next-line)
  173. (global-set-key "M-p" 'previous-line)
  174.  
  175. ;bookmark
  176. (global-set-key (kbd "<M-f2>") 'bm-toggle)
  177. (global-set-key (kbd "<f2>") 'bm-next)
  178. (global-set-key (kbd "<f3>") 'bm-previous)
  179. (setq bm-cycle-all-buffers t)
  180.  
  181. (global-set-key (kbd "<f5>") 'revert-buffer)
  182. (global-set-key (kbd "<f12>") 'delete-trailing-whitespace)
  183. (global-set-key (kbd "<f11>") 'comment-or-uncomment-region)
  184.  
  185. (global-set-key (kbd "M-RET") 'newline-and-indent)
  186. (global-set-key "C-m" 'newline-and-indent)
  187.  
  188. ;;Jump "backwards"
  189. (global-set-key "C-xp" '(lambda () (interactive) (other-window -1)))
  190.  
  191. ;;copy
  192. (global-set-key "M-y" 'yank)
  193.  
  194. ;;insert line
  195. (global-set-key "M-o" '(lambda () (interactive) (open-line 1)))
  196.  
  197. ;zap to char backwards
  198. (global-set-key "C-z" 'minimize)
  199. ;;suspend-emacs is the send-to-background command on linux
  200.  
  201. ;simplify register usage
  202. (global-set-key "M-s" 'copy-to-register)
  203. (global-set-key "M-i" 'insert-register)
  204.  
  205. ;;autocomplete hacks
  206. (global-set-key [?M-/] 'hippie-expand)
  207. (global-set-key [?C-/] 'dabbrev-expand)
  208.  
  209.  
  210. (global-set-key [?C-.] 'find-tag)
  211. ;(global-set-key "C-.C-s" 'find-tag)
  212. (global-unset-key [?M-.])
  213.  
  214. ;;this lets us have long lines go off the side of the screen instead of hosing up the ascii art
  215. (global-set-key "C-t" 'toggle-truncate-lines)
  216.  
  217. ;comment/uncomment region
  218. (global-set-key "C-cC-c" 'comment-or-uncomment-region)
  219.  
  220. ;;Buffer-move
  221. (global-set-key (kbd "<C-S-left>") 'buf-move-left)
  222. (global-set-key (kbd "<C-S-right>") 'buf-move-right)
Advertisement
Add Comment
Please, Sign In to add comment