mirror of
https://github.com/fscotto/infra.git
synced 2026-09-27 19:03:47 +00:00
Refactor Emacs for authoring workflows
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
if command -v emacsclient >/dev/null 2>&1; then
|
||||
ec() {
|
||||
emacsclient -c -n "$@" || {
|
||||
printf '%s\n' "Emacs server is not available. Log into a graphical session and ensure the user 'emacs' service is running." >&2
|
||||
printf '%s\n' "Emacs server is not available. Start Emacs or run M-x server-start." >&2
|
||||
return 1
|
||||
}
|
||||
}
|
||||
|
||||
et() {
|
||||
emacsclient -t "$@" || {
|
||||
printf '%s\n' "Emacs server is not available. Ensure the user 'emacs' service is running in your graphical session." >&2
|
||||
printf '%s\n' "Emacs server is not available. Start Emacs or run M-x server-start." >&2
|
||||
return 1
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,12 +5,6 @@ x-scheme-handler/https=userapp-Firefox-91DVN3.desktop
|
||||
x-scheme-handler/about=firefox.desktop
|
||||
x-scheme-handler/unknown=firefox.desktop
|
||||
application/pdf=com.github.xournalpp.xournalpp.desktop
|
||||
application/json=emacs.desktop
|
||||
application/json5=emacs.desktop
|
||||
application/xml=emacs.desktop
|
||||
application/xml-external-parsed-entity=emacs.desktop
|
||||
application/x-shellscript=emacs.desktop
|
||||
application/yaml=emacs.desktop
|
||||
inode/directory=thunar.desktop
|
||||
image/bmp=org.xfce.ristretto.desktop
|
||||
image/gif=org.xfce.ristretto.desktop
|
||||
@@ -148,18 +142,6 @@ application/zstd=xarchiver.desktop
|
||||
text/markdown=emacs.desktop
|
||||
text/org=emacs.desktop
|
||||
text/plain=emacs.desktop
|
||||
text/rust=emacs.desktop
|
||||
text/x-c++hdr=emacs.desktop
|
||||
text/x-c++src=emacs.desktop
|
||||
text/x-chdr=emacs.desktop
|
||||
text/x-csrc=emacs.desktop
|
||||
text/x-emacs-lisp=emacs.desktop
|
||||
text/x-go=emacs.desktop
|
||||
text/x-java=emacs.desktop
|
||||
text/x-makefile=emacs.desktop
|
||||
text/x-patch=emacs.desktop
|
||||
text/x-python=emacs.desktop
|
||||
text/x-python3=emacs.desktop
|
||||
text/x-readme=emacs.desktop
|
||||
text/x-rst=emacs.desktop
|
||||
text/x-tex=emacs.desktop
|
||||
@@ -173,13 +155,7 @@ application/x-extension-xhtml=userapp-Firefox-91DVN3.desktop
|
||||
application/x-extension-xht=userapp-Firefox-91DVN3.desktop
|
||||
|
||||
[Added Associations]
|
||||
application/json=emacs.desktop;
|
||||
application/json5=emacs.desktop;
|
||||
application/pdf=com.github.xournalpp.xournalpp.desktop;
|
||||
application/xml=emacs.desktop;
|
||||
application/xml-external-parsed-entity=emacs.desktop;
|
||||
application/x-shellscript=emacs.desktop;
|
||||
application/yaml=emacs.desktop;
|
||||
text/plain=emacs.desktop;
|
||||
inode/directory=thunar.desktop;
|
||||
image/bmp=org.xfce.ristretto.desktop;
|
||||
@@ -317,18 +293,6 @@ application/zip=xarchiver.desktop;
|
||||
application/zstd=xarchiver.desktop;
|
||||
text/markdown=emacs.desktop;
|
||||
text/org=emacs.desktop;
|
||||
text/rust=emacs.desktop;
|
||||
text/x-c++hdr=emacs.desktop;
|
||||
text/x-c++src=emacs.desktop;
|
||||
text/x-chdr=emacs.desktop;
|
||||
text/x-csrc=emacs.desktop;
|
||||
text/x-emacs-lisp=emacs.desktop;
|
||||
text/x-go=emacs.desktop;
|
||||
text/x-java=emacs.desktop;
|
||||
text/x-makefile=emacs.desktop;
|
||||
text/x-patch=emacs.desktop;
|
||||
text/x-python=emacs.desktop;
|
||||
text/x-python3=emacs.desktop;
|
||||
text/x-readme=emacs.desktop;
|
||||
text/x-rst=emacs.desktop;
|
||||
text/x-tex=emacs.desktop;
|
||||
|
||||
78
dotfiles/desktop/.emacs.d/.gitignore
vendored
78
dotfiles/desktop/.emacs.d/.gitignore
vendored
@@ -1,65 +1,13 @@
|
||||
# Created by https://www.toptal.com/developers/gitignore/api/emacs
|
||||
# Edit at https://www.toptal.com/developers/gitignore?templates=emacs
|
||||
|
||||
### Emacs ###
|
||||
# -*- mode: gitignore; -*-
|
||||
*~
|
||||
\#*\#
|
||||
/.emacs.desktop
|
||||
/.emacs.desktop.lock
|
||||
*.elc
|
||||
auto-save-list
|
||||
tramp
|
||||
.\#*
|
||||
eln-cache
|
||||
projects
|
||||
transient/
|
||||
.dap-breakpoints
|
||||
.lsp-session-v1
|
||||
/.extension/**
|
||||
url/**
|
||||
**/*.bak
|
||||
**/recentf
|
||||
|
||||
# Org-mode
|
||||
.org-id-locations
|
||||
*_archive
|
||||
|
||||
# flymake-mode
|
||||
*_flymake.*
|
||||
|
||||
# eshell files
|
||||
/eshell/history
|
||||
/eshell/lastdir
|
||||
|
||||
# elpa packages
|
||||
/elpa/
|
||||
|
||||
# reftex files
|
||||
*.rel
|
||||
|
||||
# AUCTeX auto folder
|
||||
/auto/
|
||||
|
||||
# cask packages
|
||||
.cask/
|
||||
dist/
|
||||
|
||||
# Flycheck
|
||||
flycheck_*.el
|
||||
|
||||
# server auth directory
|
||||
/server/
|
||||
|
||||
# projectiles files
|
||||
.projectile
|
||||
/projectile-bookmarks.eld
|
||||
|
||||
# directory configuration
|
||||
.dir-locals.el
|
||||
|
||||
# network security
|
||||
/network-security.data
|
||||
|
||||
|
||||
# End of https://www.toptal.com/developers/gitignore/api/emacs
|
||||
*~
|
||||
\#*\#
|
||||
*.elc
|
||||
auto-save-list/
|
||||
.\#*
|
||||
eln-cache/
|
||||
.org-id-locations
|
||||
*_archive
|
||||
/eshell/
|
||||
/elpa/
|
||||
/auto/
|
||||
/server/
|
||||
/network-security.data
|
||||
|
||||
@@ -18,6 +18,3 @@
|
||||
(defun fscotto/load-modules (&rest modules)
|
||||
"Load MODULES."
|
||||
(mapc #'fscotto/load-module modules))
|
||||
|
||||
(defvar fscotto/emacs-profile
|
||||
(or (getenv "EMACS_PROFILE") "full"))
|
||||
|
||||
@@ -1,52 +1,20 @@
|
||||
(message "Welcome to Emacs")
|
||||
(message "Loading user configuration...")
|
||||
(message "Emacs profile: %s" fscotto/emacs-profile)
|
||||
(message "Loading authoring configuration...")
|
||||
|
||||
;;=====================================================================================
|
||||
;; Load modules
|
||||
;;=====================================================================================
|
||||
(fscotto/load-modules
|
||||
;; Core
|
||||
'core/packages
|
||||
'core/ui
|
||||
'core/performance
|
||||
'core/editor
|
||||
'core/keybindings
|
||||
'core/modal
|
||||
'core/buffer
|
||||
'core/packages
|
||||
'core/ui
|
||||
'core/performance
|
||||
'core/editor
|
||||
'core/keybindings
|
||||
'core/buffer
|
||||
'tools/spell
|
||||
'tools/completion
|
||||
'lang/org
|
||||
'authoring
|
||||
'quality-of-life
|
||||
'misc/dashboard
|
||||
'misc/which-key
|
||||
'misc/vcs
|
||||
'misc/rss)
|
||||
|
||||
;; Tools
|
||||
'tools/completion
|
||||
'tools/dired
|
||||
'tools/project
|
||||
'tools/spell
|
||||
'tools/tramp
|
||||
'tools/lsp
|
||||
'tools/dap
|
||||
'tools/treesitter
|
||||
|
||||
;; Languages
|
||||
'lang/c
|
||||
'lang/docker
|
||||
'lang/golang
|
||||
'lang/json
|
||||
'lang/markdown
|
||||
'lang/org
|
||||
'lang/python
|
||||
'lang/shell
|
||||
'lang/yaml
|
||||
|
||||
;; Misc
|
||||
'misc/dashboard
|
||||
'misc/custom-functions
|
||||
'misc/doom-modeline
|
||||
'misc/which-key
|
||||
'misc/gptel
|
||||
'misc/rss
|
||||
'misc/terminal
|
||||
'misc/vcs
|
||||
'misc/documents
|
||||
'misc/i3-config
|
||||
'misc/xclip)
|
||||
|
||||
(message "...user configuration loaded")
|
||||
(message "Authoring configuration loaded")
|
||||
|
||||
76
dotfiles/desktop/.emacs.d/lisp/authoring.el
Normal file
76
dotfiles/desktop/.emacs.d/lisp/authoring.el
Normal file
@@ -0,0 +1,76 @@
|
||||
;;; authoring.el --- Export and document templates -*- lexical-binding: t; -*-
|
||||
|
||||
(require 'org)
|
||||
(require 'ox)
|
||||
(require 'ox-html)
|
||||
(require 'ox-latex)
|
||||
(require 'ox-md)
|
||||
(require 'ox-odt)
|
||||
|
||||
(defconst fscotto/org-templates-directory
|
||||
(expand-file-name "templates/org" user-emacs-directory)
|
||||
"Directory containing the versioned Org templates.")
|
||||
|
||||
(defun fscotto/org--require-current-buffer ()
|
||||
"Signal an actionable error unless the current buffer is an Org document."
|
||||
(unless (derived-mode-p 'org-mode)
|
||||
(user-error "Open an Org file before exporting")))
|
||||
|
||||
(defun fscotto/org-export-pdf ()
|
||||
"Export the current Org document to PDF with LuaLaTeX and latexmk."
|
||||
(interactive)
|
||||
(fscotto/org--require-current-buffer)
|
||||
(dolist (program '("latexmk" "lualatex"))
|
||||
(unless (executable-find program)
|
||||
(user-error "%s is not available; install the authoring dependencies" program)))
|
||||
(org-latex-export-to-pdf))
|
||||
|
||||
(defun fscotto/org-export-html ()
|
||||
"Export the current Org document to HTML5."
|
||||
(interactive)
|
||||
(fscotto/org--require-current-buffer)
|
||||
(org-html-export-to-html))
|
||||
|
||||
(defun fscotto/org-export-markdown ()
|
||||
"Export the current Org document to Markdown."
|
||||
(interactive)
|
||||
(fscotto/org--require-current-buffer)
|
||||
(org-md-export-to-markdown))
|
||||
|
||||
(defun fscotto/org-export-docx ()
|
||||
"Export the current Org document to DOCX through Pandoc."
|
||||
(interactive)
|
||||
(fscotto/org--require-current-buffer)
|
||||
(unless (buffer-file-name)
|
||||
(user-error "Save the Org file before exporting it to DOCX"))
|
||||
(let ((pandoc (executable-find "pandoc"))
|
||||
(output (concat (file-name-sans-extension (buffer-file-name)) ".docx")))
|
||||
(unless pandoc
|
||||
(user-error "pandoc is not available; install the authoring dependencies"))
|
||||
(save-buffer)
|
||||
(unless (zerop (call-process pandoc nil "*Org Pandoc*" nil
|
||||
(buffer-file-name) "-f" "org" "-t" "docx" "-o" output))
|
||||
(pop-to-buffer "*Org Pandoc*")
|
||||
(user-error "Pandoc could not export this document"))
|
||||
(message "DOCX exported to %s" output)))
|
||||
|
||||
(defun fscotto/org-export-odt ()
|
||||
"Export the current Org document to OpenDocument Text."
|
||||
(interactive)
|
||||
(fscotto/org--require-current-buffer)
|
||||
(org-odt-export-to-odt))
|
||||
|
||||
(defun fscotto/org-copy-template (template)
|
||||
"Copy a versioned TEMPLATE into `org-directory'."
|
||||
(interactive
|
||||
(list (completing-read "Template: "
|
||||
'("documentation.org" "cv.org" "generic-document.org") nil t)))
|
||||
(let ((source (expand-file-name template fscotto/org-templates-directory))
|
||||
(destination (expand-file-name template org-directory)))
|
||||
(unless (file-exists-p source)
|
||||
(user-error "Template not found: %s" source))
|
||||
(make-directory org-directory t)
|
||||
(copy-file source destination nil)
|
||||
(find-file destination)))
|
||||
|
||||
(provide 'authoring)
|
||||
@@ -1,4 +1,6 @@
|
||||
;;; buffer.el -*- lexical-binding: t; -*-
|
||||
;;; buffer.el --- Buffer management -*- lexical-binding: t; -*-
|
||||
|
||||
(require 'use-package)
|
||||
|
||||
(use-package ibuffer
|
||||
:ensure t)
|
||||
@@ -9,13 +11,6 @@
|
||||
(use-package ibuffer-vc
|
||||
:ensure t)
|
||||
|
||||
(use-package ibuffer-projectile
|
||||
:ensure t)
|
||||
(global-set-key (kbd "C-x C-b") #'ibuffer)
|
||||
|
||||
(add-hook 'ibuffer-mode-hook
|
||||
(lambda ()
|
||||
(ibuffer-projectile-set-filter-groups)))
|
||||
|
||||
(provide 'buffer)
|
||||
|
||||
;;; buffer.el ends here
|
||||
(provide 'core/buffer)
|
||||
|
||||
@@ -1,19 +1,9 @@
|
||||
;;; core-editor
|
||||
;;; editor.el --- General editing defaults -*- lexical-binding: t; -*-
|
||||
|
||||
(require 'ansi-color)
|
||||
|
||||
(setq standard-indent 4)
|
||||
(setq tab-stop-list nil)
|
||||
(setq indent-tabs-mode nil)
|
||||
|
||||
;; Setting variables
|
||||
(setq vc-follow-symlinks 't)
|
||||
(setq vc-handled-backends nil)
|
||||
(setq standard-indent 4
|
||||
indent-tabs-mode nil
|
||||
vc-follow-symlinks t
|
||||
custom-file (null-device))
|
||||
(prefer-coding-system 'utf-8-unix)
|
||||
(setq custom-file (null-device))
|
||||
|
||||
(add-hook 'compilation-filter-hook #'ansi-color-compilation-filter)
|
||||
|
||||
(provide 'editor)
|
||||
|
||||
;;; editor.el ends here
|
||||
(provide 'core/editor)
|
||||
|
||||
@@ -1,183 +1,15 @@
|
||||
;;; keybindings.el -*- lexical-binding: t; -*-
|
||||
;;; keybindings.el --- Native Emacs bindings -*- lexical-binding: t; -*-
|
||||
|
||||
;;;; Global / Core
|
||||
(global-set-key (kbd "C-c a") #'org-agenda)
|
||||
(global-set-key (kbd "C-c c") #'org-capture)
|
||||
|
||||
(global-set-key (kbd "C-x C-b") #'ibuffer)
|
||||
(global-set-key (kbd "C-<return>") 'company-complete)
|
||||
(global-set-key (kbd "M-n f") #'flyspell-buffer)
|
||||
|
||||
(defvar fscotto/leader-map (make-sparse-keymap)
|
||||
"Keymap per comandi sotto C-c.")
|
||||
|
||||
(define-key global-map (kbd "C-c") fscotto/leader-map)
|
||||
|
||||
;;;; Org
|
||||
|
||||
(autoload 'org-agenda "org" nil t)
|
||||
(autoload 'org-capture "org-capture" nil t)
|
||||
|
||||
(define-key fscotto/leader-map (kbd "a") #'org-agenda)
|
||||
(define-key fscotto/leader-map (kbd "c") #'org-capture)
|
||||
|
||||
;;;; Git / Magit
|
||||
(defun fscotto/enable-magit-keymap ()
|
||||
"Enable Git keybindings if current buffer is inside a Git repository."
|
||||
(when (and (require 'magit nil 'noerror)
|
||||
(magit-toplevel))
|
||||
(local-set-key (kbd "C-c g") fscotto/git-map)))
|
||||
|
||||
(defvar fscotto/git-map (make-sparse-keymap)
|
||||
"Keymap for Git commands under C-c g.")
|
||||
|
||||
(add-hook 'find-file-hook #'fscotto/enable-magit-keymap)
|
||||
(add-hook 'prog-mode-hook #'fscotto/enable-magit-keymap)
|
||||
(add-hook 'conf-mode-hook #'fscotto/enable-magit-keymap)
|
||||
|
||||
;; autoload: il tasto carica magit
|
||||
(autoload 'magit-status "magit" nil t)
|
||||
(autoload 'magit-branch "magit" nil t)
|
||||
(autoload 'magit-commit "magit" nil t)
|
||||
(autoload 'magit-push "magit" nil t)
|
||||
(autoload 'magit-fetch "magit" nil t)
|
||||
(global-set-key (kbd "C-x g") #'magit-status)
|
||||
|
||||
;; keybinding (sempre definite nella mappa)
|
||||
(define-key fscotto/git-map (kbd "s") #'magit-status)
|
||||
(define-key fscotto/git-map (kbd "b") #'magit-branch)
|
||||
(define-key fscotto/git-map (kbd "c") #'magit-commit)
|
||||
(define-key fscotto/git-map (kbd "p") #'magit-push)
|
||||
(define-key fscotto/git-map (kbd "f") #'magit-fetch)
|
||||
|
||||
;;;; Open / Tools
|
||||
(defvar fscotto/open (make-sparse-keymap))
|
||||
(define-key fscotto/leader-map (kbd "o") fscotto/open)
|
||||
|
||||
;; -------- vterm --------
|
||||
(autoload 'multi-vterm "multi-vterm" nil t)
|
||||
(define-key fscotto/open (kbd "T") #'fscotto/home-multi-vterm)
|
||||
|
||||
(with-eval-after-load 'vterm
|
||||
(define-key vterm-mode-map (kbd "C-c C-t") #'vterm-copy-mode))
|
||||
|
||||
;; -------- elfeed --------
|
||||
(autoload 'elfeed "elfeed" nil t)
|
||||
(define-key fscotto/open (kbd "f") #'fscotto/elfeed-load-db-and-open)
|
||||
|
||||
;; -------- gptel --------
|
||||
(autoload 'gptel "gptel" nil t)
|
||||
(define-key fscotto/open (kbd "l") #'gptel)
|
||||
|
||||
;; -------- dirvish --------
|
||||
(autoload 'dirvish-dwim "dirvish" nil t)
|
||||
(define-key fscotto/open (kbd "d") #'dirvish-dwim)
|
||||
|
||||
;; -------- ztree --------
|
||||
(autoload 'ztree-diff "ztree" nil t)
|
||||
(define-key fscotto/open (kbd "z") #'ztree-diff)
|
||||
|
||||
;;;; Elfeed mode maps
|
||||
(with-eval-after-load 'elfeed
|
||||
(define-key elfeed-search-mode-map (kbd "w") #'elfeed-search-yank)
|
||||
(define-key elfeed-search-mode-map (kbd "R") #'elfeed-update)
|
||||
(define-key elfeed-search-mode-map (kbd "q") #'elfeed-kill-buffer)
|
||||
|
||||
(define-key elfeed-show-mode-map (kbd "S") #'elfeed-show-new-live-search)
|
||||
(define-key elfeed-show-mode-map (kbd "f") #'elfeed-show-fetch-full-text)
|
||||
(define-key elfeed-show-mode-map (kbd "w") #'elfeed-show-yank))
|
||||
|
||||
;;;; hl-todo
|
||||
(with-eval-after-load 'hl-todo
|
||||
(define-key hl-todo-mode-map (kbd "C-t p") #'hl-todo-previous)
|
||||
(define-key hl-todo-mode-map (kbd "C-t n") #'hl-todo-next)
|
||||
(define-key hl-todo-mode-map (kbd "C-t o") #'hl-todo-occur)
|
||||
(define-key hl-todo-mode-map (kbd "C-t i") #'hl-todo-insert))
|
||||
|
||||
;; Projectile keybindings
|
||||
(define-key fscotto/leader-map (kbd "p") 'projectile-command-map)
|
||||
|
||||
(with-eval-after-load 'projectile
|
||||
(define-key projectile-command-map (kbd "v") #'fscotto/project-multi-vterm)
|
||||
(define-key projectile-command-map (kbd "V") nil)
|
||||
(define-key projectile-command-map (kbd "x") #'fscotto/project-external-terminal)
|
||||
(define-key projectile-command-map (kbd "a") #'fscotto/project-agent-dwim)
|
||||
(define-key projectile-command-map (kbd "A") #'fscotto/project-agent-session)
|
||||
(define-key projectile-command-map (kbd "g") #'fscotto/project-magit-status))
|
||||
|
||||
;;;; LSP
|
||||
(defvar fscotto/lsp-map (make-sparse-keymap))
|
||||
|
||||
(autoload 'lsp-find-definition "lsp-mode" nil t)
|
||||
(autoload 'lsp-find-type-definition "lsp-mode" nil t)
|
||||
(autoload 'lsp-find-implementation "lsp-mode" nil t)
|
||||
(autoload 'lsp-execute-code-action "lsp-mode" nil t)
|
||||
(autoload 'lsp-rename "lsp-mode" nil t)
|
||||
(autoload 'lsp-format-buffer "lsp-mode" nil t)
|
||||
(autoload 'lsp-restart-workspace "lsp-mode" nil t)
|
||||
|
||||
(autoload 'consult-lsp-symbols "consult-lsp" nil t)
|
||||
(autoload 'consult-lsp-diagnostics "consult-lsp" nil t)
|
||||
|
||||
(define-key fscotto/lsp-map (kbd "s") #'consult-lsp-symbols)
|
||||
(define-key fscotto/lsp-map (kbd "e") #'consult-lsp-diagnostics)
|
||||
(define-key fscotto/lsp-map (kbd "d") #'lsp-find-definition)
|
||||
(define-key fscotto/lsp-map (kbd "D") #'lsp-find-type-definition)
|
||||
(define-key fscotto/lsp-map (kbd "i") #'lsp-find-implementation)
|
||||
(define-key fscotto/lsp-map (kbd "a") #'lsp-execute-code-action)
|
||||
(define-key fscotto/lsp-map (kbd "r") #'lsp-rename)
|
||||
(define-key fscotto/lsp-map (kbd "f") #'lsp-format-buffer)
|
||||
(define-key fscotto/lsp-map (kbd "R") #'lsp-restart-workspace)
|
||||
|
||||
(defun fscotto/enable-lsp-keymap ()
|
||||
"Enable LSP keybindings if LSP is active in the current buffer."
|
||||
(when (and (bound-and-true-p lsp-mode)
|
||||
(lsp-workspaces))
|
||||
(local-set-key (kbd "C-c l") fscotto/lsp-map)))
|
||||
|
||||
(add-hook 'lsp-mode-hook #'fscotto/enable-lsp-keymap)
|
||||
(add-hook 'lsp-after-initialize-hook #'fscotto/enable-lsp-keymap)
|
||||
(add-hook 'lsp-after-open-hook #'fscotto/enable-lsp-keymap)
|
||||
|
||||
;;;; DAP
|
||||
(defvar fscotto/dap-map (make-sparse-keymap)
|
||||
"Keymap for DAP commands under C-c d.")
|
||||
|
||||
(autoload 'dap-debug "dap-mode" nil t)
|
||||
(autoload 'dap-breakpoint-toggle "dap-mode" nil t)
|
||||
(autoload 'dap-continue "dap-mode" nil t)
|
||||
(autoload 'dap-next "dap-mode" nil t)
|
||||
(autoload 'dap-step-in "dap-mode" nil t)
|
||||
(autoload 'dap-step-out "dap-mode" nil t)
|
||||
(autoload 'dap-restart-frame "dap-mode" nil t)
|
||||
(autoload 'dap-disconnect "dap-mode" nil t)
|
||||
|
||||
(define-key fscotto/dap-map (kbd "d") #'dap-debug)
|
||||
(define-key fscotto/dap-map (kbd "b") #'dap-breakpoint-toggle)
|
||||
(define-key fscotto/dap-map (kbd "c") #'dap-continue)
|
||||
(define-key fscotto/dap-map (kbd "n") #'dap-next)
|
||||
(define-key fscotto/dap-map (kbd "i") #'dap-step-in)
|
||||
(define-key fscotto/dap-map (kbd "o") #'dap-step-out)
|
||||
(define-key fscotto/dap-map (kbd "r") #'dap-restart-frame)
|
||||
(define-key fscotto/dap-map (kbd "q") #'dap-disconnect)
|
||||
|
||||
(defun fscotto/enable-dap-keymap ()
|
||||
"Enable DAP keybindings if dap-mode is active in the current buffer."
|
||||
(when (bound-and-true-p dap-mode)
|
||||
(local-set-key (kbd "C-c d") fscotto/dap-map)))
|
||||
|
||||
(add-hook 'dap-mode-hook #'fscotto/enable-dap-keymap)
|
||||
(add-hook 'dap-session-created-hook #'fscotto/enable-dap-keymap)
|
||||
(add-hook 'dap-terminated-hook #'fscotto/enable-dap-keymap)
|
||||
|
||||
;;;; Go
|
||||
|
||||
(with-eval-after-load 'go-ts-mode
|
||||
(define-key go-ts-mode-map (kbd "C-c m t") #'fscotto/go-mod-tidy)
|
||||
(define-key go-ts-mode-map (kbd "C-c m d") #'fscotto/go-mod-download)
|
||||
(define-key go-ts-mode-map (kbd "C-c t p") #'fscotto/go-test-package)
|
||||
(define-key go-ts-mode-map (kbd "C-c t a") #'fscotto/go-test-module)
|
||||
(define-key go-ts-mode-map (kbd "C-c t t") #'fscotto/go-test-current-test)
|
||||
(define-key go-ts-mode-map (kbd "C-c d t") #'dap-debug))
|
||||
(defvar fscotto/export-map (make-sparse-keymap)
|
||||
"Native Emacs prefix map for document exports.")
|
||||
(global-set-key (kbd "C-c e") fscotto/export-map)
|
||||
(define-key fscotto/export-map (kbd "p") #'fscotto/org-export-pdf)
|
||||
(define-key fscotto/export-map (kbd "h") #'fscotto/org-export-html)
|
||||
(define-key fscotto/export-map (kbd "m") #'fscotto/org-export-markdown)
|
||||
(define-key fscotto/export-map (kbd "d") #'fscotto/org-export-docx)
|
||||
(define-key fscotto/export-map (kbd "o") #'fscotto/org-export-odt)
|
||||
|
||||
(provide 'core/keybindings)
|
||||
|
||||
;;; keybindings.el ends here
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
;;; modal.el --- Vim motions for the desktop Emacs profile -*- lexical-binding: t; -*-
|
||||
|
||||
(use-package evil
|
||||
:ensure t
|
||||
:init
|
||||
(setq evil-want-C-u-scroll t
|
||||
evil-want-C-i-jump nil
|
||||
evil-undo-system 'undo-redo)
|
||||
:config
|
||||
(evil-mode 1)
|
||||
(evil-define-key '(normal visual motion) 'global
|
||||
(kbd "SPC") fscotto/leader-map))
|
||||
|
||||
(provide 'modal)
|
||||
|
||||
;;; modal.el ends here
|
||||
@@ -1,22 +1,15 @@
|
||||
;;; core-performance.el -*-
|
||||
;;; performance.el --- Conservative startup settings -*- lexical-binding: t; -*-
|
||||
|
||||
;; --- Startup speed tweaks ----------------------------------------------------
|
||||
;; Temporarily increase GC threshold during init
|
||||
(defvar fscotto/gc-cons-threshold-orig gc-cons-threshold)
|
||||
(setq gc-cons-threshold (* 50 1000 1000)) ;; 50MB for init
|
||||
|
||||
;; Speedup file-name-handler during init
|
||||
(defvar fscotto/file-name-handler-alist-orig file-name-handler-alist)
|
||||
(setq file-name-handler-alist nil)
|
||||
(setq gc-cons-threshold (* 50 1000 1000)
|
||||
file-name-handler-alist nil
|
||||
inhibit-compacting-font-caches t)
|
||||
|
||||
;; Restore after init
|
||||
(add-hook 'emacs-startup-hook
|
||||
(lambda ()
|
||||
(setq gc-cons-threshold fscotto/gc-cons-threshold-orig)
|
||||
(setq file-name-handler-alist fscotto/file-name-handler-alist-orig)
|
||||
(setq gc-cons-threshold fscotto/gc-cons-threshold-orig
|
||||
file-name-handler-alist fscotto/file-name-handler-alist-orig)
|
||||
(garbage-collect)))
|
||||
|
||||
;; LSP responsiveness
|
||||
(setq read-process-output-max (* 1024 1024)) ;; 1MB, utile per lsp-mode
|
||||
(setq lsp-idle-delay 0.5) ;; meno ritardo prima che LSP aggiorni info
|
||||
(setq inhibit-compacting-font-caches t)
|
||||
(provide 'core/performance)
|
||||
|
||||
@@ -1,73 +1,28 @@
|
||||
;;; core-ui.el -*- lexical-binding: t; -*-
|
||||
;;; ui.el --- Authoring UI -*- lexical-binding: t; -*-
|
||||
|
||||
;; Load default theme
|
||||
;; Keep the established desktop appearance while leaving IDE-specific UI out.
|
||||
(require 'use-package)
|
||||
(use-package nordic-night-theme
|
||||
:ensure t
|
||||
:config
|
||||
(load-theme 'nordic-night t))
|
||||
|
||||
;; Setting default font
|
||||
(set-frame-font "UbuntuSansMono Nerd Font 14" nil t)
|
||||
|
||||
(add-to-list 'default-frame-alist
|
||||
'(font . "UbuntuSansMono Nerd Font-14"))
|
||||
|
||||
;; Remove toolbar
|
||||
(tool-bar-mode -1)
|
||||
|
||||
;; Remove menu
|
||||
(menu-bar-mode -1)
|
||||
|
||||
;; Disable startup screen
|
||||
(setq inhibit-startup-screen t)
|
||||
|
||||
;; Disable splash screen
|
||||
(setq inhibit-splash-screen t)
|
||||
|
||||
;; Start all frames maximized
|
||||
(add-to-list 'default-frame-alist '(font . "UbuntuSansMono Nerd Font-14"))
|
||||
(add-to-list 'default-frame-alist '(fullscreen . maximized))
|
||||
|
||||
;; Remove scrollbar
|
||||
(tool-bar-mode -1)
|
||||
(menu-bar-mode -1)
|
||||
(scroll-bar-mode -1)
|
||||
|
||||
;; Simple 'y' for 'yes' and 'n' for 'no'
|
||||
(setq inhibit-startup-screen t
|
||||
inhibit-splash-screen t
|
||||
fill-column 120
|
||||
undo-limit 8000000
|
||||
undo-strong-limit 12000000
|
||||
scroll-step 3
|
||||
ring-bell-function 'ignore)
|
||||
(defalias 'yes-or-no-p 'y-or-n-p)
|
||||
|
||||
;; Set global value for paragraph witdh
|
||||
(setq-default fill-column 120)
|
||||
|
||||
;; Stop Emacs from losing informations
|
||||
(setq undo-limit 8000000)
|
||||
(setq undo-strong-limit 12000000)
|
||||
|
||||
;; Smooth scroll
|
||||
(setq scroll-step 3)
|
||||
(setq ring-bell-function 'ignore)
|
||||
|
||||
;; Add column number in the status line
|
||||
(column-number-mode)
|
||||
|
||||
;; View clock in the status line
|
||||
(display-time)
|
||||
|
||||
;; Enable line numbers in the programming mode only
|
||||
(add-hook 'prog-mode-hook 'display-line-numbers-mode)
|
||||
|
||||
;; Enable line numbers in the configuration mode only
|
||||
(add-hook 'conf-mode-hook 'display-line-numbers-mode)
|
||||
|
||||
;; Highlight keywords to remember the activity when coding.
|
||||
(use-package hl-todo
|
||||
:ensure t
|
||||
:commands (global-hl-todo-mode)
|
||||
:init (global-hl-todo-mode))
|
||||
|
||||
(setq hl-todo-keyword-faces
|
||||
'(("TODO" . "#94e2d5")
|
||||
("FIXME" . "#f38ba8")
|
||||
("DEBUG" . "#cba6f7")
|
||||
("GOTCHA" . "#eba0ac")
|
||||
("STUB" . "#89b4fa")))
|
||||
|
||||
(provide 'ui)
|
||||
;;; ui.el ends here
|
||||
(provide 'core/ui)
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
;; c.el -*- lexical-binding: t; -*-
|
||||
|
||||
;; C / C++ fallback style (Linux-like)
|
||||
(setq c-default-style "linux"
|
||||
c-basic-offset 4
|
||||
tab-width 8)
|
||||
|
||||
(add-hook 'c-mode-common-hook
|
||||
(lambda ()
|
||||
(setq indent-tabs-mode t)))
|
||||
|
||||
;; Tree-sitter C/C++
|
||||
(setq c-ts-mode-indent-offset 4)
|
||||
(setq c++-ts-mode-indent-offset 4)
|
||||
|
||||
(with-eval-after-load 'lsp
|
||||
;; Clangd configurations
|
||||
(setq lsp-clients-clangd-args
|
||||
'("--background-index"
|
||||
"--clang-tidy"
|
||||
"--completion-style=detailed"
|
||||
"--header-insertion=never"
|
||||
"--header-insertion-decorators"
|
||||
"--pch-storage=memory"
|
||||
"--log=error"
|
||||
"--ranking-model=heuristics"
|
||||
"--malloc-trim"
|
||||
"--limit-results=500"
|
||||
"--limit-references=2000")))
|
||||
|
||||
(with-eval-after-load 'dap-mode
|
||||
(require 'dap-cpptools))
|
||||
|
||||
(add-hook 'c-ts-mode-hook #'fscotto/disable-c-formatting)
|
||||
(add-hook 'c-mode-hook #'fscotto/disable-c-formatting)
|
||||
|
||||
(provide 'c)
|
||||
|
||||
;;; c.el ends here
|
||||
@@ -1,8 +0,0 @@
|
||||
;;; docker.el -*- lexical-binding: t; -*-
|
||||
|
||||
(use-package dockerfile-mode
|
||||
:ensure t)
|
||||
|
||||
(provide 'docker)
|
||||
|
||||
;;; docker.el ends here
|
||||
@@ -1,89 +0,0 @@
|
||||
;;=================================================================
|
||||
;; Go Language Support
|
||||
;;=================================================================
|
||||
|
||||
(use-package go-ts-mode
|
||||
:ensure nil
|
||||
:mode "\\.go\\'"
|
||||
:hook
|
||||
((go-ts-mode . lsp-deferred)
|
||||
(go-ts-mode . fscotto/go-format-on-save)))
|
||||
|
||||
(use-package go-mod-ts-mode
|
||||
:ensure nil
|
||||
:mode
|
||||
(("/go\\.mod\\'" . go-mod-ts-mode)
|
||||
("/go\\.sum\\'" . go-mod-ts-mode))
|
||||
:hook
|
||||
((go-mod-ts-mode . lsp-deferred)
|
||||
;; restart gopls only when go.mod/go.sum are saved (buffer-local)
|
||||
(go-mod-ts-mode . (lambda ()
|
||||
(add-hook 'after-save-hook
|
||||
(lambda ()
|
||||
(when (lsp-workspaces)
|
||||
(lsp-restart-workspace)))
|
||||
nil t)))))
|
||||
|
||||
(with-eval-after-load 'project
|
||||
(add-to-list 'project-vc-extra-root-markers "go.mod"))
|
||||
|
||||
(with-eval-after-load 'lsp-mode
|
||||
;; gopls settings (single source of truth)
|
||||
(lsp-register-custom-settings
|
||||
'(("gopls.staticcheck" t)
|
||||
("gopls.gofumpt" t)
|
||||
;; ("gopls.experimentalWorkspaceModule" t)
|
||||
("gopls.expandWorkspaceToModule" t)
|
||||
("gopls.directoryFilters" ["-vendor"])
|
||||
("gopls.analyses.unusedparams" t)
|
||||
("gopls.analyses.shadow" t)
|
||||
("gopls.analyses.nilness" t)
|
||||
("gopls.analyses.useany" t)
|
||||
("gopls.env" ((GO111MODULE . "on"))))))
|
||||
|
||||
(with-eval-after-load 'flycheck
|
||||
;; Usa golangci-lint in Go
|
||||
(add-hook 'go-ts-mode-hook
|
||||
(lambda ()
|
||||
(setq-local flycheck-checker 'golangci-lint)
|
||||
(setq-local flycheck-check-syntax-automatically '(save mode-enabled))
|
||||
(flycheck-mode 1))))
|
||||
|
||||
(use-package dap-dlv-go
|
||||
:after (dap-mode go-ts-mode))
|
||||
|
||||
(with-eval-after-load 'dap-dlv-go
|
||||
;; Debug all tests in module
|
||||
(dap-register-debug-template
|
||||
"Go :: Debug all tests"
|
||||
(list :type "go"
|
||||
:request "launch"
|
||||
:name "Go :: Debug all tests"
|
||||
:mode "test"
|
||||
:program "${workspaceFolder}"
|
||||
:cwd "${workspaceFolder}"))
|
||||
|
||||
;; Debug tests in current package
|
||||
(dap-register-debug-template
|
||||
"Go :: Debug package tests"
|
||||
(list :type "go"
|
||||
:request "launch"
|
||||
:name "Go :: Debug package tests"
|
||||
:mode "test"
|
||||
:program "${fileDirname}"
|
||||
:cwd "${fileDirname}"))
|
||||
|
||||
;; Debug test at point
|
||||
(dap-register-debug-template
|
||||
"Go :: Debug test at point"
|
||||
(list :type "go"
|
||||
:request "launch"
|
||||
:name "Go :: Debug test at point"
|
||||
:mode "test"
|
||||
:program "${fileDirname}"
|
||||
:cwd "${fileDirname}"
|
||||
:args (list "-test.run" "${input:testName}"))))
|
||||
|
||||
(add-hook 'dap-terminated-hook
|
||||
(lambda (_)
|
||||
(delete-other-windows)))
|
||||
@@ -1,24 +0,0 @@
|
||||
;;; json.el -*- lexical-binding: t -*-
|
||||
|
||||
(defun fscotto/json-maybe-start-lsp ()
|
||||
"Start LSP for JSON buffers when lsp-mode is available."
|
||||
(when (fboundp 'lsp-deferred)
|
||||
(lsp-deferred)))
|
||||
|
||||
(use-package json-mode
|
||||
:ensure t
|
||||
:mode
|
||||
(("\\.json\\'" . json-mode)
|
||||
("\\.jsonc\\'" . json-mode))
|
||||
:hook
|
||||
(json-mode . fscotto/json-maybe-start-lsp))
|
||||
|
||||
(with-eval-after-load 'json-ts-mode
|
||||
(add-hook 'json-ts-mode-hook #'fscotto/json-maybe-start-lsp))
|
||||
|
||||
(with-eval-after-load 'jsonc-mode
|
||||
(add-hook 'jsonc-mode-hook #'fscotto/json-maybe-start-lsp))
|
||||
|
||||
(provide 'json)
|
||||
|
||||
;;; json.el ends here
|
||||
@@ -1,15 +0,0 @@
|
||||
;;; markdown.el -*- lexical-binding: t; -*-
|
||||
|
||||
(use-package markdown-mode
|
||||
:ensure t
|
||||
:mode ("\\.md\\'" . gfm-mode)
|
||||
:config
|
||||
(setq markdown-fontify-code-blocks-natively t)
|
||||
(setq markdown-live-preview-mode t))
|
||||
|
||||
(use-package markdown-toc
|
||||
:ensure t)
|
||||
|
||||
(provide 'lang/markdown)
|
||||
|
||||
;;; markdown.el ends here
|
||||
@@ -1,167 +1,69 @@
|
||||
;;; org.el -*- lexical-binding: t; -*-
|
||||
;;; org.el --- Org authoring workflow -*- lexical-binding: t; -*-
|
||||
|
||||
(use-package htmlize
|
||||
:ensure t)
|
||||
(require 'org)
|
||||
(require 'org-capture)
|
||||
(require 'org-agenda)
|
||||
(require 'org-id)
|
||||
(require 'org-tempo)
|
||||
(require 'ox)
|
||||
(require 'ox-html)
|
||||
(require 'ox-latex)
|
||||
(require 'ox-md)
|
||||
(require 'ox-odt)
|
||||
|
||||
;; Setting default directory for Org files.
|
||||
(setq org-directory "~/Org")
|
||||
(setq org-directory (expand-file-name "Org" (getenv "HOME"))
|
||||
org-default-notes-file (expand-file-name "inbox.org" org-directory)
|
||||
org-agenda-files (list org-default-notes-file
|
||||
(expand-file-name "agenda.org" org-directory)
|
||||
(expand-file-name "notes.org" org-directory)
|
||||
(expand-file-name "meetings" org-directory)
|
||||
(expand-file-name "projects" org-directory))
|
||||
org-todo-keywords '((sequence "TODO(t)" "NEXT(n)" "WAIT(w)" "|" "DONE(d)" "CANCELLED(c)"))
|
||||
org-tag-alist '((:startgroup) ("work" . ?w) ("personal" . ?p) ("meeting" . ?m)
|
||||
("documentation" . ?d) (:endgroup))
|
||||
org-startup-indented t
|
||||
org-startup-folded 'content
|
||||
org-hide-leading-stars t
|
||||
org-hide-emphasis-markers t
|
||||
org-return-follows-link t
|
||||
org-src-fontify-natively t
|
||||
org-src-tab-acts-natively t
|
||||
org-fontify-quote-and-verse-blocks t
|
||||
org-export-with-smart-quotes t
|
||||
org-html-doctype "html5"
|
||||
org-html-html5-fancy t
|
||||
org-html-head-include-default-style nil
|
||||
org-html-head "<link rel=\"stylesheet\" href=\"org.css\" type=\"text/css\" />"
|
||||
org-latex-compiler "lualatex"
|
||||
org-latex-pdf-process '("latexmk -lualatex -interaction=nonstopmode -output-directory=%o %f"))
|
||||
|
||||
(defvar org-notes-file (expand-file-name "notes.org" org-directory)
|
||||
"Default Org notes file.")
|
||||
;; Keep the LuaLaTeX dependency set small while retaining text, tables, links,
|
||||
;; and images in exported documents.
|
||||
(setq org-latex-default-packages-alist
|
||||
'(("" "amsmath" t ("lualatex" "xetex"))
|
||||
("" "fontspec" t ("lualatex" "xetex"))
|
||||
("" "graphicx" t)
|
||||
("" "longtable" nil)
|
||||
("" "hyperref" nil)))
|
||||
|
||||
(defvar org-calendar-file (expand-file-name "calendar.org" org-directory)
|
||||
"Default Org calendar file.")
|
||||
(setq org-capture-templates
|
||||
`(("t" "TODO" entry (file ,org-default-notes-file)
|
||||
"* TODO %?\n:PROPERTIES:\n:CREATED: %U\n:END:\n")
|
||||
("n" "Note" entry (file ,(expand-file-name "notes.org" org-directory))
|
||||
"* %U %?\n")
|
||||
("m" "Meeting" entry (file+olp+datetree ,(expand-file-name "meetings/meetings.org" org-directory))
|
||||
"* %^{Title} :meeting:\n%U\n%?\n")
|
||||
("d" "Document idea" entry (file ,(expand-file-name "documentation/ideas.org" org-directory))
|
||||
"* IDEA %? :documentation:\n%U\n")))
|
||||
|
||||
(defface +org-todo-active
|
||||
'((t (:foreground "#51afef" :weight bold)))
|
||||
"Face for active Org TODO states.")
|
||||
(add-hook 'org-mode-hook #'org-indent-mode)
|
||||
(add-hook 'org-mode-hook #'visual-line-mode)
|
||||
(add-hook 'org-mode-hook #'flyspell-mode)
|
||||
|
||||
(defface +org-todo-project
|
||||
'((t (:foreground "#c678dd" :weight bold)))
|
||||
"Face for project Org TODO states.")
|
||||
|
||||
(defface +org-todo-onhold
|
||||
'((t (:foreground "#ECBE7B" :weight bold)))
|
||||
"Face for waiting Org TODO states.")
|
||||
|
||||
(defface +org-todo-cancel
|
||||
'((t (:foreground "#ff6c6b" :weight bold)))
|
||||
"Face for cancelled Org TODO states.")
|
||||
|
||||
(use-package org
|
||||
:init
|
||||
(setq org-clock-mode-line-total 'today
|
||||
org-fontify-done-headline t
|
||||
org-fontify-quote-and-verse-blocks t
|
||||
org-indent-mode t
|
||||
org-agenda-skip-unavailable-files t
|
||||
org-return-follows-link t
|
||||
org-src-fontify-natively t
|
||||
org-src-tab-acts-natively t
|
||||
org-startup-folded 'content
|
||||
org-hide-leading-stars t
|
||||
org-hide-emphasis-markers t
|
||||
org-id-link-to-org-use-this t
|
||||
org-id-track-globally t
|
||||
org-todo-keywords
|
||||
'((sequence
|
||||
"TODO(t)"
|
||||
"PROJ(p)"
|
||||
"LOOP(r)"
|
||||
"STRT(s)"
|
||||
"WAIT(w)"
|
||||
"HOLD(h)"
|
||||
"IDEA(i)"
|
||||
"|"
|
||||
"DONE(d)"
|
||||
"KILL(k)")
|
||||
(sequence
|
||||
"[ ](T)"
|
||||
"[-](S)"
|
||||
"[?](W)"
|
||||
"|"
|
||||
"[X](D)")
|
||||
(sequence
|
||||
"|"
|
||||
"OKAY(o)"
|
||||
"YES(y)"
|
||||
"NO(n)"))
|
||||
org-todo-keyword-faces
|
||||
'(("[-]" . +org-todo-active)
|
||||
("STRT" . +org-todo-active)
|
||||
("[?]" . +org-todo-onhold)
|
||||
("WAIT" . +org-todo-onhold)
|
||||
("HOLD" . +org-todo-onhold)
|
||||
("PROJ" . +org-todo-project)
|
||||
("NO" . +org-todo-cancel)
|
||||
("KILL" . +org-todo-cancel))
|
||||
org-export-backends '(html latex odt md ascii icalendar)
|
||||
org-latex-pdf-process '("pdflatex -interaction nonstopmode %f"
|
||||
"pdflatex -interaction nonstopmode %f")
|
||||
org-latex-default-class "article"
|
||||
org-html-doctype "html5"
|
||||
org-html-html5-fancy t
|
||||
org-default-notes-file (expand-file-name "inbox.org" org-directory)
|
||||
org-agenda-files (mapcar (lambda (file)
|
||||
(expand-file-name file org-directory))
|
||||
'("inbox.org" "tasks.org" "calendar.org" "notes.org"))
|
||||
org-capture-templates
|
||||
'(("t" "Task" entry
|
||||
(file org-default-notes-file)
|
||||
"* TODO %?\n:PROPERTIES:\n:CREATED: %U\n:END:\n")
|
||||
("n" "Note" entry
|
||||
(file org-notes-file)
|
||||
"* %U %?\n")
|
||||
("e" "Event" entry
|
||||
(file org-calendar-file)
|
||||
"* %?\nSCHEDULED: %^T\n")))
|
||||
:config
|
||||
(require 'org-tempo)
|
||||
(require 'org-id)
|
||||
(require 'org-protocol)
|
||||
(add-to-list 'org-src-lang-modes '("go" . go-ts))
|
||||
(add-to-list 'org-src-lang-modes '("rust" . rust-ts))
|
||||
(add-hook 'org-mode-hook 'org-indent-mode))
|
||||
|
||||
(use-package org-appear
|
||||
:ensure t
|
||||
:hook (org-mode . org-appear-mode))
|
||||
|
||||
(use-package org-bullets
|
||||
:ensure t
|
||||
:init
|
||||
(setq org-bullets-bullet-list '("❯" "❯❯" "❯❯❯" "❯❯❯❯" "❯❯❯❯❯"))
|
||||
:config
|
||||
(add-hook 'org-mode-hook 'org-bullets-mode))
|
||||
|
||||
(use-package org-re-reveal
|
||||
:ensure t
|
||||
:init
|
||||
(setq org-re-reveal-transition 'none
|
||||
org-re-reveal-theme "dracula"))
|
||||
|
||||
(use-package org-alert
|
||||
:ensure t
|
||||
:after org
|
||||
:config
|
||||
(setq alert-default-style 'libnotify
|
||||
org-alert-interval 300
|
||||
org-alert-notify-cutoff 5
|
||||
org-alert-notify-after-event-cutoff 10
|
||||
org-alert-notification-title "Org Agenda")
|
||||
(add-hook 'org-agenda-mode-hook #'org-alert-enable))
|
||||
|
||||
(use-package ob-mermaid
|
||||
:ensure t
|
||||
:init
|
||||
(setq ob-mermaid-cli-path (or (executable-find "mmdc") "mmdc")))
|
||||
|
||||
(use-package ob-go
|
||||
:ensure t
|
||||
:after org)
|
||||
|
||||
(use-package ob-rust
|
||||
:ensure t
|
||||
:after org)
|
||||
(org-babel-do-load-languages
|
||||
'org-babel-load-languages
|
||||
'((shell . t)
|
||||
(python . t)
|
||||
(C . t)))
|
||||
|
||||
(provide 'lang/org)
|
||||
|
||||
(with-eval-after-load 'org
|
||||
(require 'ob-C)
|
||||
(require 'ob-emacs-lisp)
|
||||
(require 'ob-go)
|
||||
(require 'ob-perl)
|
||||
(require 'ob-python)
|
||||
(require 'ob-rust)
|
||||
(require 'ob-shell)
|
||||
(org-babel-do-load-languages
|
||||
'org-babel-load-languages
|
||||
'((C . t)
|
||||
(emacs-lisp . t)
|
||||
(go . t)
|
||||
(perl . t)
|
||||
(python . t)
|
||||
(rust . t)
|
||||
(shell . t))))
|
||||
|
||||
;;; org.el ends here
|
||||
|
||||
@@ -1,111 +0,0 @@
|
||||
;;; python.el -*- lexical-binding: t; -*-
|
||||
|
||||
(use-package reformatter
|
||||
:ensure t
|
||||
:demand t)
|
||||
|
||||
(with-eval-after-load 'project
|
||||
(add-to-list 'project-vc-extra-root-markers "pyproject.toml")
|
||||
(add-to-list 'project-vc-extra-root-markers "uv.lock")
|
||||
(add-to-list 'project-vc-extra-root-markers ".venv"))
|
||||
|
||||
(defun fscotto/python-project-root ()
|
||||
"Return project root for Python projects, nil otherwise."
|
||||
(when (and (featurep 'project)
|
||||
(project-current))
|
||||
(let ((root (project-root (project-current))))
|
||||
(when (or (file-exists-p (expand-file-name "pyproject.toml" root))
|
||||
(file-exists-p (expand-file-name "uv.lock" root)))
|
||||
root))))
|
||||
|
||||
(defun fscotto/python-project-has-uv-p ()
|
||||
"Return t if current project uses uv (pyproject.toml or uv.lock)."
|
||||
(when-let ((root (fscotto/python-project-root)))
|
||||
(or (file-exists-p (expand-file-name "uv.lock" root))
|
||||
(file-exists-p (expand-file-name "pyproject.toml" root)))))
|
||||
|
||||
(defun fscotto/python-project-bin (tool)
|
||||
"Return path to TOOL in .venv/bin if it exists, else nil."
|
||||
(when-let ((root (fscotto/python-project-root)))
|
||||
(let ((venv-bin (expand-file-name (concat ".venv/bin/" tool) root)))
|
||||
(when (and (file-exists-p venv-bin)
|
||||
(file-executable-p venv-bin))
|
||||
venv-bin))))
|
||||
|
||||
(defun fscotto/python-activate-project-tools ()
|
||||
"Prefer tools from the project virtualenv when available."
|
||||
(when-let* ((root (fscotto/python-project-root))
|
||||
(venv-bin (expand-file-name ".venv/bin" root))
|
||||
((file-directory-p venv-bin)))
|
||||
(make-local-variable 'exec-path)
|
||||
(add-to-list 'exec-path venv-bin)
|
||||
(setq-local process-environment (copy-sequence process-environment))
|
||||
(setenv "PATH" (concat venv-bin path-separator (getenv "PATH")))))
|
||||
|
||||
(defun fscotto/resolve-pylsp ()
|
||||
"Return the pylsp binary path if found, else nil.
|
||||
Checks: project .venv, uv tool install path, and PATH."
|
||||
(or (fscotto/python-project-bin "pylsp")
|
||||
(let ((uv-pylsp (expand-file-name "pylsp"
|
||||
(concat (getenv "HOME")
|
||||
"/.local/share/uv/tools/python-lsp-server/bin"))))
|
||||
(when (and (file-exists-p uv-pylsp)
|
||||
(file-executable-p uv-pylsp))
|
||||
uv-pylsp))
|
||||
(executable-find "pylsp")))
|
||||
|
||||
(defun fscotto/python-lsp-server-available-p ()
|
||||
"Return non-nil when a supported Python LSP server is available."
|
||||
(fscotto/resolve-pylsp))
|
||||
|
||||
(defun fscotto/python-ensure-lsp-server ()
|
||||
"Start Python LSP when its Ansible-managed pylsp executable is available."
|
||||
(cond
|
||||
((not (fboundp 'lsp-deferred))
|
||||
(message "python: lsp-mode not available"))
|
||||
((fscotto/python-lsp-server-available-p)
|
||||
(setq lsp-pylsp-server-command (fscotto/resolve-pylsp))
|
||||
(lsp-deferred))
|
||||
(t
|
||||
(message "python: pylsp not found; run the desktop Ansible profile"))))
|
||||
|
||||
(defun fscotto/python-maybe-start-lsp ()
|
||||
"Start Python LSP when pylsp is available."
|
||||
(fscotto/python-ensure-lsp-server))
|
||||
|
||||
(defun fscotto/python-setup-check-command ()
|
||||
"Use Ruff for the built-in Python check command."
|
||||
(setq-local python-check-command "ruff check"))
|
||||
|
||||
(reformatter-define fscotto/ruff-format
|
||||
:program (or (fscotto/python-project-bin "ruff") (executable-find "ruff"))
|
||||
:args '("format" "-")
|
||||
:lighter " ruff")
|
||||
|
||||
(with-eval-after-load 'python
|
||||
(add-hook 'python-mode-hook #'fscotto/python-activate-project-tools)
|
||||
(add-hook 'python-mode-hook #'fscotto/python-setup-check-command)
|
||||
(add-hook 'python-mode-hook #'fscotto/ruff-format-on-save-mode)
|
||||
(add-hook 'python-mode-hook #'fscotto/python-maybe-start-lsp))
|
||||
|
||||
(with-eval-after-load 'python-ts-mode
|
||||
(add-hook 'python-ts-mode-hook #'fscotto/python-activate-project-tools)
|
||||
(add-hook 'python-ts-mode-hook #'fscotto/python-setup-check-command)
|
||||
(add-hook 'python-ts-mode-hook #'fscotto/ruff-format-on-save-mode)
|
||||
(add-hook 'python-ts-mode-hook #'fscotto/python-maybe-start-lsp))
|
||||
|
||||
(with-eval-after-load 'lsp-mode
|
||||
(add-to-list 'lsp-language-id-configuration '(python-mode . "python"))
|
||||
(add-to-list 'lsp-language-id-configuration '(python-ts-mode . "python"))
|
||||
(setq lsp-pylsp-server-command (fscotto/resolve-pylsp))
|
||||
(setq lsp-pylsp-plugins
|
||||
'((pycodestyle nil)
|
||||
(pyflakes nil)
|
||||
(mccabe nil)
|
||||
(autopep8 nil)
|
||||
(yapf nil)))
|
||||
(add-to-list 'lsp-disabled-clients 'pyls))
|
||||
|
||||
(provide 'lang/python)
|
||||
|
||||
;;; python.el ends here
|
||||
@@ -1,11 +0,0 @@
|
||||
(with-eval-after-load 'flycheck
|
||||
(add-hook 'bash-ts-mode-hook 'flycheck-mode))
|
||||
|
||||
(use-package reformatter
|
||||
:ensure t
|
||||
:config
|
||||
(reformatter-define shfmt-format
|
||||
:program "shfmt"
|
||||
:args '("-i" "2" "-ci")))
|
||||
|
||||
(add-hook 'bash-ts-mode-hook #'shfmt-format-on-save-mode)
|
||||
@@ -1,8 +0,0 @@
|
||||
;;; yaml.el -*- lexical-binding: t; -*-
|
||||
|
||||
(use-package yaml-mode
|
||||
:ensure t)
|
||||
|
||||
(provide 'yaml)
|
||||
|
||||
;;; yaml.el ends here
|
||||
@@ -1,318 +0,0 @@
|
||||
(require 'seq)
|
||||
(require 'subr-x)
|
||||
;;makes sure elfeed reads index from disk before launching
|
||||
(defvar fscotto/elfeed-initial-update-done nil
|
||||
"Non-nil once Elfeed has triggered its first automatic update this session.")
|
||||
|
||||
(defvar fscotto/elfeed-update-timer nil
|
||||
"Timer used for periodic Elfeed updates.")
|
||||
|
||||
(defun fscotto/elfeed-auto-update ()
|
||||
"Refresh Elfeed feeds in the background."
|
||||
(when (require 'elfeed nil 'noerror)
|
||||
(require 'elfeed-db)
|
||||
(elfeed-db-load)
|
||||
(elfeed-update)))
|
||||
|
||||
(defun fscotto/elfeed-start-auto-update ()
|
||||
"Start the periodic Elfeed update timer if needed."
|
||||
(unless (timerp fscotto/elfeed-update-timer)
|
||||
(setq fscotto/elfeed-update-timer
|
||||
(run-at-time "15 min" (* 15 60) #'fscotto/elfeed-auto-update))))
|
||||
|
||||
(defun fscotto/elfeed-load-db-and-open ()
|
||||
"Open Elfeed, updating once per session and then every 15 minutes.
|
||||
|
||||
Based on https://pragmaticemacs.wordpress.com/2016/08/17/read-your-rss-feeds-in-emacs-with-elfeed/
|
||||
Created: 2016-08-17
|
||||
Updated: 2025-06-13"
|
||||
(interactive)
|
||||
(require 'elfeed)
|
||||
(require 'elfeed-db)
|
||||
(elfeed-db-load)
|
||||
(elfeed)
|
||||
(fscotto/elfeed-start-auto-update)
|
||||
(unless fscotto/elfeed-initial-update-done
|
||||
(setq fscotto/elfeed-initial-update-done t)
|
||||
(message "Updating Elfeed feeds...")
|
||||
(elfeed-update)))
|
||||
|
||||
(defun fscotto/project-root ()
|
||||
"Return projectile project root or fallback to default-directory."
|
||||
(if (featurep 'projectile)
|
||||
(or (projectile-project-root) default-directory)
|
||||
default-directory))
|
||||
|
||||
(defun fscotto/project-vterm ()
|
||||
"Open vterm in project root."
|
||||
(interactive)
|
||||
(let ((default-directory (fscotto/project-root)))
|
||||
(vterm)))
|
||||
|
||||
(defun fscotto/open-multi-vterm-in (directory)
|
||||
"Open a new multi-vterm buffer in DIRECTORY."
|
||||
(let ((default-directory (file-name-as-directory directory)))
|
||||
(multi-vterm)))
|
||||
|
||||
(defun fscotto/home-multi-vterm ()
|
||||
"Open a new multi-vterm buffer in HOME."
|
||||
(interactive)
|
||||
(fscotto/open-multi-vterm-in (expand-file-name "~/")))
|
||||
|
||||
(defun fscotto/project-multi-vterm ()
|
||||
"Open a new multi-vterm buffer in project root."
|
||||
(interactive)
|
||||
(fscotto/open-multi-vterm-in (fscotto/project-root)))
|
||||
|
||||
(defconst fscotto/opencode-db-path
|
||||
(expand-file-name "~/.local/share/opencode/opencode.db")
|
||||
"Path to the OpenCode SQLite database.")
|
||||
|
||||
(defun fscotto/launch-external-terminal (&optional command directory)
|
||||
"Launch external terminal in DIRECTORY, optionally running COMMAND."
|
||||
(let* ((default-directory (file-name-as-directory (or directory (fscotto/project-root))))
|
||||
(terminal-program (or (executable-find fscotto/external-terminal-program)
|
||||
fscotto/external-terminal-program))
|
||||
(args (append
|
||||
(list fscotto/external-terminal-working-directory-option
|
||||
default-directory)
|
||||
(when command
|
||||
(append
|
||||
(list fscotto/external-terminal-execute-option)
|
||||
command)))))
|
||||
(unless (file-executable-p terminal-program)
|
||||
(user-error "External terminal not found: %s" fscotto/external-terminal-program))
|
||||
(apply #'start-process
|
||||
"fscotto-external-terminal"
|
||||
nil
|
||||
terminal-program
|
||||
args)))
|
||||
|
||||
(defun fscotto/opencode-session-candidates (directory)
|
||||
"Return OpenCode session candidates for DIRECTORY.
|
||||
|
||||
Each entry is a cons cell of display string and session id."
|
||||
(let ((sqlite3-program (executable-find "sqlite3"))
|
||||
(session-directory (directory-file-name (expand-file-name directory))))
|
||||
(unless sqlite3-program
|
||||
(user-error "sqlite3 not found"))
|
||||
(unless (file-exists-p fscotto/opencode-db-path)
|
||||
(user-error "OpenCode database not found: %s" fscotto/opencode-db-path))
|
||||
(mapcar
|
||||
(lambda (line)
|
||||
(pcase-let* ((fields (split-string line "\t"))
|
||||
(`(,session-id ,title ,updated-at) fields)
|
||||
(title (if (and title (not (string= title "")))
|
||||
title
|
||||
"Untitled session"))
|
||||
(updated-seconds (/ (string-to-number updated-at) 1000))
|
||||
(updated-label (format-time-string "%Y-%m-%d %H:%M"
|
||||
(seconds-to-time updated-seconds)))
|
||||
(short-id (if (> (length session-id) 12)
|
||||
(substring session-id 0 12)
|
||||
session-id)))
|
||||
(cons (format "%s | %s | %s" title updated-label short-id)
|
||||
session-id)))
|
||||
(process-lines
|
||||
sqlite3-program
|
||||
"-tabs"
|
||||
"-noheader"
|
||||
fscotto/opencode-db-path
|
||||
(format (concat
|
||||
"select id, title, time_updated "
|
||||
"from session "
|
||||
"where directory = '%s' and time_archived is null "
|
||||
"order by time_updated desc;")
|
||||
(replace-regexp-in-string "'" "''" session-directory))))))
|
||||
|
||||
(defun fscotto/project-opencode-latest-session-id ()
|
||||
"Return the latest saved OpenCode session id for the current project."
|
||||
(cdr (car (fscotto/opencode-session-candidates (fscotto/project-root)))))
|
||||
|
||||
(defun fscotto/project-agent-dwim ()
|
||||
"Choose an agent for the current project and launch it externally."
|
||||
(interactive)
|
||||
(let ((agent (completing-read "Agent: " '("Claude" "Codex" "Gemini" "OpenCode") nil t)))
|
||||
(pcase agent
|
||||
("Claude"
|
||||
(fscotto/launch-external-terminal '("claude" "--continue")))
|
||||
("OpenCode"
|
||||
(let ((session-id (fscotto/project-opencode-latest-session-id)))
|
||||
(if session-id
|
||||
(fscotto/launch-external-terminal (list "opencode" "--session" session-id)
|
||||
(fscotto/project-root))
|
||||
(fscotto/project-opencode))))
|
||||
("Codex"
|
||||
(fscotto/launch-external-terminal '("codex" "resume" "--last")))
|
||||
("Gemini"
|
||||
(fscotto/launch-external-terminal '("gemini" "--resume" "latest")
|
||||
(fscotto/project-root))))))
|
||||
|
||||
(defun fscotto/project-opencode-session ()
|
||||
"Resume a saved OpenCode session for the current project."
|
||||
(interactive)
|
||||
(let* ((project-directory (fscotto/project-root))
|
||||
(candidates (fscotto/opencode-session-candidates project-directory)))
|
||||
(unless candidates
|
||||
(user-error "No OpenCode sessions found for %s" project-directory))
|
||||
(let* ((selection (completing-read "OpenCode session: " candidates nil t))
|
||||
(session-id (cdr (assoc selection candidates))))
|
||||
(fscotto/launch-external-terminal (list "opencode" "--session" session-id)
|
||||
project-directory))))
|
||||
|
||||
(defun fscotto/gemini-session-candidates (directory)
|
||||
"Return Gemini session candidates for DIRECTORY.
|
||||
|
||||
Each entry is a cons cell of display string and session index.
|
||||
Tries JSON output first, falls back to text parsing if unavailable."
|
||||
(let* ((default-directory (file-name-as-directory directory))
|
||||
(json-output (shell-command-to-string
|
||||
"gemini --list-sessions --output-format json 2>/dev/null")))
|
||||
(cond
|
||||
((string-match "^{" json-output)
|
||||
(ignore-errors
|
||||
(require 'json)
|
||||
(let* ((parsed (json-parse-string json-output))
|
||||
(sessions (gethash "sessions" parsed)))
|
||||
(when (vectorp sessions)
|
||||
(seq-map-indexed
|
||||
(lambda (s idx)
|
||||
(let* ((idx-str (number-to-string (1+ idx)))
|
||||
(msg (if (hash-table-p s)
|
||||
(or (gethash "firstUserMessage" s) "Session")
|
||||
"Session"))
|
||||
(ts (and (hash-table-p s)
|
||||
(ignore-errors (gethash "lastUpdated" s))
|
||||
(when (stringp it) (string-trim it))))
|
||||
(label (if ts (format "%s [%s]" msg ts) msg)))
|
||||
(cons label idx-str)))
|
||||
sessions)))))
|
||||
(t
|
||||
(let* ((output (shell-command-to-string "gemini --list-sessions"))
|
||||
(lines (seq-filter (lambda (s) (string-match "\\S-" s))
|
||||
(split-string output "\n" t)))
|
||||
(data-lines (seq-drop lines 1))
|
||||
(candidates nil))
|
||||
(dolist (line data-lines)
|
||||
(let ((trimmed (string-trim line)))
|
||||
(when (string-match
|
||||
(rx (group (one-or-more digit))
|
||||
(one-or-more whitespace)
|
||||
(group (one-or-more nonl)))
|
||||
trimmed)
|
||||
(push (cons (match-string 2 trimmed)
|
||||
(match-string 1 trimmed))
|
||||
candidates))))
|
||||
(nreverse candidates))))))
|
||||
|
||||
(defun fscotto/project-gemini-session ()
|
||||
"Choose and resume a Gemini session for the current project."
|
||||
(interactive)
|
||||
(let* ((project-directory (fscotto/project-root))
|
||||
(candidates (fscotto/gemini-session-candidates project-directory)))
|
||||
(unless candidates
|
||||
(user-error "No Gemini sessions found for %s" project-directory))
|
||||
(let* ((selection (completing-read "Gemini session: " candidates nil t))
|
||||
(session-idx (cdr (assoc selection candidates))))
|
||||
(fscotto/launch-external-terminal
|
||||
(list "gemini" "--resume" session-idx)
|
||||
project-directory))))
|
||||
|
||||
(defun fscotto/project-agent-session ()
|
||||
"Choose an agent and resume a saved session for the current project."
|
||||
(interactive)
|
||||
(let ((agent (completing-read "Agent session: " '("Claude" "Codex" "Gemini" "OpenCode") nil t)))
|
||||
(pcase agent
|
||||
("Claude"
|
||||
(fscotto/launch-external-terminal '("claude" "--resume")))
|
||||
("OpenCode"
|
||||
(fscotto/project-opencode-session))
|
||||
("Codex"
|
||||
(fscotto/launch-external-terminal '("codex" "resume")))
|
||||
("Gemini"
|
||||
(fscotto/project-gemini-session)))))
|
||||
|
||||
(defun fscotto/project-external-terminal ()
|
||||
"Open the external terminal in project root."
|
||||
(interactive)
|
||||
(fscotto/launch-external-terminal))
|
||||
|
||||
(defun fscotto/project-opencode ()
|
||||
"Open the external terminal in project root and run opencode."
|
||||
(interactive)
|
||||
(fscotto/launch-external-terminal '("opencode")))
|
||||
|
||||
(defun fscotto/project-magit-status ()
|
||||
"Open magit-status in project root."
|
||||
(interactive)
|
||||
(let ((default-directory (fscotto/project-root)))
|
||||
(magit-status)))
|
||||
|
||||
(defun fscotto/magit-dispatch ()
|
||||
"Load Magit if necessary and open magit-dispatch."
|
||||
(interactive)
|
||||
(require 'magit)
|
||||
(call-interactively #'magit-dispatch))
|
||||
|
||||
(defun fscotto/disable-c-formatting ()
|
||||
(setq-local lsp-enable-on-type-formatting nil))
|
||||
|
||||
;; Golang development support functions
|
||||
(defun fscotto/go-format-on-save ()
|
||||
"Format Go buffers on save using gofmt."
|
||||
(add-hook 'before-save-hook #'lsp-format-buffer nil t))
|
||||
|
||||
(defun fscotto/go-mod-tidy ()
|
||||
"Esegue go mod tidy nella root del progetto."
|
||||
(interactive)
|
||||
(let ((default-directory (project-root (project-current t))))
|
||||
(compile "go mod tidy")))
|
||||
|
||||
(defun fscotto/go-mod-download ()
|
||||
"Scarica i moduli Go."
|
||||
(interactive)
|
||||
(let ((default-directory (project-root (project-current t))))
|
||||
(compile "go mod download")))
|
||||
|
||||
(defun fscotto/go-mod-after-save ()
|
||||
(when (and (eq major-mode 'go-mod-ts-mode)
|
||||
(lsp-workspaces))
|
||||
(lsp-restart-workspace)))
|
||||
|
||||
(defun fscotto/go-test-package ()
|
||||
"Run `go test` in the current package."
|
||||
(interactive)
|
||||
(let ((default-directory (project-root (project-current t))))
|
||||
(compile "go test")))
|
||||
|
||||
(defun fscotto/go-test-module ()
|
||||
"Run `go test ./...` in the current Go module."
|
||||
(interactive)
|
||||
(let ((default-directory (project-root (project-current t))))
|
||||
(compile "go test ./...")))
|
||||
|
||||
(defun fscotto/go-test-current-test ()
|
||||
"Run `go test -run` for the test at point."
|
||||
(interactive)
|
||||
(let* ((test-name (thing-at-point 'symbol t))
|
||||
(default-directory (project-root (project-current t))))
|
||||
(unless test-name
|
||||
(user-error "No test name at point"))
|
||||
(compile (format "go test -run '^%s$'" test-name))))
|
||||
|
||||
(defun fscotto/go-test-at-point ()
|
||||
"Return Go test name at point."
|
||||
(let ((sym (thing-at-point 'symbol t)))
|
||||
(unless (and sym (string-prefix-p "Test" sym))
|
||||
(user-error "No Go test at point"))
|
||||
sym))
|
||||
|
||||
(defun fscotto/sudo-edit (&optional arg)
|
||||
"Reopen current file as root via TRAMP.
|
||||
If ARG is provided (C-u), prompts for file path."
|
||||
(interactive "P")
|
||||
(if arg
|
||||
(find-file (concat "/sudo:root@localhost:" (read-file-name "File: ")))
|
||||
(if buffer-file-name
|
||||
(find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name))
|
||||
(user-error "This buffer is not associated with a file"))))
|
||||
@@ -1,39 +0,0 @@
|
||||
;;; documents.el -*- lexical-binding: t; -*-
|
||||
|
||||
(use-package pdf-tools
|
||||
:ensure t
|
||||
:config
|
||||
(pdf-tools-install))
|
||||
|
||||
(use-package pdf-view
|
||||
:config
|
||||
(setq-default pdf-view-display-size 'fit-width)
|
||||
(setq pdf-cache-org-imgparams t
|
||||
pdf-view-use-smooth-scrolling t)
|
||||
(setq pdf-annot-default-visible-properties t))
|
||||
|
||||
(with-eval-after-load 'pdf-view
|
||||
(define-key pdf-view-mode-map (kbd "n") 'pdf-view-next-page)
|
||||
(define-key pdf-view-mode-map (kbd "p") 'pdf-view-previous-page)
|
||||
(define-key pdf-view-mode-map (kbd "q") 'pdf-view-close))
|
||||
|
||||
(use-package nov
|
||||
:ensure t
|
||||
:mode ("\\.epub\\'" . nov-mode))
|
||||
|
||||
(use-package calibre
|
||||
:ensure t
|
||||
:commands calibre-library
|
||||
:config
|
||||
(setq calibre-calibredb-executable
|
||||
(or (executable-find "calibredb")
|
||||
(let ((flatpak-wrapper (expand-file-name "~/.local/bin/calibredb")))
|
||||
(when (file-executable-p flatpak-wrapper)
|
||||
flatpak-wrapper))
|
||||
"calibredb")
|
||||
calibre-libraries
|
||||
`(("Library" . ,(expand-file-name "~/Documents/Library")))))
|
||||
|
||||
(provide 'misc/documents)
|
||||
|
||||
;;; documents.el ends here
|
||||
@@ -1,9 +0,0 @@
|
||||
;;; doom-modeline.el -*-
|
||||
|
||||
(use-package doom-modeline
|
||||
:ensure t
|
||||
:config
|
||||
(setq doom-modeline-height 25
|
||||
doom-modeline-bar-width 3
|
||||
doom-modeline-project-detection 'projectile)
|
||||
:init (doom-modeline-mode 1))
|
||||
@@ -1,24 +0,0 @@
|
||||
;;; gptel.el -*- lexical-binding: t; -*-
|
||||
|
||||
(use-package gptel
|
||||
:ensure t
|
||||
:commands (gptel gptel-send gptel-rewrite)
|
||||
:config
|
||||
(setq gptel-model 'qwen3.5:397b)
|
||||
(setq gptel-backend
|
||||
(gptel-make-ollama
|
||||
"Ollama Cloud"
|
||||
:protocol "https"
|
||||
:host "ollama.com"
|
||||
:endpoint "/api/chat"
|
||||
:models '(qwen3.5:397b)
|
||||
:stream t
|
||||
:key (lambda () (gptel-api-key-from-auth-source "ollama.com"))
|
||||
:header
|
||||
(lambda (&optional _info)
|
||||
(when-let ((key (gptel-api-key-from-auth-source "ollama.com")))
|
||||
`(("Authorization" . ,(concat "Bearer " key))))))))
|
||||
|
||||
(provide 'fscotto-gptel)
|
||||
|
||||
;;; gptel.el ends here
|
||||
@@ -1,2 +0,0 @@
|
||||
(use-package i3wm-config-mode
|
||||
:ensure t)
|
||||
@@ -1,10 +1,14 @@
|
||||
;;; rss.el -*-
|
||||
;;; rss.el --- Elfeed configuration -*- lexical-binding: t; -*-
|
||||
|
||||
(require 'use-package)
|
||||
|
||||
(use-package elfeed
|
||||
:ensure t
|
||||
:commands elfeed
|
||||
:bind ("C-c r" . elfeed)
|
||||
:config
|
||||
(defun elfeed-play-with-mpv ()
|
||||
"Open the current elfeed entry link with mpv."
|
||||
"Open the current Elfeed entry link with mpv."
|
||||
(interactive)
|
||||
(let* ((entry (if (eq major-mode 'elfeed-show-mode)
|
||||
elfeed-show-entry
|
||||
@@ -14,44 +18,26 @@
|
||||
(progn
|
||||
(message "Opening with mpv: %s" url)
|
||||
(start-process "mpv" nil "mpv" url))
|
||||
(message "No URL found"))))
|
||||
(define-key elfeed-search-mode-map (kbd "v") #'elfeed-play-with-mpv)
|
||||
(define-key elfeed-show-mode-map (kbd "v") #'elfeed-play-with-mpv)
|
||||
:custom
|
||||
(elfeed-enclosure-default-dir "~/Downloads/")
|
||||
(elfeed-search-remain-on-entry t)
|
||||
(elfeed-search-title-max-width 100)
|
||||
(elfeed-search-title-min-width 30)
|
||||
(elfeed-search-trailing-width 25)
|
||||
(elfeed-show-truncate-long-urls t)
|
||||
(elfeed-sort-order 'descending)
|
||||
(elfeed-search-filter "+unread")
|
||||
:hook
|
||||
(elfeed-show-mode . visual-line-mode))
|
||||
(message "No URL found"))))
|
||||
|
||||
(use-package evil-collection
|
||||
:ensure t
|
||||
:after (evil elfeed)
|
||||
:config
|
||||
;; Enable Vim-style keybindings only for elfeed (search + entry views),
|
||||
;; leaving the rest of the configuration on evil's defaults.
|
||||
(evil-collection-init (list 'elfeed))
|
||||
;; Restore the custom "v" -> mpv binding, which evil's normal-state visual
|
||||
;; selection would otherwise shadow inside elfeed buffers.
|
||||
(evil-collection-define-key 'normal 'elfeed-search-mode-map
|
||||
"v" #'elfeed-play-with-mpv)
|
||||
(evil-collection-define-key 'normal 'elfeed-show-mode-map
|
||||
"v" #'elfeed-play-with-mpv))
|
||||
(setq elfeed-enclosure-default-dir "~/Downloads/"
|
||||
elfeed-search-remain-on-entry t
|
||||
elfeed-search-title-max-width 100
|
||||
elfeed-search-title-min-width 30
|
||||
elfeed-search-trailing-width 25
|
||||
elfeed-show-truncate-long-urls t
|
||||
elfeed-sort-order 'descending
|
||||
elfeed-search-filter "+unread")
|
||||
(define-key elfeed-search-mode-map (kbd "v") #'elfeed-play-with-mpv)
|
||||
(define-key elfeed-show-mode-map (kbd "v") #'elfeed-play-with-mpv)
|
||||
(add-hook 'elfeed-show-mode-hook #'visual-line-mode))
|
||||
|
||||
(use-package elfeed-org
|
||||
:ensure t
|
||||
:after elfeed
|
||||
:custom
|
||||
;; Optionally specify a number of files containing elfeed
|
||||
;; configuration. If not set then the location below is used.
|
||||
;; Note: The customize interface is also supported.
|
||||
(rmh-elfeed-org-files (list "~/.emacs.d/elfeed.org")))
|
||||
|
||||
(with-eval-after-load 'elfeed
|
||||
(rmh-elfeed-org-files (list (expand-file-name "elfeed.org" user-emacs-directory)))
|
||||
:config
|
||||
(elfeed-org))
|
||||
|
||||
(provide 'misc/rss)
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
;;; terminal.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defgroup fscotto nil
|
||||
"Personal customization group."
|
||||
:group 'applications)
|
||||
|
||||
(defcustom fscotto/external-terminal-program "alacritty"
|
||||
"Program used to launch external terminal windows."
|
||||
:type 'string
|
||||
:group 'fscotto)
|
||||
|
||||
(defcustom fscotto/external-terminal-working-directory-option "--working-directory"
|
||||
"Argument used to set the working directory for the external terminal."
|
||||
:type 'string
|
||||
:group 'fscotto)
|
||||
|
||||
(defcustom fscotto/external-terminal-execute-option "-e"
|
||||
"Argument used to execute a command in the external terminal."
|
||||
:type 'string
|
||||
:group 'fscotto)
|
||||
|
||||
(defvar-local fscotto/vterm-font-cookie nil
|
||||
"Face remap cookie used to set a custom font in vterm buffers.")
|
||||
|
||||
(defun fscotto/apply-vterm-font ()
|
||||
"Use Hack Nerd Font only inside vterm buffers."
|
||||
(when fscotto/vterm-font-cookie
|
||||
(face-remap-remove-relative fscotto/vterm-font-cookie))
|
||||
(setq fscotto/vterm-font-cookie
|
||||
(face-remap-add-relative
|
||||
'default
|
||||
'(:family "Hack Nerd Font" :height 120 :weight regular))))
|
||||
|
||||
(use-package vterm
|
||||
:ensure t
|
||||
:hook (vterm-mode . fscotto/apply-vterm-font))
|
||||
|
||||
(use-package multi-vterm
|
||||
:ensure t
|
||||
:after vterm
|
||||
:commands (multi-vterm multi-vterm-next multi-vterm-prev))
|
||||
|
||||
(provide 'terminal)
|
||||
|
||||
;;; terminal.el ends here
|
||||
@@ -1,41 +1,6 @@
|
||||
(use-package magit
|
||||
:ensure t
|
||||
:commands (magit-status magit-log)
|
||||
:init
|
||||
;; Entry point principale
|
||||
(setq magit-display-buffer-function #'magit-display-buffer-fullframe-status-v1)
|
||||
:config
|
||||
;; Performance & UX
|
||||
(setq magit-refresh-status-buffer nil)
|
||||
(setq magit-repository-directories
|
||||
'(("~/Projects" . 2)
|
||||
("~/Work" . 2))))
|
||||
;;; vcs.el --- Optional Git interface -*- lexical-binding: t; -*-
|
||||
|
||||
(use-package vdiff
|
||||
:ensure t
|
||||
:commands (vdiff-current-file vdiff-files vdiff-merge-conflict)
|
||||
:custom
|
||||
(vdiff-lock-scrolling t)
|
||||
(vdiff-auto-refine t))
|
||||
(autoload 'magit-status "magit" nil t)
|
||||
(global-set-key (kbd "C-x g") #'magit-status)
|
||||
|
||||
(use-package vdiff-magit
|
||||
:ensure t
|
||||
:after (magit vdiff)
|
||||
:commands (vdiff-magit vdiff-magit-dwim)
|
||||
:custom
|
||||
(vdiff-magit-use-ediff-for-merges nil)
|
||||
:config
|
||||
(define-key magit-mode-map "e" #'vdiff-magit-dwim)
|
||||
(define-key magit-mode-map "E" #'vdiff-magit)
|
||||
(transient-suffix-put 'magit-dispatch "e" :description "vdiff (dwim)")
|
||||
(transient-suffix-put 'magit-dispatch "e" :command #'vdiff-magit-dwim)
|
||||
(transient-suffix-put 'magit-dispatch "E" :description "vdiff")
|
||||
(transient-suffix-put 'magit-dispatch "E" :command #'vdiff-magit))
|
||||
|
||||
(use-package ztree
|
||||
:ensure t
|
||||
:commands (ztree-diff ztree-dir))
|
||||
|
||||
(provide 'vcs)
|
||||
|
||||
;;; vcs.el ends here
|
||||
(provide 'misc/vcs)
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
;;; which-key.el -*-
|
||||
;;; which-key.el --- Discoverable native bindings -*- lexical-binding: t; -*-
|
||||
|
||||
(require 'use-package)
|
||||
|
||||
(use-package which-key
|
||||
:ensure t
|
||||
@@ -8,157 +10,17 @@
|
||||
(setq which-key-idle-delay 0.45
|
||||
which-key-idle-secondary-delay 0.05
|
||||
which-key-max-display-columns 3
|
||||
which-key-max-description-length 45))
|
||||
|
||||
(with-eval-after-load 'which-key
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Top-level prefixes
|
||||
;; --------------------------------------------------------------------------
|
||||
which-key-max-description-length 45)
|
||||
(which-key-add-key-based-replacements
|
||||
"C-c !" "Analyze"
|
||||
"C-c o" "Open"
|
||||
"C-c v" "Version control"
|
||||
"C-c l" "LSP"
|
||||
"C-c t" "TODO / Annotations"
|
||||
"C-c b" "Buffers"
|
||||
"C-c p" "Project"
|
||||
"C-c d" "Debug"
|
||||
"C-c g" "Git"
|
||||
"C-c e" "Elfeed")
|
||||
"C-c a" "Org agenda"
|
||||
"C-c c" "Org capture"
|
||||
"C-c e" "Document export"
|
||||
"C-c e p" "Export PDF"
|
||||
"C-c e h" "Export HTML"
|
||||
"C-c e m" "Export Markdown"
|
||||
"C-c e d" "Export DOCX"
|
||||
"C-c e o" "Export ODT"
|
||||
"C-c r" "RSS (Elfeed)"
|
||||
"C-x C-b" "Ibuffer"))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Open (C-c o …)
|
||||
;; --------------------------------------------------------------------------
|
||||
(which-key-add-key-based-replacements
|
||||
"C-c o d" "Dirvish"
|
||||
"C-c o f" "RSS (Elfeed)"
|
||||
"C-c o l" "LLM chat (gptel)"
|
||||
"C-c o T" "Terminal (multi-vterm)"
|
||||
"C-c o z" "Ztree diff")
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Version control
|
||||
;; --------------------------------------------------------------------------
|
||||
(which-key-add-key-based-replacements
|
||||
"C-c v g" "Magit status (legacy)")
|
||||
|
||||
(which-key-add-key-based-replacements
|
||||
;; Core
|
||||
"C-c g g" "Status"
|
||||
"C-c g s" "Status"
|
||||
;; "C-c g b" "Branch"
|
||||
;; "C-c g c" "Commit"
|
||||
"C-c g p" "Push / Pull"
|
||||
"C-c g f" "Fetch"
|
||||
"C-c g l" "Log"
|
||||
"C-c g S" "Stash"
|
||||
|
||||
;; Files
|
||||
"C-c g d" "Diff"
|
||||
"C-c g D" "Diff (cached)"
|
||||
"C-c g B" "Blame"
|
||||
|
||||
;; Rebase / Reset
|
||||
"C-c g r" "Rebase"
|
||||
"C-c g R" "Reset"
|
||||
|
||||
;; Remote
|
||||
"C-c g y" "Show refs"
|
||||
"C-c g o" "Browse remote")
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Buffers
|
||||
;; --------------------------------------------------------------------------
|
||||
(which-key-add-key-based-replacements
|
||||
"C-x C-b" "ibuffer")
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; TODO / hl-todo
|
||||
;; --------------------------------------------------------------------------
|
||||
(which-key-add-key-based-replacements
|
||||
"C-t" "hl-todo"
|
||||
"C-t p" "Previous TODO"
|
||||
"C-t n" "Next TODO"
|
||||
"C-t o" "Occur (list)"
|
||||
"C-t i" "Insert TODO")
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; LSP (C-c l …)
|
||||
;; --------------------------------------------------------------------------
|
||||
(which-key-add-key-based-replacements
|
||||
;; Navigation
|
||||
"C-c l d" "Go to definition"
|
||||
"C-c l D" "Go to type definition"
|
||||
"C-c l i" "Go to implementation"
|
||||
|
||||
;; Symbols / diagnostics
|
||||
"C-c l s" "Workspace symbols"
|
||||
"C-c l e" "Diagnostics"
|
||||
|
||||
;; Actions
|
||||
"C-c l a" "Code actions"
|
||||
"C-c l r" "Rename symbol"
|
||||
"C-c l f" "Format buffer"
|
||||
|
||||
;; Control
|
||||
"C-c l R" "Restart workspace")
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Elfeed modes
|
||||
;; --------------------------------------------------------------------------
|
||||
(which-key-add-key-based-replacements
|
||||
"w" "Yank"
|
||||
"R" "Update feeds"
|
||||
"q" "Quit")
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Debug / DAP
|
||||
;; --------------------------------------------------------------------------
|
||||
(which-key-add-key-based-replacements
|
||||
"C-c d d" "Start debug session"
|
||||
"C-c d b" "Toggle breakpoint")
|
||||
;; "C-c d c" "Continue"
|
||||
;; "C-c d n" "Next"
|
||||
;; "C-c d i" "Step in"
|
||||
;; "C-c d o" "Step out")
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Project (future)
|
||||
;; --------------------------------------------------------------------------
|
||||
(which-key-add-key-based-replacements
|
||||
;; Core
|
||||
"C-c p p" "Switch project"
|
||||
"C-c p f" "Find file"
|
||||
"C-c p d" "Find directory"
|
||||
"C-c p b" "Switch buffer"
|
||||
"C-c p k" "Kill project buffers"
|
||||
"C-c p r" "Recent files"
|
||||
|
||||
;; Search
|
||||
"C-c p s" "Search"
|
||||
"C-c p s g" "Grep (ripgrep)"
|
||||
"C-c p s r" "Replace in project"
|
||||
|
||||
;; Actions
|
||||
"C-c p c" "Compile"
|
||||
"C-c p t" "Test"
|
||||
"C-c p v" "Open multi-vterm in project"
|
||||
"C-c p x" "Open external term"
|
||||
"C-c p a" "Choose agent"
|
||||
"C-c p A" "Choose agent session"
|
||||
"C-c p e" "Edit project config"
|
||||
"C-c p g" "Project Git status"
|
||||
"C-c p 4" "Other Window"
|
||||
"C-c p 5" "Other Frame"
|
||||
|
||||
;; Cache
|
||||
"C-c p i" "Invalidate cache")
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Cleanup annoying +prefix
|
||||
;; --------------------------------------------------------------------------
|
||||
(which-key-add-key-based-replacements
|
||||
"+prefix" "Prefix"
|
||||
"+lsp" "LSP"
|
||||
"+debug" "Debug"
|
||||
"+project" "Project"))
|
||||
(provide 'misc/which-key)
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
;;; misc-xclip.el -*- lexical-binding: t; -*-
|
||||
|
||||
(use-package xclip
|
||||
:ensure t
|
||||
:config
|
||||
(xclip-mode t)
|
||||
(setq xclip-method 'xclip))
|
||||
|
||||
(provide 'xclip)
|
||||
|
||||
;;; xclip.el ends here
|
||||
11
dotfiles/desktop/.emacs.d/lisp/quality-of-life.el
Normal file
11
dotfiles/desktop/.emacs.d/lisp/quality-of-life.el
Normal file
@@ -0,0 +1,11 @@
|
||||
;;; quality-of-life.el --- Writing-focused conveniences -*- lexical-binding: t; -*-
|
||||
|
||||
(recentf-mode 1)
|
||||
(savehist-mode 1)
|
||||
(fido-mode 1)
|
||||
(global-visual-line-mode 1)
|
||||
(setq history-length 200
|
||||
recentf-max-saved-items 200
|
||||
sentence-end-double-space nil)
|
||||
|
||||
(provide 'quality-of-life)
|
||||
@@ -1,4 +1,6 @@
|
||||
;;; completion.el -*- lexical-binding: t; -*-
|
||||
;;; completion.el --- Completion for writing -*- lexical-binding: t; -*-
|
||||
|
||||
(require 'use-package)
|
||||
|
||||
(use-package ivy
|
||||
:ensure t
|
||||
@@ -9,32 +11,6 @@
|
||||
:ensure t
|
||||
:defer t)
|
||||
|
||||
(use-package company
|
||||
:ensure t
|
||||
:custom
|
||||
(company-tooltip-align-annotations 't)
|
||||
(company-minimum-prefix-length 1)
|
||||
(company-idle-delay 0.1)
|
||||
:hook (prog-mode . company-mode))
|
||||
|
||||
(with-eval-after-load 'company
|
||||
(add-hook 'bash-ts-mode-hook 'company-mode))
|
||||
|
||||
;; Static analysis for code base
|
||||
(use-package flycheck
|
||||
:ensure t
|
||||
:hook (prog-mode . flycheck-mode)
|
||||
:config
|
||||
(setq flycheck-check-syntax-automatically '(save mode-enabled)))
|
||||
|
||||
;; Snippets
|
||||
(use-package yasnippet
|
||||
:ensure t
|
||||
:config
|
||||
(setq yas/root-directory
|
||||
(list "~/.emacs.d/snippets") yas-indent-line 'fixed)
|
||||
(yas-global-mode))
|
||||
|
||||
(use-package orderless
|
||||
:ensure t
|
||||
:custom
|
||||
@@ -43,21 +19,18 @@
|
||||
(completion-pcm-leading-wildcard t)
|
||||
:config
|
||||
(setq ivy-re-builders-alist '((t . orderless-ivy-re-builder)))
|
||||
(add-to-list 'ivy-highlight-functions-alist '(orderless-ivy-re-builder . orderless-ivy-highlight)))
|
||||
(add-to-list 'ivy-highlight-functions-alist
|
||||
'(orderless-ivy-re-builder . orderless-ivy-re-builder-highlight)))
|
||||
|
||||
(defun just-one-face (fn &rest args)
|
||||
(let ((orderless-match-faces [completions-common-part]))
|
||||
(apply fn args)))
|
||||
|
||||
(advice-add 'company-capf--candidates :around #'just-one-face)
|
||||
(use-package yasnippet
|
||||
:ensure t
|
||||
:config
|
||||
(yas-global-mode))
|
||||
|
||||
(use-package smartparens
|
||||
:ensure smartparens ;; install the package
|
||||
:hook (prog-mode text-mode markdown-mode) ;; add `smartparens-mode` to these hooks
|
||||
:ensure t
|
||||
:hook (text-mode . smartparens-mode)
|
||||
:config
|
||||
;; load default config
|
||||
(require 'smartparens-config))
|
||||
|
||||
(provide 'completion)
|
||||
|
||||
;;; completion.el ends here
|
||||
(provide 'tools/completion)
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
(use-package dap-mode
|
||||
:ensure t
|
||||
:after lsp-mode
|
||||
:hook (lsp-mode . dap-mode)
|
||||
:init
|
||||
;; Enabling only some features
|
||||
(setq dap-auto-configure-features '(sessions locals expressions repl))
|
||||
:config
|
||||
(dap-mode 1)
|
||||
(dap-ui-mode 1)
|
||||
(dap-ui-controls-mode 1)
|
||||
;; Auto show breakpoints + REPL
|
||||
(setq dap-ui-buffer-configurations
|
||||
'(;; RIGHT SIDE — Debug data (like IntelliJ)
|
||||
(dap-ui-locals . ((side . right) (slot . 1) (window-width . 0.30)))
|
||||
(dap-ui-sessions . ((side . right) (slot . 2) (window-width . 0.30)))
|
||||
(dap-ui-expressions . ((side . right) (slot . 3) (window-width . 0.30)))
|
||||
;; BOTTOM — Console / REPL
|
||||
(dap-ui-repl . ((side . bottom) (slot . 1) (window-height . 0.25)))
|
||||
(dap-ui-console . ((side . bottom) (slot . 2) (window-height . 0.25)))))
|
||||
;; Loading DAP adapters
|
||||
;; For Python
|
||||
(require 'dap-python)
|
||||
(setq dap-python-debugger 'debugpy
|
||||
dap-python-executable
|
||||
(let ((uv-debugpy-python
|
||||
(expand-file-name
|
||||
"~/.local/share/uv/tools/debugpy/bin/python")))
|
||||
(if (file-executable-p uv-debugpy-python)
|
||||
uv-debugpy-python
|
||||
"python3"))))
|
||||
@@ -1,36 +0,0 @@
|
||||
;;; dired.el -*- lexical-binding: t; -*-
|
||||
|
||||
(use-package dired
|
||||
:ensure nil
|
||||
:commands (dired dired-jump)
|
||||
:config
|
||||
(setq delete-by-moving-to-trash t
|
||||
dired-dwim-target t
|
||||
dired-kill-when-opening-new-dired-buffer t
|
||||
dired-listing-switches
|
||||
"-l --almost-all --human-readable --group-directories-first --no-group")
|
||||
(put 'dired-find-alternate-file 'disabled nil))
|
||||
|
||||
(use-package dirvish
|
||||
:ensure t
|
||||
:init
|
||||
(dirvish-override-dired-mode)
|
||||
:custom
|
||||
(dirvish-use-header-line nil)
|
||||
(dirvish-use-mode-line nil)
|
||||
(dirvish-hide-details nil)
|
||||
(dirvish-attributes nil)
|
||||
(dirvish-large-directory-threshold 20000)
|
||||
:config
|
||||
(with-eval-after-load 'projectile
|
||||
(setq projectile-switch-project-action #'projectile-dired))
|
||||
:bind
|
||||
(:map dirvish-mode-map
|
||||
("?" . dirvish-dispatch)
|
||||
("TAB" . dirvish-subtree-toggle)
|
||||
("s" . dirvish-quicksort)
|
||||
("h" . dired-up-directory)))
|
||||
|
||||
(provide 'tools/dired)
|
||||
|
||||
;;; dired.el ends here
|
||||
@@ -1,47 +0,0 @@
|
||||
;;; lsp.el -*- lexical-binding: t; -*-
|
||||
|
||||
(use-package lsp-mode
|
||||
:ensure t
|
||||
:commands (lsp lsp-deferred)
|
||||
:hook
|
||||
((c-mode
|
||||
c-ts-mode
|
||||
c++-mode
|
||||
c++-ts-mode
|
||||
sh-mode
|
||||
bash-ts-mode) . lsp-deferred)
|
||||
:config
|
||||
;; Performance
|
||||
(setq lsp-enable-symbol-highlighting t
|
||||
lsp-enable-snippet t
|
||||
lsp-log-io nil
|
||||
lsp-modeline-code-actions-enable nil
|
||||
lsp-modeline-diagnostics-enable nil
|
||||
lsp-signature-auto-activate nil
|
||||
lsp-enable-on-type-formatting nil
|
||||
lsp-completion-provider :capf
|
||||
lsp-diagnostics-provider :flycheck
|
||||
lsp-headerline-breadcrumb-enable nil
|
||||
lsp-enable-indentation nil
|
||||
;; Disable for huge projects
|
||||
lsp-enable-file-watchers nil
|
||||
lsp-idle-delay 0.5))
|
||||
|
||||
(use-package lsp-ui
|
||||
:ensure t
|
||||
:config
|
||||
(setq lsp-ui-doc-enable t
|
||||
lsp-ui-doc-delay 0.3
|
||||
lsp-ui-sideline-enable t
|
||||
lsp-ui-sideline-show-code-actions t))
|
||||
|
||||
(use-package consult-lsp
|
||||
:ensure t
|
||||
:after (consult lsp-mode)
|
||||
:commands
|
||||
(consult-lsp-symbols
|
||||
consult-lsp-diagnostics))
|
||||
|
||||
(provide 'lsp)
|
||||
|
||||
;;; lsp.el ends here
|
||||
@@ -1,25 +0,0 @@
|
||||
;;; project.el - lexical-binding *-*
|
||||
|
||||
(use-package projectile
|
||||
:ensure t
|
||||
:defer 1
|
||||
:init
|
||||
;; Root detection
|
||||
(setq projectile-project-search-path '("~/Projects" "~/Work" "~/Progetti" "~/.local/src"))
|
||||
(setq projectile-completion-system 'ivy)
|
||||
:config
|
||||
;; Performance
|
||||
(setq projectile-enable-caching t)
|
||||
(setq projectile-indexing-method 'hybrid)
|
||||
(setq projectile-sort-order 'recently-active)
|
||||
;; Projectile as single source of truth
|
||||
(setq projectile-switch-project-action #'projectile-dired)
|
||||
;; Use ripgrep if available
|
||||
(when (executable-find "rg")
|
||||
(setq projectile-generic-command "rg --files --hidden --glob '!.git'"))
|
||||
;; Enable globally
|
||||
(projectile-mode 1))
|
||||
|
||||
(provide 'project)
|
||||
|
||||
;;; project.el ends here
|
||||
@@ -1,13 +0,0 @@
|
||||
;;; tramp.el -*- lexical-binding: t; -*-
|
||||
|
||||
(use-package tramp
|
||||
:config
|
||||
(setq tramp-use-ssh-controlmaster-options t)
|
||||
(setq tramp-chunksize 500)
|
||||
(setq tramp-verbose 0)
|
||||
(setq tramp-gvfs-wget "wget --quiet")
|
||||
(setq tramp-cache-read-persistent-cache t))
|
||||
|
||||
(provide 'tools/tramp)
|
||||
|
||||
;;; tramp.el ends here
|
||||
@@ -1,20 +0,0 @@
|
||||
;;; treesitter.el -*- lexical-binding: t; -*-
|
||||
|
||||
(use-package treesit
|
||||
:ensure nil
|
||||
:config
|
||||
(setq treesit-font-lock-level 4))
|
||||
|
||||
(use-package treesit-auto
|
||||
:ensure t
|
||||
:after treesit
|
||||
:custom
|
||||
(treesit-auto-install 'prompt)
|
||||
(treesit-auto-langs '(bash c cpp dockerfile go gomod json markdown python rust yaml))
|
||||
:config
|
||||
(treesit-auto-add-to-auto-mode-alist 'all)
|
||||
(global-treesit-auto-mode))
|
||||
|
||||
(provide 'treesitter)
|
||||
|
||||
;;; treesitter.el ends here
|
||||
@@ -1,3 +0,0 @@
|
||||
func main() {
|
||||
$0
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
fmt.Printf("%v\n", $0)
|
||||
@@ -1,23 +0,0 @@
|
||||
func Test$0 {
|
||||
tests := []struct {
|
||||
name string
|
||||
req string
|
||||
expected string
|
||||
}{
|
||||
{
|
||||
name: "happy path",
|
||||
req: "answer to life, the universe and everything"
|
||||
expected: "42"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
actual := foo(t, tt.req)
|
||||
assertEquals(t, tt.want, expected)
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
#name : author
|
||||
# --
|
||||
@author <a href="mailto:torstein@skybert.net">Torstein Krause Johansen</a>$0
|
||||
@@ -1,6 +0,0 @@
|
||||
#name : debug
|
||||
# --
|
||||
if (mLogger.isDebugEnabled()) {
|
||||
mLogger.debug(String.format("${1:result}=%s", ${2:result}));
|
||||
}
|
||||
$0
|
||||
@@ -1,31 +0,0 @@
|
||||
#name : dwmain
|
||||
# --
|
||||
package ${1:net.skybert.dw};
|
||||
|
||||
import io.dropwizard.Application;
|
||||
import io.dropwizard.assets.AssetsBundle;
|
||||
import io.dropwizard.configuration.SubstitutingSourceProvider;
|
||||
import io.dropwizard.jetty.ConnectorFactory;
|
||||
import io.dropwizard.jetty.HttpConnectorFactory;
|
||||
import io.dropwizard.lifecycle.Managed;
|
||||
import io.dropwizard.server.DefaultServerFactory;
|
||||
import io.dropwizard.setup.Bootstrap;
|
||||
import io.dropwizard.setup.Environment;
|
||||
|
||||
/**
|
||||
* Main
|
||||
*/
|
||||
public class Main extends Application<${2:SkybertConf}> {
|
||||
|
||||
public static void main(final String[] args) throws Exception {
|
||||
new Main().run(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(
|
||||
final $2 pConfiguration,
|
||||
final Environment pEnvironment)
|
||||
throws Exception {
|
||||
$0
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
#name : new method/function
|
||||
# --
|
||||
${1:public} ${2:void} ${3:update}(final ${4:String} ${5:pName}) {
|
||||
$0
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
#name : for (...; ...; ...) { ... }
|
||||
# --
|
||||
for (${1:Object} ${downcase-word 1} ; ${2:list}) {
|
||||
$0
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
#name : for loop with index
|
||||
# --
|
||||
for (int ${1:i} = 0; $1 < ${2:args.length}; $1${3:++}) {
|
||||
$0
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
#name : get/set/member variable
|
||||
# --
|
||||
private ${1:String} ${2:name};
|
||||
|
||||
public void set${2:$(capitalize text)}(final $1 p${2:$(capitalize text)}) {
|
||||
$2 = p${2:$(capitalize text)};
|
||||
}
|
||||
|
||||
public $1 get${2:$(capitalize text)}() {
|
||||
return $2;
|
||||
}
|
||||
$0
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
#name : if
|
||||
# --
|
||||
if (${1:result} ${2:!=} ${3:null}) {
|
||||
$0
|
||||
}
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
#name : static import of isBlank
|
||||
# --
|
||||
import static org.apache.commons.lang.StringUtils.isBlank;
|
||||
$0
|
||||
@@ -1,21 +0,0 @@
|
||||
#name : junitwrapperfns
|
||||
# --
|
||||
private void assertTrue(final String pMessage, final boolean pConditition) {
|
||||
Assertions.assertTrue(pConditition, pMessage);
|
||||
}
|
||||
|
||||
private void assertFalse(final String pMessage, final boolean pConditition) {
|
||||
Assertions.assertFalse(pConditition, pMessage);
|
||||
}
|
||||
|
||||
private void assertNotNull(final String pMessage, final Object pActual) {
|
||||
Assertions.assertNotNull(pActual, pMessage);
|
||||
}
|
||||
|
||||
private void assertNull(final String pMessage, final Object pActual) {
|
||||
Assertions.assertNull(pActual, pMessage);
|
||||
}
|
||||
|
||||
private void assertEquals(final String pMessage, final Object pExpected, final Object pActual) {
|
||||
Assertions.assertEquals(pExpected, pActual, pMessage);
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
#name : main
|
||||
# --
|
||||
public static void main(String[] args) {
|
||||
$0
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
#name : np
|
||||
# --
|
||||
// NOPMD
|
||||
@@ -1,3 +0,0 @@
|
||||
#name : get ObjectLoader
|
||||
# --
|
||||
$0ObjectLoader objectLoader = IOAPI.getAPI().getObjectLoader();
|
||||
@@ -1,6 +0,0 @@
|
||||
#name : req
|
||||
# --
|
||||
HttpRequest request = HttpRequest.newBuilder()
|
||||
.uri(URI.create($0))
|
||||
.timeout(Duration.ofMillis(getResponseTimeout()))
|
||||
.build();
|
||||
@@ -1,3 +0,0 @@
|
||||
#name : res
|
||||
# --
|
||||
HttpResponse<String> response = mHttpClient.send(request, ofString());$0
|
||||
@@ -1,3 +0,0 @@
|
||||
#name : sf
|
||||
# --
|
||||
String.format("%s", $0)
|
||||
@@ -1,3 +0,0 @@
|
||||
#name : System.out.println
|
||||
# --
|
||||
System.out.println($0);
|
||||
@@ -1,4 +0,0 @@
|
||||
@Test
|
||||
void ${1:can}() throws Exception {
|
||||
$0
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
#name : try, catch & finally
|
||||
# --
|
||||
try {
|
||||
$0
|
||||
}
|
||||
catch (${1:Exception} ${2:e}) {
|
||||
mLogger.error($2);
|
||||
}
|
||||
finally {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
#name : try & catch
|
||||
# --
|
||||
try {
|
||||
$0
|
||||
}
|
||||
catch (${1:Exception} ${2:e}) {
|
||||
mLogger.error($2);
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
#name : new array
|
||||
# --
|
||||
var ${1:myArray} = new Array();
|
||||
$0
|
||||
@@ -1,6 +0,0 @@
|
||||
#name : function
|
||||
# --
|
||||
function ${1:test}(${2:pValue}) {
|
||||
$0
|
||||
}
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
#name : for (...; ...; ...) { ... }
|
||||
# --
|
||||
for (var ${1:i} = 0; $1 < ${2:args.length}; $1${3:++}) {
|
||||
$0
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
#name : if
|
||||
# --
|
||||
if (${1:s} == ${2:undefined}) {
|
||||
$0
|
||||
}
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
#name : log
|
||||
# --
|
||||
console.log("$0");
|
||||
@@ -1,3 +0,0 @@
|
||||
#name : a
|
||||
# --
|
||||
[${1}](${2})${0}
|
||||
@@ -1,9 +0,0 @@
|
||||
#name : img snippet
|
||||
# --
|
||||
|
||||
<img
|
||||
class="centered"
|
||||
src="${1:foo.png}"
|
||||
alt="${2:alt img text}"
|
||||
/>
|
||||
$0
|
||||
@@ -1,3 +0,0 @@
|
||||
# name : me
|
||||
# --
|
||||
[@skybert](https://skybert.net) ${1:says:}$0
|
||||
@@ -1,17 +0,0 @@
|
||||
#name : pelican article
|
||||
# --
|
||||
title: ${1:`(s-replace "-" " " (file-name-base (buffer-file-name)))`}
|
||||
date: ${2:`(format-time-string "%Y-%m-%d" (current-time))`}
|
||||
category: ${3:`(file-name-nondirectory
|
||||
(substring
|
||||
(file-name-directory (buffer-file-name))
|
||||
0
|
||||
(- (length (file-name-directory (buffer-file-name))) 1)
|
||||
))`}
|
||||
tags: ${4:`(file-name-nondirectory
|
||||
(substring
|
||||
(file-name-directory (buffer-file-name))
|
||||
0
|
||||
(- (length (file-name-directory (buffer-file-name))) 1)
|
||||
))`}
|
||||
$0
|
||||
@@ -1,6 +0,0 @@
|
||||
#name : src code snippet
|
||||
# --
|
||||
|
||||
\`\`\`${1:text}
|
||||
$0
|
||||
\`\`\`
|
||||
@@ -1,4 +0,0 @@
|
||||
#name : strong element
|
||||
# --
|
||||
|
||||
<strong>${1:text}</strong>$0
|
||||
@@ -1,3 +0,0 @@
|
||||
#name: cdata
|
||||
# --
|
||||
<![CDATA[$0]]>
|
||||
@@ -1,8 +0,0 @@
|
||||
#name : cha
|
||||
# --
|
||||
<chapter xml:id="t_${1:$(replace-regexp-in-string " " "_" (downcase text))}">
|
||||
<title>${1:My Title}</title>
|
||||
<para>
|
||||
$0
|
||||
</para>
|
||||
</chapter>
|
||||
@@ -1,7 +0,0 @@
|
||||
#name : dep
|
||||
# --
|
||||
<dependency>
|
||||
<groupId>$1</groupId>
|
||||
<artifactId>$2</artifactId>
|
||||
<version>$0</version>
|
||||
</dependency>
|
||||
@@ -1,10 +0,0 @@
|
||||
#name : diary
|
||||
# --
|
||||
<!--#include virtual="/ssi/header.shtml" -->
|
||||
<h1>$1</h1>
|
||||
<div id="main">
|
||||
<p>
|
||||
$0
|
||||
</p>
|
||||
</div>
|
||||
<!--#include virtual="/ssi/footer.shtml" -->
|
||||
@@ -1,6 +0,0 @@
|
||||
#name : exclusion
|
||||
# --
|
||||
<exclusion>
|
||||
<groupId>$1</groupId>
|
||||
<artifactId>$2</artifactId>
|
||||
</exclusion>$0
|
||||
@@ -1,8 +0,0 @@
|
||||
#name : exclusions
|
||||
# --
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>$1</groupId>
|
||||
<artifactId>$2</artifactId>
|
||||
</exclusion>$0
|
||||
</exclusions>
|
||||
@@ -1,3 +0,0 @@
|
||||
#name : incvar
|
||||
# --
|
||||
<xi:include href="local-variables.ebk" xpointer="${1:l-product-um}"/>$0
|
||||
@@ -1,10 +0,0 @@
|
||||
#name : list
|
||||
# --
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
$0
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
#name : listi
|
||||
# --
|
||||
<listitem><para>$0</para></listitem>
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
#name : lit
|
||||
# --
|
||||
<literal>$0</literal>
|
||||
@@ -1,5 +0,0 @@
|
||||
#name : ol with a li
|
||||
# --
|
||||
<ol>
|
||||
<li>$0</li>
|
||||
</ol>
|
||||
@@ -1,5 +0,0 @@
|
||||
#name : para
|
||||
# --
|
||||
<para>
|
||||
$0
|
||||
</para>
|
||||
@@ -1,4 +0,0 @@
|
||||
#name : prog
|
||||
# --
|
||||
<programlisting><![CDATA[$0
|
||||
]]></programlisting>
|
||||
@@ -1,5 +0,0 @@
|
||||
#name : insert a JS tag without src
|
||||
# --
|
||||
<script type="text/javascript">
|
||||
$0
|
||||
</script>
|
||||
@@ -1,4 +0,0 @@
|
||||
#name : insert a JS tag with src
|
||||
# --
|
||||
<script type="text/javascript" src="${1:script.js}"></script>
|
||||
$0
|
||||
@@ -1,8 +0,0 @@
|
||||
#name : sec
|
||||
# --
|
||||
<section xml:id="t_${1:$(replace-regexp-in-string " " "_" (downcase text))}">
|
||||
<title>${1:My Title}</title>
|
||||
<para>
|
||||
$0
|
||||
</para>
|
||||
</section>
|
||||
@@ -1,5 +0,0 @@
|
||||
#name : ul with a li
|
||||
# --
|
||||
<ul>
|
||||
<li>$0</li>
|
||||
</ul>
|
||||
@@ -1,3 +0,0 @@
|
||||
#name : varece
|
||||
# --
|
||||
<xi:include href="ece-global:global-variables.ebk" xpointer="g-engine" />
|
||||
@@ -1,4 +0,0 @@
|
||||
#name : xlink
|
||||
# --
|
||||
<link xlink:href="${1:https://example.com}">$2</link>
|
||||
$0
|
||||
@@ -1,5 +0,0 @@
|
||||
#name : insert a Confluence code block
|
||||
# --
|
||||
{code}
|
||||
$0
|
||||
{code}
|
||||
@@ -1,21 +0,0 @@
|
||||
#name: daily
|
||||
# --
|
||||
* ❯ Admin, training & maintenance
|
||||
** DEVTR-1 Meetings, email, Slack++
|
||||
** DEVTR-5 System Maintenance
|
||||
** DEVTR-6 Software Delivery
|
||||
** DEVTR-8 Training
|
||||
|
||||
* ❯ Coding
|
||||
|
||||
* ❯ Review
|
||||
|
||||
* ❯ Specification
|
||||
|
||||
* ❯ Support
|
||||
** DEVTR-3 PSERV Assistance
|
||||
** DEVTR-5 Helping out colleagues in R&D
|
||||
|
||||
* ❯ Report
|
||||
#+BEGIN: clocktable :maxlevel 2
|
||||
#+END:
|
||||
@@ -1 +0,0 @@
|
||||
** TODO DEVTR-44 Review - $0
|
||||
@@ -1,5 +0,0 @@
|
||||
#name : insert a quote
|
||||
# --
|
||||
#+begin_quote
|
||||
$0
|
||||
#+end_quote
|
||||
@@ -1,5 +0,0 @@
|
||||
#name : insert a source block
|
||||
# --
|
||||
#+begin_src ${1:emacs-lisp}
|
||||
$0
|
||||
#+end_src
|
||||
@@ -1 +0,0 @@
|
||||
#+title: $0
|
||||
@@ -1,4 +0,0 @@
|
||||
#name : app
|
||||
# --
|
||||
app = $1(__name__)
|
||||
$0
|
||||
@@ -1,4 +0,0 @@
|
||||
#name : def
|
||||
# --
|
||||
def $1($2):
|
||||
$0
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user