Compare commits

...

10 Commits

3 changed files with 408 additions and 44 deletions

96
dev-settings-work.el Normal file
View File

@@ -0,0 +1,96 @@
;;; dev-settings-work.el --- Work-specific development configuration (Windows)
;;; C# Configuration
(use-package csharp-mode
:defer t
:hook (csharp-mode . eglot-ensure)
:config
;; C# LSP server configuration
;; Install via: dotnet tool install --global csharp-ls
(add-to-list 'eglot-server-programs
'(csharp-mode . ("csharp-ls")))
(add-to-list 'auto-mode-alist '("\\.cs\\'" . csharp-mode)))
;; DAP for .NET debugging
(with-eval-after-load 'dap-mode
(require 'dap-netcore)
(setq dap-netcore-install-dir (expand-file-name "~/.emacs.d/.extension/vscode/ms-dotnettools.csharp")))
;;; Python Configuration
(use-package python-ts-mode
:ensure nil ; Built-in with tree-sitter
:mode "\\.py\\'"
:hook (python-ts-mode . eglot-ensure)
:config
(setq python-shell-interpreter "python3"))
;; Python debugging configuration
(with-eval-after-load 'dap-mode
(require 'dap-python)
(setq dap-python-debugger 'debugpy))
;; Python virtual environment support
(use-package pyvenv
:defer t
:commands (pyvenv-activate pyvenv-workon))
;;; JavaScript/TypeScript Configuration
;; Use built-in js-mode with eglot (no js2-mode needed)
(use-package js-mode
:ensure nil ; Built-in
:mode "\\.js\\'"
:hook (js-mode . eglot-ensure)
:config
(setq js-indent-level 2))
;; TypeScript with tree-sitter
(use-package typescript-ts-mode
:ensure nil ; Built-in with tree-sitter
:mode (("\\.ts\\'" . typescript-ts-mode)
("\\.tsx\\'" . tsx-ts-mode))
:hook ((typescript-ts-mode . eglot-ensure)
(tsx-ts-mode . eglot-ensure))
:config
(setq typescript-ts-mode-indent-offset 2))
;;; Node.js Configuration
;; Node.js REPL
(use-package nodejs-repl
:defer t
:commands nodejs-repl)
;; JSON support
(use-package json-ts-mode
:ensure nil ; Built-in with tree-sitter
:mode "\\.json\\'")
;;; Additional Web Development Tools
;; Web mode for HTML/JSX/template files
(use-package web-mode
:defer t
:mode ("\\.html\\'"
"\\.vue\\'")
:config
(setq web-mode-markup-indent-offset 2
web-mode-css-indent-offset 2
web-mode-code-indent-offset 2))
;; CSS with tree-sitter
(use-package css-ts-mode
:ensure nil ; Built-in with tree-sitter
:mode "\\.css\\'"
:config
(setq css-indent-offset 2))
;; REST client for API testing
(use-package restclient
:defer t
:mode ("\\.http\\'" . restclient-mode))
(provide 'dev-settings-work)
;;; dev-settings-work.el ends here

195
dev-settings.el Normal file
View File

@@ -0,0 +1,195 @@
;;; dev-settings.el --- Development environment configuration
;; Disable warnings for config files
(setq byte-compile-warnings '(not free-vars unresolved noruntime lexical make-local))
;;; Package Management
(require 'use-package)
(setq use-package-always-ensure t)
;;; Core Development Packages
;; Company - autocomplete
(use-package company
:defer 1
:config
(global-company-mode)
(setq company-idle-delay 0.2
company-minimum-prefix-length 2
company-show-numbers t
company-tooltip-align-annotations t))
;; Eglot - Built-in LSP client (Emacs 29+)
(use-package eglot
:ensure nil ; Built-in to Emacs 29+
:defer t
:commands (eglot eglot-ensure)
:config
;; Disable intrusive features
(setq eglot-autoshutdown t
eglot-send-changes-idle-time 0.5)
;; Disable eldoc signature help and documentation on hover
(setq eldoc-echo-area-use-multiline-p nil)
(add-to-list 'eglot-stay-out-of 'eldoc))
;; DAP Mode - Debug Adapter Protocol
(use-package dap-mode
:defer t
:commands (dap-mode dap-debug)
:config
(require 'dap-gdb-lldb) ; C/C++
(require 'dap-cpptools))
;;; Tree-sitter Configuration (Emacs 29+)
;; Tree-sitter is built-in to Emacs 29+
;; Language grammars need to be installed separately
;; Automatically install tree-sitter grammars
(use-package treesit-auto
:custom
(treesit-auto-install t) ; Auto-install without prompting
:config
(treesit-auto-add-to-auto-mode-alist 'all)
(global-treesit-auto-mode))
;;; C/C++ Configuration
(use-package c-ts-mode
:ensure nil ; Built-in
:mode (("\\.c\\'" . c-ts-mode)
("\\.h\\'" . c-ts-mode)
("\\.cpp\\'" . c++-ts-mode)
("\\.hpp\\'" . c++-ts-mode)
("\\.cc\\'" . c++-ts-mode)
("\\.cxx\\'" . c++-ts-mode))
:hook ((c-ts-mode . eglot-ensure)
(c++-ts-mode . eglot-ensure))
:config
(setq c-ts-mode-indent-offset 4))
;; Install clangd for C/C++ LSP support
;; Arch: sudo pacman -S clang
;; Windows: Download from LLVM releases
;;; Go Configuration
(use-package go-ts-mode
:ensure nil ; Built-in to Emacs 29+
:mode "\\.go\\'"
:hook (go-ts-mode . eglot-ensure)
:config
(setq go-ts-mode-indent-offset 4))
;; Install gopls for Go LSP support
;; Arch: sudo pacman -S go gopls
;; Debug adapter: go install github.com/go-delve/delve/cmd/dlv@latest
(with-eval-after-load 'dap-mode
(require 'dap-dlv-go))
;;; Rust Configuration
(use-package rust-ts-mode
:ensure nil ; Built-in to Emacs 29+
:mode "\\.rs\\'"
:hook (rust-ts-mode . eglot-ensure)
:config
(setq rust-ts-mode-indent-offset 4))
;; Install rust-analyzer for Rust LSP support
;; Arch: sudo pacman -S rust rust-analyzer
(with-eval-after-load 'eglot
(add-to-list 'eglot-server-programs
'(rust-ts-mode . ("rust-analyzer"))))
(with-eval-after-load 'dap-mode
(require 'dap-gdb-lldb))
;; Note: Rust debugging uses the same gdb-lldb adapter as C/C++
;; configured in the DAP Mode section above
;;; Common Lisp Configuration
(use-package slime
:defer t
:commands slime
:config
(setq inferior-lisp-program "sbcl")
(setq slime-contribs '(slime-fancy slime-company))
(setq slime-lisp-implementations
'((sbcl ("sbcl") :coding-system utf-8-unix)
(ccl ("ccl") :coding-system utf-8-unix))))
(use-package slime-company
:defer t
:after (slime company)
:config
(setq slime-company-completion 'fuzzy))
;;; Emacs Lisp Configuration
(use-package elisp-mode
:ensure nil
:hook ((emacs-lisp-mode . eldoc-mode)
(emacs-lisp-mode . company-mode)))
;; Better elisp docs
(use-package helpful
:defer t
:commands (helpful-callable helpful-variable helpful-key))
;;; Additional Useful Packages
(use-package smartparens
:defer 1
:hook (prog-mode . smartparens-mode)
:config
(require 'smartparens-config))
;; Snippets
(use-package yasnippet
:defer 2
:config
(yas-global-mode 1))
(use-package yasnippet-snippets
:defer t
:after yasnippet)
;;; LSP Keybindings
(with-eval-after-load 'general
(rh/leader-keys
"g" '(:ignore t :which-key "lsp/go-to")
"gd" '(xref-find-definitions :which-key "go to definition")
"gr" '(xref-find-references :which-key "find references")
"gi" '(eglot-find-implementation :which-key "go to implementation")
"gt" '(eglot-find-typeDefinition :which-key "go to type definition")
"gh" '(eldoc-doc-buffer :which-key "show documentation")
"gs" '(eldoc :which-key "signature help")
"ga" '(eglot-code-actions :which-key "code actions")
"gn" '(eglot-rename :which-key "rename symbol")
"ge" '(flymake-show-buffer-diagnostics :which-key "show diagnostics")
"gf" '(eglot-format-buffer :which-key "format buffer")
"d" '(:ignore t :which-key "debug")
"dd" '(dap-debug :which-key "start debugging")
"db" '(dap-breakpoint-toggle :which-key "toggle breakpoint")
"dc" '(dap-continue :which-key "continue")
"dn" '(dap-next :which-key "step over")
"di" '(dap-step-in :which-key "step into")
"do" '(dap-step-out :which-key "step out")
"dr" '(dap-restart-frame :which-key "restart")
"dq" '(dap-disconnect :which-key "quit/disconnect")
"de" '(dap-eval :which-key "eval expression")
"dl" '(dap-ui-locals :which-key "show locals")
"ds" '(dap-ui-sessions :which-key "show sessions")))
;;; Conditional loading of work-specific settings (Windows only)
(when (eq system-type 'windows-nt)
(let ((work-settings (expand-file-name "dev-settings-work.el" user-emacs-directory)))
(when (file-exists-p work-settings)
(load work-settings))))
(provide 'dev-settings)
;;; dev-settings.el ends here

161
init.el
View File

@@ -1,3 +1,4 @@
;; General Config --------------------------------------------------------------
(setq inhibit-startup-message t) ;; turn off splash screen (setq inhibit-startup-message t) ;; turn off splash screen
(scroll-bar-mode -1) ;; disable scroll bar (scroll-bar-mode -1) ;; disable scroll bar
@@ -11,14 +12,6 @@
(setq display-line-numbers-type 'relative) (setq display-line-numbers-type 'relative)
(global-display-line-numbers-mode) (global-display-line-numbers-mode)
;;disable line numbers for modes where it's weird
(dolist (mode '(org-mode-hook
term-mode-hook
shell-mode-hook
eshell-mode-hook))
(add-hook mode (lambda () (display-line-numbers-mode 0))))
;;disable file backups ;;disable file backups
(setq make-backup-files nil) (setq make-backup-files nil)
(setq create-lockfiles nil) (setq create-lockfiles nil)
@@ -26,11 +19,11 @@
;; always follow symlinks without asking ;; always follow symlinks without asking
(setq vc-follows-symlinks t (setq vc-follows-symlinks t
find-file-visit-truename t) find-file-visit-truename t)
;;set up package management
;; Package Manager -------------------------------------------------------------
(require 'package) (require 'package)
(setq package-archives '(("mepla" . "https://melpa.org/packages/") (setq package-archives '(("melpa" . "https://melpa.org/packages/")
("org" . "https://orgmode.org/elpa")
("elpa" . "https://elpa.gnu.org/packages/"))) ("elpa" . "https://elpa.gnu.org/packages/")))
(package-initialize) (package-initialize)
@@ -42,14 +35,32 @@
(require 'use-package) (require 'use-package)
(setq use-package-always-ensure t) (setq use-package-always-ensure t)
;;end package management set-up
;;theme ;; Style/Theme stuff ----------------------------------------------------------
;; Theme
(use-package gruvbox-theme (use-package gruvbox-theme
:ensure t :ensure t
:config :config
(load-theme 'gruvbox-dark-hard t)) (load-theme 'gruvbox-dark-hard t))
;;icons are required for modeline
(use-package all-the-icons
:ensure t
:if (display-graphic-p))
;;change delimeters to different colors to help identify them
(use-package rainbow-delimiters
:hook (prog-mode . rainbow-delimiters-mode))
;; Replace the line at the bottom with something more stylish
(use-package doom-modeline
:ensure t
:init (doom-modeline-mode 1)
:config
(setq doom-modeline-height 15))
;; Completion/Search/Navigation Shenanigans -----------------------------------
;;completions ;;completions
(use-package vertico (use-package vertico
:ensure t :ensure t
@@ -85,7 +96,83 @@
(use-package embark-consult (use-package embark-consult
:ensure t) :ensure t)
;;search across entire projects (use-package which-key
:init (which-key-mode)
:diminish which-key-mode
:config
(setq which-key-idle-delay 1))
;; Key Binding Configuration ---------------------------------------------------
;; Make ESC quit prompts
(global-set-key (kbd "<escape>") 'keyboard-escape-quit)
(use-package general
:config
(general-create-definer rh/leader-keys
:keymaps '(normal insert visual emacs)
:prefix "SPC"
:global-prefix "C-SPC")
(rh/leader-keys
"t" '(:ignore t :which-key "toggles")
"tt" '(consult-theme :which-key "choose theme")
"f" '(:ignore t :which-key "files")
"ff" '(find-file :which-key "find file")
"fr" '(consult-recent-file :which-key "recent files")
"fb" '(consult-buffer :which-key "switch buffer")
"o" '(:ignore t :which-key "org")
"oa" '(org-agenda :which-key "agenda")
"oc" '(org-capture :which-key "capture")
"ol" '(org-store-link :which-key "store link")
"oi" '(org-insert-link :which-key "insert link")
"ot" '(org-todo :which-key "cycle todo")
"os" '(org-schedule :which-key "schedule")
"od" '(org-deadline :which-key "deadline")
"oT" '(org-time-stamp :which-key "timestamp")
"op" '(org-priority :which-key "priority")
"ox" '(org-toggle-checkbox :which-key "toggle checkbox")
"o-" '(org-ctrl-c-minus :which-key "insert item/cycle list type")
"or" '(org-refile :which-key "refile")))
(use-package evil
:init
(setq evil-want-integration t)
(setq evil-want-keybinding nil)
(setq evil-want-C-u-scroll t)
(setq evil-want-C-i-jump nil)
:config
(evil-mode 1)
(define-key evil-insert-state-map (kbd "C-g") 'evil-normal-state)
(define-key evil-insert-state-map (kbd "C-h") 'evil-delete-backward-char-and-join)
;; Use visual line motions even outside of visual-line-mode buffers
(evil-global-set-key 'motion "j" 'evil-next-visual-line)
(evil-global-set-key 'motion "k" 'evil-previous-visual-line)
(evil-set-initial-state 'messages-buffer-mode 'normal)
(evil-set-initial-state 'dashboard-mode 'normal))
(use-package evil-collection
:after evil
:config
(evil-collection-init))
(use-package hydra)
(defhydra hydra-text-scale (:timeout 4)
"scale text"
("j" text-scale-increase "in")
("k" text-scale-decrease "out")
("f" nil "finished" :exit t))
(rh/leader-keys
"ts" '(hydra-text-scale/body :which-key "scale text"))
;; Projectile Configuration ----------------------------------------------------
(use-package projectile (use-package projectile
:diminish projectile-mode :diminish projectile-mode
:config (projectile-mode) :config (projectile-mode)
@@ -100,26 +187,7 @@
:ensure t :ensure t
:bind (("C-c h" . consult-projectile))) :bind (("C-c h" . consult-projectile)))
;;icons are required for modeline ;; Magit Configuration ---------------------------------------------------------
(use-package all-the-icons
:ensure t
:if (display-graphic-p))
;;replace the line at the bottom with something more stylish
(use-package doom-modeline
:ensure t
:init (doom-modeline-mode 1)
:config
(setq doom-modeline-height 15))
(use-package rainbow-delimiters
:hook (prod-mode . rainbow-delimiters-mode))
(use-package which-key
:init (which-key-mode)
:diminish which-key-mode
:config
(setq which-key-idle-delay 1))
(use-package magit (use-package magit
:commands (magit-status magit-get-current-branch) :commands (magit-status magit-get-current-branch)
@@ -135,16 +203,7 @@
;; Use default terminal for SSH (if relevant) ;; Use default terminal for SSH (if relevant)
(magit-process-find-password-functions '(magit-process-password-auth-source))) (magit-process-find-password-functions '(magit-process-password-auth-source)))
(defun rh/org-mode-setup () ;; IDK what this stuff is but it shows up automatically ------------------------
(org-indent-mode)
(variable-pitch-mode 1)
(auto-fill-mode 0)
(visual-line-mode 1))
(use-package org
:hook (org-mode . rh/org-mode-setup)
:config
(setq org-ellipsis ""))
(custom-set-variables (custom-set-variables
;; custom-set-variables was added by Custom. ;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful. ;; If you edit it by hand, you could mess it up, so be careful.
@@ -157,3 +216,17 @@
;; Your init file should contain only one such instance. ;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right. ;; If there is more than one, they won't work right.
) )
;; Org Mode Configuration ------------------------------------------------------
(defun rh/org-mode-setup ()
(org-indent-mode)
(visual-line-mode 1))
(use-package org
:hook (org-mode . rh/org-mode-setup)
:config
(setq org-agenda-files (directory-files-recursively "~/org" "\\.org$")))
;; Development Environment -----------------------------------------------------
(load (expand-file-name "dev-settings.el" user-emacs-directory))