try to organize first try

This commit is contained in:
frosty 2024-09-06 05:33:33 -04:00
parent c266f50474
commit f11c94e725

View file

@ -3,21 +3,30 @@
#+EMAIL: passedgoandgot200@gmail.com #+EMAIL: passedgoandgot200@gmail.com
#+OPTIONS: num:nil #+OPTIONS: num:nil
* Package Bootstrapping
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
;;; Initial bootstrapping ;; Add MELPA to the repositories list
;; Enable MELPA repository
(require 'package) (require 'package)
(add-to-list 'package-archives (add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/") t) '("melpa" . "https://melpa.org/packages/") t)
;; Load packages list
(package-initialize) (package-initialize)
;;; Look and feel ;; Setup `use-package'
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
(eval-when-compile
(require 'use-package))
#+END_SRC
* Look and Feel
#+BEGIN_SRC emacs-lisp
;; Set the theme ;; Set the theme
(unless (package-installed-p 'ample-theme) (use-package ample-theme
(package-install 'ample-theme)) :ensure t
(load-theme 'ample t) :config (load-theme 'ample t))
;; Disable menu bar ;; Disable menu bar
(menu-bar-mode -1) (menu-bar-mode -1)
@ -42,179 +51,181 @@
(setq-default show-trailing-whitespace t) (setq-default show-trailing-whitespace t)
;; Flash mode line on bell ;; Flash mode line on bell
(unless (package-installed-p 'mode-line-bell) (use-package mode-line-bell
(package-install 'mode-line-bell)) :ensure t
(require 'mode-line-bell) :config (mode-line-bell-mode))
(mode-line-bell-mode) #+END_SRC
;;; Buffer input and interaction #+BEGIN_SRC emacs-lisp
;; Better mouse scrolling ;;; Buffer input and interaction
(setq mouse-wheel-progressive-speed nil)
;; Use short yes/no answers ;; Better mouse scrolling
(setq-default use-short-answers t) (setq mouse-wheel-progressive-speed nil)
;; Auto-pair parenthesis ;; Use short yes/no answers
(electric-pair-mode 1) (setq-default use-short-answers t)
;; VIM emulation ;; Auto-pair parenthesis
(unless (package-installed-p 'evil) (electric-pair-mode 1)
(package-install 'evil))
(setq
;; Scroll up with C-u
evil-want-C-u-scroll t
;; Yank to EOL with Y
evil-want-Y-yank-to-eol t
;; Create split windows below
evil-split-window-below t
;; Create vsplit windows to the right
evil-vsplit-window-right t)
(require 'evil)
(evil-mode 1)
;; Automatically trim trailing whitespace on save ;; VIM emulation
(add-hook 'before-save-hook 'delete-trailing-whitespace) (unless (package-installed-p 'evil)
(package-install 'evil))
(setq
;; Scroll up with C-u
evil-want-C-u-scroll t
;; Yank to EOL with Y
evil-want-Y-yank-to-eol t
;; Create split windows below
evil-split-window-below t
;; Create vsplit windows to the right
evil-vsplit-window-right t)
(require 'evil)
(evil-mode 1)
;;; General interface ;; Automatically trim trailing whitespace on save
(add-hook 'before-save-hook 'delete-trailing-whitespace)
;; Completion UI ;;; General interface
(unless (package-installed-p 'vertico)
(package-install 'vertico))
(require 'vertico)
(vertico-mode 1)
;; Improve directory navigation ;; Completion UI
(define-key vertico-map (kbd "RET") #'vertico-directory-enter) (unless (package-installed-p 'vertico)
(define-key vertico-map (kbd "DEL") #'vertico-directory-delete-word) (package-install 'vertico))
(define-key vertico-map (kbd "M-d") #'vertico-directory-delete-char) (require 'vertico)
(vertico-mode 1)
;;; Extended completion utilities ;; Improve directory navigation
(unless (package-installed-p 'consult) (define-key vertico-map (kbd "RET") #'vertico-directory-enter)
(package-install 'consult)) (define-key vertico-map (kbd "DEL") #'vertico-directory-delete-word)
(global-set-key [rebind switch-to-buffer] #'consult-buffer) (define-key vertico-map (kbd "M-d") #'vertico-directory-delete-char)
(global-set-key (kbd "C-c j") #'consult-line)
(global-set-key (kbd "C-c i") #'consult-imenu)
(setq read-buffer-completion-ignore-case t
read-file-name-completion-ignore-case t
completion-ignore-case t)
;;; LSP Support ;;; Extended completion utilities
(unless (package-installed-p 'eglot) (unless (package-installed-p 'consult)
(package-install 'eglot)) (package-install 'consult))
(global-set-key [rebind switch-to-buffer] #'consult-buffer)
(global-set-key (kbd "C-c j") #'consult-line)
(global-set-key (kbd "C-c i") #'consult-imenu)
(setq read-buffer-completion-ignore-case t
read-file-name-completion-ignore-case t
completion-ignore-case t)
;; Enable LSP support by default in programming buffers ;;; LSP Support
(add-hook 'prog-mode-hook #'eglot-ensure) (unless (package-installed-p 'eglot)
(package-install 'eglot))
;; Create a memorable alias for `eglot-ensure'. ;; Enable LSP support by default in programming buffers
(defalias 'start-lsp-server #'eglot) (add-hook 'prog-mode-hook #'eglot-ensure)
;; Completion style ;; Create a memorable alias for `eglot-ensure'.
(unless (package-installed-p 'orderless) (defalias 'start-lsp-server #'eglot)
(package-install 'orderless))
(require 'orderless)
(setq completion-styles '(orderless basic)
completion-category-overrides '((file (styles basic partial-completion))))
;; Persist history over restarts ;; Completion style
(require 'savehist) (unless (package-installed-p 'orderless)
(savehist-mode 1) (package-install 'orderless))
(require 'orderless)
(setq completion-styles '(orderless basic)
completion-category-overrides '((file (styles basic partial-completion))))
;; Persist history over restarts
(require 'savehist)
(savehist-mode 1)
;;; Inline static analysis ;;; Inline static analysis
;; Enabled inline static analysis ;; Enabled inline static analysis
(add-hook 'prog-mode-hook #'flymake-mode) (add-hook 'prog-mode-hook #'flymake-mode)
;; Display messages when idle, without prompting ;; Display messages when idle, without prompting
(setq help-at-pt-display-when-idle t) (setq help-at-pt-display-when-idle t)
;; Message navigation bindings ;; Message navigation bindings
(with-eval-after-load 'flymake (with-eval-after-load 'flymake
(define-key flymake-mode-map (kbd "C-c n") #'flymake-goto-next-error) (define-key flymake-mode-map (kbd "C-c n") #'flymake-goto-next-error)
(define-key flymake-mode-map (kbd "C-c p") #'flymake-goto-prev-error)) (define-key flymake-mode-map (kbd "C-c p") #'flymake-goto-prev-error))
;;; Pop-up completion ;;; Pop-up completion
(unless (package-installed-p 'corfu) (unless (package-installed-p 'corfu)
(package-install 'corfu)) (package-install 'corfu))
;; Enable autocompletion by default in programming buffers ;; Enable autocompletion by default in programming buffers
(add-hook 'prog-mode-hook #'corfu-mode) (add-hook 'prog-mode-hook #'corfu-mode)
;; Enable automatic completion. ;; Enable automatic completion.
(setq corfu-auto t) (setq corfu-auto t)
;;; Git client ;;; Git client
(unless (package-installed-p 'magit) (unless (package-installed-p 'magit)
(package-install 'magit)) (package-install 'magit))
;; Bind the `magit-status' command to a convenient key. ;; Bind the `magit-status' command to a convenient key.
(global-set-key (kbd "C-c g") #'magit-status) (global-set-key (kbd "C-c g") #'magit-status)
;;; Indication of local VCS changes ;;; Indication of local VCS changes
(unless (package-installed-p 'diff-hl) (unless (package-installed-p 'diff-hl)
(package-install 'diff-hl)) (package-install 'diff-hl))
;; Enable `diff-hl' support by default in programming buffers ;; Enable `diff-hl' support by default in programming buffers
(add-hook 'prog-mode-hook #'diff-hl-mode) (add-hook 'prog-mode-hook #'diff-hl-mode)
;;; Go Support ;;; Go Support
(unless (package-installed-p 'go-mode) (unless (package-installed-p 'go-mode)
(package-install 'go-mode)) (package-install 'go-mode))
;;; JSON Support ;;; JSON Support
(unless (package-installed-p 'json-mode) (unless (package-installed-p 'json-mode)
(package-install 'json-mode)) (package-install 'json-mode))
;;; Lua Support ;;; Lua Support
(unless (package-installed-p 'lua-mode) (unless (package-installed-p 'lua-mode)
(package-install 'lua-mode)) (package-install 'lua-mode))
;;; Rust Support ;;; Rust Support
(unless (package-installed-p 'rust-mode) (unless (package-installed-p 'rust-mode)
(package-install 'rust-mode)) (package-install 'rust-mode))
;;; YAML Support ;;; YAML Support
(unless (package-installed-p 'yaml-mode) (unless (package-installed-p 'yaml-mode)
(package-install 'yaml-mode)) (package-install 'yaml-mode))
;;; Markdown support ;;; Markdown support
(unless (package-installed-p 'markdown-mode) (unless (package-installed-p 'markdown-mode)
(package-install 'markdown-mode)) (package-install 'markdown-mode))
;;; EditorConfig support ;;; EditorConfig support
(unless (package-installed-p 'editorconfig) (unless (package-installed-p 'editorconfig)
(package-install 'editorconfig)) (package-install 'editorconfig))
;; Enable EditorConfig ;; Enable EditorConfig
(editorconfig-mode t) (editorconfig-mode t)
;;; In-Emacs Terminal Emulation ;;; In-Emacs Terminal Emulation
(unless (package-installed-p 'eat) (unless (package-installed-p 'eat)
(package-install 'eat)) (package-install 'eat))
;; Close the terminal buffer when the shell terminates. ;; Close the terminal buffer when the shell terminates.
(setq eat-kill-buffer-on-exit t) (setq eat-kill-buffer-on-exit t)
;; Enable mouse-support. ;; Enable mouse-support.
(setq eat-enable-mouse t) (setq eat-enable-mouse t)
;;; Jump to arbitrary positions ;;; Jump to arbitrary positions
(unless (package-installed-p 'avy) (unless (package-installed-p 'avy)
(package-install 'avy)) (package-install 'avy))
(global-set-key (kbd "C-c z") #'avy-goto-word-1) (global-set-key (kbd "C-c z") #'avy-goto-word-1)
;; Store automatic customisation options elsewhere ;; Store automatic customisation options elsewhere
(setq custom-file (locate-user-emacs-file "custom.el")) (setq custom-file (locate-user-emacs-file "custom.el"))
(when (file-exists-p custom-file) (when (file-exists-p custom-file)
(load custom-file)) (load custom-file))
#+END_SRC #+END_SRC