Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 93 lines (71 sloc) 3.684 kb
5fcb34d Phil Hagelberg 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.
8 (global-set-key "\C-\M-h" 'backward-kill-word)
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 Phil Hagelberg Extracted cleanup buffer function.
authored
17 (global-set-key (kbd "C-c n") 'cleanup-buffer)
5fcb34d Phil Hagelberg initial commit
authored
18
19 ;; Turn on the menu bar for exploring new modes
20 (global-set-key [f1] 'menu-bar-mode)
21
22 ;; Use regex searches by default.
23 (global-set-key "\C-s" 'isearch-forward-regexp)
24 (global-set-key "\C-r" 'isearch-backward-regexp)
25 (global-set-key "\C-\M-s" 'isearch-forward)
26 (global-set-key "\C-\M-r" 'isearch-backward)
27
28 ;; Jump to a definition in the current file. (This is awesome.)
d7bdec6 Phil Hagelberg Rename some functions; remove mention of nxhtml until it's in ELPA.
authored
29 (global-set-key "\C-x\C-i" 'ido-imenu)
5fcb34d Phil Hagelberg initial commit
authored
30
31 ;; File finding
32 (global-set-key (kbd "C-x M-f") 'ido-find-file-other-window)
33 (global-set-key (kbd "C-x C-M-f") 'find-file-in-project)
34 (global-set-key (kbd "C-x f") 'recentf-ido-find-file)
35 (global-set-key (kbd "C-x C-p") 'find-file-at-point)
36 (global-set-key (kbd "C-c y") 'bury-buffer)
37 (global-set-key (kbd "C-c r") 'revert-buffer)
38 (global-set-key (kbd "M-`") 'file-cache-minibuffer-complete)
3967f4b Phil Hagelberg Remove ELPA'd ruby libs, clean up regen-autoloads.
authored
39 (global-set-key (kbd "C-x C-b") 'ibuffer)
5fcb34d Phil Hagelberg initial commit
authored
40
41 ;; Window switching. (C-x o goes to the next window)
42 (windmove-default-keybindings) ;; Shift+direction
43 (global-set-key "\C-xO" (lambda () (interactive) (other-window -1))) ;; back one
44 (global-set-key "\C-x\C-o" (lambda () (interactive) (other-window 2))) ;; forward two
45
46 ;; Start eshell or switch to it if it's active.
47 (global-set-key (kbd "C-x m") 'eshell)
48
49 ;; Start a new eshell even if one is active.
50 (global-set-key (kbd "C-x M") (lambda () (interactive) (eshell t)))
51
52 ;; Start a regular shell if you prefer that.
af222d2 Phil Hagelberg Meta-less command invocation binding.
authored
53 (global-set-key (kbd "C-x M-m") 'shell)
54
55 ;; If you want to be able to M-x without meta
56 (global-set-key (kbd "C-x C-m") 'execute-extended-command)
5fcb34d Phil Hagelberg initial commit
authored
57
58 ;; Fetch the contents at a URL, display it raw.
59 (global-set-key (kbd "C-x h") 'view-url)
60
38ac75b Phil Hagelberg Remove cheat binding, use coding-hook.
authored
61 ;; Help should search more than just commands
5fcb34d Phil Hagelberg initial commit
authored
62 (global-set-key (kbd "C-h a") 'apropos)
63
eb9eeb5 Phil Hagelberg Move lisp bindings and add in JS stuff.
authored
64 ;; Should be able to eval-and-replace anywhere.
65 (global-set-key (kbd "C-c e") 'eval-and-replace)
66
5fcb34d Phil Hagelberg initial commit
authored
67 ;; Applications
68
69 (global-set-key (kbd "C-c j") (lambda () (interactive) (switch-or-start 'jabber-connect "*-jabber-*")))
70 (global-set-key (kbd "C-c g") (lambda () (interactive) (switch-or-start 'gnus "*Group*")))
38ac75b Phil Hagelberg Remove cheat binding, use coding-hook.
authored
71 (global-set-key (kbd "C-c i") (lambda () (interactive) (switch-or-start (lambda ()
b6f578c Phil Hagelberg Add Jabber client.
authored
72 (rcirc-connect "irc.freenode.net"))
5fcb34d Phil Hagelberg initial commit
authored
73 "*irc.freenode.net*")))
74 (global-set-key (kbd "C-c J") 'jabber-send-presence)
75 (global-set-key (kbd "C-c M-j") 'jabber-disconnect)
76 (global-set-key (kbd "C-x g") 'magit-status)
77
78 ;; This is a little hacky since VC doesn't support git add internally
4fb4321 Phil Hagelberg Fix vc binding to use prefix map.
authored
79 (eval-after-load 'vc
80 (define-key vc-prefix-map "i" '(lambda () (interactive)
81 (if (not (eq 'Git (vc-backend buffer-file-name)))
82 (vc-register)
83 (shell-command (format "git add %s" buffer-file-name))
84 (message "Staged changes.")))))
5fcb34d Phil Hagelberg initial commit
authored
85
86 ;; Activate occur easily inside isearch
87 (define-key isearch-mode-map (kbd "C-o")
88 (lambda () (interactive)
89 (let ((case-fold-search isearch-case-fold-search))
90 (occur (if isearch-regexp isearch-string (regexp-quote isearch-string))))))
91
92 (provide 'starter-kit-bindings)
93 ;;; starter-kit-bindings.el ends here
Something went wrong with that request. Please try again.