Compare commits

...

8 Commits

2 changed files with 104 additions and 90 deletions

120
init.el
View File

@ -18,6 +18,79 @@
(convert-standard-filename "lisp/")))) (convert-standard-filename "lisp/"))))
(add-to-list 'load-path mir-directory t) (add-to-list 'load-path mir-directory t)
(defun mir/visual-setup ()
"Commands to run when setting up any display. To be called in use-package
declarations for color schemes."
(tooltip-mode -1)
(menu-bar-mode -1)
(setq window-divider-default-places t)
;; (setq right-divider-width 5)
(setq ring-bell-function 'ignore)
(unless (not (display-graphic-p))
(set-face-attribute 'fixed-pitch nil
:family "MesloLGS Nerd Font")
(set-face-attribute 'default nil
:family "MesloLGS Nerd Font")
(set-face-attribute 'variable-pitch nil
:inherit 'default
:family "sans serif"
:height (/ 1.5 1.3))
(add-to-list 'initial-frame-alist '(alpha-background . 65))
(add-to-list 'default-frame-alist '(alpha-background . 65))
(add-to-list 'default-frame-alist '(cursor-color . "white"))
(add-to-list 'default-frame-alist '(fullscreen . maximized)))
;; see also https://emacs.stackexchange.com/questions/7228/nice-tty-window-borders-in-24-4
(unless (display-graphic-p)
(let ((display-table (or standard-display-table (make-display-table))))
(set-display-table-slot display-table 'vertical-border (make-glyph-code ?│))
(setq standard-display-table display-table))))
(defun mir/graphical-setup ()
"Commands to run at the beginning of init when on a graphical display.
This prevents errors in termux and speeds up init when editing from the
console."
;; hide gui scrollbars and menubar etc
;; (scroll-bar-mode -1) ;; use `yascroll' instead
(setq scroll-bar-adjust-thumb-portion nil)
(tool-bar-mode 0)
(menu-bar-mode 0)
(set-fringe-mode 8)
;; diable stupid file open box thingy
(setq use-file-dialog nil)
(setq use-dialog-box nil)
;; Pixel scrolling. Only in emacs 29+...
(if (>= (string-to-number emacs-version) 29)
(pixel-scroll-precision-mode t)
(pixel-scroll-mode t))
;; Size of text. おまえ わ もう しんでいる.
(let* ((resy (display-pixel-height))
(font-height (/ resy 8))) ; gonna be different on diff machines 💀
(set-face-attribute 'fixed-pitch nil :height font-height)
(set-face-attribute 'default nil :height font-height)
(set-face-attribute 'variable-pitch nil :height (+ font-height 10))))
(defun turn-off-line-numbers ()
"A tiny wrapper around `display-line-numbers-mode' or `linum'.
For use in hooks."
(interactive)
(if (bound-and-true-p display-line-numbers-mode)
(display-line-numbers-mode -1))
(if (fboundp #'linum-mode)
(linum-mode -1))
(if (fboundp #'linum-relative-mode)
(linum-relative-mode -1))
(if (fboundp #'nlinum-mode)
(nlinum-mode -1))
(if (fboundp #'nlinum-relative-mode)
(nlinum-relative-mode -1)))
(defun mir/terminal-setup ()
"A batch of commands to run when opening anything that looks like a terminal.
For instance:
- Shell
- (ansi-)term
- eshell
- vterm
- Maybe SLIME too."
(turn-off-line-numbers))
(require 'mir-defuns) (require 'mir-defuns)
;; minify yes/no prompts ;; minify yes/no prompts
@ -310,8 +383,6 @@ If the current window occupies the whole frame, split it."
(use-package page-break-lines (use-package page-break-lines
:init :init
(add-hook 'emacs-lisp-mode-hook #'page-break-lines-mode)) (add-hook 'emacs-lisp-mode-hook #'page-break-lines-mode))
(use-package rainbow-mode
:hook (prog-mode . rainbow-mode))
(use-package powershell (use-package powershell
:mode ("\\.ps1\\'" . powershell-mode)) :mode ("\\.ps1\\'" . powershell-mode))
@ -320,8 +391,13 @@ If the current window occupies the whole frame, split it."
;; diminish ;; diminish
(use-package diminish (use-package diminish
:config (diminish 'visual-line-mode)) :config
(diminish 'page-break-lines-mode)
(diminish 'visual-line-mode))
(use-package rainbow-mode
:diminish
:hook (prog-mode . rainbow-mode))
;; Keybinding manager ;; Keybinding manager
(use-package general (use-package general
:demand t :demand t
@ -339,7 +415,14 @@ If the current window occupies the whole frame, split it."
(use-package eldoc-box (use-package eldoc-box
:after eldoc :after eldoc
:diminish (eldoc-mode eldoc-box-hover-at-point-mode) :diminish (eldoc-mode eldoc-box-hover-at-point-mode)
:hook (prog-mode . eldoc-box-hover-at-point-mode)) :hook (prog-mode . eldoc-box-hover-at-point-mode)
:init
(defun mir/eldoc-dont (orig &rest args)
(unless (member 'use-package args)
(apply orig args)))
(advice-add #'eldoc :around #'mir/eldoc-dont)
)
;; (eldoc 'nothing)
;; load evil or meow ;; load evil or meow
(require 'mir-evil) (require 'mir-evil)
@ -396,10 +479,14 @@ If the current window occupies the whole frame, split it."
:custom :custom
(edwina-mfact 0.59) (edwina-mfact 0.59)
;; (display-buffer-base-action '(display-buffer-below-selected)) ;; (display-buffer-base-action '(display-buffer-below-selected))
:config (edwina-mode) :init
(advice-add 'balance-windows (advice-add 'balance-windows
:override 'edwina-arrange) :override 'edwina-arrange)
(add-hook 'server-after-make-frame-hook #'edwina-arrange) (add-hook 'server-after-make-frame-hook #'edwina-arrange)
(add-hook 'after-init-hook #'edwina-arrange)
(add-hook 'elpaca-after-init-hook #'edwina-arrange)
:config
(edwina-mode)
(edwina-arrange) (edwina-arrange)
:general :general
(general-define-key (general-define-key
@ -1069,14 +1156,14 @@ Return nil if DIR is not in a hugo project at all."
:height 140 :height 140
:italic t))) :italic t)))
:commands blamer-show-posframe-commit-info) :commands blamer-show-posframe-commit-info)
(use-package magit-stats ;; (use-package magit-stats
:ensure (:host github :repo "LionyxML/magit-stats") ;; :ensure (:host github :repo "LionyxML/magit-stats")
:after magit ;; :defer t
:commands magit-stats) ;; :commands magit-stats)
(use-package magit-pretty-graph ;; (use-package magit-pretty-graph
:ensure (:host github :repo "georgek/magit-pretty-graph") ;; :ensure (:host github :repo "georgek/magit-pretty-graph")
:after magit ;; :after magit
:commands magit-pg-repo) ;; :commands magit-pg-repo)
(use-package hyperbole (use-package hyperbole
:ensure (:files ("*.el" :ensure (:files ("*.el"
@ -1157,9 +1244,9 @@ Taken from https://howardism.org/Technical/Emacs/eshell-why.html"
(use-package yuck-mode (use-package yuck-mode
:mode "\\.yuck") :mode "\\.yuck")
(use-package fretboard ;; (use-package fretboard
:ensure (:host github :repo "vifon/fretboard.el") ;; :ensure (:host github :repo "vifon/fretboard.el")
:commands fretboard) ;; :commands fretboard)
(use-package power-mode (use-package power-mode
:commands power-mode :commands power-mode
@ -1220,6 +1307,7 @@ Taken from https://howardism.org/Technical/Emacs/eshell-why.html"
:mode "\\.nix") :mode "\\.nix")
(use-package yeetube (use-package yeetube
:defer t
:commands 'yeetube-search) :commands 'yeetube-search)
;(require 'mir-packages) ;(require 'mir-packages)

View File

@ -23,54 +23,6 @@ Made solely to reduce lines in the init-file."
(evil-scroll-line-to-center (car flush))) (evil-scroll-line-to-center (car flush)))
(advice-add 'evil-search-next :filter-return #'mir/search-and-rebalance) (advice-add 'evil-search-next :filter-return #'mir/search-and-rebalance)
(add-hook 'isearch-mode-end-hook #'mir/search-and-rebalance)) (add-hook 'isearch-mode-end-hook #'mir/search-and-rebalance))
(defun mir/visual-setup ()
"Commands to run when setting up any display. To be called in use-package
declarations for color schemes."
(tooltip-mode -1)
(menu-bar-mode -1)
(set-face-attribute 'fixed-pitch nil
:family "MesloLGS Nerd Font")
(set-face-attribute 'default nil
:family "MesloLGS Nerd Font")
(set-face-attribute 'variable-pitch nil
:inherit 'default
:family "sans serif"
:height (/ 1.5 1.3))
(setq window-divider-default-places t)
(setq right-divider-width 5)
(setq ring-bell-function 'ignore)
(add-to-list 'initial-frame-alist '(alpha-background . 65))
(add-to-list 'default-frame-alist '(alpha-background . 65))
(add-to-list 'default-frame-alist '(cursor-color . "white"))
(add-to-list 'default-frame-alist '(fullscreen . maximized))
;; see also https://emacs.stackexchange.com/questions/7228/nice-tty-window-borders-in-24-4
(unless (display-graphic-p)
(let ((display-table (or standard-display-table (make-display-table))))
(set-display-table-slot display-table 'vertical-border (make-glyph-code ?│))
(setq standard-display-table display-table))))
(defun mir/graphical-setup ()
"Commands to run at the beginning of init when on a graphical display.
This prevents errors in termux and speeds up init when editing from the
console."
;; hide gui scrollbars and menubar etc
;; (scroll-bar-mode -1) ;; use `yascroll' instead
(setq scroll-bar-adjust-thumb-portion nil)
(tool-bar-mode 0)
(menu-bar-mode 0)
(set-fringe-mode 8)
;; diable stupid file open box thingy
(setq use-file-dialog nil)
(setq use-dialog-box nil)
;; Pixel scrolling. Only in emacs 29+...
(if (>= (string-to-number emacs-version) 29)
(pixel-scroll-precision-mode t)
(pixel-scroll-mode t))
;; Size of text. おまえ わ もう しんでいる.
(let* ((resy (display-pixel-height))
(font-height (/ resy 8))) ; gonna be different on diff machines 💀
(set-face-attribute 'fixed-pitch nil :height font-height)
(set-face-attribute 'default nil :height font-height)
(set-face-attribute 'variable-pitch nil :height (+ font-height 10))))
(defun toggle-ja-input () (defun toggle-ja-input ()
"Switch between english and japanese. Not broken." "Switch between english and japanese. Not broken."
@ -78,32 +30,6 @@ console."
(if (eq current-input-method 'japanese) (if (eq current-input-method 'japanese)
(setq current-input-method 'japanese-ascii) (setq current-input-method 'japanese-ascii)
(setq current-input-method 'japanese))) (setq current-input-method 'japanese)))
(defun turn-off-line-numbers ()
"A tiny wrapper around `display-line-numbers-mode' or `linum'.
For use in hooks."
(interactive)
(if (bound-and-true-p display-line-numbers-mode)
(display-line-numbers-mode -1))
(if (fboundp #'linum-mode)
(linum-mode -1))
(if (fboundp #'linum-relative-mode)
(linum-relative-mode -1))
(if (fboundp #'nlinum-mode)
(nlinum-mode -1))
(if (fboundp #'nlinum-relative-mode)
(nlinum-relative-mode -1)))
(defun mir/terminal-setup ()
"A batch of commands to run when opening anything that looks like a terminal.
For instance:
- Shell
- (ansi-)term
- eshell
- vterm
- Maybe SLIME too."
(turn-off-line-numbers))
;; This one line cost me over an hour of frustration... ;; This one line cost me over an hour of frustration...
(provide 'mir-defuns) (provide 'mir-defuns)