From 6ee77b9ee7abede01a963a88167f5d7682ed32c7 Mon Sep 17 00:00:00 2001 From: zongor Date: Fri, 22 Nov 2024 23:11:20 -0500 Subject: [PATCH] update .emacs --- .emacs | 299 ++++++++++++++++++++++++++++++--------------------------- 1 file changed, 160 insertions(+), 139 deletions(-) diff --git a/.emacs b/.emacs index fea42ae..6347c98 100755 --- a/.emacs +++ b/.emacs @@ -34,11 +34,10 @@ (straight-use-package 'use-package) (setq straight-use-package-by-default t) - -(setq browse-url-browser-function 'eww-browse-url) -;; C-x SPC -- box select kode -(global-set-key [f10] 'toggle-frame-fullscreen) +(global-set-key [f11] 'toggle-frame-fullscreen) (global-set-key (kbd "C-s") 'ripgrep-regexp) +(global-set-key (kbd "C-,") 'move-to-previous-window) +(global-set-key (kbd "C-.") 'move-to-next-window) (global-set-key (kbd "M-i") 'xref-find-definitions) (global-set-key (kbd "C-M-i") 'xref-pop-marker-stack) @@ -118,14 +117,6 @@ (point)))) (comment-or-uncomment-region start end))) -(use-package exec-path-from-shell - :init - (exec-path-from-shell-initialize)) - -(use-package undo-tree - :config (global-undo-tree-mode 1) - :diminish undo-tree-mode) - (use-package evil :ensure t :init @@ -150,17 +141,18 @@ (define-key evil-normal-state-map (kbd "C-M-u") 'eval-buffer) (define-key evil-normal-state-map (kbd "C-M-p") 'compile) (define-key evil-normal-state-map (kbd "M-/") 'dabbrev-expand) - (define-key evil-normal-state-map (kbd "C-,") 'move-to-previous-window) - (define-key evil-normal-state-map (kbd "C-.") 'move-to-next-window) - (define-key evil-normal-state-map (kbd "C-M-\\") 'format-all-region-or-buffer)) + (define-key evil-normal-state-map (kbd "C-M-\\") 'format-all-buffer) -(use-package format-all - :commands format-all-mode - :hook (prog-mode . format-all-mode) - :config - (setq-default format-all-formatters - '(("C" (astyle "--mode=c")) - ("Shell" (shfmt "-i" "4" "-ci"))))) + ;; (evil-define-key 'normal Buffer-menu-mode-map (kbd "RET") ) + (evil-define-key 'normal neotree-mode-map (kbd "TAB") 'neotree-enter) + (evil-define-key 'normal neotree-mode-map (kbd "SPC") 'neotree-quick-look) + (evil-define-key 'normal neotree-mode-map (kbd "q") 'neotree-hide) + (evil-define-key 'normal neotree-mode-map (kbd "RET") 'neotree-enter) + (evil-define-key 'normal neotree-mode-map (kbd "g") 'neotree-refresh) + (evil-define-key 'normal neotree-mode-map (kbd "n") 'neotree-next-line) + (evil-define-key 'normal neotree-mode-map (kbd "p") 'neotree-previous-line) + (evil-define-key 'normal neotree-mode-map (kbd "A") 'neotree-stretch-toggle) + (evil-define-key 'normal neotree-mode-map (kbd "H") 'neotree-hidden-file-toggle)) (use-package evil-collection :after evil @@ -168,8 +160,6 @@ :config (evil-collection-init)) -(use-package all-the-icons) - (use-package dashboard :ensure t :config @@ -178,15 +168,17 @@ (use-package doom-themes :ensure t :config - (setq doom-themes-enable-bold t - doom-themes-enable-italic t) + ;; Global settings (defaults) + (setq doom-themes-enable-bold t ; if nil, bold is universally disabled + doom-themes-enable-italic t) ; if nil, italics is universally disabled (load-theme 'doom-monokai-classic t) - ;; (load-theme 'mazarbul t) + ;; Enable custom neotree theme (all-the-icons must be installed!) + (doom-themes-neotree-config) + ;; Corrects (and improves) org-mode's native fontification. (doom-themes-org-config)) -(use-package solaire-mode - :config - (solaire-global-mode +1)) +(use-package all-the-icons + :if (display-graphic-p)) (use-package treemacs :ensure t @@ -249,6 +241,10 @@ treemacs-width-is-initially-locked t treemacs-workspace-switch-cleanup nil) + ;; The default width and height of the icons is 22 pixels. If you are + ;; using a Hi-DPI display, uncomment this to double the icon size. + ;;(treemacs-resize-icons 44) + (treemacs-follow-mode nil) (treemacs-filewatch-mode t) (treemacs-fringe-indicator-mode 'always) @@ -289,6 +285,16 @@ :after (treemacs magit) :ensure t) +(use-package treemacs-persp ;;treemacs-perspective if you use perspective.el vs. persp-mode + :after (treemacs persp-mode) ;;or perspective vs. persp-mode + :ensure t + :config (treemacs-set-scope-type 'Perspectives)) + +(use-package treemacs-tab-bar ;;treemacs-tab-bar if you use tab-bar-mode + :after (treemacs) + :ensure t + :config (treemacs-set-scope-type 'Tabs)) + (use-package centaur-tabs :init (setq centaur-tabs-enable-key-bindings t) @@ -367,10 +373,23 @@ Other buffer group by `centaur-tabs-get-group-name' with project name." ("g t" . centaur-tabs-forward) ("g T" . centaur-tabs-backward))) +(use-package undo-tree + :config (global-undo-tree-mode 1) + :diminish undo-tree-mode) + +(use-package format-all + :hook ((format-all-mode-hook . format-all-ensure-formatter))) + +(use-package rainbow-delimiters + :hook ((prog-mode-hook . rainbow-delimiters-mode))) + +(use-package dumb-jump + :hook ((xref-backend-functions . dumb-jump-xref-activate))) + (use-package elfeed :config (global-set-key (kbd "C-x w") 'elfeed) - (setq elfeed-feeds + (setq elfeed-feeds '(("https://programming.dev/feeds/c/rust.xml?sort=Active" programming) ("https://programming.dev/feeds/c/gamedev.xml?sort=Active" programming) ("https://hexbear.net/feeds/c/programming.xml?sort=Active" programming) @@ -405,35 +424,115 @@ Other buffer group by `centaur-tabs-get-group-name' with project name." ("https://feeds.npr.org/344098539/podcast.xml" podcast)))) (use-package projectile - :config - (setq company-minimum-prefix-length 1 - company-idle-delay 0.0)) - -(use-package company :ensure t - :config (global-company-mode t)) + :init + (projectile-mode +1) + :bind (:map projectile-mode-map + ("s-p" . projectile-command-map) + ("C-c p" . projectile-command-map))) (use-package ivy :init (ivy-mode 1)) -(use-package which-key +(use-package org-modern + :config + (setq + ;; Edit settings + org-auto-align-tags nil + org-tags-column 0 + org-catch-invisible-edits 'show-and-error + org-special-ctrl-a/e t + org-insert-heading-respect-content t + + ;; Org styling, hide markup etc. + org-hide-emphasis-markers t + org-pretty-entities t + org-ellipsis "…" + + ;; Agenda styling + org-agenda-tags-column 0 + org-agenda-block-separator ?─ + org-agenda-time-grid + '((daily today require-timed) + (800 1000 1200 1400 1600 1800 2000) + " ┄┄┄┄┄ " "┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄") + org-agenda-current-time-string + "◀── now ─────────────────────────────────────────────────") + :init + (add-hook 'org-mode-hook #'org-modern-mode) + (add-hook 'org-mode-hook (lambda () + (setq buffer-face-mode-face '(:family "Fira Code" :height 100)) + (buffer-face-mode))) + (add-hook 'org-agenda-finalize-hook #'org-modern-agenda)) + +(use-package restclient) +(use-package markdown-mode + :ensure t + :mode ("README\\.md\\'" . gfm-mode) + :init (setq markdown-command "multimarkdown")) + +(use-package docker + :ensure t + :bind ("C-c d" . docker)) +(use-package docker-compose-mode) + +(use-package web-mode + :config + (add-to-list 'auto-mode-alist '("\\.jsx?$" . web-mode)) + (setq web-mode-content-types-alist '(("jsx" . "\\.js[x]?\\'")))) + +(use-package typescript-mode) +(use-package tide + :ensure t + :after (typescript-mode company flycheck) + :hook ((typescript-mode . tide-setup) + (typescript-mode . tide-hl-identifier-mode) + (before-save . tide-format-before-save))) +(use-package uxntal-mode) +(use-package hy-mode) +(use-package lua-mode) +(use-package elm-mode) +(use-package go-mode) +(use-package rust-mode) +(use-package cargo) +(use-package ccls + :ensure t + :init (setq ccls-executable "/usr/bin/ccls") + :hook ((c-mode c++-mode objc-mode cuda-mode) . + (lambda () (require 'ccls) (lsp)))) + +(use-package lsp-mode + :commands (lsp lsp-deferred) + :init + (setq lsp-keymap-prefix "C-c l") + :hook + ((go-mode) . lsp) + ((rust-mode) . lsp)) + +(use-package lsp-ui + :hook (lsp-mode . lsp-ui-mode) + :config + (setq lsp-ui-doc-enable t)) + +(use-package sly :ensure t :config - (which-key-mode)) + (setq inferior-lisp-program "sbcl")) -(use-package column-enforce-mode - :init - (global-column-enforce-mode)) +(use-package vterm + :ensure t) -(use-package magit - :ensure t - :bind ( - ("C-x g" . magit-status))) +(use-package dash) +(use-package column-enforce-mode) +(use-package desktop) +(use-package magit) (use-package magit-lfs :ensure t :pin melpa) (use-package forge :after magit) +(use-package ripgrep) + (use-package git-gutter :ensure t :init (global-git-gutter-mode t)) @@ -447,103 +546,25 @@ Other buffer group by `centaur-tabs-get-group-name' with project name." :type 'list :version "green") -;;(global-display-line-numbers-mode) - -(use-package markdown-mode - :ensure t - :mode ("README\\.md\\'" . gfm-mode) - :init (setq markdown-command "multimarkdown")) - -(use-package org-modern - :init - (global-org-modern-mode)) - -(use-package docker - :ensure t - :bind ("C-c d" . docker)) -(use-package docker-compose-mode) - -(use-package json-mode - :ensure t) - -(use-package web-mode - :ensure t - :config - (setq web-mode-markup-indent-offset 2) - (setq web-mode-code-indent-offset 2) - (setq web-mode-css-indent-offset 2) - :mode (("\\.js\\'" . web-mode) - ("\\.jsx\\'" . web-mode) - ("\\.ts\\'" . web-mode) - ("\\.tsx\\'" . web-mode) - ("\\.html\\'" . web-mode)) - :commands web-mode) - -(modify-syntax-entry ?` "\"" js-mode-syntax-table) - -(use-package prettier-js - :ensure t) -(add-hook 'web-mode-hook #'(lambda () - (enable-minor-mode - '("\\.jsx?\\'" . prettier-js-mode)) - (enable-minor-mode - '("\\.tsx?\\'" . prettier-js-mode)))) -(use-package uxntal-mode) -(use-package hy-mode) -(use-package lua-mode) -(use-package elm-mode) -(use-package go-mode) -(use-package rust-mode) -(use-package cargo) -(use-package ccls - :hook ((c-mode c++-mode objc-mode cuda-mode) . - (lambda () (require 'ccls) (lsp)))) - -(use-package lsp-mode - :commands (lsp lsp-deferred) - :init - (setq lsp-keymap-prefix "C-c l") - :hook ( - (elm-mode . lsp-deferred) - (go-mode . lsp-deferred) - (rust-mode . lsp-deferred) - (web-mode . lsp-deferred) - (lsp-mode . lsp-enable-which-key-integration))) - -(use-package lsp-ui :commands lsp-ui-mode) -(use-package company-lsp :commands company-lsp) -(use-package lsp-treemacs :commands lsp-treemacs-errors-list) -(use-package verb) - -(use-package sly - :ensure t - :config - (setq inferior-lisp-program "sbcl")) - -(use-package vterm - :ensure t) +(defun display-line-numbers--turn-on () + "Turn on line numbers except for certain major modes. +Exempt major modes are defined in `display-line-numbers-exempt-modes'." + (unless (or (minibufferp) + (member major-mode display-line-numbers-exempt-modes)) + (display-line-numbers-mode))) +;(global-column-enforce-mode) +(global-display-line-numbers-mode) (custom-set-variables ;; custom-set-variables 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. - '(custom-safe-themes - '("5409f053b500223bdcc4d4214986b4b57a55529b1e4659d6c48049751f1be43b" "f5f80dd6588e59cfc3ce2f11568ff8296717a938edd448a947f9823a4e282b66" "02d422e5b99f54bd4516d4157060b874d14552fe613ea7047c4a5cfa1288cf4f" "8d8207a39e18e2cc95ebddf62f841442d36fcba01a2a9451773d4ed30b632443" "be84a2e5c70f991051d4aaf0f049fa11c172e5d784727e0b525565bb1533ec78" default)) - '(inhibit-startup-screen t)) -;; Must be used *after* the theme is loaded + '(inhibit-startup-screen t) + '(neo-theme 'icons)) (custom-set-faces -;; electric buffer list - `(cm-electric-emacs-buffer-mode-face ((t (:foreground ,(doom-color 'violet))))) - `(cm-electric-c-buffer-mode-face ((t (:foreground ,(doom-color 'blue))))) - - `(cm-electric-cm-dir-face ((t (:foreground ,(doom-color 'magenta))))) - `(cm-electric-custom-dir-face ((t (:foreground ,(doom-color 'orange))))) - `(cm-electric-emacs-face ((t (:inherit cm-electric-custom-dir-face)))) - `(cm-electric-profile-dir-face ((t (:foreground ,(doom-color 'yellow))))) - - `(cm-electric-buffer-mode-face ((t (:foreground ,(doom-color 'violet))))) - `(cm-electric-cet-dir-face ((t (:foreground ,(doom-color 'violet))))) - `(cm-electric-root-face ((t (:foreground ,(doom-color 'violet))))) - `(cm-electric-fundamental-face ((t (:foreground ,(doom-color 'violet))))) - `(cm-electric-rs-file-face ((t (:foreground ,(doom-color 'violet)))))) + ;; 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. + )