snowflake/config/spacemacs
2025-05-30 22:59:38 +08:00

543 lines
24 KiB
Plaintext

;; -*- mode: emacs-lisp; lexical-binding: t -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Layer configuration:
This function should only modify configuration layer settings."
(setq-default
dotspacemacs-distribution 'spacemacs
dotspacemacs-enable-lazy-installation 'unused
dotspacemacs-ask-for-lazy-installation t
;; List of additional paths where to look for configuration layers.
;; Paths must have a trailing slash (i.e. "~/.mycontribs/")
dotspacemacs-configuration-layer-path '()
dotspacemacs-configuration-layers
'(yaml
html
shell-scripts
;; Spacemacs
spacemacs-project
spacemacs-defaults
spacemacs-org
spacemacs-evil
;; Fonts
emoji
unicode-fonts
;; editing
better-defaults
compleseus
auto-completion
multiple-cursors
prettier
;; tools
pdf
git
(shell :variables
shell-default-shell 'vterm
shell-default-term-shell "/home/dpv/.nix-profile/bin/zsh"
spacemacs-vterm-history-file-location "~/.local/share/zsh/zsh_history")
;; apps
hackernews
;; development
(lsp :variables
lsp-headerline-breadcrumb-enable nil)
emacs-lisp
c-c++
lua
go
php
react
markdown
(python :variables python-backend 'lsp python-lsp-server 'pyright)
(javascript :variables
javascript-backend 'lsp)
(typescript :variables
typescript-backend 'lsp)
(docker :variables
docker-dockerfile-backend 'lsp)
;; Custom
dat-utils
dat-tabs
dat-notetaking
dat-emms)
dotspacemacs-additional-packages '(doom-themes org-modern persistent-scratch autothemer)
;; A list of packages that cannot be updated.
dotspacemacs-frozen-packages '()
;; A list of packages that will not be installed and loaded.
dotspacemacs-excluded-packages
'(vi-tilde-fringe)
;; Defines the behaviour of Spacemacs when installing packages.
;; Possible values are `used-only', `used-but-keep-unused' and `all'.
;; `used-only' installs only explicitly used packages and deletes any unused
;; packages as well as their unused dependencies. `used-but-keep-unused'
;; installs only the used packages but won't delete unused ones. `all'
;; installs *all* packages supported by Spacemacs and never uninstalls them.
;; (default is `used-only')
dotspacemacs-install-packages 'used-only))
(defun dotspacemacs/init ()
"Initialization:
This function is called at the very beginning of Spacemacs startup,
before layer configuration.
It should only modify the values of Spacemacs settings."
;; This setq-default sexp is an exhaustive list of all the supported
;; spacemacs settings.
(setq-default
;; If non-nil then enable support for the portable dumper. You'll need to
;; compile Emacs 27 from source following the instructions in file
;; EXPERIMENTAL.org at to root of the git repository.
;;
;; WARNING: pdumper does not work with Native Compilation, so it's disabled
;; regardless of the following setting when native compilation is in effect.
;;
;; (default nil)
dotspacemacs-enable-emacs-pdumper nil
;; Name of executable file pointing to emacs 27+. This executable must be
;; in your PATH.
;; (default "emacs")
dotspacemacs-emacs-pdumper-executable-file "emacs"
;; Name of the Spacemacs dump file. This is the file will be created by the
;; portable dumper in the cache directory under dumps sub-directory.
;; To load it when starting Emacs add the parameter `--dump-file'
;; when invoking Emacs 27.1 executable on the command line, for instance:
;; ./emacs --dump-file=$HOME/.emacs.d/.cache/dumps/spacemacs-27.1.pdmp
;; (default (format "spacemacs-%s.pdmp" emacs-version))
dotspacemacs-emacs-dumper-dump-file (format "spacemacs-%s.pdmp" emacs-version)
;; Maximum allowed time in seconds to contact an ELPA repository.
;; (default 5)
dotspacemacs-elpa-timeout 5
;; Set `gc-cons-threshold' and `gc-cons-percentage' when startup finishes.
;; This is an advanced option and should not be changed unless you suspect
;; performance issues due to garbage collection operations.
;; (default '(100000000 0.1))
dotspacemacs-gc-cons '(100000000 0.1)
;; Set `read-process-output-max' when startup finishes.
;; This defines how much data is read from a foreign process.
;; Setting this >= 1 MB should increase performance for lsp servers
;; in emacs 27.
;; (default (* 1024 1024))
dotspacemacs-read-process-output-max (* 1024 1024)
;; If non-nil then Spacelpa repository is the primary source to install
;; a locked version of packages. If nil then Spacemacs will install the
;; latest version of packages from MELPA. Spacelpa is currently in
;; experimental state please use only for testing purposes.
;; (default nil)
dotspacemacs-use-spacelpa nil
;; If non-nil then verify the signature for downloaded Spacelpa archives.
;; (default t)
dotspacemacs-verify-spacelpa-archives t
;; If non-nil then spacemacs will check for updates at startup
;; when the current branch is not `develop'. Note that checking for
;; new versions works via git commands, thus it calls GitHub services
;; whenever you start Emacs. (default nil)
dotspacemacs-check-for-update nil
;; If non-nil, a form that evaluates to a package directory. For example, to
;; use different package directories for different Emacs versions, set this
;; to `emacs-version'. (default 'emacs-version)
dotspacemacs-elpa-subdirectory 'emacs-version
;; One of `vim', `emacs' or `hybrid'.
;; `hybrid' is like `vim' except that `insert state' is replaced by the
;; `hybrid state' with `emacs' key bindings. The value can also be a list
;; with `:variables' keyword (similar to layers). Check the editing styles
;; section of the documentation for details on available variables.
;; (default 'vim)
dotspacemacs-editing-style 'vim
;; If non-nil show the version string in the Spacemacs buffer. It will
;; appear as (spacemacs version)@(emacs version)
;; (default t)
dotspacemacs-startup-buffer-show-version t
dotspacemacs-startup-banner 'official
dotspacemacs-startup-banner-scale 'auto
dotspacemacs-startup-lists '((recents . 5)
(projects . 7))
dotspacemacs-startup-buffer-responsive t
dotspacemacs-show-startup-list-numbers t
dotspacemacs-startup-buffer-multi-digit-delay 0.4
dotspacemacs-startup-buffer-show-icons nil
;; Default major mode for a new empty buffer. Possible values are mode
;; names such as `text-mode'; and `nil' to use Fundamental mode.
;; (default `text-mode')
dotspacemacs-new-empty-buffer-major-mode 'text-mode
;; Default major mode of the scratch buffer (default `text-mode')
dotspacemacs-scratch-mode 'text-mode
;; If non-nil, *scratch* buffer will be persistent. Things you write down in
;; *scratch* buffer will be saved and restored automatically.
dotspacemacs-scratch-buffer-persistent nil
;; If non-nil, `kill-buffer' on *scratch* buffer
;; will bury it instead of killing.
dotspacemacs-scratch-buffer-unkillable nil
;; Initial message in the scratch buffer, such as "Welcome to Spacemacs!"
;; (default nil)
dotspacemacs-initial-scratch-message nil
;; List of themes, the first of the list is loaded when spacemacs starts.
;; Press `SPC T n' to cycle to the next theme in the list (works great
;; with 2 themes variants, one dark and one light). A theme from external
;; package can be defined with `:package', or a theme can be defined with
;; `:location' to download the theme package, refer the themes section in
;; DOCUMENTATION.org for the full theme specifications.
dotspacemacs-themes '(doom-dracula
modus-operandi-deuteranopia)
;; Set the theme for the Spaceline. Supported themes are `spacemacs',
;; `all-the-icons', `custom', `doom', `vim-powerline' and `vanilla'. The
;; first three are spaceline themes. `doom' is the doom-emacs mode-line.
;; `vanilla' is default Emacs mode-line. `custom' is a user defined themes,
;; refer to the DOCUMENTATION.org for more info on how to create your own
;; spaceline theme. Value can be a symbol or list with additional properties.
;; (default '(spacemacs :separator wave :separator-scale 1.5))
dotspacemacs-mode-line-theme 'doom
;; If non-nil the cursor color matches the state color in GUI Emacs.
;; (default t)
dotspacemacs-colorize-cursor-according-to-state t
;; Default font or prioritized list of fonts. This setting has no effect when
;; running Emacs in terminal. The font set here will be used for default and
;; fixed-pitch faces. The `:size' can be specified as
;; a non-negative integer (pixel size), or a floating-point (point size).
;; Point size is recommended, because it's device independent. (default 10.0)
dotspacemacs-default-font '("Iosevka Nerd Font"
:size 15.0
:weight medium)
dotspacemacs-leader-key "SPC"
dotspacemacs-emacs-command-key "SPC"
dotspacemacs-ex-command-key ":"
dotspacemacs-emacs-leader-key "M-m"
dotspacemacs-major-mode-leader-key ","
dotspacemacs-major-mode-emacs-leader-key (if window-system "<M-return>" "C-M-m")
dotspacemacs-distinguish-gui-tab nil
dotspacemacs-default-layout-name "Default"
dotspacemacs-display-default-layout nil
dotspacemacs-auto-resume-layouts nil
dotspacemacs-auto-generate-layout-names nil
dotspacemacs-large-file-size 1
dotspacemacs-auto-save-file-location 'cache
dotspacemacs-max-rollback-slots 5
dotspacemacs-enable-paste-transient-state nil
dotspacemacs-which-key-delay 0.4
;; Which-key frame position. Possible values are `right', `bottom' and
;; `right-then-bottom'. right-then-bottom tries to display the frame to the
;; right; if there is insufficient space it displays it at the bottom.
;; It is also possible to use a posframe with the following cons cell
;; `(posframe . position)' where position can be one of `center',
;; `top-center', `bottom-center', `top-left-corner', `top-right-corner',
;; `top-right-corner', `bottom-left-corner' or `bottom-right-corner'
;; (default 'bottom)
dotspacemacs-which-key-position 'bottom
;; Control where `switch-to-buffer' displays the buffer. If nil,
;; `switch-to-buffer' displays the buffer in the current window even if
;; another same-purpose window is available. If non-nil, `switch-to-buffer'
;; displays the buffer in a same-purpose window even if the buffer can be
;; displayed in the current window. (default nil)
dotspacemacs-switch-to-buffer-prefers-purpose nil
;; Whether side windows (such as those created by treemacs or neotree)
;; are kept or minimized by `spacemacs/toggle-maximize-window' (SPC w m).
;; (default t)
dotspacemacs-maximize-window-keep-side-windows t
;; If nil, no load-hints enabled. If t, enable the `load-hints' which will
;; put the most likely path on the top of `load-path' to reduce walking
;; through the whole `load-path'. It's an experimental feature to speedup
;; Spacemacs on Windows. Refer the FAQ.org "load-hints" session for details.
dotspacemacs-enable-load-hints nil
;; If t, enable the `package-quickstart' feature to avoid full package
;; loading, otherwise no `package-quickstart' attemption (default nil).
;; Refer the FAQ.org "package-quickstart" section for details.
dotspacemacs-enable-package-quickstart nil
dotspacemacs-loading-progress-bar nil
dotspacemacs-fullscreen-at-startup nil
dotspacemacs-fullscreen-use-non-native nil
dotspacemacs-maximized-at-startup t
;; If non-nil the frame is undecorated when Emacs starts up. Combine this
;; variable with `dotspacemacs-maximized-at-startup' to obtain fullscreen
;; without external boxes. Also disables the internal border. (default nil)
dotspacemacs-undecorated-at-startup nil
;; A value from the range (0..100), in increasing opacity, which describes
;; the transparency level of a frame when it's active or selected.
;; Transparency can be toggled through `toggle-transparency'. (default 90)
dotspacemacs-active-transparency 90
;; A value from the range (0..100), in increasing opacity, which describes
;; the transparency level of a frame when it's inactive or deselected.
;; Transparency can be toggled through `toggle-transparency'. (default 90)
dotspacemacs-inactive-transparency 70
;; A value from the range (0..100), in increasing opacity, which describes the
;; transparency level of a frame background when it's active or selected. Transparency
;; can be toggled through `toggle-background-transparency'. (default 90)
dotspacemacs-background-transparency 90
;; If non-nil show the titles of transient states. (default t)
dotspacemacs-show-transient-state-title t
;; If non-nil show the color guide hint for transient state keys. (default t)
dotspacemacs-show-transient-state-color-guide t
;; If non-nil unicode symbols are displayed in the mode line.
;; If you use Emacs as a daemon and wants unicode characters only in GUI set
;; the value to quoted `display-graphic-p'. (default t)
dotspacemacs-mode-line-unicode-symbols t
dotspacemacs-smooth-scrolling t
dotspacemacs-scroll-bar-while-scrolling nil
dotspacemacs-line-numbers '(:relative t :size-limit-kb 1000)
dotspacemacs-folding-method 'evil
dotspacemacs-smartparens-strict-mode nil
;; If non-nil smartparens-mode will be enabled in programming modes.
;; (default t)
dotspacemacs-activate-smartparens-mode t
;; If non-nil pressing the closing parenthesis `)' key in insert mode passes
;; over any automatically added closing parenthesis, bracket, quote, etc...
;; This can be temporary disabled by pressing `C-q' before `)'. (default nil)
dotspacemacs-smart-closing-parenthesis nil
;; Select a scope to highlight delimiters. Possible values are `any',
;; `current', `all' or `nil'. Default is `all' (highlight any scope and
;; emphasis the current one). (default 'all)
dotspacemacs-highlight-delimiters 'all
;; If non-nil, start an Emacs server if one is not already running.
;; (default nil)
dotspacemacs-enable-server nil
;; Set the emacs server socket location.
;; If nil, uses whatever the Emacs default is, otherwise a directory path
;; like \"~/.emacs.d/server\". It has no effect if
;; `dotspacemacs-enable-server' is nil.
;; (default nil)
dotspacemacs-server-socket-dir nil
;; If non-nil, advise quit functions to keep server open when quitting.
;; (default nil)
dotspacemacs-persistent-server nil
;; List of search tool executable names. Spacemacs uses the first installed
;; tool of the list. Supported tools are `rg', `ag', `pt', `ack' and `grep'.
;; (default '("rg" "ag" "pt" "ack" "grep"))
dotspacemacs-search-tools '("rg" "ag" "pt" "ack" "grep")
;; The backend used for undo/redo functionality. Possible values are
;; `undo-fu', `undo-redo' and `undo-tree' see also `evil-undo-system'.
;; Note that saved undo history does not get transferred when changing
;; your undo system. The default is currently `undo-fu' as `undo-tree'
;; is not maintained anymore and `undo-redo' is very basic."
dotspacemacs-undo-system 'undo-fu
dotspacemacs-frame-title-format "%F - %a"
dotspacemacs-icon-title-format nil
dotspacemacs-show-trailing-whitespace t
dotspacemacs-whitespace-cleanup nil
dotspacemacs-use-clean-aindent-mode t
dotspacemacs-use-SPC-as-y nil
dotspacemacs-swap-number-row nil
dotspacemacs-zone-out-when-idle nil
dotspacemacs-pretty-docs nil
dotspacemacs-home-shorten-agenda-source nil
dotspacemacs-byte-compile nil))
(defun dotspacemacs/user-env ()
(spacemacs/load-spacemacs-env))
(defun dotspacemacs/user-init ()
;; (add-to-list 'custom-theme-load-path "~/.emacs.d/private/themes/")
(setq-default git-magit-status-fullscreen t))
(defun dotspacemacs/user-load ())
(defun dotspacemacs/user-config ()
;; Custom functions
(setq-default indent-tabs-mode t)
(setq-default tab-width 4)
(defvaralias 'c-basic-offset 'tab-width)
(setq initial-buffer-choice (lambda () (get-buffer "*scratch*")))
(tab-bar-mode -1)
;; Configure packages
(with-eval-after-load 'projectile
(setq projectile-project-search-path '("~/dev" "~/dev/gitlab")
projectile-require-project-root nil))
(with-eval-after-load 'doom-modeline
(setq doom-modeline-icon nil))
;; Enable truncating lines
(add-hook 'hack-local-variables-hook #'spacemacs/toggle-truncate-lines-on)
;; More themes
(use-package doom-themes
:ensure t
:config
(setq doom-themes-enable-bold t
doom-themes-enable-italic t)
(doom-themes-org-config))
;; Cleaning up Dired
(setf dired-kill-when-opening-new-dired-buffer t)
(add-hook 'dired-mode-hook #'dired-hide-details-mode)
;; Evil collection
(with-eval-after-load 'emms (evil-collection-emms-setup))
(with-eval-after-load 'pdf-view (evil-collection-pdf-setup))
(with-eval-after-load 'ibuffer (evil-collection-ibuffer-setup))
;; Custom keybinds
(spacemacs/set-leader-keys "ks" 'nil)
(spacemacs/set-leader-keys "ks" 'bookmark-set)
(spacemacs/set-leader-keys "kv" 'bookmark-save)
(spacemacs/set-leader-keys "pp" (lambda ()
(interactive)
(dat-tabs/create-project-tab)
(tab-bar-mode -1)))
(spacemacs/set-leader-keys "gd" 'magit-status)
(define-key evil-normal-state-map (kbd "C-`") 'spacemacs/shell-pop-vterm)
(spacemacs/set-leader-keys "l" nil)
(spacemacs/set-leader-keys "ld" 'consult-lsp-diagnostics))
;; Do not write anything past this comment. This is where Emacs will
;; auto-generate custom variable definitions.
(defun dotspacemacs/emacs-custom-settings ()
"Emacs custom settings.
This is an auto-generated function, do not modify its content directly, use
Emacs customize menu instead.
This function is called at the very end of Spacemacs initialization."
(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
'("bbb13492a15c3258f29c21d251da1e62f1abb8bbd492386a673dcfab474186af" default))
'(ignored-local-variable-values '((origami-fold-style . triple-braces)))
'(package-selected-packages
'(ac-php-core ace-jump-helm-line ace-link add-node-modules-path
aggressive-indent all-the-icons auto-compile
auto-highlight-symbol auto-yasnippet bui catppuccin-theme
centaur-tabs centered-cursor-mode clean-aindent-mode closql
code-cells column-enforce-mode company company-c-headers
company-emoji company-php company-phpactor company-shell
company-web compleseus-spacemacs-help composer consult
consult-lsp consult-yasnippet counsel counsel-css
cpp-auto-include cython-mode dap-mode define-word devdocs
diminish dired-quick-sort disable-mouse disaster dotenv-mode
drag-stuff drupal-mode dumb-jump eat edit-indirect elisp-def
elisp-demos elisp-slime-nav emacsql embark embark-consult
emmet-mode emoji-cheat-sheet-plus emr esh-help
eshell-prompt-extras eshell-z eval-sexp-fu evil-anzu evil-args
evil-cleverparens evil-collection evil-easymotion evil-escape
evil-evilified-state evil-exchange evil-goggles
evil-iedit-state evil-indent-plus evil-lion evil-lisp-state
evil-matchit evil-mc evil-nerd-commenter evil-numbers
evil-surround evil-textobj-line evil-tutor evil-unimpaired
evil-visual-mark-mode evil-visualstar expand-region eyebrowse
fancy-battery fish-mode flycheck flycheck-bashate flycheck-elsa
flycheck-package flycheck-pos-tip font-utils forge geben
gendoxy ggtags gh-md ghub git-link git-messenger git-modes
git-timemachine gitignore-templates go-eldoc go-fill-struct
go-gen-test go-guru go-impl go-mode go-rename go-tag godoctor
golden-ratio google-c-style google-translate haml-mode helm
helm-ag helm-comint helm-core helm-css-scss helm-descbinds
helm-git-grep helm-ls-git helm-make helm-mode-manager helm-org
helm-projectile helm-purpose helm-swoop helm-themes helm-xref
hide-comnt highlight-indentation highlight-numbers
highlight-parentheses hl-todo holy-mode htmlize hungry-delete
hybrid-mode impatient-mode indent-guide info+ insert-shebang
inspector ivy js-doc js2-mode js2-refactor json-mode
json-navigator json-reformat json-snatcher link-hint
live-py-mode livid-mode llama load-env-vars lorem-ipsum
lsp-docker lsp-mode lsp-origami lsp-pyright lsp-treemacs lsp-ui
lua-mode macrostep magit magit-section marginalia markdown-mode
markdown-toc multi-line multi-term multi-vterm multiple-cursors
mwim nameless nerd-icons nodejs-repl npm-mode open-junk-file
orderless org-superstar origami overseer package-lint paradox
password-generator pcache pcre2el pdf-tools pdf-view-restore
persistent-scratch persistent-soft php-auto-yasnippets
php-extras php-mode php-runtime phpactor phpunit
pip-requirements pipenv pippel poetry popwin pos-tip powerline
prettier-js pug-mode py-isort pydoc pyenv-mode pylookup pytest
pythonic pyvenv quickrun rainbow-delimiters reformatter request
restart-emacs rjsx-mode sass-mode scss-mode shell-pop shfmt
simple-httpd skewer-mode slim-mode smeargle space-doc spaceline
spacemacs-purpose-popwin spacemacs-whitespace-cleanup
sphinx-doc string-edit-at-point string-inflection swiper
symbol-overlay symon tablist tagedit term-cursor terminal-here
toc-org transient treemacs-evil treemacs-icons-dired
treemacs-magit treemacs-persp treemacs-projectile treepy
typescript-mode ucs-utils undo-fu undo-fu-session unfill
unicode-fonts uuidgen vertico vi-tilde-fringe
volatile-highlights vterm vundo web-beautify
web-completion-data web-mode wfnames wgrep winum with-editor
writeroom-mode ws-butler xcscope yaml yasnippet
yasnippet-snippets))
'(safe-local-variable-values
'((js2-basic-offset . 2) (web-mode-indent-style . 2)
(web-mode-block-padding . 2) (web-mode-script-padding . 2)
(web-mode-style-padding . 2) (typescript-backend . tide)
(typescript-backend . lsp) (javascript-backend . tide)
(javascript-backend . tern) (javascript-backend . lsp))))
(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.
;; '(company-tooltip-selection ((t (:background "#ffffff" :foreground "#43242B" :weight bold))))
;; '(dired-directory ((t (:inherit bold :background "#1f1f28" :foreground "#4f97d7"))))
;; '(font-lock-comment-face ((t (:foreground "#727169" :background "#1f1f28" :slant italic))))
;; '(minibuffer-prompt ((t (:inherit bold :background "#1f1f28" :foreground "#E6C384"))))
'(org-block ((t (:inherit shadow :extend t :background "#010F1D"))))
'(org-block-begin-line ((t (:inherit org-meta-line :extend t :background "#1f1f28" :foreground "#7FB4CA" :slant italic))))
'(org-block-end-line ((t (:inherit org-meta-line :extend t :background "#1f1f28" :foreground "#FF5D62" :slant italic))))
'(org-level-1 ((t (:inherit outline-1 :height 1.7))))
'(org-level-2 ((t (:inherit outline-2 :height 1.5))))
'(org-level-3 ((t (:inherit outline-3 :height 1.3))))
'(org-level-4 ((t (:inherit outline-4 :height 1.2))))
'(org-level-5 ((t (:inherit outline-5 :height 1.1))))
'(org-level-6 ((t (:inherit outline-6 :height 1.1))))
'(org-level-7 ((t (:inherit outline-7 :height 1.1))))
'(org-level-8 ((t (:inherit outline-8 :height 1.1))))
'(org-level-9 ((t (:inherit outline-9 :height 1.1)))))
)