Compare commits

..

No commits in common. "main" and "main-2" have entirely different histories.
main ... main-2

38 changed files with 1197 additions and 1403 deletions

View File

@ -1,13 +0,0 @@
# EditorConfig is awesome: https://editorconfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
indent_style = space
indent_size = 2

5
.gitignore vendored
View File

@ -7,3 +7,8 @@ straight
eln-cache
*~
\#*#
history
recentf
projects
.lsp-session-*
transient

View File

@ -4,12 +4,7 @@
;; 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
'("9f297216c88ca3f47e5f10f8bd884ab24ac5bc9d884f0f23589b0a46a608fe14"
"6a5584ee8de384f2d8b1a1c30ed5b8af1d00adcbdcd70ba1967898c265878acf"
"e1f4f0158cd5a01a9d96f1f7cdcca8d6724d7d33267623cc433fe1c196848554"
"9a977ddae55e0e91c09952e96d614ae0be69727ea78ca145beea1aae01ac78d2"
default)))
'(package-vc-selected-packages '((nm :url "https://github.com/Kodkollektivet/emacs-nm"))))
(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

@ -1,107 +0,0 @@
;;; init-lib.el --- Facilities for loading the rest of my config. -*- lexical-binding: t; -*-
;; Author: Wojciech Siewierski
;; Keywords: lisp, maint, local
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;; Facilities for loading and maintaining the rest of my config.
;;; Code:
;;;###autoload
(defun load-parts (directory &optional regexp recursive)
"Load all the Elisp files from DIRECTORY, in the lexicographical order.
REGEXP defaults to `load-parts--regexp'.
If RECURSIVE is non-nil, load files recursively, sorted by their
full paths.
Inspired by: https://manpages.debian.org/stable/debianutils/run-parts.8.en.html"
(interactive "D")
(dolist (part (load-parts--gather directory regexp recursive))
(load part)))
(defun require-parts (directory &optional regexp recursive)
"The same as `load-parts' but uses `require' instead of `load'.
Should be used instead `load-parts' if loading a feature multiple
times is a concern.
If RECURSIVE is non-nil, require files recursively, sorted by
their full paths."
(dolist (part (load-parts--gather directory regexp recursive))
(require (intern (file-name-nondirectory part))
part)))
(defconst load-parts--regexp
(rx string-start
(not ".")
(zero-or-more any)
".el"
(opt "c")
string-end)
"A regexp matching *.el and *.elc files, but not dotfiles.")
(defun load-parts--gather (directory &optional regexp recursive)
"Gather the files from DIRECTORY for `load-parts'.
REGEXP defaults to `load-parts--regexp'.
If RECURSIVE is non-nil, gather files recursively, sorted by
their full paths. Skips directories starting with a dot."
(setq regexp (or regexp "\\`[^.].*\\.elc?\\'"))
(delete-dups
(mapcar #'file-name-sans-extension
(if recursive
(sort (directory-files-recursively
(file-name-as-directory directory) regexp
nil
(lambda (dir)
;; Omit directories starting with a dot.
(not (string-match-p
"\\`\\."
(file-name-nondirectory dir)))))
#'string<)
(directory-files (file-name-as-directory directory)
t regexp)))))
(defconst load-numbered-parts--regexp
(rx string-start
(= 2 digit)
"-"
(one-or-more any)
".el"
(opt "c")
string-end)
"A regexp matching files like 10-name.el")
(defun load-numbered-parts (directory &optional max)
"Load numbered config parts from DIRECTORY.
Optionally load only the parts up to the MAX numbered part (inclusive)."
(dolist (part (load-parts--gather directory load-numbered-parts--regexp))
(if (null max)
(load part)
(let* ((part-name (file-name-nondirectory part))
(part-number-as-string (substring part-name 0 2))
(part-number (string-to-number part-number-as-string)))
(when (<= part-number max)
(load part))))))
(provide 'init-lib)
;;; init-lib.el ends here

409
init.el
View File

@ -1,64 +1,375 @@
(setq
visible-bell t
inhibit-startup-message t
auto-save-default nil
make-backup-files nil
set-mark-command-repeat-pop t
large-file-warning-threshold nil
vc-follow-symlinks t
ad-redefinition-action 'accept
global-auto-revert-non-file-buffers t
native-comp-async-report-warnings-errors nil
)
;; -*- lexical-binding: t; -*-
;;; This file is generated from the Emacs.org file in my dotfiles repository!
;;; ----- Basic Configuration -----
;; Core settings
(setq ;; Flash the UI instead of beeping
visible-bell nil
;; Yes, this is Emacs
inhibit-startup-message t
;; inhibit-startup-screen t
initial-scratch-message nil
;; initial-buffer-choice nil
frame-title-format nil
use-file-dialog nil
indicate-empty-lines t
;; Instruct auto-save-mode to save to the current file, not a backup file
auto-save-default nil
auto-save-timeout 3 ; number of seconds idle time before auto-save
; (default: 30)
auto-save-interval 200 ; number of keystrokes between auto-saves
; (default: 300)
x-select-enable-primary t
x-select-enable-clipboard t
mouse-drag-copy-region t
;; No backup files, please
make-backup-files nil
;; Make it easy to cycle through previous items in the mark ring
set-mark-command-repeat-pop t
;; Don't warn on large files
large-file-warning-threshold nil
;; Follow symlinks to VC-controlled files without warning
;; vc-follow-symlinks t
;; Don't warn on advice
ad-redefinition-action 'accept
;; Revert Dired and other buffers
global-auto-revert-non-file-buffers t
;; Silence compiler warnings as they can be pretty disruptive
native-comp-async-report-warnings-errors nil)
;; No scroll bars
(if (fboundp 'scroll-bar-mode) (set-scroll-bar-mode nil))
;; Load early-init.el regardless of the way Emacs was started.
;; (require 'nano-defaults (expand-file-name "nano-defaults" user-emacs-directory))
;; (require 'nano-splash (expand-file-name "nano-splash" user-emacs-directory))
(require 'early-init (expand-file-name "early-init" user-emacs-directory))
;; No toolbar
(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
;; Load no-littering.el before anything else to keep ~/.emacs.d/ tidy.
(use-package no-littering)
(dolist (mode '(scroll-bar-mode
horizontal-scroll-bar-mode
menu-bar-mode
tooltip-mode
tool-bar-mode))
(when (fboundp mode)
(funcall mode 0)))
(setq create-lockfiles nil)
(no-littering-theme-backups)
(when (and (fboundp 'startup-redirect-eln-cache)
(fboundp 'native-comp-available-p)
(native-comp-available-p))
(startup-redirect-eln-cache
(convert-standard-filename
(expand-file-name "var/eln-cache/" user-emacs-directory))))
;; Core modes
(repeat-mode 1) ;; Enable repeating key maps
(menu-bar-mode 0) ;; Hide the menu bar
(tool-bar-mode 0) ;; Hide the tool bar
(savehist-mode 1) ;; Save minibuffer history
(scroll-bar-mode 0) ;; Hide the scroll bar
(xterm-mouse-mode 1) ;; Enable mouse events in terminal Emacs
(display-time-mode 1) ;; Display time in mode line / tab bar
(fido-vertical-mode 1) ;; Improved vertical minibuffer completions
(column-number-mode 1) ;; Show column number on mode line
(tab-bar-history-mode 1) ;; Remember previous tab window configurations
(auto-save-visited-mode 1) ;; Auto-save files at an interval
(global-visual-line-mode 1) ;; Visually wrap long lines in all buffers
(global-auto-revert-mode 1) ;; Refresh buffers with changed local files
(icomplete-mode 0)
;; (blink-cursor-mode 0)
;; Expose the packages integrated into the config repository.
(add-to-list 'load-path (expand-file-name "vendor/" user-emacs-directory))
(show-paren-mode t)
;; Load the machine-local custom.el, versioned separately.
;; Possibly absent.
;; Tabs to spaces
(setq-default indent-tabs-mode nil
tab-width 2)
(fset 'yes-or-no-p 'y-or-n-p)
;; Display line numbers in programming modes
(add-hook 'prog-mode-hook #'display-line-numbers-mode)
(add-hook 'before-save-hook 'delete-trailing-whitespace)
;; Make icomplete slightly more convenient
;; (keymap-set icomplete-fido-mode-map "M-h" 'icomplete-fido-backward-updir)
;; (keymap-set icomplete-fido-mode-map "TAB" 'icomplete-force-complete)
;; Delete trailing whitespace before saving buffers
(add-hook 'before-save-hook 'delete-trailing-whitespace)
;; Move customization settings out of init.el
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
(load custom-file 'noerror)
(when (file-exists-p custom-file)
(load custom-file t))
;; Load the config management and maintenance helper library.
(require 'init-lib (expand-file-name "init-lib" user-emacs-directory))
;; Match completion substrings that may be out of order
(defun fn/override-fido-completion-styles ()
(setq-local completion-styles '(substring partial-completion emacs22)))
;; Load all the config parts.
(load-numbered-parts (expand-file-name "lisp/" user-emacs-directory))
;; (add-hook 'icomplete-minibuffer-setup-hook 'fn/override-fido-completion-styles)
(prefer-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-language-environment 'utf-8)
(set-default 'cursor-type '(hbar . 2))
;;; ----- System Identification -----
(defvar fn/is-termux
(string-suffix-p "Android" (string-trim (shell-command-to-string "uname -a"))))
(defvar fn/current-distro (or (and (eq system-type 'gnu/linux)
(file-exists-p "/etc/os-release")
(with-temp-buffer
(insert-file-contents "/etc/os-release")
(search-forward-regexp "^ID=\"?\\(.*\\)\"?$")
(intern (or (match-string 1)
"unknown"))))
'unknown))
(defvar fn/is-guix-system (eql fn/current-distro 'guix))
;;; ----- Package Management -----
;; Automatically install packages (when not on Guix) but don't load
;; them until requested
(setq use-package-always-ensure (not fn/is-guix-system)
use-package-always-defer t)
;;; ----- Configuration Management -----
(defvar fn/use-config-modules '()
"A list of module symbols to load once init.el is finished.")
(defvar fn/common-config-modules '(
fn-core
fn-present
fn-writing
fn-workflow
fn-coding
fn-interface
fn-vc
)
"Configuration modules most commonly used across my machines.")
(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
'("9a977ddae55e0e91c09952e96d614ae0be69727ea78ca145beea1aae01ac78d2"
default)))
(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.
)
;; Add configuration modules to load path
(add-to-list 'load-path '"~/.config/emacs/modules")
;; Load system-specific configuration
(let ((config-path
(format "~/.config/emacs/systems/%s.el" system-name)))
(if (file-exists-p config-path)
(load-file config-path)
(message "No per-system configuration found for %s!" system-name)))
;;; ----- Appearance -----
(defun fn/set-terminal-title (title)
(send-string-to-terminal (format "\e]0;%s\a" title)))
(defun fn/clear-background-color (&optional frame))
;; (interactive)
;; (or frame (setq frame (selected-frame)))
;; "unsets the background color in terminal mode"
;; (unless (display-graphic-p frame)
;; Set the terminal to a transparent version of the background color
;; (send-string-to-terminal
;; (format "\033]11;[90]%s\033\\"
;; (face-attribute 'default :background)))
;; (set-face-background 'default "unspecified-bg" frame)))
;; Clear the background color for transparent terminals
(unless (display-graphic-p)
(add-hook 'after-make-frame-functions 'fn/clear-background-color)
(add-hook 'window-setup-hook 'fn/clear-background-color)
(add-hook 'ef-themes-post-load-hook 'fn/clear-background-color))
(use-package modus-themes
:custom
(modus-themes-italic-constructs t)
(modus-themes-bold-constructs t)
(modus-themes-mixed-fonts t)
(modus-themes-variable-pitch-ui t)
(modus-themes-to-toggle '(modus-vivendi-tinted modus-operandi-tinted))
(modus-themes-common-palette-overrides
`((bg-mode-line-active bg-lavender)
(fg-mode-line-active fg-main)
(border-mode-line-active bg-magenta-warmer)))
:init
(load-theme 'modus-vivendi-tinted t)
(add-hook 'modus-themes-after-load-theme-hook #'fn/clear-background-color))
;;
;; Make vertical window separators look nicer in terminal Emacs
(set-display-table-slot standard-display-table 'vertical-border (make-glyph-code ?│))
;; Clean up the mode line
(setq-default mode-line-format
'("%e" " "
(:propertize
("" mode-line-mule-info mode-line-client mode-line-modified mode-line-remote))
mode-line-frame-identification
mode-line-buffer-identification
" "
mode-line-position
mode-line-format-right-align
" "
(project-mode-line project-mode-line-format)
" "
(vc-mode vc-mode)
" "
mode-line-modes
mode-line-misc-info
" ")
project-mode-line t
mode-line-buffer-identification '(" %b")
mode-line-position-column-line-format '(" %l:%c"))
;; Move global mode string to the tab-bar and hide tab close buttons
(setq tab-bar-close-button-show nil
tab-bar-separator " "
tab-bar-format '(tab-bar-format-menu-bar
tab-bar-format-tabs-groups
tab-bar-separator
tab-bar-format-align-right
tab-bar-format-global))
;; Turn on the tab-bar
(tab-bar-mode 1)
;; Customize time display
(setq display-time-load-average nil
display-time-format "%H:%M %b %d W%U")
;; ----- Special Buffers as Popup Window -----
(setq display-buffer-alist
'(("\\*\\(shell\\|.*term\\|.*eshell\\|help\\|compilation\\|Async Shell Command\\|Occur\\|xref\\).*\\*"
(display-buffer-reuse-window display-buffer-in-side-window)
(side . bottom) ; Popups go at the bottom
(slot . 0) ; Use the first slot at the bottom
(post-command-select-window . t) ; Select the window upon display
(window-height . 0.3)))) ; 30% of the frame height
(defun fn/toggle-popup-window ()
(interactive)
(if-let ((popup-window
(get-window-with-predicate
(lambda (window)
(eq (window-parameter window 'window-side)
'bottom)))))
;; Focus the window if it is not selected, otherwise close it
(if (eq popup-window (selected-window))
(delete-window popup-window)
(select-window popup-window))
;; Find the most recent buffer that matches the rule and show it
;; NOTE: This logic is somewhat risky because it makes the assumption
;; that the popup rule comes first in `display-buffer-alist'.
;; I chose to do this because maintaining a separate variable
;; for this rule meant I had to re-evaluate 2 different forms
;; to update my rule list.
(if-let ((popup-buffer
(seq-find (lambda (buffer)
(buffer-match-p (caar display-buffer-alist)
(buffer-name buffer)))
(if (project-current)
(project-buffers (project-current))
(buffer-list (selected-frame))))))
(display-buffer popup-buffer (cdar display-buffer-alist))
(message "No popup buffers found."))))
;; TODO: This binding may need to change
(keymap-global-set "C-c p" #'fn/toggle-popup-window)
(with-eval-after-load 'term
(keymap-set term-raw-map "C-c p" #'fn/toggle-popup-window))
;;; ----- Essential Org Mode Configuration -----
(setq org-ellipsis ""
org-startup-folded 'content
org-cycle-separator-lines 2
org-fontify-quote-and-verse-blocks t)
;; Indent org-mode buffers for readability
(add-hook 'org-mode-hook #'org-indent-mode)
;; Set up Org Babel languages
(org-babel-do-load-languages
'org-babel-load-languages
'((emacs-lisp . t)
(shell . t)))
;; Use org-tempo
(use-package org-tempo
:straight (:type built-in)
:ensure nil
:demand t
:config
(dolist (item '(("sh" . "src sh")
("el" . "src emacs-lisp")
("li" . "src lisp")
("sc" . "src scheme")
("ts" . "src typescript")
("py" . "src python")
("yaml" . "src yaml")
("json" . "src json")
("einit" . "src emacs-lisp :tangle emacs/init.el")
("emodule" . "src emacs-lisp :tangle emacs/modules/dw-MODULE.el")))
(add-to-list 'org-structure-template-alist item)))
;;; ----- Document Centering -----
(defvar center-document-desired-width 90
"The desired width of a document centered in the window.")
(defun center-document--adjust-margins ()
;; Reset margins first before recalculating
(set-window-parameter nil 'min-margins nil)
(set-window-margins nil nil)
;; Adjust margins if the mode is on
(when center-document-mode
(let ((margin-width (max 0
(truncate
(/ (- (window-width)
center-document-desired-width)
2.0)))))
(when (> margin-width 0)
(set-window-parameter nil 'min-margins '(0 . 0))
(set-window-margins nil margin-width margin-width)))))
(define-minor-mode center-document-mode
"Toggle centered text layout in the current buffer."
:lighter " Centered"
:group 'editing
(if center-document-mode
(add-hook 'window-configuration-change-hook #'center-document--adjust-margins 'append 'local)
(remove-hook 'window-configuration-change-hook #'center-document--adjust-margins 'local))
(center-document--adjust-margins))
(add-hook 'org-mode-hook #'center-document-mode)
;; Make sure ripgrep is used everywhere
(setq xref-search-program 'ripgrep
grep-command "rg -nS --noheading")
;; Load requested configuration modules
(dolist (module fn/use-config-modules)
(require module))
(dashboard-open)
(treemacs-start-on-boot)

View File

@ -1,95 +0,0 @@
;; -*- lexical-binding: t -*-
(setq gc-cons-threshold (* 100 1024 1024)
read-process-output-max (* 1024 1024) ;; 1mb
uniquify-buffer-name-style 'forward
visible-bell t
ring-bell-function 'ignore
window-divider-default-right-width 3
window-divider-default-places 'right-only
backup-directory-alist '(("." . "~/.backups"))
make-backup-files t ; backup of a file the first time it is saved.
backup-by-copying t ; don't clobber symlinks
version-control t ; version numbers for backup files
delete-old-versions t ; delete excess backup files silently
kept-old-versions 6 ; oldest versions to keep when a new numbered
; backup is made (default: 2)
kept-new-versions 9 ; newest versions to keep when a new numbered
; backup is made (default: 2)
auto-save-default t ; auto-save every buffer that visits a file
auto-save-timeout 3 ; number of seconds idle time before auto-save
; (default: 30)
auto-save-interval 200 ; number of keystrokes between auto-saves
; (default: 300)
x-select-enable-primary t
x-select-enable-clipboard t
mouse-drag-copy-region t
meow-cursor-type-default 'bar
meow-cursor-type-motion 'bar
meow-cursor-type-beacon 'bar
meow-cursor-type-insert '(hbar . 2)
)
;; Move global mode string to the tab-bar and hide tab close buttons
(setq tab-bar-close-button-show nil
tab-bar-separator " "
tab-bar-format '(tab-bar-format-menu-bar
tab-bar-format-tabs-groups
tab-bar-separator
tab-bar-format-align-right
tab-bar-format-global)
)
;; Turn on the tab-bar
(tab-bar-mode 1)
;; y/n for answering yes/no questions
(fset 'yes-or-no-p 'y-or-n-p)
;; No tabs
(setq-default indent-tabs-mode nil
;; Tab.space equivalence
tab-width 4)
;; Buffer encoding
(prefer-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-language-environment 'utf-8)
(set-default 'cursor-type '(hbar . 2))
(repeat-mode 1) ;; Enable repeating key maps
(menu-bar-mode 0) ;; Hide the menu bar
(tool-bar-mode 0) ;; Hide the tool bar
(savehist-mode 1) ;; Save minibuffer history
(scroll-bar-mode 0) ;; Hide the scroll bar
(xterm-mouse-mode 1) ;; Enable mouse events in terminal Emacs
(fido-vertical-mode 1) ;; Improved vertical minibuffer completions
(column-number-mode 1) ;; Show column number on mode line
(tab-bar-history-mode 1) ;; Remember previous tab window configurations
(tool-bar-mode -1)
(auto-save-visited-mode 1) ;; Auto-save files at an interval
(global-visual-line-mode 1) ;; Visually wrap long lines in all buffers
(global-auto-revert-mode 1) ;; Refresh buffers with changed local files
(blink-cursor-mode 0)
(show-paren-mode t)
(window-divider-mode)
(pixel-scroll-precision-mode)
;; Delete trailing whitespace before saving buffers
(add-hook 'before-save-hook 'delete-trailing-whitespace)
(setq display-buffer-alist
'(("\\*\\(shell\\|.*term\\|.*eshell\\|help\\|compilation\\|Async Shell Command\\|Occur\\|xref\\).*\\*"
(display-buffer-reuse-window display-buffer-in-side-window)
(side . bottom) ; Popups go at the bottom
(slot . 0) ; Use the first slot at the bottom
(post-command-select-window . t) ; Select the window upon display
(window-height . 0.3)))) ; 30% of the frame height

View File

@ -1,164 +0,0 @@
(set-face-attribute 'default nil :font "BlexMono Nerd Font Mono" :height 150 :weight 'semi-light)
(use-package doom-modeline
:config
(setq doom-modeline-hud nil)
(setq doom-modeline-icon nil)
(setq doom-modeline-buffer-encoding nil)
(setq doom-modeline-height 24)
:init
(doom-modeline-mode 1)
)
(use-package all-the-icons)
(use-package doom-themes
:ensure t
:config
;; 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-one-light t)
;; Enable flashing mode-line on errors
(doom-themes-visual-bell-config)
;; Enable custom neotree theme (all-the-icons must be installed!)
;; (doom-themes-neotree-config)
;; or for treemacs users
;; (setq doom-themes-treemacs-theme "doom-colors") ; use "doom-colors" for less minimal icon theme
;; (doom-themes-treemacs-config)
(setq doom-modeline-bar-width 0)
;; Corrects (and improves) org-mode's native fontification.
(doom-themes-org-config)
)
(use-package aggressive-indent)
(use-package rainbow-delimiters
:config
(add-hook 'prog-mode-hook #'rainbow-delimiters-mode))
(use-package dashboard
:ensure t
:init
(setq dashboard-startup-banner 3)
(setq dashboard-items '((recents . 5)
(projects . 5)))
;; Content is not centered by default. To center, set
(setq dashboard-center-content t)
;; vertically center content
(setq dashboard-vertically-center-content t)
;; To disable shortcut "jump" indicators for each section, set
(setq dashboard-show-shortcuts nil)
(setq dashboard-startupify-list '(dashboard-insert-banner
dashboard-insert-newline
dashboard-insert-navigator
dashboard-insert-newline
dashboard-insert-items
dashboard-insert-init-info
))
(add-to-list 'dashboard-items '(agenda) t)
(setq dashboard-week-agenda t)
:config
(dashboard-setup-startup-hook))
(use-package which-key
:config
(which-key-mode 1))
(use-package treemacs
:ensure t
:defer t
:init
(add-hook 'treemacs-mode-hook (lambda() (display-line-numbers-mode -1)))
(with-eval-after-load 'winum
(define-key winum-keymap (kbd "M-0") #'treemacs-select-window))
:config
(progn
(setq treemacs-collapse-dirs (if treemacs-python-executable 3 0)
treemacs-deferred-git-apply-delay 0.5
treemacs-directory-name-transformer #'identity
treemacs-display-in-side-window t
treemacs-eldoc-display 'simple
treemacs-file-event-delay 2000
treemacs-file-extension-regex treemacs-last-period-regex-value
treemacs-file-follow-delay 0.2
treemacs-file-name-transformer #'identity
treemacs-follow-after-init t
treemacs-expand-after-init t
treemacs-find-workspace-method 'find-for-file-or-pick-first
treemacs-git-command-pipe ""
treemacs-goto-tag-strategy 'refetch-index
treemacs-header-scroll-indicators '(nil . "^^^^^^")
treemacs-hide-dot-git-directory t
treemacs-indentation 2
treemacs-indentation-string " "
treemacs-is-never-other-window nil
treemacs-max-git-entries 5000
treemacs-missing-project-action 'ask
treemacs-move-files-by-mouse-dragging t
treemacs-move-forward-on-expand nil
treemacs-no-delete-other-windows t
treemacs-project-follow-cleanup nil
treemacs-persist-file (expand-file-name ".cache/treemacs-persist" user-emacs-directory)
treemacs-position 'left
treemacs-read-string-input 'from-child-frame
treemacs-recenter-distance 0.1
treemacs-recenter-after-file-follow nil
treemacs-recenter-after-tag-follow nil
treemacs-recenter-after-project-jump 'always
treemacs-recenter-after-project-expand 'on-distance
treemacs-litter-directories '("/node_modules" "/.venv" "/.cask")
treemacs-project-follow-into-home nil
treemacs-show-cursor nil
treemacs-show-hidden-files t
treemacs-silent-filewatch nil
treemacs-silent-refresh nil
treemacs-sorting 'alphabetic-asc
treemacs-select-when-already-in-treemacs 'move-back
treemacs-space-between-root-nodes t
treemacs-tag-follow-cleanup t
treemacs-tag-follow-delay 1.5
treemacs-text-scale nil
treemacs-user-mode-line-format nil
treemacs-user-header-line-format nil
treemacs-wide-toggle-width 70
treemacs-width 35
treemacs-width-increment 1
treemacs-width-is-initially-locked :on-nil
treemacs-workspace-switch-cleanup nil
treemacs-no-png-images t
)
;; 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 t)
(treemacs-filewatch-mode t)
(treemacs-fringe-indicator-mode 'always)
(when treemacs-python-executable
(treemacs-git-commit-diff-mode t))
(pcase (cons (not (null (executable-find "git")))
(not (null treemacs-python-executable)))
(`(t . t)
(treemacs-git-mode 'deferred))
(`(t . _)
(treemacs-git-mode 'simple)))
(treemacs-hide-gitignored-files-mode nil)))
(use-package treemacs-magit
:after (treemacs magit))
(with-eval-after-load 'treemacs
(define-key treemacs-mode-map [mouse-1] #'treemacs-single-click-expand-action))

View File

@ -1,237 +0,0 @@
(use-package corfu
:custom
(corfu-cycle t) ;; Enable cycling for `corfu-next/previous'
(corfu-auto t) ;; Enable auto completion
;; (corfu-separator ?\s) ;; Orderless field separator
(corfu-quit-at-boundary nil) ;; Never quit at completion boundary
;; (corfu-quit-no-match nil) ;; Never quit, even if there is no match
(corfu-preview-current nil) ;; Disable current candidate preview
;; (corfu-preselect 'prompt) ;; Preselect the prompt
(corfu-on-exact-match nil) ;; Configure handling of exact
;; (corfu-scroll-margin 5) ;; Use scroll margin
;; Enable Corfu only for certain modes. See also `global-corfu-modes'.
;; :hook ((prog-mode . corfu-mode)
;; (shell-mode . corfu-mode)
;; (eshell-mode . corfu-mode))
;; Use Company backends as Capfs.
(setq-local completion-at-point-functions
(mapcar #'cape-company-to-capf
(list #'company-files #'company-keywords #'company-dabbrev)))
;; Recommended: Enable Corfu globally. This is recommended since Dabbrev can
;; be used globally (M-/). See also the customization variable
;; `global-corfu-modes' to exclude certain modes.
:init
(global-corfu-mode))
;; Add extensions
(use-package cape
:init
;; Add to the global default value of `completion-at-point-functions' which is
;; used by `completion-at-point'. The order of the functions matters, the
;; first function returning a result wins. Note that the list of buffer-local
;; completion functions takes precedence over the global list.
(add-hook 'completion-at-point-functions #'cape-dabbrev)
(add-hook 'completion-at-point-functions #'cape-file)
(add-hook 'completion-at-point-functions #'cape-elisp-block)
;; (add-hook 'completion-at-point-functions #'cape-history)
;; ...
)
;; Example configuration for Consult
(use-package consult
;; Replace bindings. Lazily loaded by `use-package'.
;; Enable automatic preview at point in the *Completions* buffer. This is
;; relevant when you use the default completion UI.
:hook (completion-list-mode . consult-preview-at-point-mode)
;; The :init configuration is always executed (Not lazy)
:init
;; Optionally configure the register formatting. This improves the register
;; preview for `consult-register', `consult-register-load',
;; `consult-register-store' and the Emacs built-ins.
(setq register-preview-delay 0.5
register-preview-function #'consult-register-format)
;; Optionally tweak the register preview window.
;; This adds thin lines, sorting and hides the mode line of the window.
(advice-add #'register-preview :override #'consult-register-window)
;; Use Consult to select xref locations with preview
(setq xref-show-xrefs-function #'consult-xref
xref-show-definitions-function #'consult-xref)
;; Configure other variables and modes in the :config section,
;; after lazily loading the package.
:config
;; Optionally configure preview. The default value
;; is 'any, such that any key triggers the preview.
;; (setq consult-preview-key 'any)
;; (setq consult-preview-key "M-.")
;; (setq consult-preview-key '("S-<down>" "S-<up>"))
;; For some commands and buffer sources it is useful to configure the
;; :preview-key on a per-command basis using the `consult-customize' macro.
(consult-customize
consult-theme :preview-key '(:debounce 0.2 any)
consult-ripgrep consult-git-grep consult-grep
consult-bookmark consult-recent-file consult-xref
consult--source-bookmark consult--source-file-register
consult--source-recent-file consult--source-project-recent-file
;; :preview-key "M-."
:preview-key '(:debounce 0.4 any))
;; Optionally configure the narrowing key.
;; Both < and C-+ work reasonably well.
(setq consult-narrow-key "<") ;; "C-+"
;; Optionally make narrowing help available in the minibuffer.
;; You may want to use `embark-prefix-help-command' or which-key instead.
;; (keymap-set consult-narrow-map (concat consult-narrow-key " ?") #'consult-narrow-help)
)
(use-package consult-lsp
:ensure t)
;; Enable vertico
(use-package vertico
:custom
;; (vertico-scroll-margin 0) ;; Different scroll margin
(vertico-count 10) ;; Show more candidates
(vertico-resize t) ;; Grow and shrink the Vertico minibuffer
(vertico-cycle t) ;; Enable cycling for `vertico-next/previous'
;; Option 2: Replace `vertico-insert' to enable TAB prefix expansion.
;; (keymap-set vertico-map "TAB" #'minibuffer-complete)
:init
(vertico-mode))
(use-package vertico-multiform
:straight nil
:after vertico
:ensure nil
:custom
(setq vertico-multiform-commands
'((consult-line buffer)
(consult-imenu reverse buffer)
(execute-extended-command flat)))
(setq vertico-multiform-categories
'((file buffer grid)
(imenu (:not indexed mouse))
(symbol (vertico-sort-function . vertico-sort-alpha))))
:init
(vertico-multiform-mode)
)
(use-package vertico-posframe
:after vertico-multiform
:ensure nil
:config
(setq vertico-posframe-poshandler #'posframe-poshandler-frame-top-center)
;; (vertico-posframe-border-width . 10)
;; NOTE: This is useful when emacs is used in both in X and
;; terminal, for posframe do not work well in terminal, so
;; vertico-buffer-mode will be used as fallback at the
;; moment.
;; (vertico-posframe-fallback-mode . vertico-buffer-mode)
:init
;; (require 'vertico-posframe)
(vertico-posframe-mode 1)
)
;; Persist history over Emacs restarts. Vertico sorts by history position.
(use-package savehist
:init
(savehist-mode))
;; A few more useful configurations...
(use-package emacs
:custom
;; Support opening new minibuffers from inside existing minibuffers.
(enable-recursive-minibuffers t)
;; Hide commands in M-x which do not work in the current mode. Vertico
;; commands are hidden in normal buffers. This setting is useful beyond
;; Vertico.
(read-extended-command-predicate #'command-completion-default-include-p)
;; TAB cycle if there are only few candidates
;; (completion-cycle-threshold 3)
;; Enable indentation+completion using the TAB key.
;; `completion-at-point' is often bound to M-TAB.
;; (tab-always-indent 'complete)
;; Emacs 30 and newer: Disable Ispell completion function. As an alternative,
;; try `cape-dict'.
(text-mode-ispell-word-completion nil)
;; Hide commands in M-x which do not apply to the current mode. Corfu
;; commands are hidden, since they are not used via M-x. This setting is
;; useful beyond Corfu.
(read-extended-command-predicate #'command-completion-default-include-p)
:init
;; Add prompt indicator to `completing-read-multiple'.
;; We display [CRM<separator>], e.g., [CRM,] if the separator is a comma.
(defun crm-indicator (args)
(cons (format "[CRM%s] %s"
(replace-regexp-in-string
"\\`\\[.*?]\\*\\|\\[.*?]\\*\\'" ""
crm-separator)
(car args))
(cdr args)))
(advice-add #'completing-read-multiple :filter-args #'crm-indicator)
;; Do not allow the cursor in the minibuffer prompt
(setq minibuffer-prompt-properties
'(read-only t cursor-intangible t face minibuffer-prompt))
(add-hook 'minibuffer-setup-hook #'cursor-intangible-mode)
)
(use-package hotfuzz)
;; Optionally use the `orderless' completion style.
(use-package orderless
:custom
;; Configure a custom style dispatcher (see the Consult wiki)
;; (orderless-style-dispatchers '(+orderless-consult-dispatch orderless-affix-dispatch))
;; (orderless-component-separator #'orderless-escapable-split-on-space)
(completion-styles '(hotfuzz orderless partial-completion basic))
(completion-category-defaults nil)
(completion-category-overrides nil))
(use-package marginalia
:config
(marginalia-mode 1))
;; Consult users will also want the embark-consult package.
(use-package embark-consult
:hook
(embark-collect-mode . consult-preview-at-point-mode))
(use-package embark
:init
;; Optionally replace the key help with a completing-read interface
(setq prefix-help-command #'embark-prefix-help-command)
;; Show the Embark target at point via Eldoc. You may adjust the
;; Eldoc strategy, if you want to see the documentation from
;; multiple providers. Beware that using this can be a little
;; jarring since the message shown in the minibuffer can be more
;; than one line, causing the modeline to move up and down:
;; (add-hook 'eldoc-documentation-functions #'embark-eldoc-first-target)
;; (setq eldoc-documentation-strategy #'eldoc-documentation-compose-eagerly)
:config
;; Hide the mode line of the Embark live/completions buffers
(add-to-list 'display-buffer-alist
'("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*"
nil
(window-parameters (mode-line-format . none)))))
;; Consult users will also want the embark-consult package.

View File

@ -1,6 +0,0 @@
(use-package meow
:demand t
:config
(require 'meow)
(meow-global-mode 1))

View File

View File

@ -1,3 +0,0 @@
(use-package wakatime-mode
:init
(global-wakatime-mode))

View File

@ -1,7 +0,0 @@
;; (use-package flymake-posframe
;; :ensure t
;; :straight (:host github :repo "Ladicle/flymake-posframe")
;; :hook (flymake-mode . flymake-posframe-mode))
;; (add-hook 'prog-mode-hook #'flymake-mode)

View File

@ -1,8 +0,0 @@
;; Posframe is a pop-up tool that must be manually installed for dap-mode
(use-package posframe)
;; Use the Debug Adapter Protocol for running tests and debugging
(use-package dap-mode
:hook
(lsp-mode . dap-mode)
(lsp-mode . dap-ui-mode))

View File

@ -1,12 +0,0 @@
(use-package editorconfig
:ensure t
:init
(editorconfig-mode 1))
(use-package format-all
:ensure t
:init
(format-all-mode))
(use-package envrc
:hook (after-init . envrc-global-mode))

View File

@ -1,67 +0,0 @@
(use-package lsp-mode
;; Optional - enable lsp-mode automatically in scala files
;; You could also swap out lsp for lsp-deffered in order to defer loading
:hook
(scala-mode . lsp)
(lsp-mode . lsp-lens-mode)
(lsp-completion-mode . my/lsp-mode-setup-completion)
:init
(defun my/orderless-dispatch-flex-first (_pattern index _total)
(and (eq index 0) 'orderless-flex))
(defun my/lsp-mode-setup-completion ()
(setf (alist-get 'styles (alist-get 'lsp-capf completion-category-defaults))
'(orderless))
;; Optionally configure the first word as flex filtered.
(add-hook 'orderless-style-dispatchers #'my/orderless-dispatch-flex-first nil 'local)
;; Optionally configure the cape-capf-buster.
(setq-local completion-at-point-functions (list (cape-capf-buster #'lsp-completion-at-point))))
:config
;; Uncomment following section if you would like to tune lsp-mode performance according to
;; https://emacs-lsp.github.io/lsp-mode/page/performance/
(setq lsp-idle-delay 0.500)
(setq lsp-log-io nil)
(setq lsp-completion-provider nil)
(setq lsp-modeline-code-actions-segments '(count name))
(setq lsp-headerline-breadcrumb-segments '(path symbols))
(setq lsp-prefer-flymake t)
;; Makes LSP shutdown the metals server when all buffers in the project are closed.
;; https://emacs-lsp.github.io/lsp-mode/page/settings/mode/#lsp-keep-workspace-alive
(setq lsp-keep-workspace-alive nil)
(setq lsp-auto-execute-action nil)
(setq lsp-nix-nil-formatter ["nixfmt"])
(with-eval-after-load 'lsp-mode
(add-to-list 'lsp-file-watch-ignored-directories "[/\\\\]\\.bloop\\'")
(add-to-list 'lsp-file-watch-ignored-directories "[/\\\\]\\.metals\\'")
(add-to-list 'lsp-file-watch-ignored-directories "[/\\\\]\\.ammonite\\'")
(add-to-list 'lsp-file-watch-ignored-directories "[/\\\\]\\.ivy2\\'")
(add-to-list 'lsp-file-watch-ignored-directories "[/\\\\]\\.sbt\\'")
(add-to-list 'lsp-file-watch-ignored-directories "[/\\\\]target\\'")
(add-to-list 'lsp-file-watch-ignored-directories "[/\\\\]project/target\\'")
(add-to-list 'lsp-file-watch-ignored-directories "[/\\\\]project/\\..+\\'")
(add-to-list 'lsp-file-watch-ignored-directories "[/\\\\]dist\\'"))
)
(use-package lsp-ui
:config
(setq lsp-ui-sideline-show-diagnostics t)
(setq lsp-ui-sideline-show-code-actions t)
(setq lsp-ui-sideline-update-mode 'line)
(setq lsp-ui-peek-enable t)
(setq lsp-ui-doc-enable t)
(setq lsp-ui-doc-side 'right)
(setq lsp-ui-doc-position 'bottom)
(setq lsp-ui-doc-delay 3)
(setq lsp-ui-doc-show-with-cursor t)
(setq lsp-ui-doc-show-with-mouse t))
(use-package lsp-treemacs
:init
(lsp-treemacs-sync-mode 1)
)

View File

@ -1 +0,0 @@
(use-package magit)

View File

@ -1,5 +0,0 @@
(use-package tree-sitter
:config
(global-tree-sitter-mode))
(use-package tree-sitter-langs)

View File

@ -1,3 +0,0 @@
(use-package dockerfile-mode
:init
(require 'dockerfile-mode))

View File

@ -1,9 +0,0 @@
(use-package dash)
(use-package editorconfig)
(use-package f)
(use-package s)
(use-package copilot
:straight (:host github :repo "copilot-emacs/copilot.el" :files ("*.el"))
:ensure t)

View File

@ -1,10 +0,0 @@
;; (use-package nix-lsp
;; :ensure lsp-mode
;; :after (lsp-mode)
;; :demand t
;; :custom
;; (lsp-nix-nil-formatter ["nixfmt"]))
(use-package nix-mode
:hook (nix-mode . lsp-deferred)
:mode "\\.nix\\'")

View File

@ -1,19 +0,0 @@
(use-package scala-mode
:interpreter ("scala" . scala-mode))
;; Enable sbt mode for executing sbt commands
(use-package sbt-mode
:commands sbt-start sbt-command
:config
;; WORKAROUND: https://github.com/ensime/emacs-sbt-mode/issues/31
;; allows using SPACE when in the minibuffer
(substitute-key-definition
'minibuffer-complete-word
'self-insert-command
minibuffer-local-completion-map)
;; sbt-supershell kills sbt-mode: https://github.com/hvesalai/emacs-sbt-mode/issues/152
(setq sbt:program-options '("-Dsbt.supershell=false")))
;; Add metals backend for lsp-mode
(use-package lsp-metals)

View File

@ -1 +0,0 @@
(use-package yaml-mode)

View File

@ -1,6 +0,0 @@
(use-package kubed
:ensure t
:config
(keymap-global-set "C-c k" 'kubed-prefix-map)
)

View File

@ -1,9 +0,0 @@
;; (require 'org)
(use-package esxml
:ensure t
)
(use-package ox-rss
:ensure t)

View File

@ -1,26 +0,0 @@
;; (use-package rg
;; :config (rg-enable-default-bindings))
;; (use-package fzf
;; :ensure t
;; ;;:config
;; ;; (setq fzf/args "-x --color bw --print-query --margin=1,0 --no-hscroll"
;; ;; fzf/executable "fzf"
;; ;; fzf/git-grep-args "-i --line-number %s"
;; ;; ;; command used for `fzf-grep-*` functions
;; ;; ;; example usage for ripgrep:
;; ;; ;; fzf/grep-command "rg --no-heading -nH"
;; ;; fzf/grep-command "grep -nrH"
;; ;; ;; If nil, the fzf buffer will appear at the top of the window
;; ;; fzf/position-bottom t
;; ;; fzf/window-height 15)
;; )
(use-package projectile
:config
(projectile-mode +1))
(use-package which-key
:ensure t
:config (which-key-mode))

View File

@ -1,205 +0,0 @@
(use-package bind-key)
(require 'meow)
(require 'bind-key)
;; :bind
;; (("C-." . embark-act) ;; pick some comfortable binding
;; ("C-;" . embark-dwim) ;; good alternative: M-.
;; ("C-h B" . embark-bindings)) ;; alternative for `describe-bindings'
;; :bind (;; C-c bindings in `mode-specific-map'
;; ("C-c M-x" . consult-mode-command)
;; ("C-c h" . consult-history)
;; ("C-c k" . consult-kmacro)
;; ("C-c m" . consult-man)
;; ("C-c i" . consult-info)
;; ([remap Info-search] . consult-info)
;; ;; C-x bindings in `ctl-x-map'
;; ("C-x M-:" . consult-complex-command) ;; orig. repeat-complex-command
;; ("C-x b" . consult-buffer) ;; orig. switch-to-buffer
;; ("C-x 4 b" . consult-buffer-other-window) ;; orig. switch-to-buffer-other-window
;; ("C-x 5 b" . consult-buffer-other-frame) ;; orig. switch-to-buffer-other-frame
;; ("C-x t b" . consult-buffer-other-tab) ;; orig. switch-to-buffer-other-tab
;; ("C-x r b" . consult-bookmark) ;; orig. bookmark-jump
;; ("C-x p b" . consult-project-buffer) ;; orig. project-switch-to-buffer
;; ;; Custom M-# bindings for fast register access
;; ("M-#" . consult-register-load)
;; ("M-'" . consult-register-store) ;; orig. abbrev-prefix-mark (unrelated)
;; ("C-M-#" . consult-register)
;; ;; Other custom bindings
;; ("M-y" . consult-yank-pop) ;; orig. yank-pop
;; ;; M-g bindings in `goto-map'
;; ("M-g e" . consult-compile-error)
;; ("M-g f" . consult-flymake) ;; Alternative: consult-flycheck
;; ("M-g g" . consult-goto-line) ;; orig. goto-line
;; ("M-g M-g" . consult-goto-line) ;; orig. goto-line
;; ("M-g o" . consult-outline) ;; Alternative: consult-org-heading
;; ("M-g m" . consult-mark)
;; ("M-g k" . consult-global-mark)
;; ("M-g i" . consult-imenu)
;; ("M-g I" . consult-imenu-multi)
;; ;; M-s bindings in `search-map'
;; ("M-s d" . consult-find) ;; Alternative: consult-fd
;; ("M-s c" . consult-locate)
;; ("M-s g" . consult-grep)
;; ("M-s G" . consult-git-grep)
;; ("M-s r" . consult-ripgrep)
;; ("M-s l" . consult-line)
;; ("M-s L" . consult-line-multi)
;; ("M-s k" . consult-keep-lines)
;; ("M-s u" . consult-focus-lines)
;; ;; Isearch integration
;; ("M-s e" . consult-isearch-history)
;; :map isearch-mode-map
;; ("M-e" . consult-isearch-history) ;; orig. isearch-edit-string
;; ("M-s e" . consult-isearch-history) ;; orig. isearch-edit-string
;; ("M-s l" . consult-line) ;; needed by consult-line to detect isearch
;; ("M-s L" . consult-line-multi) ;; needed by consult-line to detect isearch
;; ;; Minibuffer history
;; :map minibuffer-local-map
;; ("M-s" . consult-history) ;; orig. next-matching-history-element
;; ("M-r" . consult-history)) ;; orig. previous-matching-history-element
;; :bind (
;; ("C-c p" . cape-prefix-map)
;; ) ;; Alternative keys: M-p, M-+, ...
;; :bind
;; ("C-<prior>" . centaur-tabs-backward)
;; ("C-<next>" . centaur-tabs-forward)
(setq meow-cheatsheet-layout meow-cheatsheet-layout-qwerty)
;; (meow-replace-state-name-list
;; '(normal . "NORMAL")
;; '(motion . "MOTION")
;; '(keypad . "KEYPAD")
;; '(insert . "INSERT")
;; '(beacon . "BEACON"))
(meow-motion-overwrite-define-key
'("j" . meow-next)
'("k" . meow-prev)
'("<escape>" . ignore))
(meow-leader-define-key
;; SPC j/k will run the original command in MOTION state.
'("j" . "H-j")
'("k" . "H-k")
;; Use SPC (0-9) for digit arguments.
'("1" . meow-digit-argument)
'("2" . meow-digit-argument)
'("3" . meow-digit-argument)
'("4" . meow-digit-argument)
'("5" . meow-digit-argument)
'("6" . meow-digit-argument)
'("7" . meow-digit-argument)
'("8" . meow-digit-argument)
'("9" . meow-digit-argument)
'("0" . meow-digit-argument)
'("/" . meow-keypad-describe-key)
'("?" . meow-cheatsheet))
(meow-normal-define-key
'("0" . meow-expand-0)
'("9" . meow-expand-9)
'("8" . meow-expand-8)
'("7" . meow-expand-7)
'("6" . meow-expand-6)
'("5" . meow-expand-5)
'("4" . meow-expand-4)
'("3" . meow-expand-3)
'("2" . meow-expand-2)
'("1" . meow-expand-1)
'("-" . negative-argument)
'(";" . meow-reverse)
'("," . meow-inner-of-thing)
'("." . meow-bounds-of-thing)
'("[" . meow-beginning-of-thing)
'("]" . meow-end-of-thing)
'("a" . meow-append)
'("A" . meow-open-below)
'("b" . meow-back-word)
'("B" . meow-back-symbol)
'("c" . meow-change)
'("d" . meow-delete)
'("D" . meow-backward-delete)
'("e" . meow-next-word)
'("E" . meow-next-symbol)
'("f" . meow-find)
'("g" . meow-cancel-selection)
'("G" . meow-grab)
'("h" . meow-left)
'("H" . meow-left-expand)
'("i" . meow-insert)
'("I" . meow-open-above)
'("j" . meow-next)
'("J" . meow-next-expand)
'("k" . meow-prev)
'("K" . meow-prev-expand)
'("l" . meow-right)
'("L" . meow-right-expand)
'("m" . meow-join)
'("n" . meow-search)
'("o" . meow-block)
'("O" . meow-to-block)
'("p" . meow-yank)
'("q" . meow-quit)
'("Q" . meow-goto-line)
'("r" . meow-replace)
'("R" . meow-swap-grab)
'("s" . meow-kill)
'("t" . meow-till)
'("u" . meow-undo)
'("U" . meow-undo-in-selection)
'("v" . meow-visit)
'("w" . meow-mark-word)
'("W" . meow-mark-symbol)
'("x" . meow-line)
'("X" . meow-goto-line)
'("y" . meow-save)
'("Y" . meow-sync-grab)
'("z" . meow-pop-selection)
'("'" . repeat)
'("<escape>" . ignore))
(defvar my-keys-minor-mode-map
(let ((map (make-sparse-keymap)))
map)
"my-keys-minor-mode keymap.")
(define-minor-mode my-keys-minor-mode
"A minor mode so that my key settings override annoying major modes."
:init-value t
:lighter " my-keys")
(defun consult-switch-buffer-kill ()
"Kill candidate buffer at point within the minibuffer completion."
(interactive)
; The vertico--candidate has a irregular char at the end.
(let ((name (substring (vertico--candidate) 0 -1)))
(when (bufferp (get-buffer name))
(kill-buffer name))))
(bind-keys :map minibuffer-local-map
("C-s" . consult-switch-buffer-kill)
)
(bind-keys :map my-keys-minor-mode-map
("C-c C-f C-b" . consult-line)
("C-c C-f C-p" . consult-ripgrep)
("C-c C-t C-t" . treemacs-select-window)
("C-c C-t T" . treemacs)
("C-c M-x" . consult-mode-command)
("C-c C-b C-b" . consult-buffer)
("C-c C-b C-s" . kill-buffer)
("C-c C-l C-s" . consult-lsp-symbols)
)
(my-keys-minor-mode 1)

153
modules/fn-coding.el Normal file
View File

@ -0,0 +1,153 @@
;; -*- lexical-binding: t; -*-
(use-package apheleia
:defer t
:bind ("C-c t a" . apheleia-mode)
:init (apheleia-global-mode)
:config
;; Set custom formatting commands
(dolist (formatter-cmd '(
(shfmt . ("shfmt" "-i" "4" "-ci" "-kp" "-sr"))
))
(add-to-list #'apheleia-formatters formatter-cmd))
;; Set custom formatters for modes
(dolist (formatter-mode '((emacs-lisp-mode . lisp-indent)
(clojure-mode . lisp-indent)
))
(add-to-list #'apheleia-mode-alist formatter-mode)))
;; Posframe is a pop-up tool that must be manually installed for dap-mode
(use-package posframe)
(use-package ripgrep)
;; Use the Debug Adapter Protocol for running tests and debugging
(use-package dap-mode
:hook
(lsp-mode . dap-mode)
(lsp-mode . dap-ui-mode))
(use-package yaml-mode
:mode "\\.ya?ml\\'")
(use-package lsp-mode
:straight (:type built-in)
;; Optional - enable lsp-mode automatically in scala files
;; You could also swap out lsp for lsp-deffered in order to defer loading
:hook
(scala-mode . lsp)
(lsp-mode . lsp-lens-mode)
(lsp-completion-mode . my/lsp-mode-setup-completion)
:init
(defun my/orderless-dispatch-flex-first (_pattern index _total)
(and (eq index 0) 'orderless-flex))
(defun my/lsp-mode-setup-completion ()
(setf (alist-get 'styles (alist-get 'lsp-capf completion-category-defaults))
'(orderless))
;; Optionally configure the first word as flex filtered.
(add-hook 'orderless-style-dispatchers #'my/orderless-dispatch-flex-first nil 'local)
;; Optionally configure the cape-capf-buster.
(setq-local completion-at-point-functions (list (cape-capf-buster #'lsp-completion-at-point))))
:config
;; Uncomment following section if you would like to tune lsp-mode performance according to
;; https://emacs-lsp.github.io/lsp-mode/page/performance/
(setq lsp-idle-delay 0.500)
(setq lsp-log-io nil)
(setq lsp-completion-provider nil)
(setq lsp-modeline-code-actions-segments '(count name))
(setq lsp-headerline-breadcrumb-segments '(path symbols))
(setq lsp-prefer-flymake t)
;; Makes LSP shutdown the metals server when all buffers in the project are closed.
;; https://emacs-lsp.github.io/lsp-mode/page/settings/mode/#lsp-keep-workspace-alive
(setq lsp-keep-workspace-alive nil)
(setq lsp-auto-execute-action nil)
(setq lsp-nix-nil-formatter ["nixfmt"])
(with-eval-after-load 'lsp-mode
(add-to-list 'lsp-file-watch-ignored-directories "[/\\\\]\\.bloop\\'")
(add-to-list 'lsp-file-watch-ignored-directories "[/\\\\]\\.metals\\'")
(add-to-list 'lsp-file-watch-ignored-directories "[/\\\\]\\.ammonite\\'")
(add-to-list 'lsp-file-watch-ignored-directories "[/\\\\]\\.ivy2\\'")
(add-to-list 'lsp-file-watch-ignored-directories "[/\\\\]\\.sbt\\'")
(add-to-list 'lsp-file-watch-ignored-directories "[/\\\\]target\\'")
(add-to-list 'lsp-file-watch-ignored-directories "[/\\\\]project/target\\'")
(add-to-list 'lsp-file-watch-ignored-directories "[/\\\\]project/\\..+\\'")
(add-to-list 'lsp-file-watch-ignored-directories "[/\\\\]dist\\'")))
(use-package lsp-ui
:config
(setq lsp-ui-sideline-show-diagnostics t)
(setq lsp-ui-sideline-show-code-actions t)
(setq lsp-ui-sideline-update-mode 'line)
(setq lsp-ui-peek-enable t)
(setq lsp-ui-doc-enable t)
(setq lsp-ui-doc-side 'right)
(setq lsp-ui-doc-position 'bottom)
(setq lsp-ui-doc-delay 3)
(setq lsp-ui-doc-show-with-cursor t)
(setq lsp-ui-doc-show-with-mouse t))
(use-package lsp-treemacs
:init
(lsp-treemacs-sync-mode 1))
(use-package scala-mode
:interpreter ("scala" . scala-mode))
;; Enable sbt mode for executing sbt commands
(use-package sbt-mode
:commands sbt-start sbt-command
:config
;; WORKAROUND: https://github.com/ensime/emacs-sbt-mode/issues/31
;; allows using SPACE when in the minibuffer
(substitute-key-definition
'minibuffer-complete-word
'self-insert-command
minibuffer-local-completion-map)
;; sbt-supershell kills sbt-mode: https://github.com/hvesalai/emacs-sbt-mode/issues/152
(setq sbt:program-options '("-Dsbt.supershell=false")))
(use-package nix-lsp
:straight (:type built-in)
:after (lsp-mode)
:custom
(lsp-nix-nil-formatter ["nixfmt"]))
(use-package nix-mode
:hook (nix-mode . lsp-deferred)
:mode "\\.nix\\'")
(use-package company-nixos-options
:after (company-mode)
:custom
(add-to-list 'company-backends 'company-nixos-options))
;; Add metals backend for lsp-mode
(use-package
lsp-metals
:straight (:type built-in))
(use-package dockerfile-mode
:init
(require 'dockerfile-mode))
(use-package tree-sitter
:config
(global-tree-sitter-mode))
(use-package tree-sitter-langs)
(use-package yasnippet
:hook (prog-mode . yas-minor-mode)
:config
(yas-reload-all))
(provide 'fn-coding)

144
modules/fn-core.el Normal file
View File

@ -0,0 +1,144 @@
;; -*- lexical-binding: t; -*-
(setq user-emacs-directory (expand-file-name "~/.cache/emacs/")
url-history-file (expand-file-name "url/history" user-emacs-directory))
(use-package no-littering
:demand t
:config
;; Set the custom-file to a file that won't be tracked by Git
(setq custom-file (if (boundp 'server-socket-dir)
(expand-file-name "custom.el" server-socket-dir)
(no-littering-expand-etc-file-name "custom.el")))
(when (file-exists-p custom-file)
(load custom-file t))
;; Don't litter project folders with backup files
(let ((backup-dir (no-littering-expand-var-file-name "backup/")))
(make-directory backup-dir t)
(setq backup-directory-alist
`(("\\`/tmp/" . nil)
("\\`/dev/shm/" . nil)
("." . ,backup-dir))))
(setq auto-save-default nil)
;; Tidy up auto-save files
(setq auto-save-default nil)
(let ((auto-save-dir (no-littering-expand-var-file-name "auto-save/")))
(make-directory auto-save-dir t)
(setq auto-save-file-name-transforms
`(("\\`/[^/]*:\\([^/]*/\\)*\\([^/]*\\)\\'"
,(concat temporary-file-directory "\\2") t)
("\\`\\(/tmp\\|/dev/shm\\)\\([^/]*/\\)*\\(.*\\)\\'" "\\3")
("." ,auto-save-dir t)))))
;;; -- Native Compilation -----
;; Silence compiler warnings as they can be pretty disruptive
(setq native-comp-async-report-warnings-errors nil)
;; Set the right directory to store the native comp cache
(add-to-list 'native-comp-eln-load-path (expand-file-name "eln-cache/" user-emacs-directory))
(setq-default fill-column 120)
(use-package minions
:init
(minions-mode))
;; Revert Dired and other buffers
(setq global-auto-revert-non-file-buffers t)
;; Revert buffers when the underlying file has changed
(global-auto-revert-mode 1)
(use-package alert)
(use-package super-save
:config
(super-save-mode +1)
(setq super-save-auto-save-when-idle t)
;; (add-to-list 'super-save-predicates (lambda ()
;; (not (eq major-mode 'mu4e-compose-mode))))
)
;; If a popup does happen, don't resize windows to be equal-sized
(setq even-window-sizes nil)
(use-package popper
:bind (("C-M-'" . popper-toggle-latest)
("M-'" . popper-cycle)
("C-M-\"" . popper-toggle-type))
:custom
(popper-window-height 12)
(popper-reference-buffers '(eshell-mode
vterm-mode
geiser-repl-mode
help-mode
grep-mode
helpful-mode
compilation-mode))
:config
(require 'popper) ;; Needed because I disabled autoloads
(popper-mode 1))
;;; ----- Dired -----
(use-package all-the-icons)
(use-package all-the-icons-dired)
(use-package dired-ranger)
(defun fn/dired-mode-hook ()
(interactive)
(dired-hide-details-mode 1)
(unless (or fn/is-termux
(string-equal "/nix/store/" (expand-file-name default-directory)))
(all-the-icons-dired-mode 1))
(hl-line-mode 1))
(use-package dired
:straight (:type built-in)
:bind (:map dired-mode-map
("b" . dired-up-directory)
("H" . dired-hide-details-mode))
:config
(setq dired-listing-switches "-agho --group-directories-first"
dired-omit-files "^\\.[^.].*"
dired-omit-verbose nil
dired-dwim-target 'dired-dwim-target-next
dired-hide-details-hide-symlink-targets nil
dired-kill-when-opening-new-dired-buffer t
delete-by-moving-to-trash t)
(add-hook 'dired-mode-hook #'fn/dired-mode-hook))
(use-package savehist
:config
(setq history-length 25)
(savehist-mode 1))
;;; -- Make Help More Helpful -----
(use-package helpful
:custom
(counsel-describe-function-function #'helpful-callable)
(counsel-describe-variable-function #'helpful-variable)
:bind (([remap describe-function] . helpful-function)
([remap describe-symbol] . helpful-symbol)
([remap describe-variable] . helpful-variable)
([remap describe-command] . helpful-command)
([remap describe-key] . helpful-key)))
(provide 'fn-core)

23
modules/fn-desktop.el Normal file
View File

@ -0,0 +1,23 @@
;; -*- lexical-binding: t; -*-
;; Integrate with the system clipboard
(unless (display-graphic-p)
(use-package xclip
:demand t
:config
(xclip-mode 1)))
(use-package bluetooth)
;; Control NetworkManager via nmcli
(use-package nm
:vc (:url "https://github.com/Kodkollektivet/emacs-nm"
:rev :newest))
(use-package wakatime-mode
:init
(global-wakatime-mode))
(provide 'fn-desktop)

283
modules/fn-interface.el Normal file
View File

@ -0,0 +1,283 @@
;; -*- lexical-binding: t; -*-
(set-face-attribute 'default nil :font "BlexMono Nerd Font Mono" :height 140 :weight 'regular)
(use-package hydra)
(use-package vertico
:demand t
:bind (:map vertico-map
("C-j" . vertico-next)
("C-k" . vertico-previous)
("C-f" . vertico-exit-input)
:map minibuffer-local-map
("M-h" . vertico-directory-up))
:custom
(vertico-cycle t)
:custom-face
(vertico-current ((t (:background "#3a3f5a"))))
:config
(require 'vertico-directory)
(vertico-mode))
(use-package corfu
:bind (:map corfu-map
("C-j" . corfu-next)
("C-k" . corfu-previous)
("TAB" . corfu-insert)
([tab] . corfu-insert)
("C-f" . corfu-insert))
:custom
(corfu-cycle t)
(corfu-auto t)
(corfu-preview-current nil)
(corfu-quit-at-boundary t)
(corfu-quit-no-match t)
:config
(global-corfu-mode 1)
(defun corfu-enable-in-minibuffer ()
"Enable Corfu in the minibuffer if `completion-at-point' is bound."
(when (where-is-internal #'completion-at-point (list (current-local-map)))
;; (setq-local corfu-auto nil) ;; Enable/disable auto completion
(setq-local corfu-echo-delay nil ;; Disable automatic echo and popup
corfu-popupinfo-delay nil)
(corfu-mode 1)))
(add-hook 'minibuffer-setup-hook #'corfu-enable-in-minibuffer))
(use-package kind-icon
:after corfu
:custom (kind-icon-default-face 'corfu-default)
:config
(add-to-list 'corfu-margin-formatters #'kind-icon-margin-formatter))
(use-package orderless
:demand t
:config
(orderless-define-completion-style orderless+initialism
(orderless-matching-styles '(orderless-initialism
orderless-literal
orderless-regexp)))
(setq completion-styles '(orderless)
completion-category-defaults nil
orderless-matching-styles '(orderless-literal orderless-regexp)
completion-category-overrides
'((file (styles partial-completion)))))
(use-package wgrep
:after consult
:hook (grep-mode . wgrep-setup))
(use-package consult
:demand t
:bind (("C-s" . consult-line)
("C-M-l" . consult-imenu)
("C-M-j" . consult-buffer)
("C-x C-b" . consult-buffer)
:map minibuffer-local-map
("C-r" . consult-history))
:custom
(consult-project-root-function #'fn/get-project-root)
(completion-in-region-function #'consult-completion-in-region)
:config
(defun fn/get-project-root ()
(when (fboundp 'projectile-project-root)
(projectile-project-root))))
(use-package consult-dir
:bind (("C-x C-d" . consult-dir)
:map vertico-map
("C-x C-d" . consult-dir)
("C-x C-j" . consult-dir-jump-file))
:custom
(consult-dir-project-list-function nil))
(use-package marginalia
:after vertico
:custom
(marginalia-annotators '(marginalia-annotators-heavy
marginalia-annotators-light
nil))
:config
(marginalia-mode))
(use-package embark
:after vertico
:bind (("C-." . embark-act)
("M-." . embark-dwim)
:map minibuffer-local-map
("C-d" . embark-act)
:map embark-region-map
("D" . denote-region))
:config
;; Remove the mixed indicator to prevent the popup from being displayed
;; automatically
(delete #'embark-mixed-indicator embark-indicators)
(add-to-list 'embark-indicators 'embark-minimal-indicator)
;; Use Embark to show command prefix help
(setq prefix-help-command #'embark-prefix-help-command))
(use-package embark-consult
:after embark)
(use-package aggressive-indent)
(use-package rainbow-delimiters
:config
(add-hook 'prog-mode-hook #'rainbow-delimiters-mode))
(use-package dashboard
:ensure t
;; :defer t
:init
(setq dashboard-startup-banner 3)
(setq dashboard-items '((recents . 5)
(projects . 5)))
;; Content is not centered by default. To center, set
(setq dashboard-center-content t)
;; vertically center content
(setq dashboard-vertically-center-content t)
;; To disable shortcut "jump" indicators for each section, set
(setq dashboard-show-shortcuts nil)
(setq dashboard-startupify-list '(dashboard-insert-banner
dashboard-insert-newline
dashboard-insert-navigator
dashboard-insert-newline
dashboard-insert-items
dashboard-insert-init-info
))
;; (add-to-list 'dashboard-items '(agenda) t)
;; (setq dashboard-week-agenda t)
:config
(dashboard-setup-startup-hook)
)
(use-package which-key
:config
(which-key-mode 1))
(use-package treemacs
:ensure t
:defer t
:init
(add-hook 'treemacs-mode-hook (lambda() (display-line-numbers-mode -1)))
(with-eval-after-load 'winum
(define-key winum-keymap (kbd "M-0") #'treemacs-select-window))
:config
(progn
(setq treemacs-collapse-dirs (if treemacs-python-executable 3 0)
treemacs-deferred-git-apply-delay 0.5
treemacs-directory-name-transformer #'identity
treemacs-display-in-side-window t
treemacs-eldoc-display 'simple
treemacs-file-event-delay 2000
treemacs-file-extension-regex treemacs-last-period-regex-value
treemacs-file-follow-delay 0.2
treemacs-file-name-transformer #'identity
treemacs-follow-after-init t
treemacs-expand-after-init t
treemacs-find-workspace-method 'find-for-file-or-pick-first
treemacs-git-command-pipe ""
treemacs-goto-tag-strategy 'refetch-index
treemacs-header-scroll-indicators '(nil . "^^^^^^")
treemacs-hide-dot-git-directory t
treemacs-indentation 2
treemacs-indentation-string " "
treemacs-is-never-other-window nil
treemacs-max-git-entries 5000
treemacs-missing-project-action 'ask
treemacs-move-files-by-mouse-dragging t
treemacs-move-forward-on-expand nil
treemacs-no-delete-other-windows t
treemacs-project-follow-cleanup nil
treemacs-persist-file (expand-file-name ".cache/treemacs-persist" user-emacs-directory)
treemacs-position 'left
treemacs-read-string-input 'from-child-frame
treemacs-recenter-distance 0.1
treemacs-recenter-after-file-follow nil
treemacs-recenter-after-tag-follow nil
treemacs-recenter-after-project-jump 'always
treemacs-recenter-after-project-expand 'on-distance
treemacs-litter-directories '("/node_modules" "/.venv" "/.cask" )
treemacs-project-follow-into-home nil
treemacs-show-cursor nil
treemacs-show-hidden-files t
treemacs-silent-filewatch nil
treemacs-silent-refresh nil
treemacs-sorting 'alphabetic-asc
treemacs-select-when-already-in-treemacs 'move-back
treemacs-space-between-root-nodes t
treemacs-tag-follow-cleanup t
treemacs-tag-follow-delay 1.5
treemacs-text-scale nil
treemacs-user-mode-line-format nil
treemacs-user-header-line-format nil
treemacs-wide-toggle-width 70
treemacs-width 35
treemacs-width-increment 1
treemacs-width-is-initially-locked :on-nil
treemacs-workspace-switch-cleanup nil
treemacs-no-png-images t
treemacs-indent-guide-style 'block
)
;; 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-git-mode 'deferred)
(treemacs-indent-guide-mode t)
(treemacs-git-commit-diff-mode t)
(treemacs-follow-mode t)
(treemacs-filewatch-mode t)
(treemacs-fringe-indicator-mode 'always)
(when treemacs-python-executable
(treemacs-git-commit-diff-mode t))
;; (pcase (cons (not (null (executable-find "git")))
;; (not (null treemacs-python-executable)))
;; (`(t . t)
;; (treemacs-git-mode 'deferred))
;; (`(t . _)
;; (treemacs-git-mode 'simple)))
(treemacs-hide-gitignored-files-mode nil)))
(use-package treemacs-magit
:after (treemacs magit))
(use-package spacious-padding
;; :after modus-theme
:custom
(spacious-padding-subtle-mode-line t)
(spacious-padding-subtle-mode-line
`(
:mode-line-active 'default
:mode-line-inactive vertical-border))
:init
(spacious-padding-mode)
;; (add-hook 'modus-themes-after-load-theme-hook 'spacious-padding-mode)
)
(provide 'fn-interface)

8
modules/fn-ops.el Normal file
View File

@ -0,0 +1,8 @@
;; -*- lexical-binding: t; -*-
(use-package kubed
:ensure t
:config
(keymap-global-set "C-c k" 'kubed-prefix-map))
(provide 'fn-ops)

41
modules/fn-present.el Normal file
View File

@ -0,0 +1,41 @@
;; -*- lexical-binding: t; -*-
(defun fn/present-prepare-slide ()
(when (and logos-focus-mode
(derived-mode-p 'org-mode))
(org-overview)
(org-show-entry)
(org-show-children)))
(defun fn/present-toggle ()
"Configures the buffer for a presentation."
(interactive)
(if logos-focus-mode
(progn
(setq-local face-remapping-alist nil)
(widen)
(logos-focus-mode 0))
(setq-local face-remapping-alist '((default (:height 1.5) default)
(org-document-title (:height 1.75) org-document-title)
(org-block-begin-line (:height 0.7) org-block)))
;; Narrow the buffer and start focus mode
(logos-narrow-dwim)
(logos-focus-mode 1)
;; Prepare the slide
(fn/present-prepare-slide)))
(use-package logos
:bind (([remap narrow-to-region] . logos-narrow-dwim)
([remap forward-page] . logos-forward-page-dwim)
([remap backward-page] . logos-backward-page-dwim))
:custom
(logos-outlines-are-pages t)
(logos-scroll-lock t)
:config
(setf (alist-get 'org-mode logos-outline-regexp-alist) "^\\*\\{1,2\\} +")
(add-hook 'logos-page-motion-hook #'fn/present-prepare-slide))
(provide 'fn-present)

View File

@ -1,3 +1,13 @@
;; -*- lexical-binding: t; -*-
(use-package editorconfig
:ensure t
:init
(editorconfig-mode 1))
;; (use-package envrc
;; :hook (after-init . envrc-global-mode))
(defvar user-cache-directory (concat user-emacs-directory "var/"))
@ -30,4 +40,10 @@
;; :general
;; (leader-keys
;; "p" 'projectile-command-map)
)
)
(use-package treemacs-projectile)
(use-package magit)
(provide 'fn-vc)

113
modules/fn-workflow.el Normal file
View File

@ -0,0 +1,113 @@
;; -*- lexical-binding: t; -*-
;;; ----- TODO Configuration -----
(setq org-todo-keywords
'((sequence "TODO(t)" "WAIT(w)" "|" "DONE(d!)")))
(setq org-todo-keyword-faces
'(("GOAL" . (:foreground "orange red" :weight bold))
("WAIT" . (:foreground "HotPink2" :weight bold))
("BACK" . (:foreground "MediumPurple3" :weight bold))))
;;; ----- Context Tags -----
(setq-default org-tag-alist
'((:startgroup)
("Areas")
(:grouptags)
("@home" . ?H)
("@work" . ?W)
(:endgroup)
(:startgrouptag . nil)
("Contexts")
(:grouptags)
("@computer" . ?C)
("@mobile" . ?M)
("@calls" . ?A)
("@errands" . ?E)
(:endgrouptag)
;; Task Types
(:startgrouptag . nil)
("Types")
(:grouptags)
("@easy" . ?e)
("@hacking" . ?h)
("@writing" . ?w)
("@creative" . ?v)
("@accounting" . ?a)
("@email" . ?m)
("@system" . ?s)
(:endgrouptag)
;; Workflow states
(:startgroup . nil)
("States")
(:grouptags)
("@plan" . ?p)
("@review" . ?r)
("@followup" . ?f)
(:endgroup)))
;; Only make context tags inheritable (what about noexport?)
(setq org-use-tag-inheritance "^@")
;;; ----- Time Tracking -----
;; Clock in on the current task when setting a timer
(add-hook 'org-timer-set-hook #'org-clock-in)
;; Clock out of the current task when the timer is complete
(add-hook 'org-timer-done-hook #'org-clock-out)
;;; ----- Agenda Configuration -----
(defvar fn/base-agenda-files '("Inbox.org" "Schedule.org")
"The base agenda files that will always be included.")
(setq org-agenda-span 'day
org-agenda-start-with-log-mode t
org-agenda-files fn/base-agenda-files
org-agenda-window-setup 'current-window)
;; Make done tasks show up in the agenda log
(setq org-log-done 'time
org-log-into-drawer t)
;;; ----- Denote Integration -----
(defun fn/refresh-agenda-files ()
(interactive)
(setq org-agenda-files
(append (denote-directory-files "_pra")
fn/base-agenda-files)))
(defun fn/goto-weekly-note ()
(interactive)
(let* ((note-title (format-time-string "%Y-W%V"))
(existing-notes
(denote-directory-files (format "-%s" note-title) nil t)))
(if existing-notes
(find-file (car existing-notes))
(denote note-title '("plw")))))
(with-eval-after-load 'denote
;; Quick access commands
(keymap-set global-map "C-c n w" #'fn/goto-weekly-note)
;; Refresh agenda files the first time
(fn/refresh-agenda-files)
;; Update agenda files after notes are created or renamed
(add-hook 'denote-after-rename-file-hook #'fn/refresh-agenda-files)
(add-hook 'denote-after-new-note-hook #'fn/refresh-agenda-files))
(use-package esxml :ensure t)
(use-package ox-rss :ensure t)
(provide 'fn-workflow)

46
modules/fn-writing.el Normal file
View File

@ -0,0 +1,46 @@
;; -*- lexical-binding: t; -*-
(use-package denote
:demand t
:bind (("C-c n l" . denote-link-or-create)
("C-c n o" . denote-open-or-create)
("C-c n r" . denote-rename-file-using-front-matter))
:custom
(denote-directory "~/Notes")
(denote-rename-buffer-format "Denote: %t (%k)")
(denote-infer-keywords nil)
(denote-known-keywords
'("pra" "prb" "prc"
"ply" "plm" "plw"
"kt" "ke" "kp" "kl" "ka" "kap"
"kcp" "kca" "kcc"
"kra" "krb" "krv"
"rn"))
:config
(require 'denote-rename-buffer)
(require 'denote-org-extras)
;; Rename buffers with the note name
(denote-rename-buffer-mode 1)
;; Buttonize all denote links in text buffers
(add-hook 'text-mode-hook #'denote-fontify-links-mode-maybe))
(defun fn/setup-markdown-mode ()
(center-document-mode 1)
(display-line-numbers-mode 0))
(use-package markdown-mode
:config
(setq markdown-command "marked")
(add-hook 'markdown-mode-hook #'fn/setup-markdown-mode)
(dolist (face '((markdown-header-face-1 . 1.2)
(markdown-header-face-2 . 1.1)
(markdown-header-face-3 . 1.0)
(markdown-header-face-4 . 1.0)
(markdown-header-face-5 . 1.0)))
(set-face-attribute (car face) nil :weight 'normal :height (cdr face))))
(provide 'fn-writing)

View File

@ -1,177 +0,0 @@
;; ---------------------------------------------------------------------
;; GNU Emacs / N Λ N O - Emacs made simple
;; Copyright (C) 2020 - N Λ N O developers
;;
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;; ---------------------------------------------------------------------
;; No startup screen
(setq inhibit-startup-screen t)
;; No startup message
(setq inhibit-startup-message t)
(setq inhibit-startup-echo-area-message t)
;; No message in scratch buffer
(setq initial-scratch-message nil)
;; Initial buffer
(setq initial-buffer-choice nil)
;; No frame title
(setq frame-title-format nil)
;; No file dialog
(setq use-file-dialog nil)
;; No dialog box
(setq use-dialog-box nil)
;; No popup windows
(setq pop-up-windows nil)
;; No empty line indicators
(setq indicate-empty-lines nil)
;; No cursor in inactive windows
(setq cursor-in-non-selected-windows nil)
;; Text mode is initial mode
(setq initial-major-mode 'text-mode)
;; Text mode is default major mode
(setq default-major-mode 'text-mode)
;; Moderate font lock
(setq font-lock-maximum-decoration nil)
;; No limit on font lock
(setq font-lock-maximum-size nil)
;; No line break space points
(setq auto-fill-mode nil)
;; Fill column at 80
(setq fill-column 80)
;; No confirmation for visiting non-existent files
(setq confirm-nonexistent-file-or-buffer nil)
;; Completion style, see
;; gnu.org/software/emacs/manual/html_node/emacs/Completion-Styles.html
;; (setq completion-styles '(basic substring))
;; Use RET to open org-mode links, including those in quick-help.org
(setq org-return-follows-link t)
;; Mouse active in terminal
(unless (display-graphic-p)
(xterm-mouse-mode 1)
(global-set-key (kbd "<mouse-4>") 'scroll-down-line)
(global-set-key (kbd "<mouse-5>") 'scroll-up-line))
;; No scroll bars
(if (fboundp 'scroll-bar-mode) (set-scroll-bar-mode nil))
;; No toolbar
(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
(dolist (mode '(scroll-bar-mode
horizontal-scroll-bar-mode
menu-bar-mode
tooltip-mode
tool-bar-mode))
(when (fboundp mode)
(funcall mode 0)))
;; Tab behavior
;; (setq tab-always-indent 'complete)
;; (global-company-mode)
;; (define-key company-mode-map [remap indent-for-tab-command]
;; #'company-indent-or-complete-common)
;; Pixel scroll (as opposed to char scrool)
;; (pixel-scroll-mode t)
;; Mac specific
;; (when (eq system-type 'darwin)
;; (setq ns-use-native-fullscreen t
;; mac-option-key-is-meta nil
;; mac-command-key-is-meta t
;; mac-command-modifier 'meta
;; mac-option-modifier nil
;; mac-use-title-bar nil))
;; Make sure clipboard works properly in tty mode on OSX
;; (defun copy-from-osx ()
;; (shell-command-to-string "pbpaste"))
;; (defun paste-to-osx (text &optional push)
;; (let ((process-connection-type nil))
;; (let ((proc (start-process "pbcopy" "*Messages*" "pbcopy")))
;; (process-send-string proc text)
;; (process-send-eof proc))))
;; (when (and (not (display-graphic-p))
;; (eq system-type 'darwin))
;; (setq interprogram-cut-function 'paste-to-osx)
;; (setq interprogram-paste-function 'copy-from-osx))
;; y/n for answering yes/no questions
(fset 'yes-or-no-p 'y-or-n-p)
;; No tabs
(setq-default indent-tabs-mode nil)
;; Tab.space equivalence
(setq-default tab-width 4)
;; Size of temporary buffers
(temp-buffer-resize-mode)
(setq temp-buffer-max-height 8)
;; Minimum window height
(setq window-min-height 1)
;; Buffer encoding
(prefer-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-language-environment 'utf-8)
;; Unique buffer names
(require 'uniquify)
(setq uniquify-buffer-name-style 'reverse
uniquify-separator ""
uniquify-after-kill-buffer-p t
uniquify-ignore-buffers-re "^\\*")
;; Default shell in term
;; (unless
;; (or (eq system-type 'windows-nt)
;; (not (file-exists-p "/bin/zsh")))
;; (setq-default shell-file-name "/bin/zsh")
;; (setq explicit-shell-file-name "/bin/zsh"))
;; Kill term buffer when exiting
;; (defadvice term-sentinel (around my-advice-term-sentinel (proc msg))
;; (if (memq (process-status proc) '(signal exit))
;; (let ((buffer (process-buffer proc)))
;; ad-do-it
;; (kill-buffer buffer))
;; ad-do-it))
;; (ad-activate 'term-sentinel)
(provide 'nano-defaults)

View File

@ -1,157 +0,0 @@
;; ---------------------------------------------------------------------
;; GNU Emacs / N Λ N O - Emacs made simple
;; Copyright (C) 2020 - N Λ N O developers
;;
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;; ---------------------------------------------------------------------
;;
;; This file defines the splash screen
;; - No logo, no modeline, no scrollbars
;; - Any key / mouse click kills the splash screen
;; - With emacs-mac (Mituharu), splash screen is faded out after .5 seconds
;;
;; Note: The screen is not shown if there are opened file buffers. For
;; example, if you start emacs with a filename on the command
;; line, the splash screen is not shown.
;;
;; Usage:
;; (require 'nano-splash)
(require 'subr-x)
(require 'cl-lib)
(defun nano-splash ()
"Nano Emacs splash screen"
(interactive)
;; Hide modeline before window-body-height is computed
(let* ((splash-buffer (get-buffer-create "*splash*")))
(with-current-buffer splash-buffer
(setq header-line-format nil)
(setq mode-line-format nil)))
(let* ((splash-buffer (get-buffer-create "*splash*"))
(height (round (- (window-body-height nil) 1) ))
(width (round (window-body-width nil) ))
(padding-center (+ (/ height 2) 1)))
;; If there are buffer associated with filenames,
;; we don't show the splash screen.
(if (eq 0 (length (cl-loop for buf in (buffer-list)
if (buffer-file-name buf)
collect (buffer-file-name buf))))
(with-current-buffer splash-buffer
(erase-buffer)
;; Buffer local settings
(if (one-window-p) (setq mode-line-format nil))
(setq cursor-type nil)
(setq line-spacing 0)
(setq vertical-scroll-bar nil)
(setq horizontal-scroll-bar nil)
(setq fill-column width)
(face-remap-add-relative 'link :underline nil)
(if (not (display-graphic-p)) (menu-bar-mode 0))
;; Vertical padding to center
(insert-char ?\n padding-center)
(center-line)
(insert (propertize " _______ _____ ______ ________ ________ ________" 'face 'nano-face-strong) "\n")
(insert (propertize "|\\ ___ \\ |\\ _ \\ _ \\|\\ __ \\|\\ ____\\|\\ ____\\" 'face 'nano-face-strong) "\n")
(insert (propertize "\\ \\ __/|\\ \\ \\\\\\__\\ \\ \\ \\ \\|\\ \\ \\ \\___|\\ \\ \\___|_" 'face 'nano-face-strong) "\n")
(insert (propertize " \\ \\ \\_|/_\\ \\ \\\\|__| \\ \\ \\ __ \\ \\ \\ \\ \\_____ \\" 'face 'nano-face-strong) "\n")
(insert (propertize " \\ \\ \\_|\\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\____\\|____|\\ \\" 'face 'nano-face-strong) "\n")
(insert (propertize " \\ \\_______\\ \\__\\ \\ \\__\\ \\__\\ \\__\\ \\_______\\____\\_\\ \\" 'face 'nano-face-strong) "\n")
(insert (propertize " \\|_______|\\|__| \\|__|\\|__|\\|__|\\|_______|\\_________\\" 'face 'nano-face-strong) "\n")
(insert (propertize " \\|_________|" 'face 'nano-face-strong) "\n")
(goto-char 0)
(read-only-mode t)
(local-set-key [t] 'nano-splash-kill)
(display-buffer-same-window splash-buffer nil)
(run-with-idle-timer 0.05 nil (lambda() (message nil)))
;; (run-with-idle-timer 0.50 nil 'nano-splash-fade-out-slow)
;; (if (fboundp 'nano-splash-help-message)
;; (run-with-idle-timer 0.55 nil 'nano-splash-help-message))
)
)))
(defun center-string (string)
"Pad a string with space on the left such as to center it"
(let* ((padding (/ (- (window-body-width) (length string)) 2))
(padding (+ (length string) padding)))
;; If the string is displayed as a tooltip, don't pad it
(if (and tooltip-mode (fboundp 'x-show-tip))
string
(format (format "%%%ds" padding) string))))
;; Mac only animation , available from
;; https://bitbucket.org/mituharu/emacs-mac/src/master/
;; https://github.com/railwaycat/homebrew-emacsmacport
(defvar mac-animation-locked-p nil)
(defun mac-animation-toggle-lock ()
(setq mac-animation-locked-p (not mac-animation-locked-p)))
(defun mac-animation-fade-out (duration &rest args)
(unless mac-animation-locked-p
(mac-animation-toggle-lock)
(mac-start-animation nil :type 'fade-out :duration duration)
(run-with-timer duration nil 'mac-animation-toggle-lock)))
(defun nano-splash-fade-out (duration)
"Fade out current frame for duration and goes to command-or-bufffer"
(interactive)
(defalias 'mac-animation-fade-out-local
(apply-partially 'mac-animation-fade-out duration))
(if (get-buffer "*splash*")
(progn (if (and (display-graphic-p) (fboundp 'mac-start-animation))
(advice-add 'set-window-buffer
:before 'mac-animation-fade-out-local))
(message nil)
(kill-buffer "*splash*")
(if (and (display-graphic-p) (fboundp 'mac-start-animation))
(advice-remove 'set-window-buffer
'mac-animation-fade-out-local)))))
(defun nano-splash-fade-out-slow ()
(interactive) (nano-splash-fade-out 1.00))
(defun nano-splash-fade-out-fast ()
(interactive) (nano-splash-fade-out 0.25))
(defun nano-splash-kill ()
"Kill the splash screen buffer (immediately)."
(interactive)
(if (get-buffer "*splash*")
(progn (message nil)
(cancel-function-timers 'nano-splash-fade-out-slow)
(cancel-function-timers 'nano-spash-help-message)
(kill-buffer "*splash*"))))
;; Install hook after frame parameters have been applied and only if
;; no option on the command line
(if (and (not (member "-no-splash" command-line-args))
(not (member "--file" command-line-args))
(not (member "--insert" command-line-args))
(not (member "--find-file" command-line-args))
;; (not inhibit-startup-screen)
)
(progn
(add-hook 'window-setup-hook 'nano-splash)
(setq inhibit-startup-screen t
inhibit-startup-message t
inhibit-startup-echo-area-message t)))
(nano-splash)
(provide 'nano-splash)

3
systems/mearah.el Normal file
View File

@ -0,0 +1,3 @@
(setq fn/use-config-modules
(append fn/common-config-modules
'(fn-desktop)))