Last active
August 29, 2015 14:19
-
-
Save Pitometsu/51f97e44a26d36d23f02 to your computer and use it in GitHub Desktop.
Super key usage in my EMACS config.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; mac os x style | |
(global-set-key (kbd "s-S") 'write-file) | |
(global-set-key (kbd "s-s") 'save-buffer) | |
(global-set-key (kbd "s-i") 'dired-jump-other-window) | |
(global-set-key (kbd "s-l") 'goto-line) | |
(global-set-key (kbd "s-q") 'save-buffers-kill-emacs) | |
(global-set-key (kbd "s-x") 'kill-region) | |
(global-set-key (kbd "s-c") 'kill-ring-save) | |
(global-set-key (kbd "s-v") 'yank) | |
(global-set-key (kbd "s-a") 'mark-whole-buffer) | |
(global-set-key (kbd "s-f") 'isearch-forward) | |
(global-set-key (kbd "s-M-f") 'occur) | |
(global-set-key (kbd "s-g") 'isearch-repeat-forward) | |
(global-set-key (kbd "s-G") 'isearch-repeat-backward) | |
(global-set-key (kbd "s-m") 'iconify-frame) | |
(global-set-key (kbd "s-`") 'other-frame) | |
(global-set-key (kbd "s-n") 'make-frame-command) | |
(global-set-key (kbd "s-w") 'delete-frame) | |
(global-set-key (kbd "s-?") 'info) | |
(global-set-key (kbd "s-.") 'keyboard-quit) | |
(global-unset-key (kbd "s-<left>")) | |
(global-unset-key (kbd "s-<right>")) | |
(global-unset-key (kbd "s-<up>")) | |
(global-unset-key (kbd "s-<down>")) | |
(global-set-key (kbd "s-<left>") 'move-beginning-of-line) | |
(global-set-key (kbd "s-<right>") 'move-end-of-line) | |
(global-set-key (kbd "s-<up>") 'beginning-of-buffer) | |
(global-set-key (kbd "s-<down>") 'end-of-buffer) | |
;; kill window with buffer | |
(global-unset-key (kbd "s-W")) | |
(global-set-key (kbd "s-W") ; 【⌘⇧W】 | |
'kill-buffer-and-window) | |
;; recent files | |
(global-set-key (kbd "s-r") 'helm-recentf) | |
;; one-key macros record | |
(global-unset-key (kbd "s-M")) | |
(global-set-key (kbd "s-M") 'call-last-kbd-macro) | |
(global-set-key (kbd "M-s-m") 'toggle-kbd-macro-recording-on) | |
(defun open-next-line (arg) | |
"Move to the next line and then opens a line. | |
See also `newline-and-indent'." | |
(interactive "p") | |
(end-of-line) | |
(open-line arg) | |
(next-line 1) | |
(when newline-and-indent | |
(indent-according-to-mode))) | |
(defun open-previous-line (arg) | |
"Open a new line before the current one. | |
See also `newline-and-indent'." | |
(interactive "p") | |
(beginning-of-line) | |
(open-line arg) | |
(when newline-and-indent | |
(indent-according-to-mode))) | |
(defvar newline-and-indent t | |
"Modify the behavior of the open-*-line functions to cause them to autoindent.") | |
;; smart open line | |
(global-set-key (kbd "S-RET") 'open-next-line) | |
(global-set-key (kbd "S-<return>") 'open-next-line) | |
(global-set-key (kbd "S-C-RET") 'open-previous-line) | |
(global-set-key (kbd "S-C-<return>") 'open-previous-line) | |
(global-set-key (kbd "C-<return>") 'open-next-line) | |
(global-set-key (kbd "C-RET") 'open-next-line) | |
(global-set-key (kbd "S-s-RET") 'open-previous-line) | |
(global-set-key (kbd "S-s-<return>") 'open-previous-line) | |
(global-set-key (kbd "s-RET") 'open-next-line) | |
(global-set-key (kbd "s-<return>") 'open-next-line) | |
;; comment-region | |
(global-set-key (kbd "s-/") 'comment-or-uncomment-region-or-line) | |
(global-set-key (kbd "s-#") 'comment-or-uncomment-region-or-line) | |
(global-set-key (kbd "s-;") 'comment-or-uncomment-region-or-line) | |
;; text scale | |
(global-set-key (kbd "s-=") | |
'(lambda () (interactive) | |
(global-text-scale-adjust (- text-scale-mode-amount)) | |
(global-text-scale-mode -1))) | |
(global-set-key (kbd "s-+") | |
'(lambda () (interactive) (global-text-scale-adjust 1))) | |
(global-set-key (kbd "s--") | |
'(lambda () (interactive) (global-text-scale-adjust -1))) | |
;; kill buffer | |
(global-set-key (kbd "s-k") 'kill-buffer) | |
;; kill buffer with frame | |
(global-set-key (kbd "s-K") 'server-edit) | |
;; ergonomic M-x | |
(global-set-key (kbd "C-c C-m") 'execute-extended-command) | |
(global-set-key (kbd "s-e") 'execute-extended-command) | |
;; textmate mode | https://github.com/defunkt/textmate.el.git | |
(textmate-mode) | |
(define-key *textmate-mode-map* [(meta return)] 'nil) | |
(define-key *textmate-mode-map* [(control c)(control t)] 'nil) | |
(define-key *textmate-mode-map* [(control c)(control a)] 'nil) | |
(define-key *textmate-mode-map* [(control tab)] 'nil) | |
(define-key *textmate-mode-map* [(control shift tab)] 'nil) | |
(define-key *textmate-mode-map* [(control c)(control k)] 'nil) | |
(define-key *textmate-mode-map* [(meta t)] 'nil) | |
(define-key *textmate-mode-map* [(meta shift l)] 'nil) | |
(define-key *textmate-mode-map* [(meta shift t)] 'nil) | |
(define-key *textmate-mode-map* [(alt up)] 'nil) | |
(define-key *textmate-mode-map* [(alt down)] 'nil) | |
(define-key *textmate-mode-map* [(alt shift up)] 'nil) | |
(define-key *textmate-mode-map* [(alt shift down)] 'nil) | |
(define-key *textmate-mode-map* [(super meta t)] 'textmate-clear-cache) | |
(define-key *textmate-mode-map* [(super meta \])] 'align) | |
(define-key *textmate-mode-map* [(super meta \[)] 'indent-according-to-mode) | |
(define-key *textmate-mode-map* [(super \])] 'textmate-shift-right) | |
(define-key *textmate-mode-map* [(super \[)] 'textmate-shift-left) | |
(define-key *textmate-mode-map* [(super shift l)] 'textmate-select-line) | |
(define-key *textmate-mode-map* [(meta up)] 'textmate-column-up) | |
(define-key *textmate-mode-map* [(meta down)] 'textmate-column-down) | |
(define-key *textmate-mode-map* [(meta shift up)] 'textmate-column-up-with-select) | |
(define-key *textmate-mode-map* [(meta shift down)] 'textmate-column-down-with-select) | |
;; direx | |
(global-set-key (kbd "s-M-p") 'direx-project:jump-to-project-root-other-window) | |
;; expand region | |
(global-set-key (kbd "s-@") 'er/expand-region) | |
(global-unset-key (kbd "M-@")) | |
(global-unset-key (kbd "s-;")) | |
(global-unset-key (kbd "s-:")) | |
(global-unset-key (kbd "M-.")) | |
(global-set-key (kbd "s-{") 'er/mark-inside-pairs) | |
(global-set-key (kbd "M-]") 'er/mark-outside-pairs) | |
(global-set-key (kbd "s-B") 'er/mark-outside-pairs) | |
(global-set-key (kbd "s-b") 'er/mark-inside-pairs) | |
(global-set-key (kbd "s-M-@") 'er/mark-symbol) | |
(global-set-key (kbd "C-M-@") 'er/mark-symbol) | |
(global-set-key (kbd "M-@") 'er/mark-word) | |
(global-set-key (kbd "C-s-@") 'er/mark-symbol) | |
(global-set-key (kbd "s-P") 'mark-paragraph) | |
(global-set-key (kbd "C-x P") 'mark-paragraph) | |
(global-set-key (kbd "s-C-/") 'er/mark-comment) | |
(global-set-key (kbd "s-C-?") 'er/mark-comment-block) | |
(global-set-key (kbd "s-C-#") 'er/mark-comment) | |
(global-set-key (kbd "s-C-`") 'er/mark-comment-block) | |
(global-set-key (kbd "s-C-;") 'er/mark-comment) | |
(global-set-key (kbd "s-C-:") 'er/mark-comment-block) | |
(global-set-key (kbd "M-\"") 'er/mark-inside-quotes) | |
(global-set-key (kbd "M-C-\"") 'er/mark-outside-quotes) | |
(global-set-key (kbd "s-\"") 'er/mark-inside-quotes) | |
(global-set-key (kbd "s-C-\"") 'er/mark-outside-quotes) | |
;; helm cmd t | |
(global-set-key (kbd "s-t") 'helm-cmd-t) | |
;; helm swoop | |
(global-set-key (kbd "s-O") 'helm-swoop) | |
;; helm | |
(global-set-key (kbd "M-o") 'helm-occur) | |
(global-set-key (kbd "C-M-o") 'helm-multi-occur) | |
(global-set-key (kbd "s-O") 'helm-multi-occur) | |
(global-set-key (kbd "s-o") 'helm-occur) | |
(defun helm-goto-symbol () | |
"multi-occur in all buffers backed by files." | |
(interactive) | |
(helm-multi-occur | |
(delq nil | |
(mapcar (lambda (b) | |
(when (buffer-file-name b) (buffer-name b))) | |
(buffer-list))))) | |
(global-set-key (kbd "M-x") 'helm-M-x) | |
(global-set-key (kbd "C-x C-r") 'helm-recentf) | |
(global-set-key (kbd "C-x C-f") 'helm-find-files) | |
(global-set-key (kbd "s-p") 'helm-goto-symbol) | |
(global-set-key (kbd "C-x p") 'helm-goto-symbol) | |
(global-set-key (kbd "C-x b") 'helm-buffers-list) | |
(global-set-key (kbd "C-x s-F") 'helm-do-grep) | |
(global-set-key (kbd "s-F") 'helm-do-grep) | |
(global-set-key (kbd "s-C-M-V") 'helm-show-kill-ring) | |
;; highlight symbol | |
(global-set-key (kbd "C-*") 'highlight-symbol-next) | |
(global-set-key (kbd "C-#") 'highlight-symbol-prev) | |
(global-set-key (kbd "C-)") 'highlight-symbol-next) | |
(global-set-key (kbd "C-(") 'highlight-symbol-prev) | |
(global-set-key (kbd "M-s-e") 'highlight-symbol-query-replace) | |
;; projectile | |
(global-set-key (kbd "s-M-h") 'helm-projectile) | |
;; move text | |
(global-set-key [s-up] 'move-text-up) | |
(global-set-key [s-down] 'move-text-down) | |
;; drag stuff | |
(setq drag-stuff-modifier '(super meta)) | |
;; multiple cursors | |
(global-set-key (kbd "C-|") 'mc/edit-lines) | |
(global-set-key (kbd "s-\\") 'mc/edit-lines) | |
(global-set-key (kbd "C-{") 'mc/mark-previous-like-this) | |
(global-set-key (kbd "C-}") 'mc/mark-next-like-this) | |
(global-unset-key (kbd "M-<down-mouse-1>")) | |
(global-set-key (kbd "M-<mouse-1>") 'mc/add-cursor-on-click) | |
(global-set-key (kbd "s-<mouse-1>") 'mc/add-cursor-on-click) | |
(defvar mc-mode-map (make-sparse-keymap) | |
"Keymap for `multiple-cursors'.") | |
(global-set-key (kbd "C-$") 'mc-mode-map) | |
(define-key mc-mode-map (kbd "a") 'mc/mark-all-like-this) | |
(define-key mc-mode-map (kbd "m") 'mc/mark-more-like-this-extended) | |
(define-key mc-mode-map (kbd "+") 'mc/mark-more-like-this-extended) | |
(define-key mc-mode-map (kbd "r") 'mc/mark-all-in-region) | |
(define-key mc-mode-map (kbd "C-e") 'mc/edit-ends-of-lines) | |
(define-key mc-mode-map (kbd "C-a") 'mc/edit-beginnings-of-lines) | |
;; thing cmds | |
(global-set-key (kbd "C-^") 'select-thing-near-point) | |
(global-set-key (kbd "s-^") 'select-thing-near-point) | |
(global-set-key (kbd "C-M-^") 'mark-enclosing-sexp) | |
(global-set-key (kbd "s-M-^") 'mark-enclosing-sexp) | |
;; undo tree | |
(global-undo-tree-mode) | |
(defalias 'redo 'undo-tree-redo) | |
(global-set-key (kbd "s-z") 'undo) ; 【⌘Z】 | |
(global-set-key (kbd "s-S-z") 'redo) ; 【⌘⇧Z】 | |
(global-set-key (kbd "S-s-z") 'redo) ; 【⌘⇧Z】 | |
(global-set-key (kbd "s-Z") 'redo) ; 【⌘⇧Z】 | |
;; workgroups2 | |
(eval-after-load 'workgroups2 | |
'(progn | |
(global-set-key (kbd "<escape> <escape> z") 'wg-switch-to-workgroup) | |
(global-set-key (kbd "ESC ESC z") 'wg-switch-to-workgroup) | |
(global-set-key (kbd "<escape> <escape> /") 'wg-switch-to-previous-workgroup) | |
(global-set-key (kbd "ESC ESC /") 'wg-switch-to-previous-workgroup) | |
(global-set-key (kbd "s-<escape>") 'wg-switch-to-workgroup) | |
(global-set-key (kbd "s-<escape>") 'wg-switch-to-workgroup))) | |
(add-hook 'after-init-hook 'workgroups-mode-on) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment