Compare commits

...

2 Commits

11 changed files with 76 additions and 26 deletions

2
.gitignore vendored
View File

@ -3,5 +3,7 @@ backup/
elpa/ elpa/
transient/ transient/
.DS_Store
.lsp-session-*
history history
recentf recentf

View File

@ -20,3 +20,10 @@
tab-width 4) tab-width 4)
(setq require-final-newline t) (setq require-final-newline t)
(add-hook 'before-save-hook 'whitespace-cleanup) (add-hook 'before-save-hook 'whitespace-cleanup)
;; Make sure that UTF-8 is *ALWAYS* the default encoding.
(set-charset-priority 'unicode)
(prefer-coding-system 'utf-8-unix)
;; Prettify symbols (eg. lambda -> λ).
(global-prettify-symbols-mode)

42
init.el
View File

@ -17,6 +17,17 @@
(package-install 'use-package)) (package-install 'use-package))
;; Configure how and where backup files are created.
(setq backup-directory-alist '(("." . "~/.emacs.d/backup"))
backup-by-copying t ; Don't delink hardlinks
version-control t ; Use version numbers on backups
delete-old-versions t ; Automatically delete excess backups
kept-new-versions 20 ; How many of the newest versions to keep
kept-old-versions 5 ; How many of the oldest versions to keep
)
;; Define a couple simple helper functions for loading user-defined ;; Define a couple simple helper functions for loading user-defined
;; configuration files. ;; configuration files.
@ -24,9 +35,12 @@
(defun load-user-file (file) (defun load-user-file (file)
"Load FILE in the current user's configuration directory. "Load FILE in the current user's configuration directory.
File names which are prefixed with an underscore will be ignored." File names which are prefixed with an underscore or which do not have the
extension '.el' will be ignored."
(interactive "f") (interactive "f")
(unless (string-prefix-p "_" (file-name-nondirectory file)) (setq file-name (file-name-nondirectory file))
(when (and (string-suffix-p ".el" file-name)
(not (string-prefix-p "_" file-name)))
(load-file (expand-file-name file user-init-dir)))) (load-file (expand-file-name file user-init-dir))))
(defun load-user-dir (dir) (defun load-user-dir (dir)
@ -38,28 +52,23 @@
(load-user-file file))) (load-user-file file)))
;; Configure how and where backup files are created: ;; Load all user-defined configuration files.
(setq backup-directory-alist '(("." . "~/.emacs.d/backup"))
backup-by-copying t ; Don't delink hardlinks
version-control t ; Use version numbers on backups
delete-old-versions t ; Automatically delete excess backups
kept-new-versions 20 ; How many of the newest versions to keep
kept-old-versions 5 ; How many of the oldest versions to keep
)
;; Load all user-defined configuration files:
(load-user-file "editor.el") (load-user-file "editor.el")
(load-user-file "interface.el") (load-user-file "interface.el")
(load-user-file "key-bindings.el") (load-user-file "key-bindings.el")
(load-user-file "typography.el") (load-user-file "theme.el")
(load-user-dir "pkg") (load-user-dir "pkg")
(load-user-dir "lang") (load-user-dir "lang")
;; Diminish some built-in modes that we don't really care about.
(add-hook 'eldoc-mode-hook (lambda () (diminish 'eldoc-mode)))
(add-hook 'hs-minor-mode-hook (lambda () (diminish 'hs-minor-mode)))
;; WARNING: Don't touch anything after this comment! ;; WARNING: Don't touch anything after this comment!
(custom-set-variables (custom-set-variables
@ -70,8 +79,7 @@
'(git-gutter:added-sign " +") '(git-gutter:added-sign " +")
'(git-gutter:deleted-sign " -") '(git-gutter:deleted-sign " -")
'(git-gutter:modified-sign " *") '(git-gutter:modified-sign " *")
'(package-selected-packages '(package-selected-packages nil))
'(yaml-mode toml-mode markdown-mode yasnippet which-key vertico super-save solaire-mode smartparens rainbow-delimiters nerd-icons nerd-icons-dired magit lsp-mode hl-todo hl-line git-gutter flycheck diminish crux)))
(custom-set-faces (custom-set-faces
;; custom-set-faces was added by Custom. ;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful. ;; If you edit it by hand, you could mess it up, so be careful.

View File

@ -19,6 +19,9 @@
scroll-margin 0 scroll-margin 0
scroll-preserve-screen-position 1) scroll-preserve-screen-position 1)
;; Hide the frame identifier in the mode line.
(setq mode-line-frame-identification " ")
;; Display the column and line numbers of the cursor in the mode line. ;; Display the column and line numbers of the cursor in the mode line.
(column-number-mode) (column-number-mode)

View File

@ -10,6 +10,5 @@
;; Enable code folding in programming modes, and set some more reasonable ;; Enable code folding in programming modes, and set some more reasonable
;; shortcuts. ;; shortcuts.
(add-hook 'prog-mode-hook #'hs-minor-mode) (add-hook 'prog-mode-hook #'hs-minor-mode)
(add-hook 'hs-minor-mode-hook (lambda () (diminish 'hs-minor-mode)))
(global-set-key (kbd "C-c C-h") (kbd "C-c @ C-h")) ; Hide a block (global-set-key (kbd "C-c C-h") (kbd "C-c @ C-h")) ; Hide a block
(global-set-key (kbd "C-c C-s") (kbd "C-c @ C-s")) ; Show a block (global-set-key (kbd "C-c C-s") (kbd "C-c @ C-s")) ; Show a block

15
lang/rust.el Normal file
View File

@ -0,0 +1,15 @@
;; Rust
;; https://github.com/emacs-rustic/rustic
(use-package rustic
:ensure t
:custom
(rustic-cargo-use-last-stored-arguments t)
:bind
(:map rustic-mode-map
("M-?" . lsp-find-references)
("C-c C-c l" . flycheck-list-errors)
("C-c C-c a" . lsp-execute-code-action)
("C-c C-c r" . lsp-rename)
("C-c C-c q" . lsp-workspace-restart)
("C-c C-c Q" . lsp-workspace-shutdown)
("C-c C-c s" . lsp-rust-analyzer-status)))

View File

@ -3,5 +3,10 @@
(use-package hl-todo (use-package hl-todo
:ensure t :ensure t
:config :config
(setq hl-todo-keyword-faces
'(("FIXME" . "#f7768e")
("HACK" . "#7aa2f7")
("NOTE" . "#e0af68")
("TODO" . "#bb9af7")))
(add-hook 'prog-mode-hook #'hl-todo-mode) (add-hook 'prog-mode-hook #'hl-todo-mode)
(add-hook 'text-mode-hook #'hl-todo-mode)) (add-hook 'text-mode-hook #'hl-todo-mode))

View File

@ -2,5 +2,10 @@
;; https://github.com/emacs-lsp/lsp-mode ;; https://github.com/emacs-lsp/lsp-mode
(use-package lsp-mode (use-package lsp-mode
:ensure t :ensure t
:commands (lsp lsp-deferred) :diminish lsp-mode
:hook ((lsp-mode . lsp-enable-which-key-integration))) :commands lsp
:init
;; Set prefix for lsp-command-keymap:
(setq lsp-keymap-prefix "C-c l")
:hook
((lsp-mode . lsp-enable-which-key-integration)))

5
pkg/org.el Normal file
View File

@ -0,0 +1,5 @@
;; Org mode.
(use-package org
:ensure t
:mode
(("\\.org$" . org-mode)))

7
theme.el Normal file
View File

@ -0,0 +1,7 @@
;; https://github.com/doomemacs/themes
(use-package doom-themes
:ensure t
:config
(load-theme 'doom-tokyo-night t)
;(doom-themes-visual-bell-config)
)

View File

@ -1,6 +0,0 @@
;; Make sure that UTF-8 is *ALWAYS* the default encoding.
(set-charset-priority 'unicode)
(prefer-coding-system 'utf-8-unix)
;; Prettify symbols (eg. lambda -> λ).
(global-prettify-symbols-mode)