Update Emacs configuration with LSP capability

This commit is contained in:
Fabio Scotto di Santolo
2025-09-02 19:34:51 +02:00
parent ea7b586c3c
commit 37e092c031
2 changed files with 185 additions and 135 deletions

114
emacs/.config/emacs/.gitignore vendored Normal file → Executable file
View File

@@ -1,57 +1,57 @@
# Created by https://www.toptal.com/developers/gitignore/api/emacs # Created by https://www.toptal.com/developers/gitignore/api/emacs
# Edit at https://www.toptal.com/developers/gitignore?templates=emacs # Edit at https://www.toptal.com/developers/gitignore?templates=emacs
### Emacs ### ### Emacs ###
# -*- mode: gitignore; -*- # -*- mode: gitignore; -*-
*~ *~
\#*\# \#*\#
/.emacs.desktop /.emacs.desktop
/.emacs.desktop.lock /.emacs.desktop.lock
*.elc *.elc
auto-save-list auto-save-list
tramp tramp
.\#* .\#*
eln-cache eln-cache
projects projects
# Org-mode # Org-mode
.org-id-locations .org-id-locations
*_archive *_archive
# flymake-mode # flymake-mode
*_flymake.* *_flymake.*
# eshell files # eshell files
/eshell/history /eshell/history
/eshell/lastdir /eshell/lastdir
# elpa packages # elpa packages
/elpa/ /elpa/
# reftex files # reftex files
*.rel *.rel
# AUCTeX auto folder # AUCTeX auto folder
/auto/ /auto/
# cask packages # cask packages
.cask/ .cask/
dist/ dist/
# Flycheck # Flycheck
flycheck_*.el flycheck_*.el
# server auth directory # server auth directory
/server/ /server/
# projectiles files # projectiles files
.projectile .projectile
# directory configuration # directory configuration
.dir-locals.el .dir-locals.el
# network security # network security
/network-security.data /network-security.data
# End of https://www.toptal.com/developers/gitignore/api/emacs # End of https://www.toptal.com/developers/gitignore/api/emacs

View File

@@ -1,78 +1,128 @@
;; Initial greeting for debugging ;; Initial greeting for debugging
(message "Welcome to Emacs") (message "Welcome to Emacs")
(message "Loading user configuration...") (message "Loading user configuration...")
;; Setting variables ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setq vc-follow-symlinks 't) ;; LOOK AND FEEL ;;
(prefer-coding-system 'utf-8-unix) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setq custom-file (null-device))
;; Setting default theme
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (load-theme 'catppuccin :no-confirm)
;; PACKAGES ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Setting default font
(set-frame-font "0xProto Nerd Font 13" nil t)
;; Initialize package system via use-package
(package-initialize) ;; Remove toolbar
(require 'use-package) (tool-bar-mode -1)
(use-package package ;; Remove menu
:config (menu-bar-mode -1)
;; Setting repo priorities
(setq package-archive-priorities ;; Disable startup screen
'(("melpa-stable" . 2) (setq inhibit-startup-screen t)
("MELPA" . 1)
("gnu" . 0))) ;; Disable splash screen
;; Setting repo URL (setq inhibit-splash-screen t)
(setq package-archives
'(("melpa-stable" . "https://stable.melpa.org/packages/") ;; Remove scrollbar
("MELPA" . "https://melpa.org/packages/") (scroll-bar-mode -1)
("gnu" . "https://elpa.gnu.org/packages/")))
) ;; Simple 'y' for 'yes' and 'n' for 'no'
(defalias 'yes-or-no-p 'y-or-n-p)
(use-package catppuccin-theme
:ensure t) ;; Set global value for paragraph witdh
(setq-default fill-column 120)
(use-package hl-todo
:ensure t) ;; Stop Emacs from losing informations
(setq undo-limit 2000000)
(setq hl-todo-keyword-faces (setq undo-strong-limit 4000000000)
'(("TODO" . "#94e2d5")
("FIXME" . "#f38ba8") ;; Smooth scroll
("DEBUG" . "#cba6f7") (setq scroll-step 3)
("GOTCHA" . "#eba0ac") (setq ring-bell-function 'ignore)
("STUB" . "#89b4fa")))
;; Add column number in the status line
(with-eval-after-load 'magit (column-number-mode)
(add-hook 'magit-log-wash-summary-hook
#'hl-todo-search-and-highlight t) ;; View clock in the status line
(add-hook 'magit-revision-wash-message-hook (display-time)
#'hl-todo-search-and-highlighthl t))
;; Enable line numbers in the programming mode only
;; TODO adding lsp-mode, dap-mode, autocomplete and project handling for C, Go, Bash and Python (add-hook 'prog-mode-hook 'display-line-numbers-mode)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Enable line numbers in the configuration mode only
;; LOOK AND FEEL ;; (add-hook 'conf-mode-hook 'display-line-numbers-mode)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Setting default theme ;; EDITOR OPTIONS ;;
(load-theme 'catppuccin :no-confirm) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setq standard-indent 4)
;; Setting default font (setq tab-stop-list nil)
(set-frame-font "0xProto Nerd Font 16" nil t) (setq indent-tabs-mode nil)
;; Remove toolbar ;; Setting variables
(tool-bar-mode -1) (setq vc-follow-symlinks 't)
(prefer-coding-system 'utf-8-unix)
;; Remove menu (setq custom-file (null-device))
(menu-bar-mode -1)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Disable startup screen ;; PACKAGES ;;
(setq inhibit-startup-screen t) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Disable splash screen ;; Initialize package system via use-package
(setq inhibit-splash-screen t) (package-initialize)
(require 'use-package)
;; Enable line numbers in the programming mode only
(add-hook 'prog-mode-hook 'display-line-numbers-mode) (use-package package
:config
(message "...user configuration loaded") ;; 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/")))
)
(use-package catppuccin-theme
:ensure t)
;; FIXME autoload hl-todo
(use-package hl-todo
:ensure t
:init (hl-todo-mode 1))
(setq hl-todo-keyword-faces
'(("TODO" . "#94e2d5")
("FIXME" . "#f38ba8")
("DEBUG" . "#cba6f7")
("GOTCHA" . "#eba0ac")
("STUB" . "#89b4fa")))
(with-eval-after-load 'magit
(add-hook 'magit-log-wash-summary-hook
#'hl-todo-search-and-highlight t)
(add-hook 'magit-revision-wash-message-hook
#'hl-todo-search-and-highlighthl t))
;; Status line like Doom Emacs
(use-package doom-modeline
:ensure t
:init (doom-modeline-mode 1))
(use-package vterm
:ensure t)
;; TODO adding lsp-mode, dap-mode, autocomplete and project handling for C, Go, Bash and Python
(use-package lsp-mode
:ensure t
:init
;; set prefix for lsp-command-keymap (few alternatives - "C-l", "C-c l")
(setq lsp-keymap-prefix "C-c l")
:hook ((c-mode . lsp))
:commands lsp)
(message "...user configuration loaded")