mirror of
https://github.com/fscotto/infra.git
synced 2026-05-30 23:49:56 +00:00
Add Emacs desktop provisioning and dev toolchain packages
Install Emacs and copy the desktop .emacs.d config so the editor setup is managed with the rest of desktop dotfiles. Add vterm/build/debug dependencies plus C/C++ and Go tooling needed by the configured workflow.
This commit is contained in:
21
dotfiles/desktop/.emacs.d/lisp/core/buffer.el
Normal file
21
dotfiles/desktop/.emacs.d/lisp/core/buffer.el
Normal file
@@ -0,0 +1,21 @@
|
||||
;;; buffer.el -*- lexical-binding: t; -*-
|
||||
|
||||
(use-package ibuffer
|
||||
:ensure t)
|
||||
|
||||
(use-package ibuffer-tramp
|
||||
:ensure t)
|
||||
|
||||
(use-package ibuffer-vc
|
||||
:ensure t)
|
||||
|
||||
(use-package ibuffer-projectile
|
||||
:ensure t)
|
||||
|
||||
(add-hook 'ibuffer-mode-hook
|
||||
(lambda ()
|
||||
(ibuffer-projectile-set-filter-groups)))
|
||||
|
||||
(provide 'buffer)
|
||||
|
||||
;;; buffer.el ends here
|
||||
14
dotfiles/desktop/.emacs.d/lisp/core/editor.el
Normal file
14
dotfiles/desktop/.emacs.d/lisp/core/editor.el
Normal file
@@ -0,0 +1,14 @@
|
||||
;;; core-editor
|
||||
|
||||
(setq standard-indent 4)
|
||||
(setq tab-stop-list nil)
|
||||
(setq indent-tabs-mode nil)
|
||||
|
||||
;; Setting variables
|
||||
(setq vc-follow-symlinks 't)
|
||||
(prefer-coding-system 'utf-8-unix)
|
||||
(setq custom-file (null-device))
|
||||
|
||||
(provide 'editor)
|
||||
|
||||
;;; editor.el ends here
|
||||
161
dotfiles/desktop/.emacs.d/lisp/core/keybindings.el
Normal file
161
dotfiles/desktop/.emacs.d/lisp/core/keybindings.el
Normal file
@@ -0,0 +1,161 @@
|
||||
;;; keybindings.el -*- lexical-binding: t; -*-
|
||||
|
||||
;;;; Global / Core
|
||||
|
||||
(global-set-key (kbd "C-x C-b") #'ibuffer)
|
||||
(global-set-key (kbd "C-<return>") 'company-complete)
|
||||
|
||||
(defvar fscotto/leader-map (make-sparse-keymap)
|
||||
"Keymap per comandi sotto C-c.")
|
||||
|
||||
(define-key global-map (kbd "C-c") fscotto/leader-map)
|
||||
|
||||
;;;; 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)
|
||||
|
||||
;; 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 'vterm "vterm" nil t)
|
||||
(define-key fscotto/open (kbd "T") #'vterm)
|
||||
|
||||
(with-eval-after-load 'vterm
|
||||
(define-key vterm-mode-map (kbd "C-c C-t") #'vterm-copy-mode))
|
||||
|
||||
;; -------- mu4e --------
|
||||
(autoload 'mu4e "mu4e" nil t)
|
||||
(define-key fscotto/open (kbd "m") #'mu4e)
|
||||
|
||||
;; -------- elfeed --------
|
||||
(autoload 'elfeed "elfeed" nil t)
|
||||
(define-key fscotto/open (kbd "f") #'elfeed)
|
||||
|
||||
;;;; 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-vterm)
|
||||
(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))
|
||||
|
||||
(provide 'core/keybindings)
|
||||
|
||||
;;; keybindings.el ends here
|
||||
15
dotfiles/desktop/.emacs.d/lisp/core/packages.el
Normal file
15
dotfiles/desktop/.emacs.d/lisp/core/packages.el
Normal file
@@ -0,0 +1,15 @@
|
||||
;; core-packages.el -*- lexical-binding: t; -*-
|
||||
(require 'use-package)
|
||||
|
||||
(use-package package
|
||||
:config
|
||||
;; Setting repo priorities
|
||||
(setq package-archive-priorities
|
||||
'(("melpa-stable" . 2)
|
||||
("MELPA" . 1)
|
||||
("gnu" . 0)))
|
||||
;; Setting repo URL
|
||||
(setq package-archives
|
||||
'(("melpa-stable" . "https://stable.melpa.org/packages/")
|
||||
("MELPA" . "https://melpa.org/packages/")
|
||||
("gnu" . "https://elpa.gnu.org/packages/"))))
|
||||
22
dotfiles/desktop/.emacs.d/lisp/core/performance.el
Normal file
22
dotfiles/desktop/.emacs.d/lisp/core/performance.el
Normal file
@@ -0,0 +1,22 @@
|
||||
;;; core-performance.el -*-
|
||||
|
||||
;; --- 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)
|
||||
|
||||
;; 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)
|
||||
(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)
|
||||
82
dotfiles/desktop/.emacs.d/lisp/core/ui.el
Normal file
82
dotfiles/desktop/.emacs.d/lisp/core/ui.el
Normal file
@@ -0,0 +1,82 @@
|
||||
;;; core-ui.el -*- lexical-binding: t; -*-
|
||||
|
||||
;; Load default theme
|
||||
(use-package sublime-themes
|
||||
:ensure t)
|
||||
|
||||
(use-package soothe-theme
|
||||
:ensure t)
|
||||
|
||||
(use-package nordic-night-theme
|
||||
:ensure t)
|
||||
|
||||
(use-package timu-caribbean-theme
|
||||
:ensure t)
|
||||
|
||||
(load-theme 'nordic-night t)
|
||||
|
||||
;; Setting default font
|
||||
(set-frame-font "Liberation Mono 14" nil t)
|
||||
|
||||
(add-to-list 'default-frame-alist
|
||||
'(font . "Liberation Mono-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 '(fullscreen . maximized))
|
||||
|
||||
;; Remove scrollbar
|
||||
(scroll-bar-mode -1)
|
||||
|
||||
;; Simple 'y' for 'yes' and 'n' for 'no'
|
||||
(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
|
||||
Reference in New Issue
Block a user