Created
September 21, 2017 00:58
-
-
Save asipser/903387ab3148eb260a6490fa904d80ae to your computer and use it in GitHub Desktop.
Aaron's .emacs
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
(setq comint-process-echoes t) | |
(load-theme 'misterioso) | |
(add-hook 'comint-output-filter-functions 'comint-watch-for-password-prompt) | |
(require 'package) | |
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos)) | |
(not (gnutls-available-p)))) | |
(url (concat (if no-ssl "http" "https") "://melpa.org/packages/"))) | |
(add-to-list 'package-archives (cons "melpa" url) t)) | |
(when (< emacs-major-version 24) | |
;; For important compatibility libraries like cl-lib | |
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/"))) | |
(package-initialize) | |
;;https://stackoverflow.com/questions/88399/how-do-i-duplicate-a-whole-line-in-emacs | |
(defun duplicate-line() | |
(interactive) | |
(move-beginning-of-line 1) | |
(kill-line) | |
(yank) | |
(open-line 1) | |
(next-line 1) | |
(yank) | |
) | |
(global-set-key (kbd "C-d") 'duplicate-line) | |
;;https://stackoverflow.com/questions/2423834/move-line-region-up-and-down-in-emacs | |
(defun move-text-internal (arg) | |
(cond | |
((and mark-active transient-mark-mode) | |
(if (> (point) (mark)) | |
(exchange-point-and-mark)) | |
(let ((column (current-column)) | |
(text (delete-and-extract-region (point) (mark)))) | |
(forward-line arg) | |
(move-to-column column t) | |
(set-mark (point)) | |
(insert text) | |
(exchange-point-and-mark) | |
(setq deactivate-mark nil))) | |
(t | |
(beginning-of-line) | |
(when (or (> arg 0) (not (bobp))) | |
(forward-line) | |
(when (or (< arg 0) (not (eobp))) | |
(transpose-lines arg)) | |
(forward-line -1))))) | |
(defun move-text-down (arg) | |
"Move region (transient-mark-mode active) or current line | |
arg lines down." | |
(interactive "*p") | |
(move-text-internal arg)) | |
(defun move-text-up (arg) | |
"Move region (transient-mark-mode active) or current line | |
arg lines up." | |
(interactive "*p") | |
(move-text-internal (- arg)) | |
(forward-line -1)) | |
(global-set-key [(control shift up)] 'move-text-up) | |
(global-set-key [(control shift down)] 'move-text-down) | |
(put 'downcase-region 'disabled nil) | |
(put 'upcase-region 'disabled nil) | |
(setq cua-enable-cua-keys nil) ; enable only CUA's rectangle selections | |
(cua-mode t) | |
(when (fboundp 'windmove-default-keybindings) | |
(windmove-default-keybindings)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment