Fixed emacs window auto-split

This commit is contained in:
2026-04-14 13:06:12 -06:00
parent 7161892da7
commit cf44651f85
2 changed files with 133 additions and 26 deletions

View File

@@ -52,7 +52,7 @@ determine the exact padding."
;;; Theme definition
(def-doom-theme doom-personal
"A dark theme I made myself."
"A dark theme I made myself."
;; name default 256 16
((bg '("#1e1e1e" nil nil ))

View File

@@ -166,6 +166,29 @@ Indent using tabs, render with tab-width of 2.
(with-eval-after-load 'tramp (tramp-enable-method "run0"))
#+END_SRC
** =gc-cons-threshold=
#+BEGIN_SRC emacs-lisp
(setq gc-cons-threshold 100000000)
(setq read-process-output-max (* 1024 1024))
#+END_SRC emacs-lisp
** Windowing
#+BEGIN_SRC emacs-lisp
;; Define a split function that splits based on the ratio of the width to the height, with the "ideal" ratio being 4:3 (so windows wider than this will be split vertically, and windows taller than this will be split horizontally).
;; This is contrasted with the shipped "split-window-sensibly" function which always splits horizontally unless the height is too small, which we very much do not want as most screens are wider than they are tall.
(defun actually-split-window-sensibly (&optional window)
(interactive)
(let ((window (or (selected-window))))
(if (>= (with-selected-window window (window-pixel-width)) (* (with-selected-window window (window-pixel-height)) 1.2))
(with-selected-window window (split-window-right))
(with-selected-window window (split-window-below)))))
;; Set this function as the preferred window split function.
(setq split-window-preferred-function 'actually-split-window-sensibly)
#+END_SRC
* Theming
** Highlight current line
#+BEGIN_SRC emacs-lisp
@@ -173,7 +196,17 @@ Indent using tabs, render with tab-width of 2.
#+END_SRC
** Font
#+BEGIN_SRC emacs-lisp
(add-to-list 'default-frame-alist '(font . "JetBrains Mono-9"))
(add-to-list 'default-frame-alist '(font . "FiraCode-9"))
(use-package ligature
:ensure t
:config
(ligature-set-ligatures 't '("www"))
(ligature-set-ligatures 'python-base-mode '("**" ">=" "<=" "==" "!=" "->" ":=" ">>" "<<"))
(ligature-set-ligatures 'nxml-mode '("/>" "-->" "<!--" "www" "</" "</>"))
(ligature-set-ligatures 'javascript-mode '("++" "--" "/=" "&&" "||" "||=" "=>" "==" "===" "!=" "!==" "<=" ">=" "/*" "*/" "//" " <<" ">>" "**" "?."))
(ligature-set-ligatures 'js-ts-mode '("++" "--" "/=" "&&" "||" "||=" "=>" "==" "===" "!=" "!==" "<=" ">=" "/*" "*/" "//" " <<" ">>" "**" "?."))
(global-ligature-mode 't))
#+END_SRC
** Doom-themes
#+BEGIN_SRC emacs-lisp
@@ -194,7 +227,8 @@ Indent using tabs, render with tab-width of 2.
(setq doom-themes-treemacs-theme "doom-atom") ; use "doom-colors" for less minimal icon theme
(doom-themes-treemacs-config)
;; Corrects (and improves) org-mode's native fontification.
(doom-themes-org-config)))
(doom-themes-org-config)
))
(my-theme-config)
(add-hook 'after-make-frame-functions 'my-theme-config)
#+END_SRC
@@ -367,6 +401,14 @@ Indent using tabs, render with tab-width of 2.
#+END_SRC
** Transparency
#+BEGIN_SRC emacs-lisp
(defun set-transparency (&optional frame)
;; set transparency
(set-frame-parameter frame 'alpha-background 70)
)
(add-hook 'after-make-frame-functions 'set-transparency)
#+END_SRC
* Projectile
#+BEGIN_SRC emacs-lisp
(use-package projectile
@@ -441,6 +483,15 @@ Indent using tabs, render with tab-width of 2.
#+BEGIN_SRC emacs-lisp
(add-to-list 'auto-mode-alist '("\\.tsx\\'" . typescript-mode))
#+END_SRC
** Polkit rules
#+BEGIN_SRC emacs-lisp
(defconst polkit-js-autoload-regexp
(rx "/polkit-1/rules.d/" (+? (not (any ?/))) ".rules" string-end)
"Regexp for Polkit rule files in which to autoload `js-mode'.")
(add-to-list 'auto-mode-alist `(,polkit-js-autoload-regexp . js-ts-mode))
#+END_SRC
* Config & Markup
** Markdown
*** Auto Text Wrap
@@ -496,7 +547,14 @@ Indent using tabs, render with tab-width of 2.
(use-package comment-tags
:ensure t)
#+END_SRC
** org-roam
#+BEGIN_SRC emacs-lisp
(use-package org-roam
:ensure t)
(setq org-roam-directory (file-truename "~/org/roam"))
(org-roam-db-autosync-mode)
#+END_SRC
** Fonts
#+BEGIN_SRC emacs-lisp
@@ -674,25 +732,27 @@ Indent using tabs, render with tab-width of 2.
))
#+END_SRC
** Shell Links
#+BEGIN_SRC emacs-lisp
(setq vterm-tramp-shells '(("ssh" login-shell "/bin/bash") ("sshx" login-shell "/bin/bash")))
;; Remote host SSH links (opens a vterm on the remote host via TRAMP).
(org-link-set-parameters "ssh"
:follow #'org-vterm-open)
(defun org-vterm-open (host _)
"Open an SSH session in a vterm."
(let ((default-directory (concat "/sshx:" host ":~"))) (vterm (concat "*vterm " host "*"))))
#+END_SRC
* Development
** Copilot
#+BEGIN_SRC disabled
;; Ensure dependencies are installed
** Editorconfig
#+BEGIN_SRC emacs-lisp
(use-package editorconfig
:ensure t)
(use-package jsonrpc
:ensure t)
;; Load copilot
(use-package copilot
:straight (copilot :type git :host github :repo "copilot-emacs/copilot.el" :files ("*.el"))
:ensure t
:init
(add-hook 'prog-mode-hook 'copilot-mode)
:bind
(:map copilot-completion-map
("M-<return>" . copilot-accept-completion)
("M-RET" . copilot-accept-completion))
)
:ensure t)
#+END_SRC
** Tree-Sitter
#+BEGIN_SRC emacs-lisp
@@ -712,7 +772,8 @@ Indent using tabs, render with tab-width of 2.
(tsx "https://github.com/tree-sitter/tree-sitter-typescript" "master" "tsx/src")
(typescript "https://github.com/tree-sitter/tree-sitter-typescript" "master" "typescript/src")
(yaml "https://github.com/ikatyang/tree-sitter-yaml")
(cython "https://github.com/b0o/tree-sitter-cython")))
(cython "https://github.com/b0o/tree-sitter-cython")
(dockerfile "https://github.com/camdencheek/tree-sitter-dockerfile")))
#+END_SRC
** Autocomplete
#+BEGIN_SRC emacs-lisp
@@ -745,6 +806,20 @@ Indent using tabs, render with tab-width of 2.
: company-select-previous
** LSP
*** LSP-Mode
#+BEGIN_SRC disabled-emacs-lisp
(use-package lsp-mode
:init (setq lsp-keymap-prefix "C-c l")
:hook ((python-base-mode . lsp)
(typescript-ts-mode . lsp)
(tsx-ts-mode . lsp)
(typescript-mode . lsp))
:commands lsp)
(use-package lsp-ui
:commands lsp-ui-mode)
#+END_SRC
*** Eglot
#+BEGIN_SRC emacs-lisp
(use-package eldoc
:ensure t
@@ -756,10 +831,10 @@ Indent using tabs, render with tab-width of 2.
("C-c C-e" . eglot-rename)
("C-." . eglot-code-actions)
("<f2>" . eglot-find-implementation))
:hook ((python-ts-mode . eglot-ensure)
(python-ts-mode . flyspell-prog-mode)
(python-ts-mode . superword-mode)
(python-ts-mode . hs-minor-mode)
:hook ((python-base-mode . eglot-ensure)
(python-base-mode . flyspell-prog-mode)
(python-base-mode . superword-mode)
(python-base-mode . hs-minor-mode)
(typescript-ts-mode . eglot-ensure)
(typescript-ts-mode . flyspell-prog-mode)
(typescript-ts-mode . superword-mode)
@@ -779,7 +854,8 @@ Indent using tabs, render with tab-width of 2.
:plugins (
:mccabe (:enabled :json-false)
:pyflakes (:enabled :json-false)
:flake8 (:enabled :json-false
:flake8 (:enabled :js
on-false
:maxLineLength 88)
:ruff (:enabled t :lineLength 88)
:pydocstyle (:enabled t :convention "numpy")
@@ -789,6 +865,14 @@ Indent using tabs, render with tab-width of 2.
:mypy (:enabled t))
)))))
#+END_SRC
*** eglot-booster
#+BEGIN_SRC emacs-lisp
(use-package eglot-booster
:straight ( eglot-booster :type git :host nil :repo "https://github.com/jdtsmith/eglot-booster")
:after eglot
:config (eglot-booster-mode))
#+END_SRC
** Git
*** Magit
#+BEGIN_SRC emacs-lisp
@@ -939,6 +1023,29 @@ After installing the ~rust-analyzer~ program, the following can be used:
#+RESULTS:
* System Administration
Management of system administration related packages and settings
** nftables
#+BEGIN_SRC emacs-lisp
(use-package nftables-mode
:ensure t
:config
(setq nftables-indent-basic 2)
)
#+END_SRC
** sudoers
#+BEGIN_SRC emacs-lisp
(use-package etc-sudoers-mode
:ensure t)
#+END_SRC
* Operations
** Docker
#+BEGIN_SRC emacs-lisp
(use-package dockerfile-mode
:ensure t)
(use-package docker-compose-mode
:ensure t)
#+END_SRC
* Format All The Buffers
#+BEGIN_SRC emacs-lisp
(use-package format-all