Add some more packages and fix some existing configuration

This commit is contained in:
Jesse Braham 2025-02-14 21:37:29 +01:00
parent bc343c2677
commit 38c0f134c0
10 changed files with 60 additions and 9 deletions

4
.gitignore vendored
View File

@ -1,5 +1,7 @@
auto-save-list/
backup/
elpa/
transient/
*~
history
recentf

26
init.el
View File

@ -23,19 +23,32 @@
(defconst user-init-dir "~/.emacs.d/")
(defun load-user-file (file)
"Load FILE in the current user's configuration directory.
File names which are prefixed with an underscore will be ignored."
(interactive "f")
"Load a file in the current user's configuration directory"
(load-file (expand-file-name file user-init-dir)))
(unless (string-prefix-p "_" (file-name-nondirectory file))
(load-file (expand-file-name file user-init-dir))))
(defun load-user-dir (dir)
"Recursively load all files in directory DIR.
DIR should be relative to the user's configuration directory."
(interactive "f")
"Recursively load all files in a given directory, relative to the user's
configuration directory"
(setq config-dir (file-name-concat user-init-dir dir))
(dolist (file (directory-files-recursively config-dir ""))
(load-user-file file)))
;; 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
)
;; Load all user-defined configuration files:
(load-user-file "editor.el")
@ -54,8 +67,11 @@
;; 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.
'(git-gutter:added-sign " +")
'(git-gutter:deleted-sign " -")
'(git-gutter:modified-sign " *")
'(package-selected-packages
'(yaml-mode toml-mode markdown-mode yasnippet which-key super-save solaire-mode smartparens rainbow-delimiters magit hl-todo git-gutter flycheck diminish crux)))
'(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 was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.

View File

@ -10,5 +10,6 @@
;; Enable code folding in programming modes, and set some more reasonable
;; shortcuts.
(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-s") (kbd "C-c @ C-s")) ; Show a block

View File

@ -2,7 +2,6 @@
;; https://github.com/flycheck/flycheck
(use-package flycheck
:ensure t
:defer t
:diminish flycheck-mode
:config
(setq flycheck-standard-error-navigation nil)

6
pkg/lsp.el Normal file
View File

@ -0,0 +1,6 @@
;; Language server protocol support.
;; https://github.com/emacs-lsp/lsp-mode
(use-package lsp-mode
:ensure t
:commands (lsp lsp-deferred)
:hook ((lsp-mode . lsp-enable-which-key-integration)))

8
pkg/nerd-icons-dired.el Normal file
View File

@ -0,0 +1,8 @@
;; Use nerd icons in dired mode.
;; https://github.com/rainstormstudio/nerd-icons-dired
(use-package nerd-icons-dired
:ensure t
:defer t
:diminish nerd-icons-dired-mode
:hook
(dired-mode . nerd-icons-dired-mode))

6
pkg/nerd-icons.el Normal file
View File

@ -0,0 +1,6 @@
;; Nerd Font icons.
;; https://github.com/rainstormstudio/nerd-icons.el
(use-package nerd-icons
:ensure t
:custom
(nerd-icons-font-family "FiraCode Nerd Font"))

4
pkg/savehist.el Normal file
View File

@ -0,0 +1,4 @@
;; Persist history over Emacs restarts.
(use-package savehist
:init
(savehist-mode))

View File

@ -1,8 +1,8 @@
;; Save buffers when focus is lost.
;; https://github.com/bbatsov/super-save
(use-package super-save
:ensure t
:defer t
:ensure t
:diminish super-save-mode
:config
(setq super-save-auto-save-when-idle t)
(super-save-mode +1))

9
pkg/vertico.el Normal file
View File

@ -0,0 +1,9 @@
;; Vertical interactive completion.
;; https://github.com/minad/vertico
(use-package vertico
:ensure t
:custom
(vertico-count 3)
(vertico-cycle t)
:init
(vertico-mode))