annotate .elisp/settings/90.keybindings.el @ 424:7a8483897360

custom: reformat custom-safe-themes
author Augie Fackler <raf@durin42.com>
date Tue, 29 Nov 2016 13:26:10 -0500
parents 11fdb5a60eee
children eff0298b770d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
77
45d7441d0cf2 Modularize .emacs
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
1 ;; Key Bindings
45d7441d0cf2 Modularize .emacs
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
2 ; M-backspace kills the current buffer
45d7441d0cf2 Modularize .emacs
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
3 (global-set-key [(meta backspace)] 'kill-this-buffer)
190
5dbff8b65be7 emacs: switch ways of defining M-backsp
Augie Fackler <durin42@gmail.com>
parents: 177
diff changeset
4 (global-set-key "\M-\d" 'kill-this-buffer)
77
45d7441d0cf2 Modularize .emacs
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
5 ; Save early and often, with only one keystroke
45d7441d0cf2 Modularize .emacs
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
6 (global-set-key [(meta s)] 'save-buffer)
45d7441d0cf2 Modularize .emacs
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
7 ; Typing tab is for lesser editors, make hitting return do that
128
d59b0340a85a Man, this is what I wanted all along.
Augie Fackler <durin42@gmail.com>
parents: 126
diff changeset
8 (global-set-key "\C-m" 'indent-new-comment-line)
77
45d7441d0cf2 Modularize .emacs
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
9 ; M-l makes more sense to me for jumping to a line
45d7441d0cf2 Modularize .emacs
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
10 (global-set-key "\M-l" 'goto-line)
45d7441d0cf2 Modularize .emacs
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
11 ; Sometimes C-h is what Backspace sends in a terminal, and I never use C-h
45d7441d0cf2 Modularize .emacs
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
12 (global-set-key "\C-h" 'backward-delete-char-untabify)
45d7441d0cf2 Modularize .emacs
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
13 ; M-t is what I want for the textmate file finding
45d7441d0cf2 Modularize .emacs
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
14 (global-set-key [(meta t)] 'textmate-goto-file)
126
34b698771af9 emacs keybinding fixes
Augie Fackler <durin42@gmail.com>
parents: 101
diff changeset
15 ; M-p for bouncing to the matching paren
34b698771af9 emacs keybinding fixes
Augie Fackler <durin42@gmail.com>
parents: 101
diff changeset
16 (global-set-key [(meta p)] 'bounce-to-other-paren)
101
0c1db2df2bf8 Experimental keybindings.
Augie Fackler <durin42@gmail.com>
parents: 95
diff changeset
17 (global-set-key [(meta control f)] 'textmate-find-in-project-type)
126
34b698771af9 emacs keybinding fixes
Augie Fackler <durin42@gmail.com>
parents: 101
diff changeset
18 (global-set-key [(meta shift f)] 'textmate-find-in-project)
77
45d7441d0cf2 Modularize .emacs
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
19 (global-set-key [(meta m)] 'iconify-or-deiconify-frame)
45d7441d0cf2 Modularize .emacs
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
20 (global-set-key [(control backspace)] 'kill-word)
95
df45e402581c Save in server buffer also marks as done.
Augie Fackler <durin42@gmail.com>
parents: 77
diff changeset
21
168
efe94205bf07 emacs: bind f3 to next-error
Augie Fackler <durin42@gmail.com>
parents: 141
diff changeset
22 (global-set-key [f3] 'next-error)
289
5fd871a98b5f emacs: start making an f4-dwim function
Augie Fackler <raf@durin42.com>
parents: 236
diff changeset
23 (defun af-dwim-f4 () (interactive)
5fd871a98b5f emacs: start making an f4-dwim function
Augie Fackler <raf@durin42.com>
parents: 236
diff changeset
24 (cond ((string-match "\\.t$" buffer-file-name)
5fd871a98b5f emacs: start making an f4-dwim function
Augie Fackler <raf@durin42.com>
parents: 236
diff changeset
25 (textmate-start-compile-in-root
420
11fdb5a60eee emacs: bind f4 to a smarter command in .t files
Augie Fackler <raf@durin42.com>
parents: 398
diff changeset
26 (concat "cd tests && python run-tests.py --local -j 2 "
11fdb5a60eee emacs: bind f4 to a smarter command in .t files
Augie Fackler <raf@durin42.com>
parents: 398
diff changeset
27 (file-name-nondirectory buffer-file-name))))
398
1cda3348f36b emacs f4 dwim: bind rust files to running tests with cargo
Augie Fackler <raf@durin42.com>
parents: 345
diff changeset
28 ((string-match "\\.rs$" buffer-file-name)
1cda3348f36b emacs f4 dwim: bind rust files to running tests with cargo
Augie Fackler <raf@durin42.com>
parents: 345
diff changeset
29 (textmate-start-compile-in-root "cargo test"))
1cda3348f36b emacs f4 dwim: bind rust files to running tests with cargo
Augie Fackler <raf@durin42.com>
parents: 345
diff changeset
30 ))
289
5fd871a98b5f emacs: start making an f4-dwim function
Augie Fackler <raf@durin42.com>
parents: 236
diff changeset
31 (global-set-key [f4] 'af-dwim-f4)
177
70dcdb2acade emacs keybindings: f5 for diff-apply-hunk
Augie Fackler <durin42@gmail.com>
parents: 168
diff changeset
32 (global-set-key [f5] 'diff-apply-hunk)
168
efe94205bf07 emacs: bind f3 to next-error
Augie Fackler <durin42@gmail.com>
parents: 141
diff changeset
33
101
0c1db2df2bf8 Experimental keybindings.
Augie Fackler <durin42@gmail.com>
parents: 95
diff changeset
34 ;; M-j for jump to function definition
141
e30655eb7050 textmate.el: synced with upstream
Augie Fackler <durin42@gmail.com>
parents: 128
diff changeset
35 (global-set-key [(meta j)] 'textmate-goto-symbol)
101
0c1db2df2bf8 Experimental keybindings.
Augie Fackler <durin42@gmail.com>
parents: 95
diff changeset
36
0c1db2df2bf8 Experimental keybindings.
Augie Fackler <durin42@gmail.com>
parents: 95
diff changeset
37 ;; commit emacs heresy?
236
3e1ec121efaf emacs: use smex as a replacement for execute-extended-command
Augie Fackler <durin42@gmail.com>
parents: 190
diff changeset
38 (global-set-key [(meta r)] 'smex)
3e1ec121efaf emacs: use smex as a replacement for execute-extended-command
Augie Fackler <durin42@gmail.com>
parents: 190
diff changeset
39 (global-set-key (kbd "M-R") 'smex-major-mode-commands)
101
0c1db2df2bf8 Experimental keybindings.
Augie Fackler <durin42@gmail.com>
parents: 95
diff changeset
40
311
745e7cc9c2cd emacs: bind C-x C-b to ibuffer, which is awesome
Augie Fackler <raf@durin42.com>
parents: 289
diff changeset
41 (global-set-key (kbd "C-x C-b") 'ibuffer)
745e7cc9c2cd emacs: bind C-x C-b to ibuffer, which is awesome
Augie Fackler <raf@durin42.com>
parents: 289
diff changeset
42
101
0c1db2df2bf8 Experimental keybindings.
Augie Fackler <durin42@gmail.com>
parents: 95
diff changeset
43 ;; Mac-like keybindings for undo/cut/copy/paste
0c1db2df2bf8 Experimental keybindings.
Augie Fackler <durin42@gmail.com>
parents: 95
diff changeset
44 (global-set-key [(meta c)] 'kill-ring-save)
0c1db2df2bf8 Experimental keybindings.
Augie Fackler <durin42@gmail.com>
parents: 95
diff changeset
45 (global-set-key [(meta x)] 'kill-region)
0c1db2df2bf8 Experimental keybindings.
Augie Fackler <durin42@gmail.com>
parents: 95
diff changeset
46 (global-set-key [(meta z)] 'undo)
0c1db2df2bf8 Experimental keybindings.
Augie Fackler <durin42@gmail.com>
parents: 95
diff changeset
47 (global-set-key [(meta v)] 'yank)
0c1db2df2bf8 Experimental keybindings.
Augie Fackler <durin42@gmail.com>
parents: 95
diff changeset
48 (global-set-key [M-return] 'fullscreen)
0c1db2df2bf8 Experimental keybindings.
Augie Fackler <durin42@gmail.com>
parents: 95
diff changeset
49 (global-set-key [(control v)] 'yank-pop)
0c1db2df2bf8 Experimental keybindings.
Augie Fackler <durin42@gmail.com>
parents: 95
diff changeset
50
0c1db2df2bf8 Experimental keybindings.
Augie Fackler <durin42@gmail.com>
parents: 95
diff changeset
51 ;; Fixup hooks for modes that like taking my keys back
0c1db2df2bf8 Experimental keybindings.
Augie Fackler <durin42@gmail.com>
parents: 95
diff changeset
52 (add-hook 'text-mode-hook '(lambda ()
0c1db2df2bf8 Experimental keybindings.
Augie Fackler <durin42@gmail.com>
parents: 95
diff changeset
53 (define-key text-mode-map "\M-s"
0c1db2df2bf8 Experimental keybindings.
Augie Fackler <durin42@gmail.com>
parents: 95
diff changeset
54 'save-buffer)))
0c1db2df2bf8 Experimental keybindings.
Augie Fackler <durin42@gmail.com>
parents: 95
diff changeset
55 (add-hook 'comint-mode-hook '(lambda ()
0c1db2df2bf8 Experimental keybindings.
Augie Fackler <durin42@gmail.com>
parents: 95
diff changeset
56 (local-set-key "\M-r"
0c1db2df2bf8 Experimental keybindings.
Augie Fackler <durin42@gmail.com>
parents: 95
diff changeset
57 'execute-extended-command)))
0c1db2df2bf8 Experimental keybindings.
Augie Fackler <durin42@gmail.com>
parents: 95
diff changeset
58
95
df45e402581c Save in server buffer also marks as done.
Augie Fackler <durin42@gmail.com>
parents: 77
diff changeset
59 (defun server-save-buffer-and-finish ()
df45e402581c Save in server buffer also marks as done.
Augie Fackler <durin42@gmail.com>
parents: 77
diff changeset
60 (interactive)
345
b9c8655f12f0 emacs: only call server-edit during my save function if the buffer was actually a server buffer
Augie Fackler <raf@durin42.com>
parents: 311
diff changeset
61 (save-buffer)
b9c8655f12f0 emacs: only call server-edit during my save function if the buffer was actually a server buffer
Augie Fackler <raf@durin42.com>
parents: 311
diff changeset
62 (if server-buffer-clients (server-edit)))
95
df45e402581c Save in server buffer also marks as done.
Augie Fackler <durin42@gmail.com>
parents: 77
diff changeset
63 (add-hook 'server-switch-hook
df45e402581c Save in server buffer also marks as done.
Augie Fackler <durin42@gmail.com>
parents: 77
diff changeset
64 '(lambda ()(local-set-key "\M-s" 'server-save-buffer-and-finish )))