"Bring up work-eqs.el for editing."
(interactive)
(find-file work-eqns))
+
+(defun toggle-window-split ()
+ "If two windows are open, toggle their split layout between vert. and horiz.
+Stolen from http://whattheemacsd.com"
+ (interactive)
+ (if (= (count-windows) 2)
+ (let* ((this-win-buffer (window-buffer))
+ (next-win-buffer (window-buffer (next-window)))
+ (this-win-edges (window-edges (selected-window)))
+ (next-win-edges (window-edges (next-window)))
+ (this-win-2nd (not (and (<= (car this-win-edges)
+ (car next-win-edges))
+ (<= (cadr this-win-edges)
+ (cadr next-win-edges)))))
+ (splitter
+ (if (= (car this-win-edges)
+ (car (window-edges (next-window))))
+ 'split-window-horizontally
+ 'split-window-vertically)))
+ (delete-other-windows)
+ (let ((first-win (selected-window)))
+ (funcall splitter)
+ (if this-win-2nd (other-window 1))
+ (set-window-buffer (selected-window) this-win-buffer)
+ (set-window-buffer (next-window) next-win-buffer)
+ (select-window first-win)
+ (if this-win-2nd (other-window 1))))))
+
+(defun rotate-windows ()
+ "Rotate your windows.
+Stolen from http://whattheemacsd.com"
+ (interactive)
+ (cond ((not (> (count-windows)1))
+ (message "You can't rotate a single window!"))
+ (t
+ (setq i 1)
+ (setq numWindows (count-windows))
+ (while (< i numWindows)
+ (let* (
+ (w1 (elt (window-list) i))
+ (w2 (elt (window-list) (+ (% i numWindows) 1)))
+
+ (b1 (window-buffer w1))
+ (b2 (window-buffer w2))
+
+ (s1 (window-start w1))
+ (s2 (window-start w2))
+ )
+ (set-window-buffer w1 b2)
+ (set-window-buffer w2 b1)
+ (set-window-start w1 s2)
+ (set-window-start w2 s1)
+ (setq i (1+ i)))))))
+
+(defadvice magit-status (around magit-fullscreen activate)
+ (window-configuration-to-register :magit-fullscreen)
+ ad-do-it
+ (delete-other-windows))
+
+(defun magit-quit-session ()
+ "Restores the previous window configuration and kills the magit buffer.
+Stolen from http://whattheemacsd.com"
+ (interactive)
+ (kill-buffer)
+ (jump-to-register :magit-fullscreen))
(setq delete-by-moving-to-trash t))
nil)
-(load-file work-eqns)
-(load-file editing-defuns)
+(load work-eqns)
+(load editing-defuns)
;; PACKAGES
;; NEW STRAIGHT.EL CONFIG
(use-package gnuplot-mode)
+(use-package openwith
+ :config
+ (openwith-mode t)
+ (setq openwith-associations '(("\\.pdf\\'" "sumatrapdf" (file))
+ ("\\.xlsx\\'" "excel" (file))
+ ("\\.doc\\'" "word" (file))
+ ("\\.docx\\'" "word" (file)))))
+
;; OPTIONS
(recentf-mode t)
(fringe-mode 1)
(menu-bar-mode -1)
(tool-bar-mode -1)
(auto-fill-mode t)
-(show-paren-mode t)
(column-number-mode t)
(set-scroll-bar-mode 'left)
(global-hl-line-mode t)
;; HOOKS
(add-hook 'before-save-hook 'whitespace-cleanup)
+(add-hook 'dired-mode-hook 'dired-hide-details-mode t)
;; SETQ AND DEFAULTS
(setq default-directory "~/"
inhibit-startup-message t
initial-scratch-message nil
+ server-client-instructions nil
require-final-newline t
use-short-answers t
mode-line-compact t
auto-save-default nil
show-paren-delay 0
show-paren-style 'mixed
+ global-hl-line-sticky-flag t
confirm-nonexistent-file-or-buffer nil
- ido-enable-flex-matching t
- ido-create-new-buffer 'always
org-M-RET-may-split-line nil
org-startup-folded t
org-startup-indented t
+ org-catch-invisible-edits 'show
mouse-autoselect-window t)
(setq-default indicate-empty-lines t
- show-trailing-whitespace t
+ fill-column 80
read-file-name-completion-ignore-case t
read-buffer-completion-ignore-case t
+ dired-hide-details-mode t
cursor-type 'bar
cursor-in-non-selected-windows nil)
(global-set-key (kbd "C-c ei") 'edit-init)
(global-set-key (kbd "C-c ew") 'edit-work-eqs)
(global-set-key (kbd "C-c r") 'recentf-open-files)
+(global-set-key (kbd "C-c s") 'rotate-windows)
+(global-set-key (kbd "C-c t") 'toggle-window-split)
;; OVERRIDES
(global-set-key (kbd "M-j") 'backward-join-line)
(global-set-key (kbd "M-J") 'join-line)
(global-set-key (kbd "C-x ,") 'previous-buffer)
(global-set-key (kbd "M-%") 'replace-regexp)
(global-set-key (kbd "C-M-%") 'query-replace-regexp)
+;; MODE SPECIFIC
+(define-key magit-status-mode-map (kbd "q") 'magit-quit-session)
(custom-set-variables
;; custom-set-variables was added by Custom.