initial commit with the structure and everything
Hello from magit.
This commit is contained in:
commit
0718d63cfd
17 changed files with 3016 additions and 0 deletions
53
.gitignore
vendored
Normal file
53
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
# Emacs configuration gitignore
|
||||
|
||||
# Compiled files
|
||||
*.elc
|
||||
*.eln
|
||||
|
||||
# Package directories (will be recreated)
|
||||
elpa/
|
||||
straight/
|
||||
quelpa/
|
||||
|
||||
# Cache and temporary files
|
||||
auto-save-list/
|
||||
backups/
|
||||
auto-saves/
|
||||
.lsp-session-*
|
||||
.cache/
|
||||
transient/
|
||||
history
|
||||
recentf
|
||||
bookmarks
|
||||
ido.last
|
||||
smex-items
|
||||
projectile-bookmarks.eld
|
||||
projectile.cache
|
||||
|
||||
# Custom file (user-specific settings)
|
||||
custom.el
|
||||
|
||||
# OS specific
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
# IDE/Editor files
|
||||
.vscode/
|
||||
.idea/
|
||||
|
||||
# Logs
|
||||
*.log
|
||||
|
||||
# Session files
|
||||
session.*
|
||||
desktop
|
||||
desktop.lock
|
||||
|
||||
# Emacs files
|
||||
\#*
|
||||
*.eld
|
||||
history
|
||||
projects
|
||||
*.db
|
||||
tramp
|
||||
company-statistics-cache.el
|
||||
0
README.md
Normal file
0
README.md
Normal file
157
init.el
Normal file
157
init.el
Normal file
|
|
@ -0,0 +1,157 @@
|
|||
;;; init.el --- Modular Emacs Configuration Entry Point -*- lexical-binding: t -*-
|
||||
|
||||
;;; Commentary:
|
||||
; ; This is the main entry point for a modular Emacs configuration.
|
||||
;; Each module is completely independent and can be enabled/disabled by
|
||||
;; commenting/uncommenting the corresponding (require 'module-name) line.
|
||||
;;
|
||||
;; Module Categories:
|
||||
;; - Core modules: Essential functionality (packages, evil mode)
|
||||
;; - UI modules: Visual appearance and themes
|
||||
;; - Editing modules: Text editing and completion
|
||||
;; - Development modules: Programming and project management
|
||||
;; - Integration modules: External tool integrations
|
||||
|
||||
;;; Code:
|
||||
|
||||
;; Lazy load plugins where possible
|
||||
|
||||
;; Ensure GUI windows open maximized
|
||||
(add-to-list 'default-frame-alist '(fullscreen . maximized))
|
||||
;; Set custom file to avoid cluttering init.el
|
||||
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
|
||||
(when (file-exists-p custom-file)
|
||||
(load custom-file))
|
||||
|
||||
;; Add modules directory to load path
|
||||
(add-to-list 'load-path (expand-file-name "modules" user-emacs-directory))
|
||||
|
||||
;;; ============================================================================
|
||||
;;; CORE MODULES - Essential functionality
|
||||
;;; ============================================================================
|
||||
|
||||
;; Package manager setup - REQUIRED for other modules
|
||||
(require 'core-packages)
|
||||
|
||||
;; Evil mode (vim keybindings) - Comment out if you prefer default Emacs bindings
|
||||
(require 'core-evil)
|
||||
|
||||
;;; ============================================================================
|
||||
;;; UI MODULES - Visual appearance and interface
|
||||
;;; ============================================================================
|
||||
|
||||
;; UI/Theme configuration - Modern themes and visual enhancements
|
||||
(require 'module-ui)
|
||||
|
||||
;;; ============================================================================
|
||||
;;; EDITING MODULES - Text editing and completion
|
||||
;;; ============================================================================
|
||||
|
||||
;; Completion framework - Vertico, Consult, Company
|
||||
(require 'module-completion)
|
||||
|
||||
;; Global keybindings - Centralized key mapping (recommended if using leader keys, or your brain)
|
||||
(require 'module-keybinds)
|
||||
|
||||
;;; ============================================================================
|
||||
;;; DEVELOPMENT MODULES - Programming and development tools
|
||||
;;; ============================================================================
|
||||
|
||||
;; Language Server Protocol - Modern language support
|
||||
(require 'module-lsp)
|
||||
|
||||
;; Programming language support - Language-specific configurations
|
||||
(require 'module-programming)
|
||||
|
||||
;; Project management - Projectile and project tools
|
||||
(require 'module-project)
|
||||
|
||||
;;; ============================================================================
|
||||
;;; INTEGRATION MODULES - External tools and workflows
|
||||
;;; ============================================================================
|
||||
|
||||
;; Git integration - Magit and git tools
|
||||
;; (require 'module-git)
|
||||
|
||||
;; Org mode configuration - Note-taking and organization
|
||||
;; (require 'module-org)
|
||||
|
||||
;; Terminal integration - Shell and terminal tools
|
||||
(require 'module-terminal)
|
||||
|
||||
;; File management - Dired and file operations
|
||||
(require 'module-file)
|
||||
|
||||
;; AI and LLM integration - GitHub Copilot, ChatGPT, Ollama
|
||||
(require 'module-ai)
|
||||
|
||||
|
||||
;;; ============================================================================
|
||||
;;; CORE CONFIGURATION SETTINGS
|
||||
;;; ============================================================================
|
||||
|
||||
;; Avoid creating backup~ files
|
||||
(setq make-backup-files nil)
|
||||
|
||||
;; Disable warnings
|
||||
(setq warning-minimum-level :error)
|
||||
|
||||
;; Prevent re-rendering during minibuffer input
|
||||
(setq minibuffer-follows-selected-frame nil)
|
||||
|
||||
;; Disable indentation guides
|
||||
(setq highlight-indent-guides-method nil)
|
||||
|
||||
|
||||
;; Store annoying autosave files in ~/.emacs.d/autosaves
|
||||
;; also create the directory if it doesn't exist
|
||||
(defvar autosave-dir (expand-file-name "auto-saves" user-emacs-directory))
|
||||
(unless (file-exists-p autosave-dir)
|
||||
(make-directory autosave-dir t))
|
||||
(setq auto-save-file-name-transforms `((".*" ,autosave-dir t)))
|
||||
|
||||
;; Undo history, store in a dedicated directory, under ~/.emacs.d/undo/
|
||||
;; Also create the directory if it doesn't exist
|
||||
(defvar undo-dir (expand-file-name "undo" user-emacs-directory))
|
||||
(unless (file-exists-p undo-dir)
|
||||
(make-directory undo-dir t))
|
||||
(setq undo-tree-history-directory-alist `((".*" . ,undo-dir)))
|
||||
|
||||
;; Ensure undo-tree mode is enabled (only if available)
|
||||
(when (require 'undo-tree nil t)
|
||||
(global-undo-tree-mode))
|
||||
|
||||
;; Auto-reload files on change
|
||||
(use-package autorevert
|
||||
:ensure nil
|
||||
:config
|
||||
(global-auto-revert-mode 1)
|
||||
(setq auto-revert-interval 5
|
||||
auto-revert-check-vc-info t))
|
||||
|
||||
|
||||
;; Disable the :q prompt on exit
|
||||
(setq confirm-kill-emacs nil)
|
||||
(defadvice evil-quit (around my-evil-quit-no-prompt activate)
|
||||
(let ((buffer-modified-p nil))
|
||||
ad-do-it))
|
||||
|
||||
|
||||
;; God I fucking love lisp
|
||||
|
||||
;;; ============================================================================
|
||||
;;; STARTUP MESSAGE
|
||||
;;; ============================================================================
|
||||
|
||||
(message "Nebula Emacs configuration loaded! Available modules:")
|
||||
(message " Core: packages, evil")
|
||||
(message " UI: ui")
|
||||
(message " Editing: completion, keybinds")
|
||||
(message " Development: lsp, programming, project")
|
||||
(message " Integration: git, org, terminal, file")
|
||||
(message " AI: ai (GitHub Copilot, ChatGPT, Ollama)")
|
||||
(message "Uncomment desired modules in init.el to enable them.")
|
||||
|
||||
(provide 'init)
|
||||
|
||||
;;; init.el ends here
|
||||
211
install.sh
Executable file
211
install.sh
Executable file
|
|
@ -0,0 +1,211 @@
|
|||
#!/bin/bash
|
||||
|
||||
# This script creates symbolic links from ~/.emacs.d to the emacs-config directory
|
||||
|
||||
set -euo pipefail # Exit on error, undefined vars, and pipe failures
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Configuration
|
||||
CONFIG_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
EMACS_DIR="$HOME/.emacs.d"
|
||||
|
||||
# Function to print colored output
|
||||
print_status() {
|
||||
echo -e "${BLUE}[INFO]${NC} $1"
|
||||
}
|
||||
|
||||
print_success() {
|
||||
echo -e "${GREEN}[SUCCESS]${NC} $1"
|
||||
}
|
||||
|
||||
print_warning() {
|
||||
echo -e "${YELLOW}[WARNING]${NC} $1"
|
||||
}
|
||||
|
||||
print_error() {
|
||||
echo -e "${RED}[ERROR]${NC} $1"
|
||||
}
|
||||
|
||||
# Function to backup existing configuration
|
||||
backup_existing_config() {
|
||||
if [[ -d "$EMACS_DIR" && ! -L "$EMACS_DIR" ]]; then
|
||||
local backup_dir="$HOME/.emacs.d.backup.$(date +%Y%m%d-%H%M%S)"
|
||||
print_warning "Existing Emacs configuration found. Backing up to: $backup_dir"
|
||||
mv "$EMACS_DIR" "$backup_dir"
|
||||
print_success "Backup created successfully"
|
||||
elif [[ -L "$EMACS_DIR" ]]; then
|
||||
print_warning "Removing existing symbolic link: $EMACS_DIR"
|
||||
rm "$EMACS_DIR"
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to create symlink
|
||||
create_symlink() {
|
||||
print_status "Creating symbolic link: $EMACS_DIR -> $CONFIG_DIR"
|
||||
ln -sf "$CONFIG_DIR" "$EMACS_DIR"
|
||||
print_success "Symbolic link created successfully"
|
||||
}
|
||||
|
||||
# Function to verify installation
|
||||
verify_installation() {
|
||||
if [[ -L "$EMACS_DIR" && "$(readlink "$EMACS_DIR")" == "$CONFIG_DIR" ]]; then
|
||||
print_success "Installation verified successfully"
|
||||
return 0
|
||||
else
|
||||
print_error "Installation verification failed"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to check prerequisites
|
||||
check_prerequisites() {
|
||||
print_status "Checking prerequisites..."
|
||||
|
||||
# Check if Emacs is installed
|
||||
if ! command -v emacs &> /dev/null; then
|
||||
print_warning "Emacs is not installed or not in PATH"
|
||||
print_status "Please install Emacs before proceeding"
|
||||
print_status "Ubuntu/Debian: sudo apt install emacs"
|
||||
print_status "macOS: brew install emacs"
|
||||
print_status "Arch: sudo pacman -S emacs"
|
||||
else
|
||||
local emacs_version=$(emacs --version | head -n1)
|
||||
print_success "Found: $emacs_version"
|
||||
fi
|
||||
|
||||
# Check if config directory exists
|
||||
if [[ ! -d "$CONFIG_DIR" ]]; then
|
||||
print_error "Configuration directory not found: $CONFIG_DIR"
|
||||
print_error "Please ensure you're running this script from the correct location"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
print_success "Prerequisites check completed"
|
||||
}
|
||||
|
||||
# Function to display post-installation instructions
|
||||
show_post_install_instructions() {
|
||||
echo
|
||||
print_success "=== Installation Complete ==="
|
||||
echo
|
||||
print_status "Next steps:"
|
||||
echo " 1. Start Emacs (packages will be installed automatically on first run)"
|
||||
echo " 2. Wait for package installation to complete"
|
||||
echo " 3. Restart Emacs for full functionality"
|
||||
echo " 4. Edit ~/.emacs.d/init.el to enable additional modules"
|
||||
echo
|
||||
print_status "Key bindings (Evil mode):"
|
||||
echo " - jk: Escape to normal mode"
|
||||
echo " - Standard vim motions (hjkl, w, b, etc.)"
|
||||
echo " - SPC: Leader key (when modules are enabled)"
|
||||
echo
|
||||
print_status "To enable modules:"
|
||||
echo " - Edit ~/.emacs.d/init.el"
|
||||
echo " - Uncomment the (require 'module-name) lines you want"
|
||||
echo " - Restart Emacs"
|
||||
echo
|
||||
print_status "Documentation:"
|
||||
echo " - Read the comments in init.el for module details, read the comments in each module file"
|
||||
echo
|
||||
print_warning "Note: First startup may take several minutes while packages download"
|
||||
echo
|
||||
}
|
||||
|
||||
# Function to show usage
|
||||
show_usage() {
|
||||
echo "Usage: $0 [OPTIONS]"
|
||||
echo
|
||||
echo "Options:"
|
||||
echo " -h, --help Show this help message"
|
||||
echo " -f, --force Force installation (skip confirmation)"
|
||||
echo " -d, --dry-run Show what would be done without making changes"
|
||||
echo
|
||||
echo "This script creates a symbolic link from ~/.emacs.d to the emacs-config directory."
|
||||
echo "Any existing configuration will be backed up."
|
||||
}
|
||||
|
||||
# Parse command line arguments
|
||||
FORCE=false
|
||||
DRY_RUN=false
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
-h|--help)
|
||||
show_usage
|
||||
exit 0
|
||||
;;
|
||||
-f|--force)
|
||||
FORCE=true
|
||||
shift
|
||||
;;
|
||||
-d|--dry-run)
|
||||
DRY_RUN=true
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
print_error "Unknown option: $1"
|
||||
show_usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Main installation function
|
||||
main() {
|
||||
print_status "Starting Emacs configuration installation..."
|
||||
echo
|
||||
|
||||
# Check prerequisites
|
||||
check_prerequisites
|
||||
|
||||
# Show dry run information
|
||||
if [[ "$DRY_RUN" == true ]]; then
|
||||
print_status "=== DRY RUN MODE ==="
|
||||
print_status "Would create symlink: $EMACS_DIR -> $CONFIG_DIR"
|
||||
if [[ -d "$EMACS_DIR" ]]; then
|
||||
print_status "Would backup existing directory to: $HOME/.emacs.d.backup.$(date +%Y%m%d-%H%M%S)"
|
||||
fi
|
||||
print_status "No changes made (dry run mode)"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Confirm installation
|
||||
if [[ "$FORCE" != true ]]; then
|
||||
echo
|
||||
print_status "This will install the modular Emacs configuration to: $EMACS_DIR"
|
||||
print_status "Source directory: $CONFIG_DIR"
|
||||
echo
|
||||
read -p "Continue with installation? [y/N] " -n 1 -r
|
||||
echo
|
||||
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
||||
print_status "Installation cancelled"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
echo
|
||||
print_status "Proceeding with installation..."
|
||||
|
||||
# Backup existing configuration
|
||||
backup_existing_config
|
||||
|
||||
# Create symlink
|
||||
create_symlink
|
||||
|
||||
# Verify installation
|
||||
if verify_installation; then
|
||||
show_post_install_instructions
|
||||
else
|
||||
print_error "Installation failed"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Run main function
|
||||
main "$@"
|
||||
65
modules/core-evil.el
Normal file
65
modules/core-evil.el
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
;;; core-evil.el --- Evil Mode Configuration -*- lexical-binding: t -*-
|
||||
|
||||
;;; Commentary:
|
||||
;; Configures Evil mode for vim-like keybindings.
|
||||
;; This is a core module that provides vim keybindings throughout Emacs.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(use-package evil
|
||||
:init
|
||||
;; Configure evil before loading
|
||||
(setq evil-want-integration t
|
||||
evil-want-keybinding nil ; Use evil-collection for keybindings
|
||||
evil-want-C-u-scroll t ; C-u for scrolling up
|
||||
evil-want-C-i-jump nil ; Don't use C-i for jumping
|
||||
evil-respect-visual-line-mode t
|
||||
evil-undo-system 'undo-redo) ; Use built-in undo-redo system
|
||||
|
||||
:config
|
||||
;; Enable evil mode globally
|
||||
(evil-mode 1)
|
||||
|
||||
;; 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)
|
||||
|
||||
;; Set initial state for some modes
|
||||
(evil-set-initial-state 'messages-buffer-mode 'normal)
|
||||
(evil-set-initial-state 'dashboard-mode 'normal))
|
||||
|
||||
;; Evil collection provides vim keybindings for many Emacs modes
|
||||
(use-package evil-collection
|
||||
:after evil
|
||||
:config
|
||||
(evil-collection-init))
|
||||
|
||||
;; Better escape sequence
|
||||
(use-package evil-escape
|
||||
:after evil
|
||||
:config
|
||||
(evil-escape-mode 1)
|
||||
(setq evil-escape-key-sequence "jk"
|
||||
evil-escape-delay 0.2))
|
||||
|
||||
;; Surround text objects (like vim-surround)
|
||||
(use-package evil-surround
|
||||
:after evil
|
||||
:config
|
||||
(global-evil-surround-mode 1))
|
||||
|
||||
;; Comment/uncomment with evil keybindings
|
||||
(use-package evil-commentary
|
||||
:after evil
|
||||
:config
|
||||
(evil-commentary-mode 1))
|
||||
|
||||
;; Multiple cursors for evil
|
||||
(use-package evil-mc
|
||||
:after evil
|
||||
:config
|
||||
(global-evil-mc-mode 1))
|
||||
|
||||
(provide 'core-evil)
|
||||
|
||||
;;; core-evil.el ends here
|
||||
43
modules/core-packages.el
Normal file
43
modules/core-packages.el
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
;;; core-packages.el --- Package Manager Configuration -*- lexical-binding: t -*-
|
||||
|
||||
;;; Commentary:
|
||||
;; Sets up the package manager (use-package) and package repositories.
|
||||
;; This is the foundation for all other modules.
|
||||
|
||||
|
||||
;; Set up package archives
|
||||
(require 'package)
|
||||
(setq package-archives
|
||||
'(("melpa" . "https://melpa.org/packages/")
|
||||
("gnu" . "https://elpa.gnu.org/packages/")
|
||||
("nongnu" . "https://elpa.nongnu.org/nongnu/")))
|
||||
|
||||
;; Initialize package system
|
||||
(package-initialize)
|
||||
|
||||
;; Bootstrap use-package
|
||||
(unless (package-installed-p 'use-package)
|
||||
(package-refresh-contents)
|
||||
(package-install 'use-package))
|
||||
|
||||
(eval-when-compile
|
||||
(require 'use-package))
|
||||
|
||||
;; Configure use-package defaults
|
||||
(setq use-package-always-ensure t ; Always install packages
|
||||
use-package-verbose t ; Verbose loading for debugging
|
||||
use-package-compute-statistics t ; Collect statistics
|
||||
use-package-minimum-reported-time 0.1) ; Report slow-loading packages
|
||||
|
||||
;; Auto-update packages
|
||||
(use-package auto-package-update
|
||||
:config
|
||||
(setq auto-package-update-delete-old-versions t
|
||||
auto-package-update-hide-results t)
|
||||
;; Uncomment to auto-update packages on startup
|
||||
;; (auto-package-update-maybe)
|
||||
)
|
||||
|
||||
(provide 'core-packages)
|
||||
|
||||
;;; core-packages.el ends here
|
||||
241
modules/module-ai.el
Normal file
241
modules/module-ai.el
Normal file
|
|
@ -0,0 +1,241 @@
|
|||
;;; module-ai.el --- AI and LLM Integration Configuration -*- lexical-binding: t -*-
|
||||
|
||||
;;; Commentary:
|
||||
;; Complete AI and Large Language Model integration for enhanced development.
|
||||
;; This module is completely independent - comment it out in init.el to disable.
|
||||
|
||||
|
||||
|
||||
;;; ============================================================================
|
||||
;;; GITHUB COPILOT INTEGRATION
|
||||
;;; ============================================================================
|
||||
|
||||
;; Copilot.el - Official GitHub Copilot integration
|
||||
(use-package copilot
|
||||
:ensure t
|
||||
:preface
|
||||
;; If copilot isn't available from package archives, try to fetch it from GitHub.
|
||||
;; This mirrors "install like any other module" behavior while retaining a fallback.
|
||||
(when (and (not (package-installed-p 'copilot))
|
||||
(fboundp 'package-vc-install))
|
||||
(ignore-errors
|
||||
(package-vc-install "https://github.com/copilot-emacs/copilot.el")))
|
||||
:hook (prog-mode . copilot-mode)
|
||||
:bind (:map copilot-completion-map
|
||||
("TAB" . copilot-accept-completion)
|
||||
("<tab>" . copilot-accept-completion)
|
||||
("C-TAB" . copilot-accept-completion-by-word)
|
||||
("C-<tab>" . copilot-accept-completion-by-word)
|
||||
("M-<right>" . copilot-accept-completion-by-word)
|
||||
("M-<down>" . copilot-next-completion)
|
||||
("M-<up>" . copilot-previous-completion)
|
||||
("C-g" . copilot-clear-overlay))
|
||||
:config
|
||||
;; Configure Copilot settings
|
||||
(setq copilot-idle-delay 0.1
|
||||
copilot-max-char 1000000
|
||||
copilot-log-max 1000)
|
||||
;; Custom faces for better visibility
|
||||
(custom-set-faces
|
||||
'(copilot-overlay-face ((t (:foreground "#6272A4" :background nil))))))
|
||||
|
||||
;;; ============================================================================
|
||||
;;; OPENAI INTEGRATION
|
||||
;;; ============================================================================
|
||||
|
||||
;; Manual OpenAI API integration
|
||||
;; (defun my/openai-request (prompt callback)
|
||||
;; "Send request to OpenAI API with PROMPT and execute CALLBACK with response."
|
||||
;; (let ((url-request-method "POST")
|
||||
;; (url-request-extra-headers
|
||||
;; `(("Content-Type" . "application/json")
|
||||
;; ("Authorization" . ,(concat "Bearer " (getenv "OPENAI_API_KEY")))))
|
||||
;; (url-request-data
|
||||
;; (encode-coding-string
|
||||
;; (json-encode
|
||||
;; `((model . "gpt-3.5-turbo")
|
||||
;; (messages . [((role . "user") (content . ,prompt))])
|
||||
;; (max_tokens . 1000)
|
||||
;; (temperature . 0.2)))
|
||||
;; 'utf-8)))
|
||||
;; (url-retrieve
|
||||
;; "https://api.openai.com/v1/chat/completions"
|
||||
;; (lambda (status)
|
||||
;; (if (plist-get status :error)
|
||||
;; (message "OpenAI request failed: %s" (plist-get status :error))
|
||||
;; (goto-char (point-min))
|
||||
;; (re-search-forward "^$" nil t)
|
||||
;; (condition-case err
|
||||
;; (let* ((json-response (json-read))
|
||||
;; (choices (cdr (assoc 'choices json-response)))
|
||||
;; (first-choice (when (> (length choices) 0) (aref choices 0)))
|
||||
;; (message-obj (cdr (assoc 'message first-choice)))
|
||||
;; (content (cdr (assoc 'content message-obj))))
|
||||
;; (if content
|
||||
;; (funcall callback content)
|
||||
;; (message "No content in AI response")))
|
||||
;; (error (message "Error parsing AI response: %s" err))))))))
|
||||
|
||||
;; ;; Custom OpenAI functions for development
|
||||
;; (defun my/ai-explain-code ()
|
||||
;; "Explain the selected code using OpenAI."
|
||||
;; (interactive)
|
||||
;; (if (region-active-p)
|
||||
;; (let ((code (buffer-substring-no-properties (region-beginning) (region-end))))
|
||||
;; (if (getenv "OPENAI_API_KEY")
|
||||
;; (my/openai-request (concat "Explain this code in detail:\n\n" code)
|
||||
;; (lambda (response)
|
||||
;; (with-current-buffer (get-buffer-create "*AI Code Explanation*")
|
||||
;; (erase-buffer)
|
||||
;; (insert response)
|
||||
;; (display-buffer (current-buffer)))))
|
||||
;; (message "Please set OPENAI_API_KEY environment variable")))
|
||||
;; (message "Please select code to explain")))
|
||||
|
||||
;; (defun my/ai-optimize-code ()
|
||||
;; "Get optimization suggestions for selected code."
|
||||
;; (interactive)
|
||||
;; (if (region-active-p)
|
||||
;; (let ((code (buffer-substring-no-properties (region-beginning) (region-end))))
|
||||
;; (if (getenv "OPENAI_API_KEY")
|
||||
;; (my/openai-request (concat "Suggest optimizations for this code:\n\n" code)
|
||||
;; (lambda (response)
|
||||
;; (with-current-buffer (get-buffer-create "*AI Code Optimization*")
|
||||
;; (erase-buffer)
|
||||
;; (insert response)
|
||||
;; (display-buffer (current-buffer)))))
|
||||
;; (message "Please set OPENAI_API_KEY environment variable")))
|
||||
;; (message "Please select code to optimize")))
|
||||
|
||||
;; (defun my/ai-generate-docstring ()
|
||||
;; "Generate documentation for selected function."
|
||||
;; (interactive)
|
||||
;; (if (region-active-p)
|
||||
;; (let ((code (buffer-substring-no-properties (region-beginning) (region-end))))
|
||||
;; (if (getenv "OPENAI_API_KEY")
|
||||
;; (my/openai-request (concat "Generate documentation/docstring for this function:\n\n" code)
|
||||
;; (lambda (response)
|
||||
;; (with-current-buffer (get-buffer-create "*AI Documentation*")
|
||||
;; (erase-buffer)
|
||||
;; (insert response)
|
||||
;; (display-buffer (current-buffer)))))
|
||||
;; (message "Please set OPENAI_API_KEY environment variable")))
|
||||
;; (message "Please select function to document")))
|
||||
|
||||
;; (defun my/ai-generate-code (description)
|
||||
;; "Generate code based on description using OpenAI."
|
||||
;; (interactive "sDescribe the code you want: ")
|
||||
;; (let ((prompt (concat "Generate " (symbol-name major-mode) " code for: " description)))
|
||||
;; (if (getenv "OPENAI_API_KEY")
|
||||
;; (my/openai-request prompt
|
||||
;; (lambda (response)
|
||||
;; (with-current-buffer (get-buffer-create "*AI Generated Code*")
|
||||
;; (erase-buffer)
|
||||
;; (insert response)
|
||||
;; (display-buffer (current-buffer)))))
|
||||
;; (message "Please set OPENAI_API_KEY environment variable"))))
|
||||
|
||||
;;; ============================================================================
|
||||
;;; OLLAMA INTEGRATION (LOCAL LLM)
|
||||
;;; ============================================================================
|
||||
|
||||
;; (defvar ollama-api-url "http://localhost:11434/api/generate"
|
||||
;; "URL for Ollama API endpoint.")
|
||||
|
||||
;; (defvar ollama-default-model "codellama:7b"
|
||||
;; "Default Ollama model to use.")
|
||||
|
||||
;; ;; Ollama API request function
|
||||
;; (defun my/ollama-request (prompt callback)
|
||||
;; "Send request to Ollama API with PROMPT and execute CALLBACK with response."
|
||||
;; (let ((url-request-method "POST")
|
||||
;; (url-request-extra-headers '(("Content-Type" . "application/json")))
|
||||
;; (url-request-data
|
||||
;; (encode-coding-string
|
||||
;; (json-encode
|
||||
;; `((model . ,ollama-default-model)
|
||||
;; (prompt . ,prompt)
|
||||
;; (stream . :json-false)))
|
||||
;; 'utf-8)))
|
||||
;; (url-retrieve
|
||||
;; ollama-api-url
|
||||
;; (lambda (status)
|
||||
;; (if (plist-get status :error)
|
||||
;; (message "Ollama request failed: %s" (plist-get status :error))
|
||||
;; (goto-char (point-min))
|
||||
;; (re-search-forward "^$" nil t)
|
||||
;; (condition-case err
|
||||
;; (let* ((json-response (json-read))
|
||||
;; (response (cdr (assoc 'response json-response))))
|
||||
;; (if response
|
||||
;; (funcall callback response)
|
||||
;; (message "No response from Ollama")))
|
||||
;; (error (message "Error parsing Ollama response: %s" err))))))))
|
||||
|
||||
;; ;; Custom functions for Ollama
|
||||
;; (defun my/ollama-code-review ()
|
||||
;; "Review selected code using Ollama."
|
||||
;; (interactive)
|
||||
;; (if (region-active-p)
|
||||
;; (let ((code (buffer-substring-no-properties (region-beginning) (region-end))))
|
||||
;; (my/ollama-request (concat "Review this code for best practices, potential bugs, and improvements:\n\n" code)
|
||||
;; (lambda (response)
|
||||
;; (with-current-buffer (get-buffer-create "*Ollama Code Review*")
|
||||
;; (erase-buffer)
|
||||
;; (insert response)
|
||||
;; (display-buffer (current-buffer))))))
|
||||
;; (message "Please select code to review")))
|
||||
|
||||
;; (defun my/ollama-switch-model ()
|
||||
;; "Switch between different Ollama models."
|
||||
;; (interactive)
|
||||
;; (let ((models '("codellama:7b" "codellama:13b" "llama2:7b" "llama2:13b" "mistral:7b" "deepseek-coder:6.7b")))
|
||||
;; (setq ollama-default-model
|
||||
;; (completing-read "Select Ollama model: " models nil t))
|
||||
;; (message "Switched to model: %s" ollama-default-model)))
|
||||
|
||||
;; (defun my/ollama-check-status ()
|
||||
;; "Check if Ollama is running and accessible."
|
||||
;; (interactive)
|
||||
;; (url-retrieve
|
||||
;; "http://localhost:11434/api/tags"
|
||||
;; (lambda (status)
|
||||
;; (if (plist-get status :error)
|
||||
;; (message "Ollama is not running or not accessible")
|
||||
;; (message "Ollama is running and accessible")))))
|
||||
|
||||
;;; ============================================================================
|
||||
;;; AI KEYBINDINGS
|
||||
;;; ============================================================================
|
||||
|
||||
;; AI-specific keybindings (integrate with existing keybind system)
|
||||
(when (featurep 'module-keybinds)
|
||||
;; Add AI keybindings to the leader key system
|
||||
(my/leader-keys
|
||||
"a" '(:ignore t :which-key "AI")
|
||||
"a e" '(my/ai-explain-code :which-key "Explain code")
|
||||
"a o" '(my/ai-optimize-code :which-key "Optimize code")
|
||||
"a d" '(my/ai-generate-docstring :which-key "Generate docs")
|
||||
"a g" '(my/ai-generate-code :which-key "Generate code"))
|
||||
|
||||
;; Ollama-specific bindings
|
||||
;; (my/leader-keys
|
||||
;; "a l" '(:ignore t :which-key "Local LLM")
|
||||
;; "a l r" '(my/ollama-code-review :which-key "Code review")
|
||||
;; "a l m" '(my/ollama-switch-model :which-key "Switch model")
|
||||
;; "a l s" '(my/ollama-check-status :which-key "Check status")))
|
||||
)
|
||||
;;; ============================================================================
|
||||
;;; STARTUP MESSAGE
|
||||
;;; ============================================================================
|
||||
|
||||
;; (message "AI module loaded! Features:")
|
||||
;; (message " - GitHub Copilot integration (manual install required)")
|
||||
;; (message " - OpenAI API support (set OPENAI_API_KEY)")
|
||||
;; (message " - Ollama for local LLM usage")
|
||||
;; (message " - AI-powered code generation and analysis")
|
||||
;; (message "Use SPC-a prefix for AI commands (if keybinds module is enabled)")
|
||||
|
||||
(provide 'module-ai)
|
||||
|
||||
;;; module-ai.el ends here
|
||||
263
modules/module-completion.el
Normal file
263
modules/module-completion.el
Normal file
|
|
@ -0,0 +1,263 @@
|
|||
;;; module-completion.el --- Completion Framework Configuration -*- lexical-binding: t -*-
|
||||
|
||||
;;; Commentary:
|
||||
;; Complete completion framework setup with Vertico, Consult, Company, and more.
|
||||
;; This module is completely independent - comment it out in init.el to disable.
|
||||
|
||||
;;; ============================================================================
|
||||
;;; CORE COMPLETION INTERFACE
|
||||
;;; ============================================================================
|
||||
|
||||
;; Vertico - Vertical completion UI
|
||||
(use-package vertico
|
||||
:init
|
||||
(vertico-mode)
|
||||
:config
|
||||
(setq vertico-cycle t
|
||||
vertico-resize t
|
||||
vertico-count 15
|
||||
vertico-scroll-margin 2)
|
||||
|
||||
;; Example: Custom vertico configuration per completion category
|
||||
(setq vertico-multiform-categories
|
||||
'((file indexed)
|
||||
(consult-grep buffer)
|
||||
(imenu (:not indexed))
|
||||
(symbol (vertico-sort-function . vertico-sort-alpha)))))
|
||||
|
||||
;;; ============================================================================
|
||||
;;; COMPLETION STYLES
|
||||
;;; ============================================================================
|
||||
|
||||
;; Orderless - Flexible completion style
|
||||
(use-package orderless
|
||||
:config
|
||||
(setq completion-styles '(orderless basic)
|
||||
completion-category-defaults nil
|
||||
completion-category-overrides '((file (styles partial-completion))))
|
||||
|
||||
;; Example: Custom orderless style dispatchers
|
||||
(setq orderless-matching-styles
|
||||
'(orderless-literal
|
||||
orderless-regexp
|
||||
orderless-initialism))
|
||||
|
||||
;; Example: Custom orderless component separator
|
||||
(setq orderless-component-separator #'orderless-escapable-split-on-space))
|
||||
|
||||
;;; ============================================================================
|
||||
;;; COMPLETION ANNOTATIONS AND ACTIONS
|
||||
;;; ============================================================================
|
||||
|
||||
;; Marginalia - Rich annotations for completions
|
||||
(use-package marginalia
|
||||
:init
|
||||
(marginalia-mode)
|
||||
:config
|
||||
(setq marginalia-max-relative-age 0
|
||||
marginalia-align 'right)
|
||||
|
||||
;; Example: Custom marginalia annotator
|
||||
(add-to-list 'marginalia-prompt-categories '("Find file" . file)))
|
||||
|
||||
;; Embark - Context actions
|
||||
(use-package embark
|
||||
:init
|
||||
(setq prefix-help-command #'embark-prefix-help-command)
|
||||
:config
|
||||
;; Hide the mode line of the Embark live/completions buffers
|
||||
(add-to-list 'display-buffer-alist
|
||||
'("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*"
|
||||
nil
|
||||
(window-parameters (mode-line-format . none))))
|
||||
|
||||
;; Example: Custom embark action
|
||||
(defun my/embark-copy-as-kill (string)
|
||||
"Copy STRING to kill ring and show message."
|
||||
(kill-new string)
|
||||
(message "Copied: %s" string))
|
||||
|
||||
(add-to-list 'embark-general-map '("k" my/embark-copy-as-kill)))
|
||||
|
||||
;; Embark-Consult integration
|
||||
(use-package embark-consult
|
||||
:hook
|
||||
(embark-collect-mode . consult-preview-at-point-mode))
|
||||
|
||||
;;; ============================================================================
|
||||
;;; ENHANCED SEARCH AND NAVIGATION
|
||||
;;; ============================================================================
|
||||
|
||||
;; Consult - Practical commands based on completion
|
||||
(use-package consult
|
||||
:hook (completion-list-mode . consult-preview-at-point-mode)
|
||||
:init
|
||||
;; Optionally configure the register formatting
|
||||
(setq register-preview-delay 0.5
|
||||
register-preview-function #'consult-register-format)
|
||||
|
||||
;; Optionally tweak the register preview window
|
||||
(advice-add #'register-preview :override #'consult-register-window)
|
||||
|
||||
;; Use Consult to select xref locations with preview
|
||||
(setq xref-show-xrefs-function #'consult-xref
|
||||
xref-show-definitions-function #'consult-xref)
|
||||
:config
|
||||
;; Configure preview settings
|
||||
(consult-customize
|
||||
consult-theme :preview-key '(:debounce 0.2 any)
|
||||
consult-ripgrep consult-git-grep consult-grep
|
||||
consult-bookmark consult-recent-file consult-xref
|
||||
consult--source-bookmark consult--source-file-register
|
||||
consult--source-recent-file consult--source-project-recent-file
|
||||
:preview-key '(:debounce 0.4 any))
|
||||
|
||||
;; Configure narrowing key for consult commands
|
||||
(setq consult-narrow-key "<")
|
||||
|
||||
;; Example: Custom consult source
|
||||
(defvar consult--source-my-bookmarks
|
||||
`(:name "My Bookmarks"
|
||||
:narrow ?m
|
||||
:category bookmark
|
||||
:face consult-bookmark
|
||||
:history bookmark-history
|
||||
:action ,#'bookmark-jump
|
||||
:items ,(lambda ()
|
||||
(bookmark-all-names))))
|
||||
|
||||
;; Add custom source to consult-buffer
|
||||
(add-to-list 'consult-buffer-sources 'consult--source-my-bookmarks))
|
||||
|
||||
;;; ============================================================================
|
||||
;;; IN-BUFFER COMPLETION
|
||||
;;; ============================================================================
|
||||
|
||||
;; Company - Text completion framework
|
||||
(use-package company
|
||||
:hook (after-init . global-company-mode)
|
||||
:config
|
||||
(setq company-idle-delay 0.1
|
||||
company-minimum-prefix-length 2
|
||||
company-selection-wrap-around t
|
||||
company-show-numbers t
|
||||
company-tooltip-align-annotations t
|
||||
company-require-match nil
|
||||
company-dabbrev-downcase nil
|
||||
company-dabbrev-ignore-case nil
|
||||
company-tooltip-limit 20
|
||||
company-tooltip-maximum-width 80)
|
||||
|
||||
;; Improve company performance
|
||||
(setq company-transformers '(company-sort-by-occurrence))
|
||||
|
||||
;; Evil integration (only if evil is loaded)
|
||||
(with-eval-after-load 'evil
|
||||
(define-key evil-insert-state-map (kbd "C-n") 'company-select-next)
|
||||
(define-key evil-insert-state-map (kbd "C-p") 'company-select-previous)
|
||||
(define-key evil-insert-state-map (kbd "C-d") 'company-show-doc-buffer)))
|
||||
|
||||
;; Company box - Better UI for company (only in graphical mode)
|
||||
(use-package company-box
|
||||
:if (display-graphic-p)
|
||||
:hook (company-mode . company-box-mode)
|
||||
:config
|
||||
(setq company-box-show-single-candidate t
|
||||
company-box-max-candidates 50
|
||||
company-box-doc-delay 0.3
|
||||
company-box-scrollbar nil)
|
||||
|
||||
;; Configure icons (requires all-the-icons)
|
||||
(when (featurep 'all-the-icons)
|
||||
(setq company-box-icons-alist 'company-box-icons-all-the-icons)))
|
||||
|
||||
;; Company statistics - Sort by usage
|
||||
(use-package company-statistics
|
||||
:after company
|
||||
:hook (company-mode . company-statistics-mode))
|
||||
|
||||
;;; ============================================================================
|
||||
;;; KEYBINDING DISCOVERY
|
||||
;;; ============================================================================
|
||||
|
||||
;; Which-key - Shows available keybindings
|
||||
(use-package which-key
|
||||
:config
|
||||
(which-key-mode 1)
|
||||
(setq which-key-idle-delay 0.3
|
||||
which-key-popup-type 'side-window
|
||||
which-key-side-window-max-height 0.25
|
||||
which-key-side-window-max-width 0.33
|
||||
which-key-show-operator-state-maps t
|
||||
which-key-sort-order 'which-key-key-order-alpha
|
||||
which-key-show-docstrings t
|
||||
which-key-max-description-length 50)
|
||||
|
||||
;; Example: Custom which-key descriptions
|
||||
(which-key-add-key-based-replacements
|
||||
"C-c p" "projectile"
|
||||
"C-c g" "git"
|
||||
"C-c l" "lsp"
|
||||
"SPC" "leader"))
|
||||
|
||||
;;; ============================================================================
|
||||
;;; CUSTOM COMPLETION SOURCES
|
||||
;;; ============================================================================
|
||||
|
||||
;; Example: Custom completion source for frequently used directories
|
||||
(defun my/consult-project-directories ()
|
||||
"Find directories in current project."
|
||||
(interactive)
|
||||
(let* ((dirs (split-string
|
||||
(shell-command-to-string
|
||||
"find . -type d -name '.git' -prune -o -type d -print | head -50")
|
||||
"\n" t)))
|
||||
(consult--read
|
||||
dirs
|
||||
:prompt "Project directory: "
|
||||
:category 'file
|
||||
:sort nil)))
|
||||
|
||||
;; Example: Custom company backend for project-specific completions
|
||||
(defun my/company-project-backend (command &optional arg &rest ignored)
|
||||
"Example custom company backend."
|
||||
(interactive (list 'interactive))
|
||||
(cl-case command
|
||||
(interactive (company-begin-backend 'my/company-project-backend))
|
||||
(prefix (and (derived-mode-p 'prog-mode)
|
||||
(company-grab-symbol)))
|
||||
(candidates (when (> (length arg) 2)
|
||||
(list "example-completion" "another-completion")))))
|
||||
|
||||
;; Example: Add custom backend to company
|
||||
;; (add-to-list 'company-backends 'my/company-project-backend)
|
||||
|
||||
;;; ============================================================================
|
||||
;;; UTILITY FUNCTIONS
|
||||
;;; ============================================================================
|
||||
|
||||
;; Example: Enhanced buffer switching with preview
|
||||
(defun my/switch-buffer-with-preview ()
|
||||
"Switch buffer with preview using consult."
|
||||
(interactive)
|
||||
(consult-buffer))
|
||||
|
||||
;; Example: Search in project with live preview
|
||||
(defun my/search-project ()
|
||||
"Search in project using consult-ripgrep."
|
||||
(interactive)
|
||||
(if (and (fboundp 'projectile-project-root)
|
||||
(projectile-project-root))
|
||||
(consult-ripgrep (projectile-project-root))
|
||||
(consult-ripgrep default-directory)))
|
||||
|
||||
;; Example: Enhanced find-file with recent files
|
||||
(defun my/find-file-enhanced ()
|
||||
"Enhanced find-file that includes recent files."
|
||||
(interactive)
|
||||
(let ((consult-find-args "find . -not ( -path '*/.git' -prune )"))
|
||||
(consult-find default-directory)))
|
||||
|
||||
(provide 'module-completion)
|
||||
|
||||
;;; module-completion.el ends here
|
||||
129
modules/module-file.el
Normal file
129
modules/module-file.el
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
;;; module-file.el --- File Management Configuration -*- lexical-binding: t -*-
|
||||
|
||||
;;; Commentary:
|
||||
;; To enable: uncomment (require 'module-file) in init.el
|
||||
|
||||
|
||||
;; File operations enhancements
|
||||
(use-package dired
|
||||
:ensure nil
|
||||
:config
|
||||
(setq dired-listing-switches "-alh --group-directories-first"
|
||||
dired-dwim-target t
|
||||
dired-recursive-copies 'always
|
||||
dired-recursive-deletes 'always
|
||||
dired-auto-revert-buffer t)
|
||||
|
||||
;; Evil integration
|
||||
(with-eval-after-load 'evil-collection
|
||||
(evil-collection-dired-setup)))
|
||||
|
||||
;; Dired extras
|
||||
(use-package dired-x
|
||||
:ensure nil
|
||||
:after dired
|
||||
:config
|
||||
(setq dired-omit-files "^\\.[^.]\\|^#\\|~$\\|\\.pyc$"))
|
||||
|
||||
;; Dired narrow - Quick filtering
|
||||
(use-package dired-narrow
|
||||
:after dired)
|
||||
|
||||
;; Dired ranger - Copy/move operations like ranger
|
||||
(use-package dired-ranger
|
||||
:after dired)
|
||||
|
||||
;; File templates
|
||||
(use-package autoinsert
|
||||
:ensure nil
|
||||
:config
|
||||
(auto-insert-mode 1)
|
||||
(setq auto-insert-directory "~/.emacs.d/templates/"
|
||||
auto-insert-query nil))
|
||||
|
||||
;; Backup and autosave configuration
|
||||
(setq backup-directory-alist `(("." . ,(expand-file-name "backups" user-emacs-directory)))
|
||||
backup-by-copying t
|
||||
version-control t
|
||||
delete-old-versions t
|
||||
kept-new-versions 20
|
||||
kept-old-versions 5
|
||||
create-lockfiles nil)
|
||||
|
||||
;; Auto-save configuration
|
||||
(setq auto-save-file-name-transforms
|
||||
`((".*" ,(expand-file-name "auto-saves/" user-emacs-directory) t)))
|
||||
|
||||
;; Recent files
|
||||
(use-package recentf
|
||||
:ensure nil
|
||||
:config
|
||||
(recentf-mode 1)
|
||||
(setq recentf-max-saved-items 200
|
||||
recentf-exclude '("/tmp/" "/ssh:" "/sudo:" "COMMIT_EDITMSG")))
|
||||
|
||||
;; File encryption
|
||||
(use-package epa-file
|
||||
:ensure nil
|
||||
:config
|
||||
(epa-file-enable))
|
||||
|
||||
;; Large file handling
|
||||
(use-package vlf
|
||||
:config
|
||||
(require 'vlf-setup))
|
||||
|
||||
;; Wgrep - Writable grep buffers
|
||||
(use-package wgrep
|
||||
:config
|
||||
(setq wgrep-auto-save-buffer t))
|
||||
|
||||
;; Ripgrep integration
|
||||
(use-package rg
|
||||
:config
|
||||
(rg-enable-default-bindings))
|
||||
|
||||
;; Find file in project
|
||||
(use-package find-file-in-project)
|
||||
|
||||
;; Speedbar alternative - file tree
|
||||
|
||||
(use-package neotree
|
||||
:config
|
||||
(setq neo-theme (if (display-graphic-p) 'icons 'arrow)
|
||||
neo-smart-open t))
|
||||
|
||||
;; Async operations for file operations
|
||||
(use-package async
|
||||
:config
|
||||
(dired-async-mode 1)
|
||||
(async-bytecomp-package-mode 1))
|
||||
|
||||
;; File permissions display
|
||||
(use-package dired-k
|
||||
:after dired
|
||||
:hook (dired-initial-position . dired-k)
|
||||
:hook (dired-after-readin . dired-k-no-revert))
|
||||
|
||||
;; Hide/show details in dired
|
||||
(add-hook 'dired-mode-hook
|
||||
(lambda ()
|
||||
(dired-hide-details-mode)))
|
||||
|
||||
;; Open files externally
|
||||
(use-package openwith
|
||||
:config
|
||||
(when (display-graphic-p)
|
||||
(setq openwith-associations
|
||||
'(("\\.pdf\\'" "evince" (file))
|
||||
("\\.mp3\\'" "vlc" (file))
|
||||
("\\.mp4\\'" "vlc" (file))
|
||||
("\\.avi\\'" "vlc" (file))))
|
||||
(openwith-mode 1)))
|
||||
|
||||
;; Sudo edit
|
||||
(use-package sudo-edit)
|
||||
|
||||
(provide 'module-file)
|
||||
|
||||
;;; module-file.el ends here
|
||||
77
modules/module-git.el
Normal file
77
modules/module-git.el
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
;;; module-git.el --- Git Integration Configuration -*- lexical-binding: t -*-
|
||||
|
||||
;;; Commentary:
|
||||
;; Example module for Git integration with Magit and related tools.
|
||||
;; To enable: uncomment (require 'module-git) in init.el
|
||||
|
||||
;;; Code:
|
||||
|
||||
;; Magit - Git porcelain for Emacs
|
||||
(use-package magit
|
||||
:config
|
||||
(setq magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1
|
||||
magit-revision-show-gravatars '("^Author: " . "^Commit: ")
|
||||
magit-diff-refine-hunk t))
|
||||
|
||||
;; Evil-Magit integration
|
||||
(use-package evil-magit
|
||||
:after (evil magit))
|
||||
|
||||
;; Forge - Work with Git forges from Magit
|
||||
(use-package forge
|
||||
:after magit
|
||||
:config
|
||||
(setq forge-add-default-bindings nil))
|
||||
|
||||
;; Git gutter - Show git diff in fringe
|
||||
(use-package git-gutter
|
||||
:config
|
||||
(global-git-gutter-mode 1)
|
||||
(setq git-gutter:update-interval 2
|
||||
git-gutter:added-sign "+"
|
||||
git-gutter:deleted-sign "-"
|
||||
git-gutter:modified-sign "~"))
|
||||
|
||||
;; Git gutter fringe
|
||||
(use-package git-gutter-fringe
|
||||
:if (display-graphic-p)
|
||||
:after git-gutter
|
||||
:config
|
||||
(define-fringe-bitmap 'git-gutter-fr:added [224] nil nil '(center repeated))
|
||||
(define-fringe-bitmap 'git-gutter-fr:modified [224] nil nil '(center repeated))
|
||||
(define-fringe-bitmap 'git-gutter-fr:deleted [128 192 224 240] nil nil 'bottom))
|
||||
|
||||
;; Git timemachine - Step through historic versions of git controlled file
|
||||
(use-package git-timemachine)
|
||||
|
||||
;; Git messenger - Show commit message at current line
|
||||
(use-package git-messenger
|
||||
:config
|
||||
(setq git-messenger:show-detail t
|
||||
git-messenger:use-magit-popup t))
|
||||
|
||||
;; Diff highlighting
|
||||
(use-package diff-hl
|
||||
:config
|
||||
(global-diff-hl-mode 1)
|
||||
(diff-hl-flydiff-mode 1)
|
||||
:hook
|
||||
(magit-pre-refresh . diff-hl-magit-pre-refresh)
|
||||
(magit-post-refresh . diff-hl-magit-post-refresh))
|
||||
|
||||
;; Smerge mode for handling merge conflicts
|
||||
(use-package smerge-mode
|
||||
:ensure nil
|
||||
:config
|
||||
(setq smerge-command-prefix "\C-cv"))
|
||||
|
||||
;; Ediff configuration
|
||||
(use-package ediff
|
||||
:ensure nil
|
||||
:config
|
||||
(setq ediff-window-setup-function 'ediff-setup-windows-plain
|
||||
ediff-split-window-function 'split-window-horizontally))
|
||||
|
||||
(provide 'module-git)
|
||||
|
||||
;;; module-git.el ends here
|
||||
536
modules/module-keybinds.el
Normal file
536
modules/module-keybinds.el
Normal file
|
|
@ -0,0 +1,536 @@
|
|||
;;; module-keybinds.el --- Global Keybindings Configuration -*- lexical-binding: t -*-
|
||||
;;; Commentary:
|
||||
;; Module for defining global keybindings and key mapping configurations.
|
||||
;; This module provides a centralized place for all custom keybindings.
|
||||
;; All keybindings from other modules have been consolidated here with module checks.
|
||||
;; To enable: uncomment (require 'module-keybinds) in init.el
|
||||
|
||||
;;; Code:
|
||||
|
||||
;;; Helper function to check if a module is loaded
|
||||
(defun module-loaded-p (module-name)
|
||||
"Check if MODULE-NAME is loaded (appears in features list)."
|
||||
(featurep (intern module-name)))
|
||||
|
||||
;; General - Better key definition framework
|
||||
(use-package general
|
||||
:config
|
||||
;; Set up leader key for global commands
|
||||
(general-create-definer my/leader-keys
|
||||
:keymaps '(normal insert visual emacs)
|
||||
:prefix "SPC"
|
||||
:global-prefix "C-SPC")
|
||||
;; Set up local leader key for mode-specific commands
|
||||
(general-create-definer my/local-leader-keys
|
||||
:keymaps '(normal insert visual emacs)
|
||||
:prefix ","
|
||||
:global-prefix "C-,"))
|
||||
|
||||
;; Define global leader key mappings
|
||||
(my/leader-keys
|
||||
;; File operations
|
||||
"f f" 'find-file
|
||||
"f r" 'recentf-open-files
|
||||
"f s" 'save-buffer
|
||||
"f S" 'save-some-buffers
|
||||
|
||||
;; Buffer operations
|
||||
"b b" 'switch-to-buffer
|
||||
"b d" 'kill-current-buffer
|
||||
"b n" 'next-buffer
|
||||
"b p" 'previous-buffer
|
||||
"b r" 'revert-buffer
|
||||
"b l" 'list-buffers
|
||||
|
||||
;; Window operations
|
||||
"w /" 'split-window-right
|
||||
"w -" 'split-window-below
|
||||
"w d" 'delete-window
|
||||
"w D" 'delete-other-windows
|
||||
"w h" 'windmove-left
|
||||
"w j" 'windmove-down
|
||||
"w k" 'windmove-up
|
||||
"w l" 'windmove-right
|
||||
"w =" 'balance-windows
|
||||
"w u" 'winner-undo
|
||||
"w r" 'winner-redo
|
||||
|
||||
;; Search and navigation
|
||||
"s s" 'swiper
|
||||
"s p" 'consult-ripgrep
|
||||
"s f" 'consult-find
|
||||
"s i" 'consult-imenu
|
||||
"s l" 'consult-line
|
||||
|
||||
;; Project operations (will be available if project module is loaded)
|
||||
"p f" 'projectile-find-file
|
||||
"p p" 'projectile-switch-project
|
||||
"p s" 'projectile-ripgrep
|
||||
"p b" 'projectile-switch-to-buffer
|
||||
"p d" 'projectile-dired
|
||||
|
||||
;; Git operations (will be available if git module is loaded)
|
||||
"g s" 'magit-status
|
||||
"g b" 'magit-branch
|
||||
"g c" 'magit-commit
|
||||
"g f" 'magit-fetch
|
||||
"g p" 'magit-push
|
||||
|
||||
;; Help and documentation
|
||||
"h f" 'describe-function
|
||||
"h v" 'describe-variable
|
||||
"h k" 'describe-key
|
||||
"h m" 'describe-mode
|
||||
"h ." 'display-local-help
|
||||
|
||||
;; Toggle operations
|
||||
"t l" 'display-line-numbers-mode
|
||||
"t w" 'whitespace-mode
|
||||
"t f" 'toggle-frame-fullscreen
|
||||
"t t" 'load-theme
|
||||
|
||||
;; Change window via leader w prefix, e.g., "w h" for left
|
||||
"w h" 'windmove-left
|
||||
"w j" 'windmove-down
|
||||
"w k" 'windmove-up
|
||||
"w l" 'windmove-right
|
||||
|
||||
;; Same for arrow keys
|
||||
"w <left>" 'windmove-left
|
||||
"w <down>" 'windmove-down
|
||||
"w <up>" 'windmove-up
|
||||
"w <right>" 'windmove-right
|
||||
|
||||
;; Resize windows
|
||||
"w <" 'shrink-window-horizontally
|
||||
"w >" 'enlarge-window-horizontally
|
||||
"w +" 'enlarge-window
|
||||
"w -" 'shrink-window
|
||||
|
||||
;; Neotree toggle
|
||||
"n t" 'neotree-toggle
|
||||
|
||||
;; Quit operations
|
||||
"q q" 'save-buffers-kill-terminal
|
||||
"q r" 'restart-emacs)
|
||||
|
||||
;; Evil-specific keybindings (only if evil is loaded)
|
||||
(with-eval-after-load 'evil
|
||||
;; Better escape sequence
|
||||
(setq-default evil-escape-key-sequence "jk"
|
||||
evil-escape-delay 0.2)
|
||||
|
||||
;; Additional navigation bindings
|
||||
(evil-global-set-key 'normal (kbd "C-u") 'evil-scroll-up)
|
||||
(evil-global-set-key 'visual (kbd "C-u") 'evil-scroll-up)
|
||||
|
||||
;; Better window navigation in evil mode
|
||||
(evil-global-set-key 'normal (kbd "C-h") 'windmove-left)
|
||||
(evil-global-set-key 'normal (kbd "C-j") 'windmove-down)
|
||||
(evil-global-set-key 'normal (kbd "C-k") 'windmove-up)
|
||||
(evil-global-set-key 'normal (kbd "C-l") 'windmove-right)
|
||||
|
||||
;; Better beginning/end of line
|
||||
(evil-global-set-key 'normal (kbd "H") 'evil-first-non-blank)
|
||||
(evil-global-set-key 'normal (kbd "L") 'evil-end-of-line))
|
||||
|
||||
;; Company keybindings (only if company is loaded)
|
||||
(with-eval-after-load 'company
|
||||
(define-key company-active-map (kbd "C-n") 'company-select-next)
|
||||
(define-key company-active-map (kbd "C-p") 'company-select-previous)
|
||||
(define-key company-active-map (kbd "C-d") 'company-show-doc-buffer)
|
||||
(define-key company-active-map (kbd "M-.") 'company-show-location)
|
||||
|
||||
;; Smart tab behavior while company popup is active
|
||||
;; (define-key company-active-map (kbd "TAB") 'company-complete-selection)
|
||||
;; (define-key company-active-map (kbd "<tab>") 'company-complete-selection)
|
||||
;; (define-key company-active-map (kbd "<backtab>") 'company-select-previous))
|
||||
)
|
||||
;; Org-mode local leader keys (only if org module is loaded)
|
||||
(with-eval-after-load 'org
|
||||
(my/local-leader-keys
|
||||
:keymaps 'org-mode-map
|
||||
"t" 'org-todo
|
||||
"d" 'org-deadline
|
||||
"s" 'org-schedule
|
||||
"a" 'org-archive-subtree
|
||||
"e" 'org-export-dispatch
|
||||
"l" 'org-insert-link
|
||||
"i" 'org-insert-structure-template))
|
||||
|
||||
;; LSP local leader keys (only if lsp module is loaded)
|
||||
(with-eval-after-load 'lsp-mode
|
||||
(my/local-leader-keys
|
||||
:keymaps 'lsp-mode-map
|
||||
"l" 'lsp-command-map
|
||||
"r" 'lsp-rename
|
||||
"f" 'lsp-format-buffer
|
||||
"a" 'lsp-execute-code-action
|
||||
"d" 'lsp-find-definition
|
||||
"D" 'lsp-find-declaration
|
||||
"i" 'lsp-find-implementation
|
||||
"t" 'lsp-find-type-definition
|
||||
"R" 'lsp-find-references
|
||||
"s" 'lsp-workspace-symbol
|
||||
"h" 'lsp-describe-thing-at-point))
|
||||
|
||||
;; Magit keybindings (only if git module is loaded)
|
||||
(with-eval-after-load 'magit
|
||||
(my/local-leader-keys
|
||||
:keymaps 'magit-mode-map
|
||||
"c" 'magit-commit
|
||||
"f" 'magit-fetch
|
||||
"F" 'magit-pull
|
||||
"p" 'magit-push
|
||||
"b" 'magit-branch
|
||||
"t" 'magit-tag
|
||||
"s" 'magit-stash
|
||||
"r" 'magit-rebase))
|
||||
|
||||
;;; ============================================================================
|
||||
;;; COMPLETION MODULE KEYBINDINGS (from module-completion.el)
|
||||
;;; ============================================================================
|
||||
|
||||
;; Embark keybindings (only if completion module is loaded)
|
||||
(when (module-loaded-p "module-completion")
|
||||
(with-eval-after-load 'embark
|
||||
(global-set-key (kbd "C-.") 'embark-act)
|
||||
(global-set-key (kbd "C-;") 'embark-dwim)
|
||||
(global-set-key (kbd "C-h B") 'embark-bindings)
|
||||
(setq prefix-help-command #'embark-prefix-help-command))
|
||||
|
||||
;; Consult keybindings (only if completion module is loaded)
|
||||
(with-eval-after-load 'consult
|
||||
;; C-c bindings (mode-specific-map)
|
||||
(global-set-key (kbd "C-c M-x") 'consult-mode-command)
|
||||
(global-set-key (kbd "C-c h") 'consult-history)
|
||||
(global-set-key (kbd "C-c k") 'consult-kmacro)
|
||||
(global-set-key (kbd "C-c m") 'consult-man)
|
||||
(global-set-key (kbd "C-c i") 'consult-info)
|
||||
;; C-x bindings (ctl-x-map)
|
||||
(global-set-key (kbd "C-x M-:") 'consult-complex-command)
|
||||
(global-set-key (kbd "C-x b") 'consult-buffer)
|
||||
(global-set-key (kbd "C-x 4 b") 'consult-buffer-other-window)
|
||||
(global-set-key (kbd "C-x 5 b") 'consult-buffer-other-frame)
|
||||
(global-set-key (kbd "C-x r b") 'consult-bookmark)
|
||||
(global-set-key (kbd "C-x p b") 'consult-project-buffer)
|
||||
;; M-g bindings (goto-map)
|
||||
(global-set-key (kbd "M-g e") 'consult-compile-error)
|
||||
(global-set-key (kbd "M-g f") 'consult-flymake)
|
||||
(global-set-key (kbd "M-g g") 'consult-goto-line)
|
||||
(global-set-key (kbd "M-g M-g") 'consult-goto-line)
|
||||
(global-set-key (kbd "M-g o") 'consult-outline)
|
||||
(global-set-key (kbd "M-g m") 'consult-mark)
|
||||
(global-set-key (kbd "M-g k") 'consult-global-mark)
|
||||
(global-set-key (kbd "M-g i") 'consult-imenu)
|
||||
(global-set-key (kbd "M-g I") 'consult-imenu-multi)
|
||||
;; M-s bindings (search-map)
|
||||
(global-set-key (kbd "M-s d") 'consult-find)
|
||||
(global-set-key (kbd "M-s D") 'consult-locate)
|
||||
(global-set-key (kbd "M-s g") 'consult-grep)
|
||||
(global-set-key (kbd "M-s G") 'consult-git-grep)
|
||||
(global-set-key (kbd "M-s r") 'consult-ripgrep)
|
||||
(global-set-key (kbd "M-s l") 'consult-line)
|
||||
(global-set-key (kbd "M-s L") 'consult-line-multi)
|
||||
(global-set-key (kbd "M-s k") 'consult-keep-lines)
|
||||
(global-set-key (kbd "M-s u") 'consult-focus-lines)
|
||||
;; Isearch integration
|
||||
(global-set-key (kbd "M-s e") 'consult-isearch-history)))
|
||||
|
||||
;;; ============================================================================
|
||||
;;; PROGRAMMING MODULE KEYBINDINGS (from module-programming.el)
|
||||
;;; ============================================================================
|
||||
|
||||
;; Multiple cursors keybindings (only if programming module is loaded)
|
||||
(when (module-loaded-p "module-programming")
|
||||
(with-eval-after-load 'multiple-cursors
|
||||
(global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines)
|
||||
(global-set-key (kbd "C->") 'mc/mark-next-like-this)
|
||||
(global-set-key (kbd "C-<") 'mc/mark-previous-like-this)
|
||||
(global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this))
|
||||
|
||||
;; Expand region keybinding (only if programming module is loaded)
|
||||
(with-eval-after-load 'expand-region
|
||||
(global-set-key (kbd "C-=") 'er/expand-region))
|
||||
|
||||
;; Browse at remote keybinding (only if programming module is loaded)
|
||||
(with-eval-after-load 'browse-at-remote
|
||||
(global-set-key (kbd "C-c g g") 'browse-at-remote))
|
||||
|
||||
;; Yasnippet Evil integration (only if programming and evil modules are loaded)
|
||||
(when (module-loaded-p "core-evil")
|
||||
(with-eval-after-load 'yasnippet
|
||||
(define-key evil-insert-state-map (kbd "C-y") 'yas-expand))))
|
||||
|
||||
;;; ============================================================================
|
||||
;;; PROJECT MODULE KEYBINDINGS (from module-project.el)
|
||||
;;; ============================================================================
|
||||
|
||||
;; Consult-projectile keybindings (only if project module is loaded)
|
||||
(when (module-loaded-p "module-project")
|
||||
(with-eval-after-load 'consult-projectile
|
||||
(global-set-key (kbd "C-c p f") 'consult-projectile-find-file)
|
||||
(global-set-key (kbd "C-c p F") 'consult-projectile-find-dir)
|
||||
(global-set-key (kbd "C-c p s") 'consult-projectile-switch-to-buffer)
|
||||
(global-set-key (kbd "C-c p p") 'consult-projectile-switch-project))
|
||||
|
||||
;; Evil projectile integration (only if project and evil modules are loaded)
|
||||
(when (module-loaded-p "core-evil")
|
||||
(with-eval-after-load 'projectile
|
||||
(evil-define-key 'normal 'global (kbd "SPC p") 'projectile-command-map))
|
||||
|
||||
;; Evil treemacs integration (only if project and evil modules are loaded)
|
||||
(with-eval-after-load 'treemacs
|
||||
(evil-define-key 'normal 'global (kbd "SPC t") 'treemacs))))
|
||||
|
||||
;;; ============================================================================
|
||||
;;; UI MODULE KEYBINDINGS (from module-ui.el)
|
||||
;;; ============================================================================
|
||||
|
||||
;; Helpful keybindings (only if ui module is loaded)
|
||||
(when (module-loaded-p "module-ui")
|
||||
(with-eval-after-load 'helpful
|
||||
(global-set-key [remap describe-function] 'helpful-callable)
|
||||
(global-set-key [remap describe-variable] 'helpful-variable)
|
||||
(global-set-key [remap describe-key] 'helpful-key)
|
||||
(global-set-key [remap describe-command] 'helpful-command)
|
||||
(global-set-key [remap describe-symbol] 'helpful-symbol))
|
||||
|
||||
;; Popper keybindings (only if ui module is loaded)
|
||||
(with-eval-after-load 'popper
|
||||
(global-set-key (kbd "C-`") 'popper-toggle-latest)
|
||||
(global-set-key (kbd "M-`") 'popper-cycle)
|
||||
(global-set-key (kbd "C-M-`") 'popper-toggle-type))
|
||||
|
||||
;; Ace-window keybinding (only if ui module is loaded)
|
||||
(with-eval-after-load 'ace-window
|
||||
(global-set-key (kbd "M-o") 'ace-window))
|
||||
|
||||
;; Windmove keybindings (only if ui module is loaded)
|
||||
(with-eval-after-load 'windmove
|
||||
(windmove-default-keybindings)))
|
||||
|
||||
;;; ============================================================================
|
||||
;;; TERMINAL MODULE KEYBINDINGS (from module-terminal.el)
|
||||
;;; ============================================================================
|
||||
|
||||
;; Multi-vterm keybindings (only if terminal module is loaded)
|
||||
(when (module-loaded-p "module-terminal")
|
||||
(with-eval-after-load 'multi-vterm
|
||||
(global-set-key (kbd "C-c t t") 'multi-vterm)
|
||||
(global-set-key (kbd "C-c t n") 'multi-vterm-next)
|
||||
(global-set-key (kbd "C-c t p") 'multi-vterm-prev)
|
||||
(global-set-key (kbd "C-c t d") 'multi-vterm-dedicated-toggle)
|
||||
(global-set-key (kbd "C-c t r") 'multi-vterm-rename-buffer))
|
||||
|
||||
;; Shell-pop keybinding (only if terminal module is loaded)
|
||||
(with-eval-after-load 'shell-pop
|
||||
(global-set-key (kbd "C-c t s") 'shell-pop))
|
||||
|
||||
;; VTerm evil integration (only if terminal and evil modules are loaded)
|
||||
(when (module-loaded-p "core-evil")
|
||||
(with-eval-after-load 'vterm
|
||||
(evil-set-initial-state 'vterm-mode 'insert)
|
||||
(evil-define-key 'insert vterm-mode-map
|
||||
(kbd "C-c C-t") 'vterm-copy-mode)
|
||||
(evil-define-key 'normal vterm-mode-map
|
||||
(kbd "i") 'vterm-send-key
|
||||
(kbd "o") 'vterm-send-key
|
||||
(kbd "a") 'vterm-send-key))
|
||||
|
||||
;; EShell evil integration (only if terminal and evil modules are loaded)
|
||||
(with-eval-after-load 'eshell
|
||||
(evil-set-initial-state 'eshell-mode 'insert))
|
||||
|
||||
;; Compilation mode evil integration (only if terminal and evil modules are loaded)
|
||||
(with-eval-after-load 'compile
|
||||
(evil-set-initial-state 'compilation-mode 'normal))))
|
||||
|
||||
;;; ============================================================================
|
||||
;;; FILE MODULE KEYBINDINGS (from module-file.el)
|
||||
;;; ============================================================================
|
||||
|
||||
;; Dired keybindings (only if file module is loaded)
|
||||
(when (module-loaded-p "module-file")
|
||||
(with-eval-after-load 'dired-narrow
|
||||
(define-key dired-mode-map (kbd "/") 'dired-narrow-fuzzy))
|
||||
|
||||
;; Dired ranger keybindings (only if file module is loaded)
|
||||
(with-eval-after-load 'dired-ranger
|
||||
(define-key dired-mode-map (kbd "W") 'dired-ranger-copy)
|
||||
(define-key dired-mode-map (kbd "X") 'dired-ranger-move)
|
||||
(define-key dired-mode-map (kbd "Y") 'dired-ranger-paste))
|
||||
|
||||
;; Find-file-in-project keybinding (only if file module is loaded)
|
||||
(with-eval-after-load 'find-file-in-project
|
||||
(global-set-key (kbd "C-c f f") 'find-file-in-project))
|
||||
|
||||
;; Neotree keybinding (only if file module is loaded)
|
||||
(with-eval-after-load 'neotree
|
||||
(global-set-key (kbd "C-c n") 'neotree-toggle))
|
||||
|
||||
;; Sudo-edit keybinding (only if file module is loaded)
|
||||
(with-eval-after-load 'sudo-edit
|
||||
(global-set-key (kbd "C-c C-r") 'sudo-edit)))
|
||||
|
||||
;;; ============================================================================
|
||||
;;; GIT MODULE KEYBINDINGS (from module-git.el)
|
||||
;;; ============================================================================
|
||||
|
||||
;; Magit keybindings (only if git module is loaded)
|
||||
(when (module-loaded-p "module-git")
|
||||
(with-eval-after-load 'magit
|
||||
(global-set-key (kbd "C-x g") 'magit-status)
|
||||
(global-set-key (kbd "C-x M-g") 'magit-dispatch))
|
||||
|
||||
;; Git-timemachine keybinding (only if git module is loaded)
|
||||
(with-eval-after-load 'git-timemachine
|
||||
(global-set-key (kbd "C-x v t") 'git-timemachine))
|
||||
|
||||
;; Git-messenger keybinding (only if git module is loaded)
|
||||
(with-eval-after-load 'git-messenger
|
||||
(global-set-key (kbd "C-x v p") 'git-messenger:popup-message))
|
||||
|
||||
;; Evil git integrations (only if git and evil modules are loaded)
|
||||
(when (module-loaded-p "core-evil")
|
||||
;; Evil magit integration
|
||||
(with-eval-after-load 'magit
|
||||
(evil-define-key 'normal 'global (kbd "SPC g") 'magit-status))
|
||||
|
||||
;; Evil git-gutter integration
|
||||
(with-eval-after-load 'git-gutter
|
||||
(evil-define-key 'normal 'global (kbd "] h") 'git-gutter:next-hunk)
|
||||
(evil-define-key 'normal 'global (kbd "[ h") 'git-gutter:previous-hunk)
|
||||
(evil-define-key 'normal 'global (kbd "SPC h s") 'git-gutter:stage-hunk)
|
||||
(evil-define-key 'normal 'global (kbd "SPC h r") 'git-gutter:revert-hunk)
|
||||
(evil-define-key 'normal 'global (kbd "SPC h p") 'git-gutter:popup-hunk))
|
||||
|
||||
;; Evil smerge-mode integration
|
||||
(with-eval-after-load 'smerge-mode
|
||||
(evil-define-key 'normal smerge-mode-map
|
||||
(kbd "] n") 'smerge-next
|
||||
(kbd "[ n") 'smerge-prev
|
||||
(kbd "SPC m u") 'smerge-keep-upper
|
||||
(kbd "SPC m l") 'smerge-keep-lower
|
||||
(kbd "SPC m b") 'smerge-keep-base
|
||||
(kbd "SPC m a") 'smerge-keep-all
|
||||
(kbd "SPC m r") 'smerge-resolve))))
|
||||
|
||||
;;; ============================================================================
|
||||
;;; LSP MODULE KEYBINDINGS (from module-lsp.el)
|
||||
;;; ============================================================================
|
||||
|
||||
;; LSP keybindings (only if lsp module is loaded)
|
||||
(when (module-loaded-p "module-lsp")
|
||||
;; Evil LSP integration (only if lsp and evil modules are loaded)
|
||||
(when (module-loaded-p "core-evil")
|
||||
(with-eval-after-load 'lsp-mode
|
||||
(evil-define-key 'normal lsp-mode-map
|
||||
(kbd "gd") 'lsp-find-definition
|
||||
(kbd "gr") 'lsp-find-references
|
||||
(kbd "K") 'lsp-describe-thing-at-point
|
||||
(kbd "SPC l") lsp-command-map))
|
||||
|
||||
;; Evil LSP-UI integration
|
||||
(with-eval-after-load 'lsp-ui
|
||||
(evil-define-key 'normal lsp-ui-mode-map
|
||||
(kbd "SPC l p") 'lsp-ui-peek-find-definitions
|
||||
(kbd "SPC l r") 'lsp-ui-peek-find-references
|
||||
(kbd "SPC l i") 'lsp-ui-peek-find-implementation
|
||||
(kbd "SPC l s") 'lsp-ui-peek-find-workspace-symbol))
|
||||
|
||||
;; Evil flycheck integration
|
||||
(with-eval-after-load 'flycheck
|
||||
(evil-define-key 'normal 'global
|
||||
(kbd "] e") 'flycheck-next-error
|
||||
(kbd "[ e") 'flycheck-previous-error
|
||||
(kbd "SPC e l") 'flycheck-list-errors
|
||||
(kbd "SPC e v") 'flycheck-verify-setup
|
||||
(kbd "SPC e c") 'flycheck-clear))
|
||||
|
||||
;; Evil DAP integration
|
||||
(with-eval-after-load 'dap-mode
|
||||
(evil-define-key 'normal dap-mode-map
|
||||
(kbd "SPC d d") 'dap-debug
|
||||
(kbd "SPC d l") 'dap-debug-last
|
||||
(kbd "SPC d r") 'dap-debug-recent
|
||||
(kbd "SPC d b") 'dap-breakpoint-toggle
|
||||
(kbd "SPC d c") 'dap-continue
|
||||
(kbd "SPC d n") 'dap-next
|
||||
(kbd "SPC d s") 'dap-step-in
|
||||
(kbd "SPC d o") 'dap-step-out
|
||||
(kbd "SPC d u") 'dap-ui-mode
|
||||
(kbd "SPC d R") 'dap-restart-frame))))
|
||||
|
||||
;;; ============================================================================
|
||||
;;; ORG MODULE KEYBINDINGS (from module-org.el)
|
||||
;;; ============================================================================
|
||||
|
||||
;; Org mode keybindings (only if org module is loaded)
|
||||
(when (module-loaded-p "module-org")
|
||||
(with-eval-after-load 'org
|
||||
(global-set-key (kbd "C-c l") 'org-store-link)
|
||||
(global-set-key (kbd "C-c a") 'org-agenda)
|
||||
(global-set-key (kbd "C-c c") 'org-capture)
|
||||
(global-set-key (kbd "C-c b") 'org-switchb))
|
||||
|
||||
;; Org-roam keybindings (only if org module is loaded)
|
||||
(with-eval-after-load 'org-roam
|
||||
(global-set-key (kbd "C-c n l") 'org-roam-buffer-toggle)
|
||||
(global-set-key (kbd "C-c n f") 'org-roam-node-find)
|
||||
(global-set-key (kbd "C-c n g") 'org-roam-graph)
|
||||
(global-set-key (kbd "C-c n i") 'org-roam-node-insert)
|
||||
(global-set-key (kbd "C-c n c") 'org-roam-capture)
|
||||
(global-set-key (kbd "C-c n j") 'org-roam-dailies-capture-today))
|
||||
|
||||
;; Org-cliplink keybinding (only if org module is loaded)
|
||||
(with-eval-after-load 'org-cliplink
|
||||
(global-set-key (kbd "C-c C-l") 'org-cliplink))
|
||||
|
||||
;; Org-pomodoro keybinding (only if org module is loaded)
|
||||
(with-eval-after-load 'org-pomodoro
|
||||
(global-set-key (kbd "C-c C-x p") 'org-pomodoro))
|
||||
|
||||
;; Evil org integration (only if org and evil modules are loaded)
|
||||
(when (module-loaded-p "core-evil")
|
||||
(with-eval-after-load 'org
|
||||
(evil-define-key 'normal org-mode-map
|
||||
(kbd "TAB") 'org-cycle
|
||||
(kbd "S-TAB") 'org-shifttab
|
||||
(kbd "RET") 'org-return
|
||||
(kbd "M-RET") 'org-meta-return
|
||||
(kbd "SPC o a") 'org-agenda
|
||||
(kbd "SPC o c") 'org-capture
|
||||
(kbd "SPC o l") 'org-store-link))))
|
||||
|
||||
;;; ============================================================================
|
||||
;;; CUSTOM UTILITY FUNCTIONS AND KEYBINDINGS
|
||||
;;; ============================================================================
|
||||
|
||||
;; Custom function and keybinding
|
||||
(defun my/switch-to-scratch-buffer ()
|
||||
"Switch to the *scratch* buffer, creating it if it doesn't exist."
|
||||
(interactive)
|
||||
(switch-to-buffer "*scratch*"))
|
||||
|
||||
(my/leader-keys
|
||||
"b s" 'my/switch-to-scratch-buffer)
|
||||
|
||||
;; Bind this to programming modes
|
||||
(add-hook 'prog-mode-hook
|
||||
(lambda ()
|
||||
(local-set-key (kbd "C-/") 'my/comment-or-uncomment-region-or-line)))
|
||||
|
||||
;; Evil-specific programming mode bindings (only if evil is loaded)
|
||||
(when (module-loaded-p "core-evil")
|
||||
(with-eval-after-load 'evil
|
||||
(evil-define-key 'normal prog-mode-map
|
||||
(kbd "gcc") 'my/comment-or-uncomment-region-or-line)
|
||||
(evil-define-key 'visual prog-mode-map
|
||||
(kbd "gc") 'my/comment-or-uncomment-region-or-line)))
|
||||
|
||||
|
||||
|
||||
(provide 'module-keybinds)
|
||||
|
||||
;;; module-keybinds.el ends here
|
||||
265
modules/module-lsp.el
Normal file
265
modules/module-lsp.el
Normal file
|
|
@ -0,0 +1,265 @@
|
|||
;;; module-lsp.el --- Language Server Protocol Configuration -*- lexical-binding: t -*-
|
||||
|
||||
;;; Commentary:
|
||||
;; Complete LSP setup with language servers, debugging, and tooling.
|
||||
;; This module is completely independent - comment it out in init.el to disable.
|
||||
;; To enable: uncomment (require 'module-lsp) in init.el
|
||||
|
||||
;; ============================================================================
|
||||
;;; CORE LSP SETUP
|
||||
;;; ============================================================================
|
||||
|
||||
;; LSP Mode - Language Server Protocol support
|
||||
(use-package lsp-mode
|
||||
:init
|
||||
(setq lsp-keymap-prefix "C-c l")
|
||||
:hook ((python-mode . lsp-deferred)
|
||||
(js-mode . lsp-deferred)
|
||||
(typescript-mode . lsp-deferred)
|
||||
(rust-mode . lsp-deferred)
|
||||
(go-mode . lsp-deferred)
|
||||
(java-mode . lsp-deferred)
|
||||
(c-mode . lsp-deferred)
|
||||
(c++-mode . lsp-deferred)
|
||||
(lsp-mode . lsp-enable-which-key-integration))
|
||||
:config
|
||||
;; Core LSP settings
|
||||
(setq lsp-completion-provider :company
|
||||
lsp-idle-delay 0.1
|
||||
lsp-session-file (expand-file-name ".lsp-session" user-emacs-directory)
|
||||
lsp-auto-guess-root t
|
||||
lsp-keep-workspace-alive nil
|
||||
lsp-eldoc-render-all nil
|
||||
lsp-enable-snippet t
|
||||
lsp-enable-folding t
|
||||
lsp-enable-imenu t
|
||||
lsp-enable-file-watchers t
|
||||
lsp-file-watch-threshold 2000
|
||||
lsp-signature-auto-activate '(:on-trigger-char :on-server-request)
|
||||
lsp-signature-render-documentation nil)
|
||||
|
||||
;; Performance optimizations
|
||||
(setq gc-cons-threshold (* 100 1024 1024)
|
||||
read-process-output-max (* 1024 1024)
|
||||
treemacs-space-between-root-nodes nil
|
||||
lsp-log-io nil))
|
||||
|
||||
;;; ============================================================================
|
||||
;;; UI CONFIGURATION
|
||||
;;; ============================================================================
|
||||
|
||||
;; LSP UI - Enhanced UI for lsp-mode
|
||||
(use-package lsp-ui
|
||||
:after lsp-mode
|
||||
:hook (lsp-mode . lsp-ui-mode)
|
||||
:config
|
||||
;; Documentation popup configuration
|
||||
(setq lsp-ui-doc-enable t
|
||||
lsp-ui-doc-use-childframe t
|
||||
lsp-ui-doc-position 'top
|
||||
lsp-ui-doc-include-signature t
|
||||
lsp-ui-doc-max-width 120
|
||||
lsp-ui-doc-max-height 20)
|
||||
|
||||
;; Sideline configuration
|
||||
(setq lsp-ui-sideline-enable t
|
||||
lsp-ui-sideline-ignore-duplicate t
|
||||
lsp-ui-sideline-show-code-actions t
|
||||
lsp-ui-sideline-show-hover nil
|
||||
lsp-ui-sideline-show-diagnostics t)
|
||||
|
||||
;; Peek configuration
|
||||
(setq lsp-ui-peek-enable t
|
||||
lsp-ui-peek-always-show t
|
||||
lsp-ui-peek-peek-height 20
|
||||
lsp-ui-peek-list-width 50)
|
||||
|
||||
;; Flycheck integration
|
||||
(setq lsp-ui-flycheck-enable t))
|
||||
|
||||
;; LSP Treemacs integration (only if treemacs is available)
|
||||
(use-package lsp-treemacs
|
||||
:after (lsp-mode)
|
||||
:config
|
||||
(lsp-treemacs-sync-mode 1)
|
||||
;; Example: Custom treemacs views
|
||||
(setq lsp-treemacs-symbols-position-params
|
||||
`((side . right)
|
||||
(slot . 2)
|
||||
(window-width . 35))))
|
||||
|
||||
;;; ============================================================================
|
||||
;;; ERROR CHECKING AND DIAGNOSTICS
|
||||
;;; ============================================================================
|
||||
|
||||
;; Flycheck - Syntax checking
|
||||
(use-package flycheck
|
||||
:config
|
||||
(global-flycheck-mode 1)
|
||||
(setq flycheck-indication-mode 'right-fringe
|
||||
flycheck-emacs-lisp-load-path 'inherit
|
||||
flycheck-check-syntax-automatically '(save idle-change mode-enabled)
|
||||
flycheck-idle-change-delay 0.8
|
||||
flycheck-display-errors-delay 0.3))
|
||||
|
||||
;; Flycheck popup tip for better error display
|
||||
(use-package flycheck-popup-tip
|
||||
:after flycheck
|
||||
:hook (flycheck-mode . flycheck-popup-tip-mode)
|
||||
:config
|
||||
(setq flycheck-popup-tip-error-prefix "✗ "))
|
||||
|
||||
;;; ============================================================================
|
||||
;;; DAP CONFIGURATION (Debug Adapter Protocol)
|
||||
;;; ============================================================================
|
||||
|
||||
;; DAP Mode - Debug Adapter Protocol
|
||||
(use-package dap-mode
|
||||
:after lsp-mode
|
||||
:config
|
||||
(dap-auto-configure-mode)
|
||||
(setq dap-breakpoints-file (expand-file-name ".dap-breakpoints" user-emacs-directory)
|
||||
dap-utils-extension-path (expand-file-name ".extension" user-emacs-directory))
|
||||
|
||||
;; UI configuration
|
||||
(setq dap-ui-buffer-configurations
|
||||
`((,"*dap-ui-locals*" . ((side . right) (slot . 1) (window-width . 0.20)))
|
||||
(,"*dap-ui-expressions*" . ((side . right) (slot . 2) (window-width . 0.20)))
|
||||
(,"*dap-ui-sessions*" . ((side . right) (slot . 3) (window-width . 0.20)))
|
||||
(,"*dap-ui-breakpoints*" . ((side . left) (slot . 2) (window-width . 0.20)))
|
||||
(,"*dap-ui-repl*" . ((side . bottom) (slot . 1) (window-height . 0.20))))))
|
||||
|
||||
;;; ============================================================================
|
||||
;;; LANGUAGE SERVERS
|
||||
;;; ============================================================================
|
||||
|
||||
;; Python
|
||||
(use-package python-mode
|
||||
:mode "\\.py\\'"
|
||||
:hook (python-mode . lsp-deferred)
|
||||
:config
|
||||
;; Install: pip install python-lsp-server[all]
|
||||
(setq python-indent-offset 4
|
||||
python-shell-interpreter "python3")
|
||||
|
||||
;; Example: Additional Python-specific LSP settings
|
||||
(with-eval-after-load 'lsp-mode
|
||||
(setq lsp-pylsp-plugins-pycodestyle-enabled nil
|
||||
lsp-pylsp-plugins-mccabe-enabled nil
|
||||
lsp-pylsp-plugins-pyflakes-enabled t
|
||||
lsp-pylsp-plugins-pylint-enabled t)))
|
||||
|
||||
;; JavaScript/TypeScript
|
||||
(use-package typescript-mode
|
||||
:mode "\\.ts\\'"
|
||||
:hook (typescript-mode . lsp-deferred)
|
||||
:config
|
||||
;; Install: npm install -g typescript-language-server typescript
|
||||
(setq typescript-indent-level 2))
|
||||
|
||||
;; Web mode for mixed HTML/JS/CSS
|
||||
(use-package web-mode
|
||||
:mode ("\\.html\\'" "\\.jsx\\'" "\\.tsx\\'" "\\.vue\\'")
|
||||
:hook (web-mode . lsp-deferred)
|
||||
:config
|
||||
(setq web-mode-markup-indent-offset 2
|
||||
web-mode-css-indent-offset 2
|
||||
web-mode-code-indent-offset 2))
|
||||
|
||||
;; Rust
|
||||
(use-package rust-mode
|
||||
:mode "\\.rs\\'"
|
||||
:hook (rust-mode . lsp-deferred)
|
||||
:config
|
||||
;; Install: rustup component add rust-analyzer
|
||||
(setq rust-format-on-save t)
|
||||
|
||||
;; Example: Rust-specific settings
|
||||
(with-eval-after-load 'lsp-mode
|
||||
(setq lsp-rust-analyzer-cargo-watch-command "clippy"
|
||||
lsp-rust-analyzer-server-display-inlay-hints t)))
|
||||
|
||||
;; Go
|
||||
(use-package go-mode
|
||||
:mode "\\.go\\'"
|
||||
:hook (go-mode . lsp-deferred)
|
||||
:config
|
||||
;; Install: go install golang.org/x/tools/gopls@latest
|
||||
(setq gofmt-command "goimports")
|
||||
|
||||
;; Auto-format on save
|
||||
(add-hook 'before-save-hook 'gofmt-before-save))
|
||||
|
||||
;; C/C++
|
||||
;; Install: sudo apt install clangd (or equivalent for your OS)
|
||||
(add-hook 'c-mode-hook #'lsp-deferred)
|
||||
(add-hook 'c++-mode-hook #'lsp-deferred)
|
||||
|
||||
;; Example: C++ specific settings
|
||||
(with-eval-after-load 'lsp-mode
|
||||
(setq lsp-clients-clangd-args '("-j=3"
|
||||
"--background-index"
|
||||
"--clang-tidy"
|
||||
"--completion-style=detailed"
|
||||
"--header-insertion=never")))
|
||||
|
||||
;; Java
|
||||
(use-package lsp-java
|
||||
:after lsp-mode
|
||||
:hook (java-mode . lsp-deferred)
|
||||
:config
|
||||
;; Install: Download eclipse.jdt.ls
|
||||
(setq lsp-java-workspace-dir (expand-file-name "~/.emacs.d/workspace")))
|
||||
|
||||
;;; ============================================================================
|
||||
;;; ADDITIONAL LANGUAGE SUPPORT EXAMPLES
|
||||
;;; ============================================================================
|
||||
|
||||
;; Example: Lua support
|
||||
;; Uncomment and install lua-language-server to enable
|
||||
;; (use-package lua-mode
|
||||
;; :mode "\\.lua\\'"
|
||||
;; :hook (lua-mode . lsp-deferred))
|
||||
|
||||
;; Example: PHP support
|
||||
;; Uncomment and install intelephense to enable
|
||||
;; (use-package php-mode
|
||||
;; :mode "\\.php\\'"
|
||||
;; :hook (php-mode . lsp-deferred))
|
||||
|
||||
;; Example: Dockerfile support
|
||||
;; (use-package dockerfile-mode
|
||||
;; :mode "Dockerfile\\'"
|
||||
;; :hook (dockerfile-mode . lsp-deferred))
|
||||
|
||||
;;; ============================================================================
|
||||
;;; UTILITY FUNCTIONS
|
||||
;;; ============================================================================
|
||||
|
||||
;; Example: Custom function to restart LSP workspace
|
||||
(defun my/lsp-restart-workspace ()
|
||||
"Restart the LSP workspace."
|
||||
(interactive)
|
||||
(lsp-workspace-restart
|
||||
(lsp--read-workspace)))
|
||||
|
||||
;; Example: Custom function to organize imports
|
||||
(defun my/lsp-organize-imports ()
|
||||
"Organize imports in current buffer."
|
||||
(interactive)
|
||||
(when (lsp-feature? "textDocument/codeAction")
|
||||
(lsp-organize-imports)))
|
||||
|
||||
;; Example: Custom function to format and organize on save
|
||||
(defun my/lsp-format-and-organize-on-save ()
|
||||
"Format buffer and organize imports on save."
|
||||
(when (lsp-mode)
|
||||
(lsp-format-buffer)
|
||||
(my/lsp-organize-imports)))
|
||||
|
||||
;; Uncomment to enable auto-format and organize on save
|
||||
;; (add-hook 'before-save-hook #'my/lsp-format-and-organize-on-save)
|
||||
|
||||
(provide 'module-lsp)
|
||||
|
||||
;;; module-lsp.el ends here
|
||||
156
modules/module-org.el
Normal file
156
modules/module-org.el
Normal file
|
|
@ -0,0 +1,156 @@
|
|||
;;; module-org.el --- Org Mode Configuration -*- lexical-binding: t -*-
|
||||
|
||||
;;; Commentary:
|
||||
;; Example module for Org mode configuration and enhancements.
|
||||
;; To enable: uncomment (require 'module-org) in init.el
|
||||
|
||||
;; Org mode
|
||||
(use-package org
|
||||
:ensure nil
|
||||
:mode ("\\.org\\'" . org-mode)
|
||||
:config
|
||||
(setq org-directory "~/org/"
|
||||
org-default-notes-file (concat org-directory "notes.org")
|
||||
org-agenda-files (list org-directory)
|
||||
org-startup-indented t
|
||||
org-pretty-entities t
|
||||
org-hide-emphasis-markers t
|
||||
org-startup-with-inline-images t
|
||||
org-image-actual-width '(400)
|
||||
org-log-done 'time
|
||||
org-log-into-drawer t
|
||||
org-src-fontify-natively t
|
||||
org-src-tab-acts-natively t
|
||||
org-src-preserve-indentation t
|
||||
org-edit-src-content-indentation 0
|
||||
org-confirm-babel-evaluate nil
|
||||
org-export-with-smart-quotes t)
|
||||
|
||||
;; Org babel languages
|
||||
(org-babel-do-load-languages
|
||||
'org-babel-load-languages
|
||||
'((emacs-lisp . t)
|
||||
(python . t)
|
||||
(shell . t)
|
||||
(js . t)
|
||||
(sql . t)
|
||||
(dot . t)
|
||||
(plantuml . t)))
|
||||
|
||||
;; Capture templates
|
||||
(setq org-capture-templates
|
||||
'(("t" "Todo" entry (file+headline "~/org/tasks.org" "Tasks")
|
||||
"* TODO %?\n %i\n %a")
|
||||
("j" "Journal" entry (file+datetree "~/org/journal.org")
|
||||
"* %?\nEntered on %U\n %i\n %a")
|
||||
("n" "Note" entry (file "~/org/notes.org")
|
||||
"* %?\n %i\n %a")))
|
||||
|
||||
;; Todo keywords
|
||||
(setq org-todo-keywords
|
||||
'((sequence "TODO(t)" "IN-PROGRESS(i)" "WAITING(w)" "|" "DONE(d)" "CANCELLED(c)"))))
|
||||
|
||||
;; Org bullets - Pretty bullets instead of asterisks
|
||||
(use-package org-bullets
|
||||
:hook (org-mode . org-bullets-mode)
|
||||
:config
|
||||
(setq org-bullets-bullet-list '("◉" "○" "●" "○" "●" "○" "●")))
|
||||
|
||||
;; Org superstar (alternative to org-bullets)
|
||||
(use-package org-superstar
|
||||
:hook (org-mode . org-superstar-mode)
|
||||
:config
|
||||
(setq org-superstar-remove-leading-stars t
|
||||
org-superstar-headline-bullets-list '("◉" "○" "●" "○" "●" "○" "●")
|
||||
org-superstar-item-bullet-alist '((?+ . ?➤) (?- . ?➤) (?* . ?➤))))
|
||||
|
||||
;; Org modern - Modern styling for org mode
|
||||
(use-package org-modern
|
||||
:hook ((org-mode . org-modern-mode)
|
||||
(org-agenda-finalize . org-modern-agenda))
|
||||
:config
|
||||
(setq org-modern-keyword nil
|
||||
org-modern-checkbox nil
|
||||
org-modern-table nil))
|
||||
|
||||
;; Org roam - Note taking system
|
||||
(use-package org-roam
|
||||
:custom
|
||||
(org-roam-directory "~/org/roam/")
|
||||
(org-roam-completion-everywhere t)
|
||||
:config
|
||||
(org-roam-db-autosync-mode))
|
||||
|
||||
;; Org roam UI
|
||||
(use-package org-roam-ui
|
||||
:after org-roam
|
||||
:config
|
||||
(setq org-roam-ui-sync-theme t
|
||||
org-roam-ui-follow t
|
||||
org-roam-ui-update-on-save t
|
||||
org-roam-ui-open-on-start t))
|
||||
|
||||
;; Org present - Simple presentation mode
|
||||
(use-package org-present
|
||||
:config
|
||||
(add-hook 'org-present-mode-hook
|
||||
(lambda ()
|
||||
(org-present-big)
|
||||
(org-display-inline-images)
|
||||
(org-present-hide-cursor)
|
||||
(org-present-read-only)))
|
||||
(add-hook 'org-present-mode-quit-hook
|
||||
(lambda ()
|
||||
(org-present-small)
|
||||
(org-remove-inline-images)
|
||||
(org-present-show-cursor)
|
||||
(org-present-read-write))))
|
||||
|
||||
;; Org download - Drag and drop images
|
||||
(use-package org-download
|
||||
:config
|
||||
(setq org-download-method 'directory
|
||||
org-download-image-dir "images"
|
||||
org-download-heading-lvl nil
|
||||
org-download-timestamp "%Y%m%d-%H%M%S_")
|
||||
(org-download-enable))
|
||||
|
||||
;; Org cliplink - Insert links from clipboard
|
||||
(use-package org-cliplink)
|
||||
|
||||
;; Org pomodoro - Pomodoro technique
|
||||
(use-package org-pomodoro
|
||||
:config
|
||||
(setq org-pomodoro-length 25
|
||||
org-pomodoro-short-break-length 5
|
||||
org-pomodoro-long-break-length 15))
|
||||
|
||||
;; Org journal
|
||||
(use-package org-journal
|
||||
:config
|
||||
(setq org-journal-dir "~/org/journal/"
|
||||
org-journal-date-format "%A, %d %B %Y"
|
||||
org-journal-file-format "%Y-%m-%d.org"
|
||||
org-journal-file-type 'daily))
|
||||
|
||||
;; Org agenda settings
|
||||
(with-eval-after-load 'org-agenda
|
||||
(setq org-agenda-window-setup 'current-window
|
||||
org-agenda-span 7
|
||||
org-agenda-start-on-weekday nil
|
||||
org-agenda-start-day "-1d"
|
||||
org-agenda-skip-scheduled-if-done t
|
||||
org-agenda-skip-deadline-if-done t
|
||||
org-agenda-include-deadlines t
|
||||
org-agenda-block-separator nil
|
||||
org-agenda-compact-blocks t
|
||||
org-agenda-start-with-log-mode t))
|
||||
|
||||
;; Org export backends
|
||||
(with-eval-after-load 'ox
|
||||
(require 'ox-md)
|
||||
(require 'ox-beamer))
|
||||
|
||||
(provide 'module-org)
|
||||
|
||||
;;; module-org.el ends here
|
||||
170
modules/module-programming.el
Normal file
170
modules/module-programming.el
Normal file
|
|
@ -0,0 +1,170 @@
|
|||
;;; module-programming.el --- Programming Language Support -*- lexical-binding: t -*-
|
||||
|
||||
;;; Commentary:
|
||||
;; Example module for programming language support and development tools.
|
||||
;; To enable: uncomment (require 'module-programming) in init.el
|
||||
|
||||
;;; Code:
|
||||
|
||||
;; General programming settings
|
||||
(setq-default indent-tabs-mode nil ; Use spaces instead of tabs
|
||||
tab-width 4 ; Tab width
|
||||
fill-column 80) ; Line length
|
||||
|
||||
;; Show trailing whitespace
|
||||
(add-hook 'prog-mode-hook
|
||||
(lambda () (setq show-trailing-whitespace t)))
|
||||
|
||||
;; Automatic parentheses pairing
|
||||
(use-package electric-pair
|
||||
:ensure nil
|
||||
:hook (prog-mode . electric-pair-mode))
|
||||
|
||||
;; Smart parentheses
|
||||
(use-package smartparens
|
||||
:hook (prog-mode . smartparens-mode)
|
||||
:config
|
||||
(require 'smartparens-config)
|
||||
(sp-local-pair 'emacs-lisp-mode "'" nil :actions nil)
|
||||
(sp-local-pair 'lisp-interaction-mode "'" nil :actions nil))
|
||||
|
||||
;; Multiple cursors
|
||||
(use-package multiple-cursors)
|
||||
|
||||
;; Expand region
|
||||
(use-package expand-region)
|
||||
|
||||
;; Snippet system
|
||||
(use-package yasnippet
|
||||
:hook (prog-mode . yas-minor-mode)
|
||||
:config
|
||||
(yas-reload-all))
|
||||
|
||||
;; Snippet collections
|
||||
(use-package yasnippet-snippets
|
||||
:after yasnippet)
|
||||
|
||||
;; Code formatting
|
||||
(use-package format-all
|
||||
:hook (prog-mode . format-all-mode)
|
||||
:config
|
||||
(setq format-all-formatters
|
||||
'(("Python" black)
|
||||
("JavaScript" prettier)
|
||||
("TypeScript" prettier)
|
||||
("JSON" prettier)
|
||||
("HTML" prettier)
|
||||
("CSS" prettier)
|
||||
("Rust" rustfmt)
|
||||
("Go" gofmt))))
|
||||
|
||||
;; Web development
|
||||
(use-package web-mode
|
||||
:mode ("\\.html?\\'" "\\.jsx?\\'" "\\.tsx?\\'" "\\.vue\\'")
|
||||
:config
|
||||
(setq web-mode-markup-indent-offset 2
|
||||
web-mode-css-indent-offset 2
|
||||
web-mode-code-indent-offset 2
|
||||
web-mode-enable-auto-pairing t
|
||||
web-mode-enable-auto-closing t
|
||||
web-mode-enable-current-element-highlight t))
|
||||
|
||||
;; Emmet for HTML/CSS
|
||||
(use-package emmet-mode
|
||||
:hook ((web-mode . emmet-mode)
|
||||
(css-mode . emmet-mode)
|
||||
(html-mode . emmet-mode)))
|
||||
|
||||
;; JSON mode
|
||||
(use-package json-mode
|
||||
:mode "\\.json\\'")
|
||||
|
||||
;; YAML mode
|
||||
(use-package yaml-mode
|
||||
:mode "\\.ya?ml\\'")
|
||||
|
||||
;; Markdown mode
|
||||
(use-package markdown-mode
|
||||
:mode "\\.md\\'"
|
||||
:config
|
||||
(setq markdown-command "multimarkdown"))
|
||||
|
||||
;; Docker
|
||||
(use-package dockerfile-mode
|
||||
:mode "Dockerfile\\'")
|
||||
|
||||
;; Docker Compose
|
||||
(use-package docker-compose-mode
|
||||
:mode "docker-compose.*\\.ya?ml\\'")
|
||||
|
||||
;; Restclient for API testing
|
||||
(use-package restclient
|
||||
:mode ("\\.http\\'" . restclient-mode))
|
||||
|
||||
;; SQL mode enhancements
|
||||
(use-package sql
|
||||
:ensure nil
|
||||
:config
|
||||
(setq sql-indent-offset 2))
|
||||
|
||||
;; Rainbow mode for color codes
|
||||
(use-package rainbow-mode
|
||||
:hook ((css-mode . rainbow-mode)
|
||||
(html-mode . rainbow-mode)
|
||||
(web-mode . rainbow-mode)))
|
||||
|
||||
;; EditorConfig support
|
||||
(use-package editorconfig
|
||||
:config
|
||||
(editorconfig-mode 1))
|
||||
|
||||
;; Whitespace cleanup
|
||||
(use-package whitespace-cleanup-mode
|
||||
:hook (prog-mode . whitespace-cleanup-mode))
|
||||
|
||||
;; Highlight TODO/FIXME/etc
|
||||
(use-package hl-todo
|
||||
:hook (prog-mode . hl-todo-mode)
|
||||
:config
|
||||
(setq hl-todo-highlight-punctuation ":"
|
||||
hl-todo-keyword-faces
|
||||
'(("TODO" . "#FF0000")
|
||||
("FIXME" . "#FF0000")
|
||||
("DEBUG" . "#A020F0")
|
||||
("GOTCHA" . "#FF4500")
|
||||
("STUB" . "#1E90FF"))))
|
||||
|
||||
;; Aggressive indentation
|
||||
(use-package aggressive-indent
|
||||
:hook ((emacs-lisp-mode . aggressive-indent-mode)
|
||||
(css-mode . aggressive-indent-mode)
|
||||
(lisp-mode . aggressive-indent-mode)))
|
||||
|
||||
;; Lisp-specific configuration
|
||||
(use-package lisp-mode
|
||||
:ensure nil
|
||||
:config
|
||||
(add-hook 'emacs-lisp-mode-hook
|
||||
(lambda ()
|
||||
(setq-local company-backends
|
||||
'((company-elisp company-dabbrev-code))))))
|
||||
|
||||
;; Python-specific enhancements
|
||||
(use-package python
|
||||
:ensure nil
|
||||
:config
|
||||
(setq python-shell-interpreter "python3"
|
||||
python-indent-guess-indent-offset-verbose nil))
|
||||
|
||||
;; JavaScript/Node.js
|
||||
(use-package js
|
||||
:ensure nil
|
||||
:config
|
||||
(setq js-indent-level 2))
|
||||
|
||||
;; Browse at remote (open files in GitHub/GitLab)
|
||||
(use-package browse-at-remote)
|
||||
|
||||
(provide 'module-programming)
|
||||
|
||||
;;; module-programming.el ends here
|
||||
97
modules/module-project.el
Normal file
97
modules/module-project.el
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
;;; module-project.el --- Project Management Configuration -*- lexical-binding: t -*-
|
||||
|
||||
;;; Commentary:
|
||||
;; Example module for project management with Projectile and related tools.
|
||||
;; To enable: uncomment (require 'module-project) in init.el
|
||||
|
||||
;;; Code:
|
||||
|
||||
;; Projectile - Project interaction library
|
||||
(use-package projectile
|
||||
:config
|
||||
(projectile-mode 1)
|
||||
(setq projectile-completion-system 'default
|
||||
projectile-switch-project-action #'projectile-dired
|
||||
projectile-project-search-path '("~/Projects/" "~/Storage/Projects/")
|
||||
projectile-sort-order 'recentf))
|
||||
|
||||
;; Consult-Projectile integration
|
||||
(use-package consult-projectile
|
||||
:after (consult projectile))
|
||||
|
||||
;; Treemacs - File tree sidebar
|
||||
(use-package treemacs
|
||||
:defer t
|
||||
:config
|
||||
(setq treemacs-width 30
|
||||
treemacs-show-cursor nil
|
||||
treemacs-show-hidden-files t
|
||||
treemacs-git-integration t
|
||||
treemacs-follow-after-init t
|
||||
treemacs-expand-after-init t
|
||||
treemacs-collapse-dirs 3))
|
||||
|
||||
;; Treemacs-Evil integration
|
||||
(use-package treemacs-evil
|
||||
:after (treemacs evil))
|
||||
|
||||
;; Treemacs-Projectile integration
|
||||
(use-package treemacs-projectile
|
||||
:after (treemacs projectile))
|
||||
|
||||
;; Treemacs icons
|
||||
(use-package treemacs-all-the-icons
|
||||
:if (display-graphic-p)
|
||||
:after (treemacs all-the-icons)
|
||||
:config
|
||||
(treemacs-load-theme "all-the-icons"))
|
||||
|
||||
;; Dired enhancements
|
||||
(use-package dired
|
||||
:ensure nil
|
||||
:config
|
||||
(setq dired-listing-switches "-alh --group-directories-first"
|
||||
dired-dwim-target t
|
||||
dired-recursive-copies 'always
|
||||
dired-recursive-deletes 'always)
|
||||
|
||||
;; Evil integration for dired
|
||||
(with-eval-after-load 'evil-collection
|
||||
(evil-collection-dired-setup)))
|
||||
|
||||
;; All the icons for dired
|
||||
(use-package all-the-icons-dired
|
||||
:if (display-graphic-p)
|
||||
:hook (dired-mode . all-the-icons-dired-mode))
|
||||
|
||||
;; Dired sidebar
|
||||
(use-package dired-sidebar
|
||||
:commands (dired-sidebar-toggle-sidebar)
|
||||
:config
|
||||
(setq dired-sidebar-width 30
|
||||
dired-sidebar-theme 'icons))
|
||||
|
||||
;; Recent files
|
||||
(use-package recentf
|
||||
:ensure nil
|
||||
:config
|
||||
(recentf-mode 1)
|
||||
(setq recentf-max-saved-items 200
|
||||
recentf-exclude '("/tmp/" "/ssh:" "/sudo:" "COMMIT_EDITMSG")))
|
||||
|
||||
;; Bookmarks enhancement
|
||||
(use-package bookmark
|
||||
:ensure nil
|
||||
:config
|
||||
(setq bookmark-save-flag 1))
|
||||
|
||||
;; Workspace management
|
||||
(use-package eyebrowse
|
||||
:config
|
||||
(eyebrowse-mode t)
|
||||
(setq eyebrowse-new-workspace t
|
||||
eyebrowse-wrap-around t))
|
||||
|
||||
(provide 'module-project)
|
||||
|
||||
;;; module-project.el ends here
|
||||
129
modules/module-terminal.el
Normal file
129
modules/module-terminal.el
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
;;; module-terminal.el --- Terminal Integration -*- lexical-binding: t -*-
|
||||
|
||||
;;; Commentary:
|
||||
;; Example module for terminal integration and shell configuration.
|
||||
;; To enable: uncomment (require 'module-terminal) in init.el
|
||||
|
||||
;;; Code:
|
||||
|
||||
;; VTerm - Better terminal emulator
|
||||
(use-package vterm
|
||||
:config
|
||||
(setq vterm-max-scrollback 10000
|
||||
vterm-buffer-name-string "vterm %s"
|
||||
vterm-kill-buffer-on-exit t))
|
||||
|
||||
;; Multi-VTerm - Multiple terminal management
|
||||
(use-package multi-vterm
|
||||
:after vterm
|
||||
:config
|
||||
(setq multi-vterm-dedicated-window-height-percent 30))
|
||||
|
||||
;; Shell Pop - Quick shell popup
|
||||
(use-package shell-pop
|
||||
:config
|
||||
(setq shell-pop-shell-type '("vterm" "*vterm*" (lambda () (vterm)))
|
||||
shell-pop-window-size 30
|
||||
shell-pop-window-position "bottom"))
|
||||
|
||||
;; EShell enhancements
|
||||
(use-package eshell
|
||||
:ensure nil
|
||||
:config
|
||||
(setq eshell-history-size 10000
|
||||
eshell-buffer-maximum-lines 10000
|
||||
eshell-hist-ignoredups t
|
||||
eshell-scroll-to-bottom-on-input t
|
||||
eshell-destroy-buffer-when-process-dies t
|
||||
eshell-visual-commands '("vi" "vim" "screen" "top" "less" "more" "lynx" "ncftp" "pine" "tin" "trn" "elm")))
|
||||
|
||||
;; EShell prompt
|
||||
(use-package eshell-prompt-extras
|
||||
:after eshell
|
||||
:config
|
||||
(with-eval-after-load "esh-opt"
|
||||
(autoload 'epe-theme-lambda "eshell-prompt-extras")
|
||||
(setq eshell-highlight-prompt nil
|
||||
eshell-prompt-function 'epe-theme-lambda)))
|
||||
|
||||
;; EShell syntax highlighting
|
||||
(use-package eshell-syntax-highlighting
|
||||
:after eshell
|
||||
:config
|
||||
(eshell-syntax-highlighting-global-mode 1))
|
||||
|
||||
;; EShell git prompt
|
||||
(use-package eshell-git-prompt
|
||||
:after eshell
|
||||
:config
|
||||
(eshell-git-prompt-use-theme 'powerline))
|
||||
|
||||
;; Fish completion in EShell
|
||||
(use-package fish-completion
|
||||
:hook (eshell-mode . fish-completion-mode)
|
||||
:config
|
||||
(when (executable-find "fish")
|
||||
(global-fish-completion-mode)))
|
||||
|
||||
;; TRAMP for remote editing
|
||||
(use-package tramp
|
||||
:ensure nil
|
||||
:config
|
||||
(setq tramp-default-method "ssh"
|
||||
tramp-copy-size-limit nil
|
||||
tramp-use-ssh-controlmaster-options nil)
|
||||
|
||||
;; Backup (file~) disabled and auto-save (#file#) disabled for TRAMP
|
||||
(add-to-list 'backup-directory-alist (cons tramp-file-name-regexp nil))
|
||||
(setq tramp-backup-directory-alist backup-directory-alist)
|
||||
(setq auto-save-file-name-transforms
|
||||
`((".*" ,(concat temporary-file-directory "tramp-auto-save/") t)))
|
||||
|
||||
;; Performance improvements
|
||||
(setq remote-file-name-inhibit-cache nil
|
||||
vc-ignore-dir-regexp (format "%s\\|%s" vc-ignore-dir-regexp tramp-file-name-regexp)
|
||||
tramp-verbose 1))
|
||||
|
||||
;; Docker TRAMP integration
|
||||
(use-package docker-tramp
|
||||
:after tramp)
|
||||
|
||||
;; Kubernetes TRAMP integration
|
||||
(use-package kubernetes-tramp
|
||||
:after tramp)
|
||||
|
||||
;; Compilation mode enhancements
|
||||
(use-package compile
|
||||
:ensure nil
|
||||
:config
|
||||
(setq compilation-scroll-output t
|
||||
compilation-window-height 15
|
||||
compilation-auto-jump-to-first-error t))
|
||||
|
||||
;; Ansi color in compilation mode
|
||||
(use-package ansi-color
|
||||
:ensure nil
|
||||
:hook (compilation-filter . ansi-color-compilation-filter))
|
||||
|
||||
;; Exec path from shell
|
||||
(use-package exec-path-from-shell
|
||||
:if (memq window-system '(mac ns x))
|
||||
:config
|
||||
(setq exec-path-from-shell-variables '("PATH" "MANPATH" "GOPATH" "GOROOT"))
|
||||
(exec-path-from-shell-initialize))
|
||||
|
||||
;; Environment variables
|
||||
(use-package direnv
|
||||
:config
|
||||
(direnv-mode))
|
||||
|
||||
;; Process management
|
||||
(use-package proced
|
||||
:ensure nil
|
||||
:config
|
||||
(setq proced-auto-update-flag t
|
||||
proced-auto-update-interval 1))
|
||||
|
||||
(provide 'module-terminal)
|
||||
|
||||
;;; module-terminal.el ends here
|
||||
424
modules/module-ui.el
Normal file
424
modules/module-ui.el
Normal file
|
|
@ -0,0 +1,424 @@
|
|||
;;; module-ui.el --- UI and Theme Configuration -*- lexical-binding: t -*-
|
||||
|
||||
;;; Commentary:
|
||||
;; Complete UI configuration with themes, modeline, and visual enhancements.
|
||||
;; This module is completely independent - comment it out in init.el to disable.
|
||||
|
||||
;;; ============================================================================
|
||||
;;; THEME CONFIGURATION
|
||||
;;; ============================================================================
|
||||
|
||||
;; Doom themes - Modern theme collection
|
||||
(use-package doom-themes
|
||||
:config
|
||||
(setq doom-themes-enable-bold t
|
||||
doom-themes-enable-italic t)
|
||||
;; Load default theme (change to your preference)
|
||||
(load-theme 'doom-one t)
|
||||
;; Enable flashing mode-line on errors
|
||||
(doom-themes-visual-bell-config)
|
||||
;; Corrects (and improves) org-mode's native fontification
|
||||
(doom-themes-org-config)
|
||||
;; Example: Alternative theme configurations
|
||||
;; Uncomment one of these to use a different theme:
|
||||
;; (load-theme 'doom-dracula t) ; Dracula theme
|
||||
;; (load-theme 'doom-gruvbox t) ; Gruvbox theme
|
||||
;; (load-theme 'doom-nord t) ; Nord theme
|
||||
;; (load-theme 'doom-solarized-dark t) ; Solarized dark
|
||||
;; (load-theme 'doom-monokai-pro t) ; Monokai Pro
|
||||
)
|
||||
|
||||
;; Example: Theme switching function
|
||||
(defun my/cycle-themes ()
|
||||
"Cycle through a list of favorite themes."
|
||||
(interactive)
|
||||
(let* ((themes '(doom-one doom-dracula doom-gruvbox doom-nord))
|
||||
(current-theme (car custom-enabled-themes))
|
||||
(current-index (cl-position current-theme themes))
|
||||
(next-theme (if (and current-index (< current-index (1- (length themes))))
|
||||
(nth (1+ current-index) themes)
|
||||
(car themes))))
|
||||
(disable-theme current-theme)
|
||||
(load-theme next-theme t)
|
||||
(message "Switched to theme: %s" next-theme)))
|
||||
|
||||
;;; ============================================================================
|
||||
;;; MODELINE CONFIGURATION
|
||||
;;; ============================================================================
|
||||
|
||||
;; Doom modeline - Enhanced modeline with icons
|
||||
(use-package doom-modeline
|
||||
:init (doom-modeline-mode 1)
|
||||
:config
|
||||
(setq doom-modeline-height 25
|
||||
doom-modeline-bar-width 2
|
||||
doom-modeline-icon t
|
||||
doom-modeline-major-mode-icon t
|
||||
doom-modeline-major-mode-color-icon t
|
||||
doom-modeline-buffer-file-name-style 'truncate-upto-project
|
||||
doom-modeline-buffer-state-icon t
|
||||
doom-modeline-buffer-modification-icon t
|
||||
doom-modeline-minor-modes nil
|
||||
doom-modeline-enable-word-count nil
|
||||
doom-modeline-buffer-encoding t
|
||||
doom-modeline-indent-info nil
|
||||
doom-modeline-checker-simple-format t
|
||||
doom-modeline-vcs-max-length 12
|
||||
doom-modeline-env-version t
|
||||
doom-modeline-irc-stylize 'identity
|
||||
doom-modeline-github-timer nil
|
||||
doom-modeline-gnus-timer nil)
|
||||
)
|
||||
;; Example: Custom modeline segments
|
||||
;; (setq doom-modeline-def-modeline 'my-simple-line
|
||||
;; '(bar matches buffer-info remote-host buffer-position parrot selection-info)
|
||||
;; '(misc-info minor-modes checker input-method buffer-encoding major-mode process vcs " ")))
|
||||
|
||||
;; All the icons - Icon fonts (required for doom-modeline)
|
||||
(use-package all-the-icons
|
||||
:if (display-graphic-p)
|
||||
:config
|
||||
;; Run `M-x all-the-icons-install-fonts` on first use
|
||||
(unless (find-font (font-spec :name "all-the-icons"))
|
||||
(all-the-icons-install-fonts t)))
|
||||
|
||||
;; Nerd icons - Alternative icon set
|
||||
(use-package nerd-icons
|
||||
:if (display-graphic-p))
|
||||
|
||||
;;; ============================================================================
|
||||
;;; DASHBOARD CONFIGURATION
|
||||
;;; ============================================================================
|
||||
|
||||
;; Dashboard - Startup screen
|
||||
(use-package dashboard
|
||||
:config
|
||||
(dashboard-setup-startup-hook)
|
||||
(setq dashboard-startup-banner 'logo
|
||||
dashboard-center-content t
|
||||
dashboard-banner-logo-title "Welcome to Nebula Emacs"
|
||||
dashboard-show-shortcuts nil
|
||||
dashboard-items '((recents . 8)
|
||||
(bookmarks . 5)
|
||||
(projects . 8)
|
||||
(agenda . 5))
|
||||
dashboard-set-heading-icons t
|
||||
dashboard-set-file-icons t
|
||||
dashboard-set-navigator t
|
||||
dashboard-navigator-buttons
|
||||
`(;; Line 1
|
||||
((,(all-the-icons-octicon "mark-github" :height 1.1 :v-adjust 0.0)
|
||||
"Homepage"
|
||||
"Browse homepage"
|
||||
(lambda (&rest _) (browse-url "https://github.com/user/nebula")))
|
||||
(,(all-the-icons-faicon "cog" :height 1.1 :v-adjust 0.0)
|
||||
"Settings"
|
||||
"Open settings"
|
||||
(lambda (&rest _) (find-file user-init-file)))
|
||||
(,(all-the-icons-material "update" :height 1.1 :v-adjust 0.0)
|
||||
"Update"
|
||||
"Update packages"
|
||||
(lambda (&rest _) (auto-package-update-now))))))
|
||||
|
||||
;; Example: Custom dashboard sections
|
||||
(defun my/dashboard-insert-custom ()
|
||||
"Insert custom content into dashboard."
|
||||
(insert "\n")
|
||||
(widget-create 'url-link
|
||||
:tag "Emacs Configuration Guide"
|
||||
:help-echo "Open configuration guide"
|
||||
"https://github.com/user/nebula/wiki")
|
||||
(insert "\n"))
|
||||
|
||||
;; Add custom section to dashboard
|
||||
(add-to-list 'dashboard-item-generators '(custom . my/dashboard-insert-custom))
|
||||
(add-to-list 'dashboard-items '(custom . t) t))
|
||||
|
||||
;;; ============================================================================
|
||||
;;; VISUAL ENHANCEMENTS
|
||||
;;; ============================================================================
|
||||
|
||||
;; Rainbow delimiters - Colorful parentheses
|
||||
(use-package rainbow-delimiters
|
||||
:hook (prog-mode . rainbow-delimiters-mode)
|
||||
:config
|
||||
;; Example: Custom rainbow delimiter colors
|
||||
(setq rainbow-delimiters-max-face-count 9))
|
||||
|
||||
;; Highlight matching parentheses
|
||||
(use-package paren
|
||||
:ensure nil
|
||||
:config
|
||||
(setq show-paren-delay 0.1
|
||||
show-paren-highlight-openparen t
|
||||
show-paren-when-point-inside-paren t
|
||||
show-paren-when-point-in-periphery t
|
||||
show-paren-style 'mixed)
|
||||
(show-paren-mode 1))
|
||||
|
||||
;; Line numbers configuration
|
||||
(use-package display-line-numbers
|
||||
:ensure nil
|
||||
:hook (prog-mode . display-line-numbers-mode)
|
||||
:config
|
||||
(setq display-line-numbers-type 'relative
|
||||
display-line-numbers-width-start t
|
||||
display-line-numbers-grow-only t)
|
||||
|
||||
;; Example: Disable line numbers in certain modes
|
||||
(dolist (mode '(org-mode-hook
|
||||
term-mode-hook
|
||||
shell-mode-hook
|
||||
eshell-mode-hook))
|
||||
(add-hook mode (lambda () (display-line-numbers-mode 0)))))
|
||||
|
||||
;; Highlight current line
|
||||
(use-package hl-line
|
||||
:ensure nil
|
||||
:config
|
||||
(global-hl-line-mode 1)
|
||||
(setq hl-line-sticky-flag nil))
|
||||
|
||||
;; Whitespace visualization
|
||||
(use-package whitespace
|
||||
:ensure nil
|
||||
:config
|
||||
(setq whitespace-line-column 100
|
||||
whitespace-style '(face tabs empty trailing lines-tail))
|
||||
|
||||
;; Enable in programming modes
|
||||
(add-hook 'prog-mode-hook #'whitespace-mode))
|
||||
|
||||
;; Indent guides
|
||||
(use-package indent-guide
|
||||
:hook (prog-mode . indent-guide-mode)
|
||||
:config
|
||||
(setq indent-guide-char "│"
|
||||
indent-guide-delay 0.1))
|
||||
|
||||
;; Highlight TODO/FIXME keywords
|
||||
(use-package hl-todo
|
||||
:hook (prog-mode . hl-todo-mode)
|
||||
:config
|
||||
(setq hl-todo-keyword-faces
|
||||
'(("TODO" . "#FF0000")
|
||||
("FIXME" . "#FF0000")
|
||||
("DEBUG" . "#A020F0")
|
||||
("GOTCHA" . "#FF4500")
|
||||
("STUB" . "#1E90FF")
|
||||
("NOTE" . "#32CD32")
|
||||
("HACK" . "#FF8C00"))))
|
||||
|
||||
;;; ============================================================================
|
||||
;;; FONT CONFIGURATION
|
||||
;;; ============================================================================
|
||||
|
||||
;; Font configuration (adjust to your system and preference)
|
||||
(when (display-graphic-p)
|
||||
;; Set default font
|
||||
(set-face-attribute 'default nil
|
||||
:font "JetBrains Mono" ; Change to your preferred font
|
||||
:height 110) ; Adjust size as needed
|
||||
;; Set variable pitch font (for modes like org-mode)
|
||||
(set-face-attribute 'variable-pitch nil
|
||||
:font "JetBrains Mono" ; Change to your preferred font
|
||||
:height 110)
|
||||
;; Set fixed pitch font
|
||||
(set-face-attribute 'fixed-pitch nil
|
||||
:font "JetBrains Mono"
|
||||
:height 110)
|
||||
;; Example: Alternative font configurations
|
||||
;; Uncomment and adjust as needed:
|
||||
;; (set-face-attribute 'default nil :font "Fira Code" :height 100)
|
||||
;; (set-face-attribute 'default nil :font "Source Code Pro" :height 105)
|
||||
;; (set-face-attribute 'default nil :font "Cascadia Code" :height 105))
|
||||
)
|
||||
;; Ligatures support (if your font supports it)
|
||||
(use-package ligature
|
||||
:config
|
||||
;; Enable ligatures in programming modes
|
||||
(ligature-set-ligatures 'prog-mode
|
||||
'("&&" "||" "==" "!=" "<=" ">=" "<<" ">>" "++" "--"
|
||||
"=>" "->" "<-" "|>" "<|" "!!" "??" "::" "..."
|
||||
"===" "!==" "<=>" "->>" "<<-" "<?>" "</>"
|
||||
"<$>" "<*>" "<+>" "<>" "***"))
|
||||
(global-ligature-mode t))
|
||||
|
||||
;;; ============================================================================
|
||||
;;; WINDOW MANAGEMENT
|
||||
;;; ============================================================================
|
||||
|
||||
;; Winner mode - Undo/redo window configurations
|
||||
(use-package winner
|
||||
:ensure nil
|
||||
:config
|
||||
(winner-mode 1)
|
||||
(setq winner-boring-buffers
|
||||
'("*Completions*"
|
||||
"*Compile-Log*"
|
||||
"*inferior-lisp*"
|
||||
"*Fuzzy Completions*"
|
||||
"*Apropos*"
|
||||
"*Help*"
|
||||
"*cvs*"
|
||||
"*Buffer List*"
|
||||
"*Ibuffer*")))
|
||||
|
||||
;; Windmove - Move between windows with shift+arrows
|
||||
(use-package windmove
|
||||
:ensure nil
|
||||
:config)
|
||||
|
||||
;; Example: Advanced window management with ace-window
|
||||
(use-package ace-window
|
||||
:config
|
||||
(setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l)
|
||||
aw-scope 'frame
|
||||
aw-background t))
|
||||
|
||||
;;; ============================================================================
|
||||
;;; SCROLLING AND NAVIGATION
|
||||
;;; ============================================================================
|
||||
|
||||
;; Better scrolling behavior
|
||||
(setq scroll-margin 3
|
||||
scroll-conservatively 101
|
||||
scroll-up-aggressively 0.01
|
||||
scroll-down-aggressively 0.01
|
||||
auto-window-vscroll nil
|
||||
fast-but-imprecise-scrolling t
|
||||
mouse-wheel-scroll-amount '(1 ((shift) . 1))
|
||||
mouse-wheel-progressive-speed nil
|
||||
hscroll-margin 2
|
||||
hscroll-step 1)
|
||||
|
||||
;; Smooth scrolling
|
||||
(use-package smooth-scrolling
|
||||
:config
|
||||
(smooth-scrolling-mode 1)
|
||||
(setq smooth-scroll-margin 3))
|
||||
|
||||
;;; ============================================================================
|
||||
;;; MISC UI IMPROVEMENTS
|
||||
;;; ============================================================================
|
||||
|
||||
;; Better help buffers
|
||||
(use-package helpful)
|
||||
|
||||
;; Popup rules for better buffer management
|
||||
(use-package popper
|
||||
:init
|
||||
(setq popper-reference-buffers
|
||||
'("\\*Messages\\*"
|
||||
"Output\\*$"
|
||||
"\\*Async Shell Command\\*"
|
||||
help-mode
|
||||
compilation-mode))
|
||||
(popper-mode +1)
|
||||
(popper-echo-mode +1))
|
||||
|
||||
;; Example: Custom UI toggles
|
||||
(defun my/toggle-transparency ()
|
||||
"Toggle frame transparency."
|
||||
(interactive)
|
||||
(let ((alpha (frame-parameter nil 'alpha)))
|
||||
(set-frame-parameter nil 'alpha
|
||||
(if (or (not alpha) (= alpha 100))
|
||||
'(90 . 90)
|
||||
'(100 . 100)))))
|
||||
|
||||
;; Example: Custom modeline indicator
|
||||
(defvar my/modeline-indicator ""
|
||||
"Custom modeline indicator.")
|
||||
|
||||
(defun my/update-modeline-indicator ()
|
||||
"Update custom modeline indicator."
|
||||
(setq my/modeline-indicator
|
||||
(if (and (fboundp 'projectile-project-p)
|
||||
(projectile-project-p))
|
||||
" [P]"
|
||||
"")))
|
||||
|
||||
;; Add to modeline (example)
|
||||
;; (add-to-list 'mode-line-format 'my/modeline-indicator t)
|
||||
|
||||
;; Sensible defaults for tabs/width (can be overridden per-project via .editorconfig or .dir-locals.el)
|
||||
(setq-default indent-tabs-mode nil ;; use spaces by default; set to t if you prefer tabs
|
||||
tab-width 4)
|
||||
|
||||
;; Respect .editorconfig files to match project conventions
|
||||
(use-package editorconfig
|
||||
:ensure t
|
||||
:config
|
||||
(editorconfig-mode 1))
|
||||
|
||||
;; Try to detect indentation from file contents when opening files
|
||||
(use-package dtrt-indent
|
||||
:ensure t
|
||||
:hook (prog-mode . dtrt-indent-mode)
|
||||
:config
|
||||
(setq dtrt-indent-verbosity 0))
|
||||
|
||||
;; Enable visual line wrapping in text modes
|
||||
(add-hook 'text-mode-hook 'visual-line-mode)
|
||||
|
||||
;; Disable menu bar, tool bar, and scroll bar for a cleaner UI
|
||||
(when (fboundp 'menu-bar-mode) (menu-bar-mode -1))
|
||||
(when (fboundp 'tool-bar-mode) (tool-bar-mode -1))
|
||||
(when (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))
|
||||
|
||||
;; Which-key - Display possible keybindings in popup
|
||||
(use-package which-key)
|
||||
:config
|
||||
(which-key-mode)
|
||||
(setq which-key-idle-delay 0.3)
|
||||
|
||||
;; Command history enhancement
|
||||
|
||||
(use-package savehist
|
||||
:ensure nil
|
||||
:config
|
||||
(savehist-mode 1)
|
||||
(setq savehist-additional-variables
|
||||
'(search-ring
|
||||
regexp-search-ring
|
||||
extended-command-history))
|
||||
(setq history-length 1000))
|
||||
|
||||
;; Better minibuffer
|
||||
|
||||
(use-package vertico
|
||||
:init
|
||||
(vertico-mode)
|
||||
:config
|
||||
(setq vertico-cycle t)
|
||||
(setq vertico-count 15)
|
||||
(setq vertico-resize nil))
|
||||
(use-package orderless
|
||||
:init
|
||||
(setq completion-styles '(orderless basic)
|
||||
completion-category-defaults nil
|
||||
completion-category-overrides '((file (styles partial-completion)))))
|
||||
(use-package marginalia
|
||||
:after vertico
|
||||
:init
|
||||
(marginalia-mode 1))
|
||||
(use-package consult
|
||||
:after vertico
|
||||
:config
|
||||
(setq completion-in-region-function #'consult-completion-in-region))
|
||||
|
||||
;; Enable the very important nyan mode, animated by default
|
||||
(use-package nyan-mode
|
||||
:config
|
||||
(nyan-mode 1)
|
||||
(setq nyan-wavy-trail t)
|
||||
(setq nyan-animation-frame-interval 0.1)
|
||||
(setf nyan-animate-nyancat t)
|
||||
(setf nyan-animate-nyancat-when-idle t))
|
||||
|
||||
(nyan-start-animation)
|
||||
|
||||
(provide 'module-ui)
|
||||
|
||||
;;; module-ui.el ends here
|
||||
Loading…
Add table
Add a link
Reference in a new issue