Created
November 20, 2025 17:58
-
-
Save nimeshneema/69ff55ecc50c7727e1b1a0cb0a88fd4b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;;; init.el --- Main Configuration -*- lexical-binding: t; -*- | |
| ;;; ------------------------------------------------------------------ | |
| ;;; 1. PACKAGE MANAGEMENT | |
| ;;; ------------------------------------------------------------------ | |
| (require 'package) | |
| (setq package-archives '(("melpa" . "https://melpa.org/packages/") | |
| ("gnu" . "https://elpa.gnu.org/packages/"))) | |
| (package-initialize) | |
| ;; Install and configure use-package (The modern way to manage plugins) | |
| (unless (package-installed-p 'use-package) | |
| (package-refresh-contents) | |
| (package-install 'use-package)) | |
| (require 'use-package) | |
| (setq use-package-always-ensure t) ; Automatically install packages | |
| ;;; ------------------------------------------------------------------ | |
| ;;; 2. BASIC EDITOR SETTINGS & VISUALS | |
| ;;; ------------------------------------------------------------------ | |
| (setq inhibit-startup-message t) | |
| (global-display-line-numbers-mode) ; Show line numbers globally | |
| (setq make-backup-files nil) ; Stop creating auto-backup files (~ files) | |
| ;; THEME: Set a robust, high-contrast theme | |
| (use-package doom-themes | |
| :config | |
| ;; Load a dark theme, which provides good contrast for highlighting | |
| (load-theme 'doom-one t)) | |
| ;;; ------------------------------------------------------------------ | |
| ;;; 3. SCALA LSP SETUP (Metals Integration) | |
| ;;; ------------------------------------------------------------------ | |
| ;; SCALA-MODE: Basic syntax highlighting | |
| (use-package scala-mode | |
| :interpreter ("scala" . scala-mode)) | |
| ;; SBT-MODE: Interaction with the build tool | |
| (use-package sbt-mode | |
| :commands sbt-start sbt-command) | |
| ;; LSP-MODE: The core Language Server Client | |
| (use-package lsp-mode | |
| :hook | |
| ;; Activate LSP features when opening a Scala file | |
| (scala-mode . lsp) | |
| :init | |
| (setq lsp-keymap-prefix "C-c l") ; Set a prefix for LSP commands | |
| ;; Optimization | |
| (setq gc-cons-threshold 100000000) | |
| (setq read-process-output-max (* 1024 1024)) | |
| :commands lsp) | |
| ;; LSP-METALS: Scala-specific extensions for lsp-mode | |
| (use-package lsp-metals | |
| :config | |
| ;; FIX: Explicitly set the path to the Metals binary installed by Coursier | |
| (setq lsp-metals-server-path "~/.local/share/coursier/bin/metals") | |
| (setq lsp-metals-treeview-show-when-views-received t)) | |
| ;; AUTO-COMPLETION (Presents the list of available methods/functions) | |
| (use-package company | |
| :hook (scala-mode . company-mode) | |
| :config | |
| (setq company-minimum-prefix-length 1) | |
| (setq company-idle-delay 0.0)) | |
| ;; ERROR CHECKING (Red squiggly lines / Diagnostics) | |
| (use-package flycheck | |
| :init (global-flycheck-mode)) | |
| ;; LSP-UI: Popups for documentation and definitions | |
| (use-package lsp-ui | |
| :config | |
| (setq lsp-ui-doc-enable t) | |
| (setq lsp-ui-doc-position 'top)) | |
| ;;; ------------------------------------------------------------------ | |
| ;;; 4. CUSTOM COLOR OVERRIDES (To match his specific request) | |
| ;;; ------------------------------------------------------------------ | |
| ;; Emacs uses 'font-lock' for syntax highlighting. | |
| ;; We manually override the colors to meet the 'keywords yellow, functions red' request. | |
| (custom-set-faces | |
| ;; Keywords (like 'def', 'val', 'class') in Yellow | |
| '(font-lock-keyword-face ((t (:foreground "yellow")))) | |
| ;; Function/Method names in Red | |
| '(font-lock-function-name-face ((t (:foreground "red"))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment