Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 96 lines (71 sloc) 3.417 kb
5fcb34d @technomancy initial commit
technomancy authored
1 ;;; starter-kit-bindings.el --- Set up some handy key bindings
2 ;;
3 ;; Part of the Emacs Starter Kit.
4
5 ;; You know, like Readline.
044dab1 @Singletoned Fixed keybindings to kdb style
Singletoned authored
6 (global-set-key (kbd "C-M-h") 'backward-kill-word)
5fcb34d @technomancy initial commit
technomancy authored
7
8 ;; Align your code in a pretty way.
9 (global-set-key (kbd "C-x \\") 'align-regexp)
10
11 ;; Completion that uses many different methods to find options.
12 (global-set-key (kbd "M-/") 'hippie-expand)
13
14 ;; Perform general cleanup.
1f6f58b @technomancy Extracted cleanup buffer function.
technomancy authored
15 (global-set-key (kbd "C-c n") 'cleanup-buffer)
5fcb34d @technomancy initial commit
technomancy authored
16
17 ;; Turn on the menu bar for exploring new modes
5a2eff3 @technomancy Use C-F10 to toggle menu bar to free up F1 for help prefix.
technomancy authored
18 (global-set-key (kbd "C-<f10>") 'menu-bar-mode)
5fcb34d @technomancy initial commit
technomancy authored
19
fbb6e1f @technomancy Misc cleanup.
technomancy authored
20 ;; Font size
21 (define-key global-map (kbd "C-+") 'text-scale-increase)
22 (define-key global-map (kbd "C--") 'text-scale-decrease)
23
5fcb34d @technomancy initial commit
technomancy authored
24 ;; Use regex searches by default.
044dab1 @Singletoned Fixed keybindings to kdb style
Singletoned authored
25 (global-set-key (kbd "C-s") 'isearch-forward-regexp)
26 (global-set-key (kbd "\C-r") 'isearch-backward-regexp)
27 (global-set-key (kbd "C-M-s") 'isearch-forward)
28 (global-set-key (kbd "C-M-r") 'isearch-backward)
5fcb34d @technomancy initial commit
technomancy authored
29
30 ;; Jump to a definition in the current file. (This is awesome.)
044dab1 @Singletoned Fixed keybindings to kdb style
Singletoned authored
31 (global-set-key (kbd "C-x C-i") 'ido-imenu)
5fcb34d @technomancy initial commit
technomancy authored
32
33 ;; File finding
34 (global-set-key (kbd "C-x M-f") 'ido-find-file-other-window)
35 (global-set-key (kbd "C-x C-M-f") 'find-file-in-project)
36 (global-set-key (kbd "C-x f") 'recentf-ido-find-file)
37 (global-set-key (kbd "C-c y") 'bury-buffer)
38 (global-set-key (kbd "C-c r") 'revert-buffer)
39 (global-set-key (kbd "M-`") 'file-cache-minibuffer-complete)
3967f4b @technomancy Remove ELPA'd ruby libs, clean up regen-autoloads.
technomancy authored
40 (global-set-key (kbd "C-x C-b") 'ibuffer)
5fcb34d @technomancy initial commit
technomancy authored
41
42 ;; Window switching. (C-x o goes to the next window)
b4cbc75 @timcharper disables various defaults from emacs-starter-kit
timcharper authored
43 ;; (windmove-default-keybindings) ;; Shift+direction
044dab1 @Singletoned Fixed keybindings to kdb style
Singletoned authored
44 (global-set-key (kbd "C-x O") (lambda () (interactive) (other-window -1))) ;; back one
45 (global-set-key (kbd "C-x C-o") (lambda () (interactive) (other-window 2))) ;; forward two
5fcb34d @technomancy initial commit
technomancy authored
46
47 ;; Start eshell or switch to it if it's active.
48 (global-set-key (kbd "C-x m") 'eshell)
49
50 ;; Start a new eshell even if one is active.
51 (global-set-key (kbd "C-x M") (lambda () (interactive) (eshell t)))
52
53 ;; Start a regular shell if you prefer that.
af222d2 @technomancy Meta-less command invocation binding.
technomancy authored
54 (global-set-key (kbd "C-x M-m") 'shell)
55
6cefb65 @technomancy Remove some ill-advised bindings.
technomancy authored
56 ;; If you want to be able to M-x without meta (phones, etc)
af222d2 @technomancy Meta-less command invocation binding.
technomancy authored
57 (global-set-key (kbd "C-x C-m") 'execute-extended-command)
5fcb34d @technomancy initial commit
technomancy authored
58
59 ;; Fetch the contents at a URL, display it raw.
5a37425 @technomancy Unshadow mark-whole-buffer binding.
technomancy authored
60 (global-set-key (kbd "C-x C-h") 'view-url)
5fcb34d @technomancy initial commit
technomancy authored
61
38ac75b @technomancy Remove cheat binding, use coding-hook.
technomancy authored
62 ;; Help should search more than just commands
5fcb34d @technomancy initial commit
technomancy authored
63 (global-set-key (kbd "C-h a") 'apropos)
64
eb9eeb5 @technomancy Move lisp bindings and add in JS stuff.
technomancy authored
65 ;; Should be able to eval-and-replace anywhere.
66 (global-set-key (kbd "C-c e") 'eval-and-replace)
67
7297c0a @technomancy Add message-point binding.
technomancy authored
68 ;; For debugging Emacs modes
69 (global-set-key (kbd "C-c p") 'message-point)
70
6cefb65 @technomancy Remove some ill-advised bindings.
technomancy authored
71 ;; So good!
5fcb34d @technomancy initial commit
technomancy authored
72 (global-set-key (kbd "C-x g") 'magit-status)
73
c99f278 @technomancy Nice alternate join-line binding.
technomancy authored
74 (global-set-key (kbd "C-c q") 'join-line)
75
5fcb34d @technomancy initial commit
technomancy authored
76 ;; This is a little hacky since VC doesn't support git add internally
4fb4321 @technomancy Fix vc binding to use prefix map.
technomancy authored
77 (eval-after-load 'vc
78 (define-key vc-prefix-map "i" '(lambda () (interactive)
79 (if (not (eq 'Git (vc-backend buffer-file-name)))
80 (vc-register)
81 (shell-command (format "git add %s" buffer-file-name))
82 (message "Staged changes.")))))
5fcb34d @technomancy initial commit
technomancy authored
83
84 ;; Activate occur easily inside isearch
85 (define-key isearch-mode-map (kbd "C-o")
86 (lambda () (interactive)
87 (let ((case-fold-search isearch-case-fold-search))
88 (occur (if isearch-regexp isearch-string (regexp-quote isearch-string))))))
89
bc907d2 @technomancy Add org bindings; fix clojure-project root heuristic.
technomancy authored
90 ;; Org
91 (define-key global-map "\C-cl" 'org-store-link)
92 (define-key global-map "\C-ca" 'org-agenda)
93
5fcb34d @technomancy initial commit
technomancy authored
94 (provide 'starter-kit-bindings)
6cefb65 @technomancy Remove some ill-advised bindings.
technomancy authored
95 ;;; starter-kit-bindings.el ends here
Something went wrong with that request. Please try again.