Guest User

Untitled

a guest
May 12th, 2026
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 9.76 KB | None | 0 0
  1. ;; Copyright (c) 2019-2026 cmburn <[email protected]>
  2.  
  3. ;; This program is free software: you can redistribute it and/or modify
  4. ;; it under the terms of the GNU General Public License as published by
  5. ;; the Free Software Foundation, either version 3 of the License, or
  6. ;; (at your option) any later version.
  7.  
  8. ;; This program is distributed in the hope that it will be useful,
  9. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  11. ;; GNU General Public License for more details.
  12.  
  13. ;; You should have received a copy of the GNU General Public License
  14. ;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
  15.  
  16. ;; Pull in straight.el, our package manager of choice
  17.  
  18.  
  19. (require 'use-package-ensure)
  20.  
  21. (defvar bootstrap-version)
  22.  
  23.  
  24.                     ; Custom functions/variables
  25. (defcustom display-line-numbers-exempt-modes
  26.   '(eshell-mode
  27.     shell-mode
  28.     matlab-shell-mode
  29.     treemacs-mode
  30.     help-mode
  31.     dashboard-mode)
  32.   "Major modes on which to disable line numbers."
  33.   :group 'display-line-numbers
  34.   :type 'list
  35.   :version "green")
  36.  
  37. (defcustom display-fill-column-indicator-exempt-modes
  38.   '(dashboard-mode
  39.     matlab-shell-mode)
  40.   "Major modes on which to disable the display fill column indicator"
  41.   :group 'display-fill-column-indicator
  42.   :type 'list)
  43.  
  44. (defcustom tabless-modes
  45.   '("*LSP"
  46.     "*straight"
  47.     "*Messages"
  48.     "*lsp"
  49.     "*digestif"
  50.     "*helm"
  51.     "*Flycheck"
  52.     "*company"
  53.     "*epc"
  54.     "*helm"
  55.     "*Helm"
  56.     "*Compile-Log*"
  57.     "*lsp"
  58.     "*company"
  59.     "*Flycheck"
  60.     "*tramp"
  61.     " *Mini"
  62.     "*help"
  63.     "*straight"
  64.     " *temp"
  65.     "*Help"
  66.     "*mybuf")
  67.   ""
  68.   :group 'tab
  69.   :type 'list)
  70.  
  71. (defun centaur-tabs-hide-tab (x)
  72.   "Do no to show buffer X in tabs."
  73.   (let ((name (format "%s" x)))
  74.     (or
  75.      ;; Current window is not dedicated window.
  76.      (window-dedicated-p (selected-window))
  77.  
  78.      (some (lambda (str)
  79.          (string-prefix-p str)) tabless-modes)
  80.  
  81.      ;; Is not magit buffer.
  82.      (and (string-prefix-p "magit" name)
  83.           (not (file-name-extension name))))))
  84.  
  85. (defcustom ui-size
  86.   120
  87.   ""
  88.   :group 'font
  89.   :type 'integer)
  90.  
  91. (defcustom ui-font
  92.   "Cantarell"
  93.   ""
  94.   :group 'font
  95.   :type 'string)
  96.  
  97. (defun mark-ui-font (font &optional size-in)
  98.   (let ((fonts (if (listp font) font '(font))))
  99.     (mapcar
  100.      (lambda (f)
  101.        (let ((size (if size-in size-in ui-size)))
  102.      (set-face-attribute
  103.       f nil
  104.       :family ui-font
  105.       :height size
  106.       :spacing (* size 1.1)))))))
  107.  
  108. (defun disable-exempt-modes ()
  109.   "Disable exempt modes after a mode change"
  110.   (display-line-numbers-mode
  111.    (if (derived-mode-p display-line-numbers-exempt-modes)
  112.        0
  113.      1))
  114.   (display-fill-column-indicator-mode
  115.    (if (derived-mode-p display-fill-column-indicator-exempt-modes)
  116.        0
  117.      1)))
  118.  
  119. (defun mark-ui-font (face-arg)
  120.   (let ((faces (if (listp face-arg)
  121.            face-arg
  122.          '(face-arg))))
  123.     (mapcar
  124.      (lambda (arg)
  125.        (set-face-font arg ui-font))
  126.      face-arg)))
  127.  
  128. (defun highlight-trailing-whitespace ()
  129.   "Highlight trailing whitespace in the current buffer."
  130.   (setq show-trailing-whitespace t))
  131.  
  132. (use-package emacs
  133.   :bind
  134.   (("C-s" . isearch-forward-regexp)
  135.    ("C-r" . i-search-backward-regexp)
  136.    ("C-M-s" . isearch-forward)
  137.    ("C-M-s" . isearch-backward))
  138.   :hook ((text-mode . display-fill-column-indicator-mode)
  139.      (text-mode . display-line-numbers-mode)
  140.      (after-change-major-mode . disable-exempt-modes)
  141.      (tex-mode . flycheck-mode)
  142.      (text-mode . highlight-trailing-whitespace))
  143.   :init
  144.   (setq blink-matching-paren 1)
  145.   (setq case-replace nil)
  146.   (setq comp-async-report-warnings-errors nil)
  147.   (setq query-replace-highlight 1)
  148.   (setq require-final-newline 1)
  149.   (setq show-paren-delay 0 show-paren-style 'parenthesis)
  150.   (setq warning-suppress-log-types '((comp)))
  151.   (setq warning-suppress-types '((comp)))
  152.   (setq backup-directory-alist '(("." . "~/.emacs-backups.d/")))
  153.   (setq-default buffer-file-coding-system 'utf-8-unix)
  154.   (setq-default fill-column 80)
  155.   (setq-default truncate-lines 1)
  156.   (setq dashboard-center-content t)
  157.   (setq doom-modeline-height 32)
  158.   (setq doom-modeline-icon t)
  159.   (setq safe-local-variable-values '((eval cperl-set-style "PBP")))
  160.   (setq search-highlight 1)
  161.   (setq treemacs-width 24)
  162.   (setq load-path (cons "~/.emacs.d/elisp/" load-path))
  163.   (setq whitespace-style
  164.     '(trailing lines space-before-tab)
  165.     whitespace-line-column 80)
  166.   (let ((bootstrap-file
  167.      (expand-file-name "straight/repos/straight.el/bootstrap.el"
  168.                user-emacs-directory))
  169.     (bootstrap-version 6))
  170.     (unless (file-exists-p bootstrap-file)
  171.       (with-current-buffer
  172.           (url-retrieve-synchronously
  173.            (concat "https://raw.githubusercontent.com/"
  174.            "radian-software/straight.el/develop/install.el")
  175.            'silent 'inhibit-cookies)
  176.     (goto-char (point-max))
  177.     (eval-print-last-sexp)))
  178.     (load bootstrap-file nil 'nomessage))
  179.   (setq straight-use-package-by-default 't)
  180.   (setq use-package-always-ensure t)
  181.   :config
  182.   (scroll-bar-mode -1)
  183.   (electric-pair-mode 1)
  184.   (put 'downcase-region 'disabled nil)
  185.   (put 'narrow-to-region 'disabled nil)
  186.   (put 'upcase-region 'disabled nil)
  187.   (global-display-line-numbers-mode)
  188.   (line-number-mode 1)
  189.   (show-paren-mode 1)
  190.   (tool-bar-mode -1)
  191.   (auto-compression-mode 1)
  192.   (transient-mark-mode 1))
  193.  
  194. (use-package exec-path-from-shell
  195.   :if (display-graphic-p)
  196.   :config
  197.   (setq exec-path-from-shell-debug 't)
  198.   (exec-path-from-shell-initialize))
  199.  
  200. (use-package doom-modeline
  201.   :init
  202.   (setq doom-modeline-height 32)
  203.   (setq doom-modeline-icon t)
  204.   :config
  205.   (doom-modeline-mode)
  206.   (set-face-attribute 'doom-modeline nil :family ui-font :height ui-size))
  207.  
  208. (use-package doom-themes
  209.   :config
  210.   (load-theme 'doom-one t))
  211.  
  212. (use-package anzu
  213.   :bind ("M-%" . anzu-query-replace-regexp))
  214.  
  215. (use-package helm
  216.   :config (helm-mode t)
  217.   :bind
  218.   (("C-h a" . helm-apropos)
  219.    ("C-x C-f" . helm-find-files)
  220.    ("M-x" . helm-M-x)))
  221.  
  222. (use-package company
  223.   :hook ((after-init . global-company-mode)))
  224.  
  225. (use-package treemacs
  226.   :bind ("M-1" . treemacs)
  227.   :config
  228.   (mark-ui-font
  229.    '(treemacs-directory-face
  230.      treemacs-directory-collapsed-face
  231.      treemacs-file-face
  232.      treemacs-root-face
  233.      treemacs-root-unreadable-face
  234.      treemacs-root-remote-face
  235.      treemacs-root-remote-unreadable-face
  236.      treemacs-root-remote-disconnected-face
  237.      treemacs-git-added-face
  238.      treemacs-git-commit-diff-face
  239.      treemacs-git-conflict-face
  240.      treemacs-git-ignored-face
  241.      treemacs-git-modified-face
  242.      treemacs-git-renamed-face
  243.      treemacs-git-unmodified-face
  244.      treemacs-git-untracked-face
  245.      treemacs-tags-face
  246.      treemacs-help-title-face
  247.      treemacs-help-column-face)))
  248.  
  249. (use-package dashboard
  250.   :config
  251.   (dashboard-setup-startup-hook))
  252.  
  253. (use-package rust-mode)
  254.  
  255. (use-package lsp-mode
  256.   :init
  257.   (use-package lsp-treemacs
  258.     :bind ("M-6" . lsp-treemacs-errors-list))
  259.   (use-package dap-mode)
  260.   (make-lsp-client :new-connection (lsp-stdio-connection '("ameba-ls"))
  261.                    :activation-fn (lsp-activate-on "crystal")
  262.                    :priority '1
  263.                    :server-id 'crystalline)
  264.   (make-lsp-client :new-connection (lsp-stdio-connection '("npx buf lsp serve"))
  265.            :activation-fn (lsp-activate-on "protobuf")
  266.            :priority '1
  267.            :server-id 'buf)
  268.   :hook ((c-mode-common . lsp)
  269.      (go-mode . lsp)
  270.      (elixir-ts-mode . lsp)
  271.      (heex-ts-mode . lsp)
  272.      (rust-mode . lsp)))
  273.  
  274. (use-package font-utils)
  275.  
  276. (use-package all-the-icons
  277.   :if (display-graphic-p))
  278.  
  279. (use-package projectile
  280.   :init
  281.   (use-package helm-projectile)
  282.   (use-package treemacs-projectile))
  283.  
  284. (use-package editorconfig)
  285. (use-package tree-sitter)
  286.  
  287. (use-package solaire-mode
  288.   :config
  289.   (solaire-global-mode +1))
  290.  
  291. (use-package centaur-tabs
  292.   :config
  293.   (centaur-tabs-change-fonts ui-font ui-size)
  294.   (centaur-tabs-mode t)
  295.   (setq centaur-tabs-height 32)
  296.   (setq centaur-tabs-set-icons t)
  297.   (setq centaur-tabs-icon-type 'all-the-icons)
  298.   (setq centaur-tabs-style "bar"))
  299.  
  300. (use-package flycheck)
  301. (use-package vterm)
  302. (use-package auctex
  303.   :hook ((LaTeX-mode . lsp)
  304.      (LaTeX-mode . flycheck-mode)))
  305. (use-package matlab-mode)
  306. (use-package bison-mode)
  307.  
  308. (use-package crystal-mode
  309.   :hook ((crystal-mode . lsp)))
  310.  
  311. (use-package glsl-mode
  312.   :ensure t)
  313.  
  314. (use-package elixir-ts-mode
  315.   :ensure t)
  316.  
  317. (use-package protobuf-mode
  318.   :ensure t
  319.   :config (setq lsp-buf-path "~/.local/bin/buf")
  320.   :hook ((protobuf-mode . lsp)))
  321.  
  322. (use-package yasnippet
  323.   :ensure t
  324.   :config
  325.   (yas-global-mode 1))
  326.  
  327. (use-package magit
  328.   :ensure t)
  329.  
  330. (use-package copilot
  331.   :ensure t
  332.   :hook (prog-mode . copilot-mode)
  333.   :bind (:map copilot-completion-map
  334.               ("<tab>" . copilot-accept-completion)
  335.               ("TAB" . copilot-accept-completion)
  336.               ("C-<tab>" . copilot-accept-completion-by-word)
  337.               ("C-TAB" . copilot-accept-completion-by-word)
  338.               ("C-n" . copilot-next-completion)
  339.               ("C-p" . copilot-previous-completion)))
  340.  
  341. (use-package claude-code-ide
  342.   :straight (:type git :host github :repo "manzaltu/claude-code-ide.el")
  343.   :bind ("C-c C-'" . claude-code-ide-menu)
  344.   :config (claude-code-ide-emacs-tools-setup))
  345.  
  346. (setq treesit-language-source-alist
  347.       '((cmake "https://github.com/uyha/tree-sitter-cmake")
  348.     (elixir "https://github.com/elixir-lang/tree-sitter-elixir")
  349.     (javascript "https://github.com/tree-sitter/tree-sitter-javascript")
  350.     (json "https://github.com/tree-sitter/tree-sitter-json")
  351.     (make "https://github.com/alemuller/tree-sitter-make")
  352.     (markdown "https://github.com/ikatyang/tree-sitter-markdown")
  353.         (elisp "https://github.com/Wilfred/tree-sitter-elisp")
  354.     (heex "https://github.com/phoenixframework/tree-sitter-heex")))
  355.  
  356.  
Advertisement
Add Comment
Please, Sign In to add comment