Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 104 lines (79 sloc) 4.001 kB
5fcb34d @technomancy initial commit
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
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.
authored
15 (global-set-key (kbd "C-c n") 'cleanup-buffer)
5fcb34d @technomancy initial commit
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.
authored
18 (global-set-key (kbd "C-<f10>") 'menu-bar-mode)
5fcb34d @technomancy initial commit
authored
19
fbb6e1f @technomancy Misc cleanup.
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
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
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
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.
authored
40 (global-set-key (kbd "C-x C-b") 'ibuffer)
5fcb34d @technomancy initial commit
authored
41
42 ;; Window switching. (C-x o goes to the next window)
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
authored
46
fbb6e1f @technomancy Misc cleanup.
authored
47 ;; Indentation help
48 (global-set-key (kbd "C-x ^") 'join-line)
49
5fcb34d @technomancy initial commit
authored
50 ;; Start eshell or switch to it if it's active.
51 (global-set-key (kbd "C-x m") 'eshell)
52
53 ;; Start a new eshell even if one is active.
54 (global-set-key (kbd "C-x M") (lambda () (interactive) (eshell t)))
55
56 ;; Start a regular shell if you prefer that.
af222d2 @technomancy Meta-less command invocation binding.
authored
57 (global-set-key (kbd "C-x M-m") 'shell)
58
59 ;; If you want to be able to M-x without meta
60 (global-set-key (kbd "C-x C-m") 'execute-extended-command)
5fcb34d @technomancy initial commit
authored
61
62 ;; Fetch the contents at a URL, display it raw.
63 (global-set-key (kbd "C-x h") 'view-url)
64
38ac75b @technomancy Remove cheat binding, use coding-hook.
authored
65 ;; Help should search more than just commands
5fcb34d @technomancy initial commit
authored
66 (global-set-key (kbd "C-h a") 'apropos)
67
eb9eeb5 @technomancy Move lisp bindings and add in JS stuff.
authored
68 ;; Should be able to eval-and-replace anywhere.
69 (global-set-key (kbd "C-c e") 'eval-and-replace)
70
7297c0a @technomancy Add message-point binding.
authored
71 ;; For debugging Emacs modes
72 (global-set-key (kbd "C-c p") 'message-point)
73
5fcb34d @technomancy initial commit
authored
74 ;; Applications
75
76 (global-set-key (kbd "C-c j") (lambda () (interactive) (switch-or-start 'jabber-connect "*-jabber-*")))
77 (global-set-key (kbd "C-c g") (lambda () (interactive) (switch-or-start 'gnus "*Group*")))
38ac75b @technomancy Remove cheat binding, use coding-hook.
authored
78 (global-set-key (kbd "C-c i") (lambda () (interactive) (switch-or-start (lambda ()
b6f578c @technomancy Add Jabber client.
authored
79 (rcirc-connect "irc.freenode.net"))
5fcb34d @technomancy initial commit
authored
80 "*irc.freenode.net*")))
81 (global-set-key (kbd "C-c J") 'jabber-send-presence)
82 (global-set-key (kbd "C-c M-j") 'jabber-disconnect)
83 (global-set-key (kbd "C-x g") 'magit-status)
84
85 ;; This is a little hacky since VC doesn't support git add internally
4fb4321 @technomancy Fix vc binding to use prefix map.
authored
86 (eval-after-load 'vc
87 (define-key vc-prefix-map "i" '(lambda () (interactive)
88 (if (not (eq 'Git (vc-backend buffer-file-name)))
89 (vc-register)
90 (shell-command (format "git add %s" buffer-file-name))
91 (message "Staged changes.")))))
5fcb34d @technomancy initial commit
authored
92
93 ;; Activate occur easily inside isearch
94 (define-key isearch-mode-map (kbd "C-o")
95 (lambda () (interactive)
96 (let ((case-fold-search isearch-case-fold-search))
97 (occur (if isearch-regexp isearch-string (regexp-quote isearch-string))))))
98
bc907d2 @technomancy Add org bindings; fix clojure-project root heuristic.
authored
99 ;; Org
100 (define-key global-map "\C-cl" 'org-store-link)
101 (define-key global-map "\C-ca" 'org-agenda)
102
5fcb34d @technomancy initial commit
authored
103 (provide 'starter-kit-bindings)
104 ;;; starter-kit-bindings.el ends here
Something went wrong with that request. Please try again.