Created
October 1, 2017 09:12
-
-
Save cben/ada7675ab9aa14000a1a50eae3986117 to your computer and use it in GitHub Desktop.
emacs more CUA
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
;; use on top of cua-mode. | |
;; Extreme CUA - kill buffers with C-w like browser tabs. | |
;; I still have motor memory for cutting with C-w :-(, hopefully this will help. | |
(defun kill-buffer-unless-selection () | |
(interactive) | |
(if (region-active-p) | |
(progn | |
(beep) | |
(message "Use C-x for cutting, lest you kill the buffer you're working on.")) | |
(kill-buffer) | |
;; Sometimes I want to delete the window but usually not. | |
;; Common example is when Help / ag search reused an existing window I want | |
;; to go back to what it was showing before. | |
;; Heuristic: it's silly to get multiple windows showing the same buffer ? | |
;; [i don't remember now what I meant by above line...] | |
(when (> (length (get-buffer-window-list)) 1) | |
(delete-window)))) | |
(global-set-key [?\C-w] 'kill-buffer-unless-selection) | |
;; C-o. This is NOT a universal "Open File", but excellent for 90% opens I do while developing. | |
(package-install 'find-file-in-repository) | |
(global-set-key [?\C-o] 'find-file-in-repository) | |
;; I occassionally C-x C-f `find-file' to edit whole path, and M-x ffap when I have path under cursor... | |
;; There is a setting/mode I forgot for Shift+movement selecting, | |
;; but I used (windmove-default-keybindings) to move across windows Shift+arrows. | |
;; I'm perfectly happy with C-space to start selecting. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment