Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 100 lines (76 sloc) 3.914 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 ;; TODO: switch to kbd invocations everywhere
6
7 ;; You know, like Readline.
044dab1 @Singletoned Fixed keybindings to kdb style
Singletoned authored
8 (global-set-key (kbd "C-M-h") 'backward-kill-word)
5fcb34d @technomancy initial commit
authored
9
10 ;; Align your code in a pretty way.
11 (global-set-key (kbd "C-x \\") 'align-regexp)
12
13 ;; Completion that uses many different methods to find options.
14 (global-set-key (kbd "M-/") 'hippie-expand)
15
16 ;; Perform general cleanup.
1f6f58b @technomancy Extracted cleanup buffer function.
authored
17 (global-set-key (kbd "C-c n") 'cleanup-buffer)
5fcb34d @technomancy initial commit
authored
18
19 ;; Turn on the menu bar for exploring new modes
20 (global-set-key [f1] 'menu-bar-mode)
21
fbb6e1f @technomancy Misc cleanup.
authored
22 ;; Font size
23 (define-key global-map (kbd "C-+") 'text-scale-increase)
24 (define-key global-map (kbd "C--") 'text-scale-decrease)
25
5fcb34d @technomancy initial commit
authored
26 ;; Use regex searches by default.
044dab1 @Singletoned Fixed keybindings to kdb style
Singletoned authored
27 (global-set-key (kbd "C-s") 'isearch-forward-regexp)
28 (global-set-key (kbd "\C-r") 'isearch-backward-regexp)
29 (global-set-key (kbd "C-M-s") 'isearch-forward)
30 (global-set-key (kbd "C-M-r") 'isearch-backward)
5fcb34d @technomancy initial commit
authored
31
32 ;; Jump to a definition in the current file. (This is awesome.)
044dab1 @Singletoned Fixed keybindings to kdb style
Singletoned authored
33 (global-set-key (kbd "C-x C-i") 'ido-imenu)
5fcb34d @technomancy initial commit
authored
34
35 ;; File finding
36 (global-set-key (kbd "C-x M-f") 'ido-find-file-other-window)
37 (global-set-key (kbd "C-x C-M-f") 'find-file-in-project)
38 (global-set-key (kbd "C-x f") 'recentf-ido-find-file)
39 (global-set-key (kbd "C-x C-p") 'find-file-at-point)
40 (global-set-key (kbd "C-c y") 'bury-buffer)
41 (global-set-key (kbd "C-c r") 'revert-buffer)
42 (global-set-key (kbd "M-`") 'file-cache-minibuffer-complete)
3967f4b @technomancy Remove ELPA'd ruby libs, clean up regen-autoloads.
authored
43 (global-set-key (kbd "C-x C-b") 'ibuffer)
5fcb34d @technomancy initial commit
authored
44
45 ;; Window switching. (C-x o goes to the next window)
46 (windmove-default-keybindings) ;; Shift+direction
044dab1 @Singletoned Fixed keybindings to kdb style
Singletoned authored
47 (global-set-key (kbd "C-x O") (lambda () (interactive) (other-window -1))) ;; back one
48 (global-set-key (kbd "C-x C-o") (lambda () (interactive) (other-window 2))) ;; forward two
5fcb34d @technomancy initial commit
authored
49
fbb6e1f @technomancy Misc cleanup.
authored
50 ;; Indentation help
51 (global-set-key (kbd "C-x ^") 'join-line)
52
5fcb34d @technomancy initial commit
authored
53 ;; Start eshell or switch to it if it's active.
54 (global-set-key (kbd "C-x m") 'eshell)
55
56 ;; Start a new eshell even if one is active.
57 (global-set-key (kbd "C-x M") (lambda () (interactive) (eshell t)))
58
59 ;; Start a regular shell if you prefer that.
af222d2 @technomancy Meta-less command invocation binding.
authored
60 (global-set-key (kbd "C-x M-m") 'shell)
61
62 ;; If you want to be able to M-x without meta
63 (global-set-key (kbd "C-x C-m") 'execute-extended-command)
5fcb34d @technomancy initial commit
authored
64
65 ;; Fetch the contents at a URL, display it raw.
66 (global-set-key (kbd "C-x h") 'view-url)
67
38ac75b @technomancy Remove cheat binding, use coding-hook.
authored
68 ;; Help should search more than just commands
5fcb34d @technomancy initial commit
authored
69 (global-set-key (kbd "C-h a") 'apropos)
70
eb9eeb5 @technomancy Move lisp bindings and add in JS stuff.
authored
71 ;; Should be able to eval-and-replace anywhere.
72 (global-set-key (kbd "C-c e") 'eval-and-replace)
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
99 (provide 'starter-kit-bindings)
100 ;;; starter-kit-bindings.el ends here
Something went wrong with that request. Please try again.