;; Based on emacs bedrock config: https://git.sr.ht/~ashton314/emacs-bedrock/tree/main/item/init.el ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;; Boot ;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Improve boot speed (setq gc-cons-threshold 10000000) (setq byte-compile-warnings '(not obsolete)) (setq warning-suppress-log-types '((comp) (bytecomp))) (setq native-comp-async-report-warnings-errors 'silent) ;; Silence stupid startup message (setq inhibit-startup-echo-area-message (user-login-name)) ;; Default frame configuration: full screen, good-looking title bar on macOS (setq frame-resize-pixelwise t) (setq default-frame-alist '((fullscreen . maximized) ;; You can turn off scroll bars by uncommenting these lines: (vertical-scroll-bars . nil) (horizontal-scroll-bars . nil) ;; Setting the face in here prevents flashes of ;; color as the theme gets activated (background-color . "#000000") (ns-appearance . dark) (ns-transparent-titlebar . t))) ;; Profile emacs startup (add-hook 'emacs-startup-hook (lambda () (message "*** Emacs loaded in %s with %d garbage collections." (format "%.2f seconds" (float-time (time-subtract after-init-time before-init-time))) gcs-done))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;; Setup ;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Melpa (require 'package) (setq package-enable-at-startup nil) (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/")) (add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/")) (unless (bound-and-true-p package--initialized) (package-initialize)) ;; Fixed error on Guix emacs (require 'use-package) (setq use-package-always-ensure t) ;; Automatically reread from disk if the underlying file changes (setq auto-revert-interval 1) (setq auto-revert-check-vc-info t) (global-auto-revert-mode) ;; Windmove keybinding (move between windows with CTRL+Arrows) (windmove-default-keybindings 'control) ;; Make right-click do something sensible (when (display-graphic-p) (context-menu-mode)) ;; Recent files (recentf-mode 1) (setq recentf-max-menu-items 25) (setq recentf-max-saved-items 25) (global-set-key "\C-x\ \C-r" 'recentf-open-files) ;; Auto-save files in auto-saves/ (let ((emacs-auto-save-folder (concat user-emacs-directory "auto-saves/"))) (if (file-directory-p emacs-auto-save-folder) nil (make-directory emacs-auto-save-folder)) (setq auto-save-file-name-transforms `((".*" ,emacs-auto-save-folder t)))) ;; Backup files in backups/ (let ((emacs-backup-folder (concat user-emacs-directory "backups/"))) (if (file-directory-p emacs-backup-folder) nil (make-directory emacs-backup-folder)) (setq backup-directory-alist `(("." . ,(expand-file-name emacs-backup-folder))))) ;; Which key (use-package which-key :ensure t :config (which-key-mode)) ;; Tramp (setq remote-file-name-inhibit-cache nil) (setq vc-ignore-dir-regexp (format "%s\\|%s" vc-ignore-dir-regexp tramp-file-name-regexp)) (setq tramp-verbose 1) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;; Custom variables snippet ;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (custom-set-variables ;; custom-set-variables was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(custom-safe-themes '("32f22d075269daabc5e661299ca9a08716aa8cda7e85310b9625c434041916af" "f458b92de1f6cf0bdda6bce23433877e94816c3364b821eb4ea9852112f5d7dc" default)) '(org-agenda-files '("~/Projects/org-files/agenda/financeiro.org")) '(package-selected-packages '(yaml-mode lsp-ui lsp-mode pet editorconfig geiser-guile paredit git-auto-commit-mode elpy rust-mode lua-mode sass-mode poetry markdown-mode flymake-cursor gdscript-mode magit org-pomodoro org-tracktable doom-themes which-key)) '(pyvenv-tracking-mode t) '(safe-local-variable-values '((git-auto-commit-mode . 1) (git-auto-commit-mode . t)))) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;; Minibuffer ;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; For help, see: https://www.masteringemacs.org/article/understanding-minibuffer-completion (setq enable-recursive-minibuffers t) ; Use the minibuffer whilst in the minibuffer (setq completion-cycle-threshold 1) ; TAB cycles candidates (setq completions-detailed t) ; Show annotations (setq tab-always-indent 'complete) ; When I hit TAB, try to complete, otherwise, indent (setq completion-styles '(basic initials substring)) ; Different styles to match input to candidates (setq completion-auto-help 'always) ; Open completion always; `lazy' another option (setq completions-max-height 20) ; This is arbitrary (setq completions-detailed t) (setq completions-format 'one-column) (setq completions-group t) (setq completion-auto-select 'second-tab) ; Much more eager ;(setq completion-auto-select t) ; See `C-h v completion-auto-select' for more possible values (keymap-set minibuffer-mode-map "TAB" 'minibuffer-complete) ; TAB acts more like how it does in the shell ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;; Better UI ;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Inibit (setq inhibit-splash-screen t) ;; Disable graphical toolbars (scroll-bar-mode -1) (tool-bar-mode -1) (tooltip-mode -1) (menu-bar-mode -1) ;; Disable blinking cursos (blink-cursor-mode 0) ;; Display time (setq display-time-day-and-date t) (display-time) ;; Display Battery (display-battery-mode 1) ;; Column number mode (column-number-mode) (global-display-line-numbers-mode t) (global-hl-line-mode +1) (dolist (mode '(term-mode-hook shell-mode-hook eshell-mode-hook treemacs-mode-hook)) (add-hook mode (lambda () (display-line-numbers-mode 0)))) (set-face-attribute 'default nil :font "Fira Code" :height 120) ;; Enable horizontal scrolling (setq mouse-wheel-tilt-scroll t) (setq mouse-wheel-flip-direction t) ;; Best theme (use-package doom-themes :config (load-theme 'doom-fairy-floss)) ;; Fix TUI background (add-to-list 'default-frame-alist '(background-color . "#464258")) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;; Text Modes ;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Helpful packages for org mode (use-package org-tracktable) (use-package org-pomodoro) (use-package git-auto-commit-mode) (defun set-auto-commit-settings () (setq gac-automatically-push-p t)) (add-hook 'org-mode-hook 'set-auto-commit-settings) ;; Truncate lines and word wrap (defun set-truncate-lines-mode-hook () "Custom hook." (setq word-wrap t) (setq truncate-lines nil)) (add-hook 'org-mode-hook #'set-truncate-lines-mode-hook) (add-hook 'markdown-mode-hook #'set-truncate-lines-mode-hook) ;; Markdown (use-package markdown-mode :ensure t :mode ("README\\.md\\'" . gfm-mode) :init (setq markdown-command "multimarkdown")) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;; Programming modes ;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Editor config (use-package editorconfig :ensure t) (editorconfig-mode 1) ;; Flymake errors under cursor (use-package flymake-cursor :ensure t) (eval-after-load 'flymake '(require 'flymake-cursor)) ;; Disable automatic eldoc (setq eglot-managed-mode-hook (list (lambda () (eldoc-mode -1)))) ;; Install magit (use-package magit :ensure t) ;; Guile related packages (use-package paredit :ensure t) (autoload 'enable-paredit-mode "paredit" "Turn on pseudo-structural editing of Lisp code." t) (add-hook 'emacs-lisp-mode-hook #'enable-paredit-mode) (add-hook 'eval-expression-minibuffer-setup-hook #'enable-paredit-mode) (add-hook 'ielm-mode-hook #'enable-paredit-mode) (add-hook 'lisp-mode-hook #'enable-paredit-mode) (add-hook 'lisp-interaction-mode-hook #'enable-paredit-mode) (add-hook 'scheme-mode-hook #'enable-paredit-mode) (use-package geiser-guile :ensure t) ;; LSP (use-package lsp-mode :ensure t :init (setq lsp-keymap-prefix "C-c l") :hook ((python-mode . lsp)) :commands lsp ) (use-package lsp-ui :ensure t :commands lsp-ui-mode) ;; python mode (use-package poetry :ensure t :hook (python-mode . poetry-tracking-mode)) ;; Lua mode (use-package lua-mode :ensure t) ;; YAML mode (use-package yaml-mode :ensure t) ;; Rust mode (use-package rust-mode :ensure t) ;; GDScript mode (use-package gdscript-mode) (add-hook 'gdscript-mode-hook 'eglot-ensure) (put 'dired-find-alternate-file 'disabled nil) ;; Sass mode (use-package sass-mode)