about summary refs log tree commit diff stats
path: root/.emacs.d/lisp/init-windows.el
diff options
context:
space:
mode:
authorDavid Morgan <djm_uk@protonmail.com>2021-08-17 12:49:19 +0100
committerDavid Morgan <djm_uk@protonmail.com>2021-08-17 12:49:19 +0100
commitd0db5660caa836755ea8c99471d816484ea9e837 (patch)
treec7d0456a58e450abaf34b489b0b31c58ddbc8557 /.emacs.d/lisp/init-windows.el
parentc92b18514728245850d31531ce224a74eddfc5a6 (diff)
downloaddotfiles-d0db5660caa836755ea8c99471d816484ea9e837.tar.gz
Add new .emacs.d
Diffstat (limited to '.emacs.d/lisp/init-windows.el')
-rw-r--r--.emacs.d/lisp/init-windows.el65
1 files changed, 65 insertions, 0 deletions
diff --git a/.emacs.d/lisp/init-windows.el b/.emacs.d/lisp/init-windows.el
new file mode 100644
index 0000000..b80e8bc
--- /dev/null
+++ b/.emacs.d/lisp/init-windows.el
@@ -0,0 +1,65 @@
+;;; init-windows.el --- Window/Buffer Configuration File -*- lexical-binding: t -*-
+;;; Commentary:
+;;; Code:
+
+(use-package emacs
+  :config
+  (winner-mode +1)
+  ;; From EmacsWiki
+  (defun toggle-window-split ()
+    (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))))))
+  (define-key ctl-x-4-map "t" 'toggle-window-split))
+
+
+(use-package windmove
+  :init (windmove-default-keybindings))
+
+(use-package buffer-move
+  :bind (("C-S-<up>" . buf-move-up)
+         ("C-S-<down>" . buf-move-down)
+         ("C-S-<left>" . buf-move-left)
+         ("C-S-<right>" . buf-move-right)))
+
+(use-package fullframe
+  :after (magit dashboard)
+  :config
+  (fullframe magit-status magit-mode-quit-window))
+
+(use-package ace-window
+  :diminish
+  :bind ([remap other-window] . ace-window)
+  :custom-face
+  (aw-leading-char-face
+   ((t (:foreground "white" :background "red"
+                    :weight bold :height 2.5 :box (:line-width 10 :color "red"))))))
+
+(smartrep-define-key global-map
+    "C-x" '(("}" . enlarge-window-horizontally)
+            ("{" . shrink-window-horizontally)
+            ("^" . enlarge-window)
+            ("-" . shrink-window-if-larger-than-buffer)))
+
+(provide 'init-windows)
+;;; init-windows.el ends here