From c2235d1850722932b7fb9dcf5907bbcc040bb29c Mon Sep 17 00:00:00 2001 From: tmu Date: Fri, 7 Apr 2023 09:50:30 -0700 Subject: update --- emacs/init.el | 322 ++++++++++++++++++++++++++-------------------- emacs/project-stuff.el | 306 +++++++++++++++++++++++++++++++++++++------ emacs/tmu-custom-theme.el | 10 +- 3 files changed, 456 insertions(+), 182 deletions(-) (limited to 'emacs') diff --git a/emacs/init.el b/emacs/init.el index 03fd126..c8955ab 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -5,29 +5,63 @@ ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. + '(comment-style 'extra-line) '(custom-enabled-themes '(tmu-custom)) '(custom-safe-themes - '("3d4e3644e237a95683daa73e397c4c0d1ae06bbaaf8040104232591a28bc1315" "12a07bc38295e4b06a8965db261f51ea7ea61fbf91b3ef41298bbb549d1d9403" default)) + '("6dafb31ade9ff07229faaf05c41c2ae475c44731362b792f65f3930b1a2c9cfd" "dc77e008092a5a4aa6b6ed8e4826bebf8f2fb930a8de073bf7f458efd884cca8" "d1ff3e66028f9c527298580d2a64f9e3280f07f9e94d4dada72b67ef15069441" "3d4e3644e237a95683daa73e397c4c0d1ae06bbaaf8040104232591a28bc1315" "12a07bc38295e4b06a8965db261f51ea7ea61fbf91b3ef41298bbb549d1d9403" default)) + '(ede-project-directories + '("/home/tmu/Desktop/eway/sway" "/home/tmu/Desktop/eway/cage" "/home/tmu/Desktop/eway/wlroots" "/home/tmu/Desktop/eway/comp" "/home/tmu/Desktop/eway")) '(menu-bar-mode nil) + '(package-selected-packages + '(evil-snipe evil-surround markdown-preview-mode 2048-game evil ibuffer-project persp-mode-projectile-bridge persp-mode fish-mode spell-fu pyim chinese-conv esup buffer-move vertico flymake-diagnostic-at-point emms-state emms-player-simple-mpv eshell-fringe-status esh-help eshell-vterm vterm rustic benchmark-init ivy-prescient eat ivy-hydra ivy emms eyebrowse highlight dumb-jump volume workgroups async bongo hydra free-keys gxref fold-this simple-httpd xelb oauth2 imenu-anywhere popwin folding gdscript-mode)) '(scroll-bar-mode nil) '(tool-bar-mode nil) - '(transient-mark-mode nil)) -(custom-set-faces - ;; custom-set-faces was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - ) + '(transient-mark-mode nil) + '(whitespace-style + '(face trailing tabs lines-tail missing-newline-at-eof indentation space-after-tab space-before-tab tab-mark))) +;; (use-package benchmark-init +;; :ensure t +;; :config +;; ;; To disable collection of benchmark data after init is done. +;; (add-hook 'after-init-hook 'benchmark-init/deactivate)) + +(setq gc-cons-threshold most-positive-fixnum) + +(add-hook 'emacs-startup-hook + (lambda () + (setq gc-cons-threshold (expt 2 23)))) + +(require 'package) +(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/")) +(package-initialize) ;; stuff I will always want (electric-pair-mode 1) (global-hl-line-mode 1) - -;; common hooks -(add-hook 'text-mode-hook (lambda () (flyspell-mode 1))) -(add-hook 'prog-mode-hook (lambda () - (hs-minor-mode 1))) +(global-auto-revert-mode 1) + +;; spelling +(require 'spell-fu) +(setq ispell-personal-dictionary "/home/tmu/.aspell.en.pws") +(add-hook 'text-mode-hook (lambda () (spell-fu-mode 1))) + +;; dictionaries +(define-prefix-command 'dict-map) +(global-set-key (kbd "M-l") 'dict-map) +(define-keymap :full nil + :parent nil + :suppress nil + :keymap nil + :name "dict-map" + :prefix 'dict-map + (kbd "w") 'sdcv-search-input + (kbd "c") (lambda () (interactive) + (activate-input-method 'pyim) + (sdcv-search-input (read-from-minibuffer "Chinese Word: " + nil nil nil + nil nil t)) + (activate-input-method nil))) ;; nice startup (require 'iimage) @@ -38,44 +72,34 @@ ")) (add-hook 'emacs-startup-hook (lambda () - (with-current-buffer "*scratch*" - (iimage-mode 1)))) + (with-current-buffer "*scratch*" + (iimage-mode 1)))) ;; transparancy -(add-to-list 'default-frame-alist '(alpha-background . 90)) ; For all new frames +(add-to-list 'default-frame-alist '(alpha-background . 90)) ; For all new frames (defun toggle-frame-transparency () "Toggle transparency." (interactive) (let ((alpha-transparency 90)) (if (eq alpha-transparency (frame-parameter nil 'alpha-background)) - (set-frame-parameter nil 'alpha-background 100) + (set-frame-parameter nil 'alpha-background 100) (set-frame-parameter nil 'alpha-background alpha-transparency)))) -;; mode line stuff -(require 'battery) -(defun with-face (str &rest face-plist) - (propertize str 'face face-plist)) -(defun make-mode-line-info-string () - "generates the mode line string that contains all the info to the right" - (concat (format-time-string "%a, %b %+4Y-%0m-%0d ") - (with-face (format-time-string "%R ") - :weight 'bold) - (with-face (format "<%03.2f> " (car (load-average 1))) - :foreground "#da70d6") - (with-face (let* ((mi (memory-info)) - (tm (float (car mi))) - (fm (float (car (cdr mi)))) - (ts (float (car (cdr (cdr mi))))) - (fs (float (car (cdr (cdr (cdr mi))))))) - (format "{%.2f %.2f} " (- 1 (/ fm tm)) (- 1 (/ fs ts)))) - :foreground "#00ced1") - (with-face (battery-format "[%b%p%%%%] " (and battery-status-function (funcall battery-status-function))) - :weight 'bold))) -(setq global-mode-string '("" (:eval (make-mode-line-info-string)))) - ;; custom func keybinds -(global-unset-key (kbd "M-w")) (global-set-key (kbd "M-w") 'copy-region-as-kill) ;;make copying not flash cursor +(defun wrap-region-paren () + "Wraps the region in parens. +Similar to pressing ( with the region active." + (interactive) + (let ((beg (region-beginning)) + (end (region-end))) + (save-excursion + (goto-char beg) + (insert "(") + (goto-char (+ end 1)) + (insert ")") + ))) +(global-set-key (kbd "M-(") 'wrap-region-paren) (defun zap-whitespace () "zaps the whitespace around the point in both directions" (interactive) @@ -87,53 +111,42 @@ (pop-mark) (goto-char (mark)) (pop-mark)) -(global-unset-key (kbd "M-z")) (global-set-key (kbd "M-z") 'zap-whitespace) (defun wrap-sexp (&optional arg) - "Wraps the following sexp in a pair of parens and places inside the new pair, with prefix arg do the same backwards, pushing the mark" + "Wraps the following sexp in a pair of parens. +Places inside the new pair, with prefix arg do the same backwards, pushing the +mark. Does the same of ARG number sexps if given" (interactive "P") (message "%s" arg) (if arg (progn - (push-mark) - (insert-pair -1 ?\( ?\))) + (push-mark) + (insert-pair -1 ?\( ?\))) (insert-pair 1 ?\( ?\)))) (global-set-key (kbd "C-M-z") 'wrap-sexp) ;;move buffers between windows in a convient way -(defun swap-buffer () - "Cycles the assignment of buffers to windows" - (interactive) - (cond ((one-window-p) (display-buffer (other-buffer))) - ((let* ((buffer-a (current-buffer)) - (window-b (cadr (window-list))) - (buffer-b (window-buffer window-b))) - (set-window-buffer window-b buffer-a) - (switch-to-buffer buffer-b) - (other-window 1))))) -;;replace shrink window -(global-unset-key (kbd "C-x -")) -(global-set-key (kbd "C-x -") 'swap-buffer) +(require 'buffer-move) +(global-set-key (kbd "C-x -") 'buf-move-right) ;; quick window switching (global-set-key (kbd "M-o") 'other-window) -(global-set-key (kbd "M-W") 'switch-to-buffer) ;; save/restore window config (setq current-saved-layout ?0) (seq-do (lambda (number) - (let* ((string (int-to-string number)) - (char (string-to-char string)) - (key (kbd (concat "M-" string)))) - (global-unset-key key) - (global-set-key key (lambda () - (interactive) - (window-configuration-to-register current-saved-layout) - (unless (window-configuration-p (car (get-register char))) - (window-configuration-to-register char)) - (jump-to-register char) - (setq current-saved-layout char))))) - '(0 1 2 3 4 5 6 7 8 9)) + (let* ((string (int-to-string number)) + (char (string-to-char string)) + (key (kbd (concat "M-" string)))) + (global-unset-key key) + (global-set-key key (lambda () + (interactive) + (window-configuration-to-register current-saved-layout) + (unless (window-configuration-p (car (get-register char))) + (window-configuration-to-register char)) + (jump-to-register char) + (setq current-saved-layout char))))) + '(0 1 2 3 4 5 6 7 8 9)) ;; get me a calculator (global-unset-key (kbd "M-c")) @@ -144,80 +157,82 @@ (global-set-key (kbd "M-k") 'kill-current-buffer) (global-set-key (kbd "M-K") 'kill-buffer-and-window) -;; compilation stuff -(global-unset-key (kbd "M-m")) -(global-unset-key (kbd "M-M")) -(global-set-key (kbd "M-m") 'next-error) -(global-set-key (kbd "M-M") 'recompile) - ;; latex stuff (require 'tex-mode) (define-key latex-mode-map (kbd "C-c m") (lambda () (interactive) - (insert "\\[\n\n\\]") - (backward-char 3))) - -;; region folding -(require 'fold-this) - -;; folding keybinds -(defun fold-this-fold-forward (&optional arg) - (interactive "p") - (push-mark) - (forward-sexp arg) - (fold-this (mark) (point)) - (pop-mark)) -(defun fold-this-fold-backward (&optional arg) - (interactive "p") - (push-mark) - (backward-sexp arg) - (fold-this (point) (mark)) - (pop-mark)) - -(define-prefix-command 'fold-map) -(global-set-key (kbd "M-F") 'fold-map) - -(define-key fold-map (kbd "d") 'fold-this) -;; (global-set-key (kbd "M-F d") 'fold-this) -(define-key fold-map (kbd "e") 'fold-this-unfold-at-point) -;; (global-set-key (kbd "M-F e") 'fold-this-unfold-at-point) -(define-key fold-map (kbd "t") 'hs-toggle-hiding) -;; (global-set-key (kbd "M-F t") 'hs-toggle-hiding) -(define-key fold-map (kbd "f") 'fold-this-fold-forward) -(define-key fold-map (kbd "b") 'fold-this-fold-backward) + (push-mark) + (insert "\\[\n\n\\]") + (indent-region (mark) (point)) + (pop-mark) + (previous-line) + (indent-for-tab-command) + )) + +(add-hook 'tex-mode-hook (lambda () + (setq-local compile-command + (concat "pdflatex " (shell-quote-argument (buffer-file-name)))) + (add-hook 'after-save-hook 'recompile 0 t))) ;; better minibuffer complete -(selectrum-mode 1) -(savehist-mode) -(setq selectrum-display-style '(horizontal)) -(setq selectrum-display-action '(display-buffer-in-side-window (side . bottom) (slot . -1))) +(use-package vertico + :init + (vertico-mode) + (vertico-flat-mode) + (setq vertico-cycle t)) + (use-package orderless :ensure t :custom - (completion-styles '(orderless basic)) + (completion-styles '(orderless partial-completion flex basic)) (orderless-matching-styles '(orderless-literal orderless-regexp orderless-prefixes)) - (orderless-skip-highlighting (lambda () selectrum-is-active)) - (selectrum-highlight-candidates-function #'orderless-highlight-matches)) + ;; (orderless-skip-highlighting t) + ;; (selectrum-highlight-candidates-function #'orderless-highlight-matches) + ) ;; better in-buffer completion ;; (require 'company) ;; (add-hook 'prog-mode-hook (lambda () -;; (company-mode 1))) +;; (company-mode 1))) ;; (global-unset-key (kbd "M-/")) ;; (global-set-key (kbd "M-/") 'company-complete) -;; exwm stuff -;;(load "~/.emacs.d/exwm-pref.el") - ;; mail stuff -(load "~/.emacs.d/mail.el") +(autoload 'mu4e "~/.emacs.d/mail.el" "mu4e stuff" t) ;; music -(load "~/.emacs.d/bongo.el") -(load "~/.emacs.d/youtube-dl.el") -(load "~/.emacs.d/bongo-populate.el") +;; (autoload 'youtube-dl-enqueue "~/.emacs.d/youtube-dl.el" "download from youtube" t) + +(emms-all) +(require 'emms-info-native) +(defun emms-file-info (track) + "Sets info of a track based on it's file name. Expects Artist - Album - Track.ext." + (when (emms-track-file-p track) + (let* ((file-name (emms-track-name track)) + (tags (string-split (car (seq-reverse (string-split file-name "/"))) " - "))) + (emms-track-set track 'info-artist (car tags)) + (emms-track-set track 'info-album (car (cdr tags))) + (emms-track-set track 'info-title (car (cdr (cdr tags))))))) + +(setq emms-player-list '(emms-player-mpv) + emms-info-functions '(emms-file-info) + emms-source-file-directory-tree-function 'emms-source-file-directory-tree-find) + +(require 'emms-state) +;; see single header, loaded AFTER this for more about emms-state + ;; allow using emacsclient -(server-start) +(load "server") +(unless (server-running-p) (server-start)) + +;; mutli frame stuff +(global-set-key (kbd "C-x C-C") 'save-buffers-kill-terminal) +(global-set-key (kbd "C-x C-c") (lambda () + (interactive) + (if (eq 1 (length (frame-list))) + ;; sole frame, exit + (save-buffers-kill-terminal) + (delete-frame)))) ;; don't ask about killing buffers (setq kill-buffer-query-functions (delq 'process-kill-buffer-query-function kill-buffer-query-functions)) @@ -225,29 +240,54 @@ ;; don't ask about kill processes (setq confirm-kill-processes nil) -;; allow doing webpage startup -(use-package edit-server - :ensure t - :commands edit-server-start - :init (if after-init-time - (edit-server-start) - (add-hook 'after-init-hook - #'(lambda() (edit-server-start)))) - :config (setq edit-server-new-frame-alist - '((name . "Edit with Emacs FRAME") - (top . 200) - (left . 200) - (width . 80) - (height . 25) - (minibuffer . t) - (menu-bar-lines . t)))) - -(load-file "~/.emacs.d/async-eval.el") +(autoload 'async-eval "~/.emacs.d/async-eval.el" "evaluate in another emacs process" t) (load-file "~/.emacs.d/project-stuff.el") +(load-file "~/.emacs.d/single-header.el") + (put 'dired-find-alternate-file 'disabled nil) (put 'upcase-region 'disabled nil) (put 'list-timers 'disabled nil) (put 'narrow-to-region 'disabled nil) +;; no tabs +(setq-default indent-tabs-mode nil) + +;; input method stuff +(setq rime-translate-keybindings + '("C-f" "C-b" "C-n" "C-p" "C-g" "" "" "" "" "" "" "")) +(setq rime-share-data-dir "~/.local/share/fcitx5/rime") +(setq rime-show-candidate 'popup) + +;; evil mode stuff +(evil-mode 1) +(define-key evil-motion-state-map (kbd "TAB") 'indent-for-tab-command) +(setq evil-want-C-d-scroll nil + evil-want-C-w-delete nil + evil-disable-insert-state-bindings t) +(use-package evil-surround + :ensure t + :config + (global-evil-surround-mode 1)) +(use-package evil-snipe + :ensure t + :config + (evil-snipe-mode +1) + (evil-snipe-override-mode +1) + (setq evil-snipe-scope 'buffer) + (evil-define-key 'visual evil-snipe-local-mode-map "z" 'evil-snipe-s) + (evil-define-key 'visual evil-snipe-local-mode-map "Z" 'evil-snipe-S)) +(define-key evil-insert-state-map (kbd "C-d") 'delete-char) +(define-key evil-insert-state-map (kbd "C-e") 'move-end-of-line) +(define-key evil-insert-state-map (kbd "C-a") 'move-beginning-of-line) +(define-key evil-normal-state-map (kbd "M-.") 'xref-find-definitions) + +(custom-set-faces + ;; custom-set-faces was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + '(minibuffer-prompt ((t (:background "gray10" :foreground "cyan" :box nil :weight bold)))) + '(vterm-color-blue ((t (:inherit ansi-color-bright-green))))) +(put 'downcase-region 'disabled nil) diff --git a/emacs/project-stuff.el b/emacs/project-stuff.el index 879eae0..03142b2 100644 --- a/emacs/project-stuff.el +++ b/emacs/project-stuff.el @@ -1,41 +1,275 @@ -(defun create-tags (dir-name) - "Create tags file." - (interactive "DDirectory: ") - (eshell-command - (format "gtags %s" dir-name))) - - ;;; Jonas.Jarnestromki.ericsson.se A smarter - ;;; find-tag that automagically reruns etags when it cant find a - ;;; requested item and then makes a new try to locate it. - ;;; Fri Mar 15 09:52:14 2002 - -(defadvice find-tag (around refresh-etags activate) - "Rerun etags and reload tags if tag not found and redo find-tag. - If buffer is modified, ask about save before running etags." - (let ((extension (file-name-extension (buffer-file-name)))) - (condition-case err - ad-do-it - (error (and (buffer-modified-p) - (not (ding)) - (y-or-n-p "Buffer is modified, save it? ") - (save-buffer)) - (er-refresh-tags extension) - ad-do-it)))) - -(defun er-refresh-tags (&optional extension) - "Run etags on all peer files in current dir and reload them silently." - (interactive) - (shell-command (format "etags *.%s" (or extension "el"))) - (let ((tags-revert-without-query t)) ; don't query, revert silently - (visit-tags-table default-directory nil))) +;;; project-stuff --- Things I want for coding mostly + +;;; Commentary: + +;;; Just want to seperate the coding stuff from my other init stuff + (add-hook 'xref-backend-functions 'gxref-xref-backend) -(require 'semantic/sb) -(setq semantic-default-submodes - '(global-semanticdb-minor-mode global-semantic-idle-scheduler-mode global-semantic-idle-summary-mode global-semantic-idle-completions-mode global-semantic-highlight-func-mode global-semantic-mru-bookmark-mode global-semantic-idle-local-symbol-highlight-mode)) -(semantic-mode 1) +;; (require 'semantic/sb) +;; (setq semantic-default-submodes +;; '(global-semantic-idle-scheduler-mode +;; semantic-db-minor-mode +;; global-semantic-idle-summary-mode +;; global-semantic-idle-completions-mode +;; global-semantic-highlight-func-mode +;; global-semantic-mru-bookmark-mode +;; global-semantic-idle-local-symbol-highlight-mode) +;; semantic-idle-scheduler-work-idle-time 5) +;; (semantic-mode 1) +;; (global-ede-mode t) + +;; don't forget that eglot exists + +;; better commenting stuff +(global-set-key (kbd "C-x C-;") 'comment-or-uncomment-region) +(global-set-key (kbd "C-x ;") 'comment-line) +(global-set-key (kbd "C-x :") 'comment-set-column) ;never gonna use but whatever + +(setq asm-comment-char ?#) + + +;; deal white whitespace better +(setq whitespace-style + '(face trailing tabs missing-newline-at-eof indentation space-after-tab space-before-tab tab-mark)) +(setq fill-column 80) +(add-hook 'prog-mode-hook (lambda () + (whitespace-mode 1) + (display-fill-column-indicator-mode 1))) + + +(require 'sr-speedbar "~/.emacs.d/sr-speedbar.el" nil) +(defun speedbar-switch-and-setup () + "Switch in and out of the speedbar, opening as necessary." + (interactive) + (if (eq major-mode 'speedbar-mode) + (select-window (previous-window)) + (let ((cur (current-buffer)) + (win (get-buffer-window "*SPEEDBAR*"))) + (if win + (select-window win) + (sr-speedbar-toggle) + (select-window (get-buffer-window "*SPEEDBAR*"))) + (sr-speedbar-refresh) + (speedbar-find-selected-file (buffer-file-name cur)) + (speedbar-expand-line)))) -(load-file "~/.emacs.d/sr-speedbar.el") +(define-key speedbar-mode-map (kbd "q") 'sr-speedbar-toggle) (global-unset-key (kbd "M-i")) -(global-set-key (kbd "M-i") 'sr-speedbar-toggle) +(global-set-key (kbd "M-i") 'speedbar-switch-and-setup) + +;; indent code when pasting, from +;; https://trey-jackson.blogspot.com/2008/03/emacs-tip-15-indent-yanked-code.html + +;; automatically indenting yanked text if in programming-modes +(defvar yank-indent-modes '(emacs-lisp-mode + c-mode c++-mode + tcl-mode sql-mode + perl-mode cperl-mode + java-mode jde-mode + lisp-interaction-mode + LaTeX-mode TeX-mode + rust-mode + rustic-mode) + "Modes in which to indent regions that are yanked (or yank-popped).") + +(defun yank-advised-indent-function (beg end) + "Do indentation, as long as the region isn't too large. +BEG and END define the region." + (indent-region beg end nil)) + +(defadvice yank (after yank-indent activate) + "If current mode is one of 'yank-indent-modes, indent yanked text (with prefix arg don't indent)." + (if (and (not (ad-get-arg 0)) + (member major-mode yank-indent-modes)) + (let ((transient-mark-mode nil)) + (yank-advised-indent-function (region-beginning) (region-end))))) + +(defadvice yank-pop (after yank-pop-indent activate) + "If current mode is one of 'yank-indent-modes, indent yanked text (with prefix arg don't indent)." + (if (and (not (ad-get-arg 0)) + (member major-mode yank-indent-modes)) + (let ((transient-mark-mode nil)) + (yank-advised-indent-function (region-beginning) (region-end))))) + + + +;; make ibuffer play with projectile +(require 'ibuffer) +(add-hook 'ibuffer-hook + (lambda () + (ibuffer-projectile-set-filter-groups) + (unless (eq ibuffer-sorting-mode 'alphabetic) + (ibuffer-do-sort-by-alphabetic)))) + +;; make shells and whatnot slightly better +(require 'comint) +(setq comint-scroll-to-bottom-on-input t) +(setq comint-scroll-to-bottom-on-output t) + +;; code folding + +;; region folding +(autoload 'fold-this "fold-this" "arbitrary folding" t) +(autoload 'fold-this-unfold-at-point "fold-this" "arbitrary folding" t) + +;; folding keybinds +(defun fold-this-fold-forward (&optional arg) + "Fold forward ARG number of sexps, defaulting to one." + (interactive "p") + (push-mark) + (forward-sexp arg) + (fold-this (mark) (point)) + (pop-mark)) +(defun fold-this-fold-backward (&optional arg) + "Fold backward ARG number of sexps, defaulting to one." + (interactive "p") + (push-mark) + (backward-sexp arg) + (fold-this (point) (mark)) + (pop-mark)) + +(define-prefix-command 'fold-map) +(global-set-key (kbd "M-F") 'fold-map) + +(define-keymap :full nil + :parent nil + :suppress nil + :keymap nil + :name "fold-map" + :prefix 'fold-map + (kbd "c") 'fold-this + (kbd "e") 'fold-this-unfold-at-point + (kbd "t") 'hs-toggle-hiding + (kbd "f") 'fold-this-fold-forward + (kbd "b") 'fold-this-fold-backward + (kbd "l") 'hs-hide-level) + + +(add-hook 'tex-mode-hook (lambda () + (setq spell-fu-faces-exclude + '(tex-math + font-lock-builtin-face + font-lock-keyword-face + font-lock-function-name-face + font-lock-variable-name-face)))) + +(defun clean-prog-file (buffer) + "Fixes whitespace in buffer" + (save-excursion + (with-current-buffer buffer + (untabify (point-min) (point-max)) + (goto-char (point-min)) + (while (re-search-forward " +$" nil t) + (replace-match "" nil nil))))) + +(add-hook 'prog-mode-hook (lambda () + (hs-minor-mode 1) + ;; (flymake-mode 1) + (spell-fu-mode 0) + (add-hook 'before-save-hook (lambda () (clean-prog-file (current-buffer)))))) + +(use-package flymake-diagnostic-at-point + :after flymake + :config + (setq flymake-diagnostic-at-point-timer-delay 1) + (add-hook 'flymake-mode-hook #'flymake-diagnostic-at-point-mode)) + +(setq rustic-lsp-setup-p nil) + +;; eshell stuff +(require 'eshell) +(require 'esh-help) +(setup-esh-help-eldoc) +(add-hook 'eshell-mode-hook (lambda () (eldoc-mode 1))) +(add-hook 'eshell-mode-hook 'eshell-fringe-status-mode) +(require 'em-smart) +(setq eshell-where-to-jump 'begin) +(setq eshell-review-quick-commands 'not-even-short-output) +(setq eshell-smart-space-goes-to-end t) +(add-to-list 'eshell-modules-list 'eshell-smart) +(eshell-vterm-mode 1) +(setq eshell-visual-commands + (append eshell-visual-commands + '("ytfzf" "nmtui" "w3m"))) + +(add-hook 'vterm-mode-hook (lambda () + (hl-line-mode 0))) +(add-hook 'eshell-mode-hook (lambda () + (hl-line-mode 0))) + +(define-key vterm-mode-map (kbd "M-W") 'persp-switch-to-buffer) +(define-key vterm-mode-map (kbd "M-k") 'persp-kill-buffer) +(define-key vterm-mode-map (kbd "M-p") 'persp-key-map) + +(require 'evil) +(evil-set-initial-state 'vterm-mode 'emacs) + +(define-key eshell-mode-map (kbd "M-o") 'other-window) +(define-key eshell-mode-map (kbd "M-W") 'switch-buffer) +(define-key eshell-mode-map (kbd "C-l") (lambda () + (interactive) + (recenter-top-bottom 0))) + +;; compilation stuff +(global-unset-key (kbd "M-m")) +(global-unset-key (kbd "M-M")) +(global-set-key (kbd "M-m") (lambda () + (interactive) + (if flymake-mode + (flymake-goto-next-error) + (next-error)))) +(global-set-key (kbd "M-M") 'recompile) +(setq compilation-always-kill t + compilation-scroll-output t) + +;; better finding things +(global-set-key (kbd "C-s") 'swiper) +(global-set-key (kbd "C-S-s") 'isearch-forward) +(global-set-key (kbd "C-r") 'counsel-ag) + +;; perspective and friends +;; (require 'perspective) +;; (customize-set-variable 'persp-mode-prefix-key (kbd "M-p")) +;; (global-set-key (kbd "C-x C-b") 'persp-ibuffer) +;; (persp-mode) +;; (global-set-key (kbd "C-x b") 'persp-switch-to-buffer*) +;; (global-set-key (kbd "M-W") 'persp-switch-to-buffer*) +;; (global-set-key (kbd "C-x k") 'persp-kill-buffer*) + + +(require 'persp-mode) +(persp-mode 1) + + +(with-eval-after-load "persp-mode" + (defvar after-switch-to-buffer-functions nil) + (defvar after-display-buffer-functions nil) + + (if (fboundp 'advice-add) + ;;Modern way + (progn + (defun after-switch-to-buffer-adv (&rest r) + (apply #'run-hook-with-args 'after-switch-to-buffer-functions r)) + (defun after-display-buffer-adv (&rest r) + (apply #'run-hook-with-args 'after-display-buffer-functions r)) + (advice-add #'switch-to-buffer :after #'after-switch-to-buffer-adv) + (advice-add #'display-buffer :after #'after-display-buffer-adv)) + + (add-hook 'after-switch-to-buffer-functions + #'(lambda (bn) (when (and persp-mode + (not persp-temporarily-display-buffer)) + (persp-add-buffer bn))))) + + (setq persp-add-buffer-on-after-change-major-mode 'free + persp-autokill-buffer-on-remove t + persp-kill-foreign-buffer-behaviour 'dont-ask) + (global-set-key (kbd "M-p") 'persp-key-map) + (global-set-key (kbd "C-x b") #'persp-switch-to-buffer) + (global-set-key (kbd "C-x C-b") (lambda () + (interactive) + (with-persp-buffer-list () (ibuffer)))) + (global-set-key (kbd "M-W") #'persp-switch-to-buffer) + (global-set-key (kbd "C-x k") #'persp-kill-buffer)) + diff --git a/emacs/tmu-custom-theme.el b/emacs/tmu-custom-theme.el index 80955d1..a3e30d3 100644 --- a/emacs/tmu-custom-theme.el +++ b/emacs/tmu-custom-theme.el @@ -3,7 +3,6 @@ (custom-theme-set-faces 'tmu-custom - '(default ((t (:family "Source Code Pro" :foundry "ADBO" :width normal :height 98 :weight regular :slant normal :underline nil :overline nil :extend nil :strike-through nil :box nil :inverse-video nil :foreground "white smoke" :background "gray10" :stipple nil :inherit nil)))) '(cursor ((((background light)) (:background "black")) (((background dark)) (:background "white")))) '(fixed-pitch ((t (:family "Monospace")))) '(variable-pitch ((((type w32)) (:foundry "outline" :family "Arial")) (t (:family "Sans Serif")))) @@ -43,18 +42,19 @@ '(link ((((class color) (min-colors 88) (background light)) (:underline (:color foreground-color :style line :position nil) :foreground "RoyalBlue3")) (((class color) (background light)) (:underline (:color foreground-color :style line :position nil) :foreground "blue")) (((class color) (min-colors 88) (background dark)) (:underline (:color foreground-color :style line :position nil) :foreground "cyan1")) (((class color) (background dark)) (:underline (:color foreground-color :style line :position nil) :foreground "cyan")) (t (:inherit (underline))))) '(link-visited ((default (:inherit (link))) (((class color) (background light)) (:foreground "magenta4")) (((class color) (background dark)) (:foreground "violet")))) '(fringe ((((class color) (background light)) (:background "grey95")) (((class color) (background dark)) (:background "grey10")) (t (:background "gray")))) - '(header-line ((t (:box (:line-width (1 . -1) :color "red" :style released-button) :inherit (mode-line))))) + '(header-line ((t (:inherit mode-line)))) '(tooltip ((((class color)) (:inherit (variable-pitch) :foreground "black" :background "lightyellow")) (t (:inherit (variable-pitch))))) - '(mode-line ((t (:family "DejaVu Sans" :box (:line-width (1 . 1) :color "red" :style nil) :background "gray30")))) + '(mode-line ((t (:background "black" :family "DejaVu Sans")))) '(mode-line-buffer-id ((t (:weight bold)))) '(mode-line-emphasis ((t (:weight bold)))) '(mode-line-highlight ((((supports :box t) (class color) (min-colors 88)) (:box (:line-width (2 . 2) :color "grey40" :style released-button))) (t (:inherit (highlight))))) - '(mode-line-inactive ((t (:foreground "dark gray" :inherit (mode-line))))) + '(mode-line-inactive ((t (:inherit mode-line :foreground "dark gray")))) '(isearch ((((class color) (min-colors 88) (background light)) (:foreground "lightskyblue1" :background "magenta3")) (((class color) (min-colors 88) (background dark)) (:foreground "brown4" :background "palevioletred2")) (((class color) (min-colors 16)) (:foreground "cyan1" :background "magenta4")) (((class color) (min-colors 8)) (:foreground "cyan1" :background "magenta4")) (t (:inverse-video t)))) '(isearch-fail ((((class color) (min-colors 88) (background light)) (:background "RosyBrown1")) (((class color) (min-colors 88) (background dark)) (:background "red4")) (((class color) (min-colors 16)) (:background "red")) (((class color) (min-colors 8)) (:background "red")) (((class color grayscale)) (:foreground "grey")) (t (:inverse-video t)))) '(lazy-highlight ((((class color) (min-colors 88) (background light)) (:distant-foreground "black" :background "paleturquoise")) (((class color) (min-colors 88) (background dark)) (:distant-foreground "white" :background "paleturquoise4")) (((class color) (min-colors 16)) (:distant-foreground "white" :background "turquoise3")) (((class color) (min-colors 8)) (:distant-foreground "white" :background "turquoise3")) (t (:underline (:color foreground-color :style line :position nil))))) '(match ((((class color) (min-colors 88) (background light)) (:background "khaki1")) (((class color) (min-colors 88) (background dark)) (:background "RoyalBlue3")) (((class color) (min-colors 8) (background light)) (:foreground "black" :background "yellow")) (((class color) (min-colors 8) (background dark)) (:foreground "white" :background "blue")) (((type tty) (class mono)) (:inverse-video t)) (t (:background "gray")))) '(next-error ((t (:inherit (region))))) - '(query-replace ((t (:inherit (isearch)))))) + '(query-replace ((t (:inherit (isearch))))) + '(default ((t (:family "Source Code Pro" :foundry "ADBO" :width normal :height 98 :weight regular :slant normal :underline nil :overline nil :extend nil :strike-through nil :box nil :inverse-video nil :foreground "white smoke" :background "gray10" :stipple nil :inherit nil))))) (provide-theme 'tmu-custom) -- cgit v1.2.3