diff --git a/.gitignore b/.gitignore index 25aa374..6d15180 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,7 @@ elpa/ eln-cache/ # emacs temp files **.**~ +projects +recentf +tramp +transient/** diff --git a/init.el b/init.el index 2603364..e3aae0f 100644 --- a/init.el +++ b/init.el @@ -1,118 +1,228 @@ -;; Custom +;; Add MELPA package repo +(require 'package) +(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) +(package-initialize) + +;; Install use-package if not already installed +(unless (package-installed-p 'use-package) + (package-refresh-contents) + (package-install 'use-package)) + +(require 'use-package) +(setq use-package-always-ensure t) ;; Auto-install packages + +;; Bell Settings +(setq ring-bell-function 'ignore) +(setq visible-bell t) + +;; Set Font +(set-face-attribute 'default nil + :family "Hurmit Nerd Font Mono" + :foundry "PfEd" + :height 120 + :background "#000000" + :foreground "#ffffff") + +;; Disable splash screen (typo fixed) +(setq inhibit-startup-message t) + +;; UI elements - these are fast, keep them early +(menu-bar-mode 1) +(tool-bar-mode -1) +(scroll-bar-mode -1) +(global-display-line-numbers-mode 1) + +(use-package super-save + :ensure t + :config + (super-save-mode +1)) + +;; magit +(use-package magit + :ensure t) + +;; Packages with deferred loading +(use-package helm + :defer 1 + :bind (("M-x" . helm-M-x) + ("C-c h" . helm-command-prefix)) + :config + (global-unset-key (kbd "C-x c")) + (define-key helm-map (kbd "<tab>") 'helm-execute-persistent-action) + (define-key helm-map (kbd "C-i") 'helm-execute-persistent-action) + (define-key helm-map (kbd "C-z") 'helm-select-action) + (when (executable-find "curl") + (setq helm-google-suggest-use-curl-p t)) + (setq helm-split-window-in-side-p t + helm-move-to-line-cycle-in-source t + helm-ff-search-library-in-sexp t + helm-scroll-amount 8 + helm-ff-file-name-history-use-recentf t + helm-echo-input-in-header-line t + helm-autoresize-max-height 0 + helm-autoresize-min-height 20) + (helm-autoresize-mode 1) + (helm-mode 1)) + +(use-package catppuccin-theme + :config + (setq catppuccin-flavor 'macchiato) + (load-theme 'catppuccin t) + (add-hook 'after-init-hook (lambda () (run-with-timer 0.5 nil #'catppuccin-reload)))) + +(use-package which-key + :defer 1 + :config + (setq which-key-idle-delay 0.01 + which-key-idle-secondary-delay 0.01) + (which-key-setup-side-window-right-bottom) + (which-key-mode)) + +(use-package git-gutter + :defer 2 + :config + (global-git-gutter-mode +1)) + +(use-package meow + :config + (defvar meow-lsp-keymap + (let ((keymap (make-sparse-keymap))) + (define-key keymap (kbd "d") #'xref-find-definitions) + (define-key keymap (kbd "D") #'eglot-find-implementation) + (define-key keymap (kbd "r") #'xref-find-references) + (define-key keymap (kbd "t") #'eglot-find-typeDefinition) + (define-key keymap (kbd "h") #'eglot-help-at-point) + (define-key keymap (kbd "a") #'eglot-code-actions) + (define-key keymap (kbd "R") #'eglot-rename) + (define-key keymap (kbd "f") #'eglot-format) + (define-key keymap (kbd "o") #'eglot-code-action-organize-imports) + keymap) + "Keymap for LSP navigation commands in Meow normal mode.") + + (defun meow-lsp-keymap-fn () + "Access the LSP keymap." + (interactive) + (set-transient-map meow-lsp-keymap)) + + (defun meow-setup () + (setq meow-cheatsheet-layout meow-cheatsheet-layout-colemak-dh) + (meow-leader-define-key + '("?" . helm-apropos) + '("B" . meow-cheatsheet) + '("1" . meow-digit-argument) + '("2" . meow-digit-argument) + '("3" . meow-digit-argument) + '("4" . meow-digit-argument) + '("5" . meow-digit-argument) + '("6" . meow-digit-argument) + '("7" . meow-digit-argument) + '("8" . meow-digit-argument) + '("9" . meow-digit-argument) + '("0" . meow-digit-argument) + '("/" . helm-do-grep-ag) + '("a" . eglot-code-actions) + '("b" . helm-mini) + '("f" . helm-find-files)) + (meow-normal-define-key + '("0" . meow-expand-0) + '("1" . meow-expand-1) + '("2" . meow-expand-2) + '("3" . meow-expand-3) + '("4" . meow-expand-4) + '("5" . meow-expand-5) + '("6" . meow-expand-6) + '("7" . meow-expand-7) + '("8" . meow-expand-8) + '("9" . meow-expand-9) + '("-" . negative-argument) + '(":" . helm-M-x) + '(";" . meow-reverse) + '("'" . meow-inner-of-thing) + '("," . meow-bounds-of-thing) + '("[" . meow-beginning-of-thing) + '("]" . meow-end-of-thing) + '("/" . meow-visit) + '("a" . meow-append) + '("A" . meow-open-below) + '("b" . meow-back-word) + '("B" . meow-back-symbol) + '("c" . meow-change) + '("C" . meow-grab) + '("d" . meow-delete) + '("D" . meow-backward-delete) + '("e" . meow-prev) + '("E" . meow-prev-expand) + '("f" . meow-find) + '("g" . meow-lsp-keymap-fn) + '("G" . meow-goto-line) + '("h" . meow-insert) + '("H" . meow-open-above) + '("i" . meow-next) + '("I" . meow-next-expand) + '("j" . meow-join) + '("K" . meow-kill) + '("k" . meow-clipboard-kill) + '("l" . meow-line) + '("m" . meow-mark-word) + '("M" . meow-mark-symbol) + '("n" . meow-left) + '("N" . meow-left-expand) + '("o" . meow-right) + '("O" . meow-right-expand) + '("p" . meow-yank) + '("P" . meow-clipboard-yank) + '("q" . meow-quit) + '("r" . meow-replace) + '("t" . meow-till) + '("u" . meow-undo) + '("U" . undo-redo) + '("v" . meow-search) + '("w" . meow-next-word) + '("W" . meow-next-symbol) + '("y" . meow-save) + '("Y" . meow-clipboard-save) + '("z" . meow-pop-selection) + '("." . repeat) + '("~" . upcase-region) + '("`" . downcase-region) + '("<escape>" . ignore))) + + (meow-setup) + (meow-global-mode 1)) + +;; Lazy load other packages that are only needed for specific file types +(use-package markdown-mode :defer t) +(use-package go-mode :defer t) +;; (use-package cider :defer t) +(use-package eglot :defer t) +(add-hook 'go-mode-hook 'eglot-ensure) + +;; If using Company (recommended) +(use-package company + :ensure t + :hook (eglot-managed-mode . company-mode) + :config + (setq company-idle-delay 0.1 + company-minimum-prefix-length 1)) + + + +;; Optionally, measure startup time +(add-hook 'emacs-startup-hook + (lambda () + (message "Emacs loaded in %s seconds" + (float-time (time-subtract after-init-time before-init-time))))) (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. - '(package-selected-packages '(meow))) + '(package-selected-packages + '(magit super-save company which-key use-package-hydra meow markdown-mode helm go-mode git-gutter eglot-inactive-regions cider catppuccin-theme))) (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. ) - -;; Disable splash screen -(setq inihibit-startup-message t) - -;; UI elements -(menu-bar-mode 1) -(tool-bar-mode -1) -(scroll-bar-mode -1) -(global-display-line-numbers-mode 1) - -;; Theme -(load-theme 'modus-vivendi t) - - -;;;; -;; meow-mode -;;;; -(require 'meow) - -(defun meow-setup () - (setq meow-cheatsheet-layout meow-cheatsheet-layout-colemak-dh) -;; (meow-motion-define-key - ;; Use e to move up, n to move down. - ;; Since special modes usually use n to move down, we only overwrite e here. -;; '("<escape>" . ignore)) - (meow-leader-define-key - '("?" . meow-cheatsheet) - '("1" . meow-digit-argument) - '("2" . meow-digit-argument) - '("3" . meow-digit-argument) - '("4" . meow-digit-argument) - '("5" . meow-digit-argument) - '("6" . meow-digit-argument) - '("7" . meow-digit-argument) - '("8" . meow-digit-argument) - '("9" . meow-digit-argument) - '("0" . meow-digit-argument)) - (meow-normal-define-key - '("0" . meow-expand-0) - '("1" . meow-expand-1) - '("2" . meow-expand-2) - '("3" . meow-expand-3) - '("4" . meow-expand-4) - '("5" . meow-expand-5) - '("6" . meow-expand-6) - '("7" . meow-expand-7) - '("8" . meow-expand-8) - '("9" . meow-expand-9) - '("-" . negative-argument) - '(";" . meow-reverse) - '("," . meow-inner-of-thing) - '("." . meow-bounds-of-thing) - '("[" . meow-beginning-of-thing) - '("]" . meow-end-of-thing) - '("/" . meow-visit) - '("a" . meow-append) - '("A" . meow-open-below) - '("b" . meow-back-word) - '("B" . meow-back-symbol) - '("c" . meow-change) - '("d" . meow-delete) - '("D" . meow-backward-delete) - '("e" . meow-prev) - '("E" . meow-prev-expand) - '("f" . meow-find) - '("g" . meow-cancel-selection) - '("G" . meow-grab) - '("n" . meow-left) - '("N" . meow-left-expand) - '("o" . meow-right) - '("O" . meow-right-expand) - '("i" . meow-next) - '("I" . meow-next-expand) - '("j" . meow-join) - '("k" . meow-kill) - '("g" . meow-line) - '("G" . meow-goto-line) - '("m" . meow-mark-word) - '("M" . meow-mark-symbol) - '("n" . meow-left) - '("N" . meow-left-expand) - '("o" . meow-right) - '("O" . meow-right-expand) - '("p" . meow-yank) - '("q" . meow-quit) - '("r" . meow-replace) - '("h" . meow-insert) - '("H" . meow-open-above) - '("t" . meow-till) - '("u" . meow-undo) - '("U" . meow-redo) - '("v" . meow-search) - '("w" . meow-next-word) - '("W" . meow-next-symbol) - '("x" . meow-line) - '("y" . meow-save) - '("z" . meow-pop-selection) - '("'" . repeat) - '("<escape>" . ignore))) - -(meow-setup) -(meow-global-mode 1) - -;; Helm -(require 'helm) +(put 'downcase-region 'disabled nil)