Reorganize and enhance configuration with org-mode
Convert init.el to a literate configuration using org-mode. Major changes include: - Add Basic Settings section for file management and auto-revert - Enhance Project Management with layout templates and compilation - Add LSP key bindings with documentation - Add Org Mode configuration with Org Roam setup - Improve completion framework with savehist - Add LaTeX configuration - Better organize and document all sections The new org-mode structure provides better organization and documentation while maintaining all existing functionality.
This commit is contained in:
parent
4bba7122f3
commit
1d4c5a3e1a
1 changed files with 583 additions and 105 deletions
688
config.org
688
config.org
|
|
@ -180,6 +180,16 @@ Remove unnecessary UI elements and set basic preferences.
|
|||
(load custom-file 'noerror 'nomessage)
|
||||
#+end_src
|
||||
|
||||
* Basic Settings
|
||||
** File Management
|
||||
Configure how Emacs handles file changes and buffer updates.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
;; Auto-revert settings
|
||||
(global-auto-revert-mode 1) ; Auto-refresh buffers when files change
|
||||
(setq global-auto-revert-non-file-buffers t) ; Also auto-refresh dired and other buffers
|
||||
(setq auto-revert-verbose nil) ; Don't show message when reverting buffers
|
||||
#+end_src
|
||||
* Package Management
|
||||
Configure package archives and initialize use-package.
|
||||
|
||||
|
|
@ -236,71 +246,296 @@ Configure the visual appearance of Emacs.
|
|||
Vim keybindings for Emacs.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package evil
|
||||
:init
|
||||
(setq evil-want-integration t
|
||||
evil-want-keybinding nil)
|
||||
:config
|
||||
(evil-mode 1))
|
||||
(use-package evil
|
||||
:init
|
||||
(setq evil-want-integration t
|
||||
evil-want-keybinding nil)
|
||||
:config
|
||||
(evil-mode 1))
|
||||
|
||||
(use-package evil-collection
|
||||
:after evil
|
||||
:config
|
||||
(evil-collection-init))
|
||||
(use-package evil-collection
|
||||
:after evil
|
||||
:config
|
||||
(evil-collection-init))
|
||||
|
||||
; Make ESC quit prompts
|
||||
(global-set-key (kbd "<escape>") 'keyboard-escape-quit)
|
||||
#+end_src
|
||||
|
||||
* Completion Framework
|
||||
Configure Vertico, Orderless, and Marginalia for enhanced completion.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package vertico
|
||||
:bind (:map vertico-map
|
||||
("C-j" . vertico-next)
|
||||
("C-k" . vertico-previous)
|
||||
("C-f" . vertico-exit)
|
||||
:map minibuffer-local-map
|
||||
("M-h" . backward-kill-word))
|
||||
:custom
|
||||
(vertico-cycle t)
|
||||
:init
|
||||
(vertico-mode))
|
||||
(use-package vertico
|
||||
:ensure t
|
||||
:bind (:map vertico-map
|
||||
("C-j" . vertico-next)
|
||||
("C-k" . vertico-previous)
|
||||
("C-f" . vertico-exit)
|
||||
:map minibuffer-local-map
|
||||
("M-h" . backward-kill-word))
|
||||
:custom
|
||||
(vertico-cycle t)
|
||||
:init
|
||||
(vertico-mode))
|
||||
|
||||
(use-package orderless
|
||||
:custom
|
||||
(completion-styles '(orderless basic))
|
||||
(completion-category-overrides '((file (styles basic partial-completion)))))
|
||||
(use-package consult
|
||||
:ensure t)
|
||||
|
||||
(use-package marginalia
|
||||
:after vertico
|
||||
:custom
|
||||
(marginalia-annotators '(marginalia-annotators-heavy marginalia-annotators-light nil))
|
||||
:init
|
||||
(marginalia-mode))
|
||||
(use-package orderless
|
||||
:custom
|
||||
(completion-styles '(orderless basic))
|
||||
(completion-category-overrides '((file (styles basic partial-completion)))))
|
||||
|
||||
(use-package marginalia
|
||||
:after vertico
|
||||
:custom
|
||||
(marginalia-annotators '(marginalia-annotators-heavy marginalia-annotators-light nil))
|
||||
:init
|
||||
(marginalia-mode))
|
||||
#+end_src
|
||||
|
||||
#+RESULTS:
|
||||
** Minibuffer History
|
||||
Preserve command, search, and input history between sessions.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package savehist
|
||||
:init
|
||||
(savehist-mode)
|
||||
:custom
|
||||
(savehist-file (expand-file-name "savehist" user-emacs-directory))
|
||||
(savehist-additional-variables '(search-ring ; Search history
|
||||
regexp-search-ring ; Regexp search history
|
||||
extended-command-history ; M-x history
|
||||
kill-ring ; Kill ring history
|
||||
compile-command ; Compilation commands
|
||||
log-edit-comment-ring)) ; VCS commit messages
|
||||
(savehist-autosave-interval 60) ; Save every minute
|
||||
(history-length 1000) ; Store more history
|
||||
(history-delete-duplicates t)) ; Remove duplicates
|
||||
#+end_src
|
||||
* Project Management
|
||||
Projectile configuration for project management.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package projectile
|
||||
:diminish projectile-mode
|
||||
:bind
|
||||
("C-M-p" . projectile-find-file)
|
||||
:bind-keymap
|
||||
("C-c p" . projectile-command-map)
|
||||
:init
|
||||
(setq projectile-project-search-path '("~/Code/git.dwavesys.local/"
|
||||
"~/Code/nikolaishields/"
|
||||
"~/.emacs.d/"
|
||||
"/etc/nixos")
|
||||
projectile-auto-discover t
|
||||
projectile-enable-caching t
|
||||
projectile-indexing-method 'alien)
|
||||
:config
|
||||
(projectile-mode)
|
||||
(run-with-idle-timer 10 t #'projectile-discover-projects-in-search-path))
|
||||
(use-package consult-projectile
|
||||
:ensure t)
|
||||
|
||||
(use-package projectile
|
||||
:diminish projectile-mode
|
||||
:bind
|
||||
("C-M-p" . projectile-find-file)
|
||||
:bind-keymap
|
||||
("C-c p" . projectile-command-map)
|
||||
:init
|
||||
(setq projectile-project-search-path '("~/Code/git.dwavesys.local/"
|
||||
"~/Code/nikolaishields/"
|
||||
"~/.emacs.d/"
|
||||
"/etc/nixos")
|
||||
projectile-auto-discover t
|
||||
projectile-enable-caching t
|
||||
projectile-indexing-method 'alien)
|
||||
:config
|
||||
(projectile-mode)
|
||||
(run-with-idle-timer 10 t #'projectile-discover-projects-in-search-path))
|
||||
#+end_src
|
||||
|
||||
** Project Layout Templates
|
||||
Configure automatic window and buffer layouts for projects.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
;; Default layout configuration
|
||||
(defun default-project-layout ()
|
||||
"Set up the default window layout for any project.
|
||||
Creates a three-window layout:
|
||||
- Main editing window
|
||||
- Terminal (vterm)
|
||||
- Dired for file management"
|
||||
(delete-other-windows) ; Clear current layout
|
||||
(split-window-below) ; Create horizontal split
|
||||
(other-window 1) ; Move to new window
|
||||
(projectile-run-vterm) ; Start terminal
|
||||
(other-window 1) ; Move to next window
|
||||
(dired (projectile-project-root)) ; Open project root in dired
|
||||
(other-window -2)) ; Return to main window
|
||||
|
||||
;; Universal project setup
|
||||
(defun my-universal-project-setup ()
|
||||
"Set up project-specific layout and settings.
|
||||
Called automatically when switching projects."
|
||||
(default-project-layout))
|
||||
|
||||
;; Apply layout when switching projects
|
||||
(add-hook 'projectile-after-switch-project-hook 'my-universal-project-setup)
|
||||
#+end_src
|
||||
|
||||
** Additional Layout Templates
|
||||
Alternative layout templates for different project types.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(defun dev-project-layout ()
|
||||
"Development-focused project layout.
|
||||
Includes main editor, terminal, and test runner."
|
||||
(delete-other-windows)
|
||||
(split-window-right) ; Vertical split for code/tests
|
||||
(other-window 1)
|
||||
(split-window-below) ; Horizontal split for terminal
|
||||
(other-window 1)
|
||||
(projectile-run-vterm)
|
||||
(other-window -2))
|
||||
|
||||
(defun docs-project-layout ()
|
||||
"Documentation project layout.
|
||||
Includes editor, preview, and file browser."
|
||||
(delete-other-windows)
|
||||
(split-window-right) ; Vertical split for editing/preview
|
||||
(other-window 1)
|
||||
(split-window-below) ; Horizontal split for files
|
||||
(other-window 1)
|
||||
(dired (projectile-project-root))
|
||||
(other-window -2))
|
||||
|
||||
;; Project type specific setups
|
||||
(defun project-type-setup ()
|
||||
"Apply different layouts based on project type."
|
||||
(cond
|
||||
;; Documentation projects
|
||||
((file-exists-p (expand-file-name "docs" (projectile-project-root)))
|
||||
(docs-project-layout))
|
||||
;; Development projects
|
||||
((file-exists-p (expand-file-name "src" (projectile-project-root)))
|
||||
(dev-project-layout))
|
||||
;; Default for all other projects
|
||||
(t (default-project-layout))))
|
||||
|
||||
;; Optional: Replace universal setup with type-specific setup
|
||||
;; (add-hook 'projectile-after-switch-project-hook 'project-type-setup)
|
||||
#+end_src
|
||||
|
||||
** Layout Utilities
|
||||
Helper functions for managing project layouts.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(defun save-window-layout ()
|
||||
"Save current window layout for the project."
|
||||
(interactive)
|
||||
(window-configuration-to-register
|
||||
(intern (concat ":" (projectile-project-name)))))
|
||||
|
||||
(defun restore-window-layout ()
|
||||
"Restore saved window layout for the project."
|
||||
(interactive)
|
||||
(jump-to-register
|
||||
(intern (concat ":" (projectile-project-name)))))
|
||||
|
||||
;; Bind layout commands
|
||||
(define-key projectile-mode-map (kbd "C-c p L s") 'save-window-layout)
|
||||
(define-key projectile-mode-map (kbd "C-c p L r") 'restore-window-layout)
|
||||
#+end_src
|
||||
|
||||
** Project Compilation
|
||||
Configure project compilation settings and shortcuts.
|
||||
|
||||
*** Basic Compilation Setup
|
||||
Set up silent compilation and basic key bindings.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
;; Silent compilation function
|
||||
(defun my-projectile-compile-project-silently ()
|
||||
"Compile the project using the preset command without prompting.
|
||||
Uses the project's default compilation command as specified in
|
||||
.dir-locals.el or projectile's default command for the project type."
|
||||
(interactive)
|
||||
(let ((compilation-read-command nil)) ;; Prevent prompt
|
||||
(projectile-compile-project nil)))
|
||||
|
||||
;; Bind to key
|
||||
(define-key projectile-mode-map (kbd "C-c m") 'my-projectile-compile-project-silently)
|
||||
#+end_src
|
||||
|
||||
*** Enhanced Compilation Features
|
||||
Additional compilation utilities and settings.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
;; Compilation window settings
|
||||
(setq compilation-window-height 15) ; Set compilation window height
|
||||
(setq compilation-scroll-output t) ; Auto-scroll compilation buffer
|
||||
|
||||
;; Auto-close compilation window if successful
|
||||
(defun my-compilation-exit-function (status code msg)
|
||||
"Close the compilation window if compilation was successful."
|
||||
(when (and (eq status 'exit) (zerop code))
|
||||
(let ((window (get-buffer-window "*compilation*")))
|
||||
(when window
|
||||
(quit-window nil window)))))
|
||||
|
||||
(add-hook 'compilation-finish-functions #'my-compilation-exit-function)
|
||||
|
||||
;; Colorize compilation buffer
|
||||
(require 'ansi-color)
|
||||
(defun my-colorize-compilation-buffer ()
|
||||
"Colorize compilation buffer output."
|
||||
(let ((inhibit-read-only t))
|
||||
(ansi-color-apply-on-region compilation-filter-start (point))))
|
||||
|
||||
(add-hook 'compilation-filter-hook #'my-colorize-compilation-buffer)
|
||||
|
||||
;; Save all buffers before compiling
|
||||
(setq compilation-ask-about-save nil)
|
||||
(setq compilation-save-buffers-predicate 'save-some-buffers)
|
||||
#+end_src
|
||||
|
||||
*** Project-Specific Compilation
|
||||
Configure different compilation commands for different project types.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(defun my-project-compilation-command ()
|
||||
"Return the appropriate compilation command based on project type."
|
||||
(cond
|
||||
;; Make-based projects
|
||||
((file-exists-p (expand-file-name "Makefile" (projectile-project-root)))
|
||||
"make")
|
||||
;; Node.js projects
|
||||
((file-exists-p (expand-file-name "package.json" (projectile-project-root)))
|
||||
"npm run build")
|
||||
;; Python projects
|
||||
((file-exists-p (expand-file-name "setup.py" (projectile-project-root)))
|
||||
"python setup.py build")
|
||||
;; Default
|
||||
(t projectile-project-compilation-cmd)))
|
||||
|
||||
;; Function to compile with specific command
|
||||
(defun my-projectile-compile-with-command ()
|
||||
"Compile project with a specific command based on project type."
|
||||
(interactive)
|
||||
(let ((compilation-command (my-project-compilation-command)))
|
||||
(projectile-compile-project compilation-command)))
|
||||
|
||||
;; Bind alternative compilation command
|
||||
(define-key projectile-mode-map (kbd "C-c M") 'my-projectile-compile-with-command)
|
||||
#+end_src
|
||||
|
||||
*** Compilation Notifications
|
||||
Add desktop notifications for compilation results.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(defun my-compilation-notify (buffer msg)
|
||||
"Send a desktop notification when compilation is done."
|
||||
(if (string-match "^finished" msg)
|
||||
(notifications-notify
|
||||
:title "Compilation Finished"
|
||||
:body "Project compilation completed successfully!"
|
||||
:timeout 5000
|
||||
:urgency 'normal)
|
||||
(notifications-notify
|
||||
:title "Compilation Failed"
|
||||
:body "There were errors in compilation."
|
||||
:timeout 5000
|
||||
:urgency 'critical)))
|
||||
|
||||
(add-hook 'compilation-finish-functions #'my-compilation-notify)
|
||||
#+end_src
|
||||
* LSP Configuration
|
||||
Language Server Protocol setup for development.
|
||||
|
||||
|
|
@ -338,30 +573,215 @@ Language Server Protocol setup for development.
|
|||
(lsp-ui-sideline-show-hover t)
|
||||
(lsp-ui-sideline-show-code-actions t))
|
||||
#+end_src
|
||||
*** LSP Key Bindings
|
||||
Configure key bindings for common Language Server Protocol operations.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(with-eval-after-load 'lsp-mode
|
||||
;; Navigation
|
||||
(define-key lsp-mode-map (kbd "C-c l d") 'lsp-find-definition) ; Go to definition
|
||||
(define-key lsp-mode-map (kbd "C-c l r") 'lsp-find-references) ; Find references
|
||||
(define-key lsp-mode-map (kbd "C-c l s") 'lsp-find-implementation) ; Find implementations
|
||||
|
||||
;; Code actions and documentation
|
||||
(define-key lsp-mode-map (kbd "C-c l h") 'lsp-describe-thing-at-point) ; Show documentation
|
||||
(define-key lsp-mode-map (kbd "C-c l a") 'lsp-execute-code-action) ; Show available actions
|
||||
|
||||
;; Refactoring
|
||||
(define-key lsp-mode-map (kbd "C-c l R") 'lsp-rename) ; Rename symbol
|
||||
(define-key lsp-mode-map (kbd "C-c l f") 'lsp-format-buffer)) ; Format buffer
|
||||
#+end_src
|
||||
|
||||
**** Key Binding Quick Reference
|
||||
| Key | Command | Description |
|
||||
|-------------+--------------------------------+-------------------------------------------|
|
||||
| ~C-c l d~ | lsp-find-definition | Jump to definition of symbol at point |
|
||||
| ~C-c l r~ | lsp-find-references | Find all references to symbol |
|
||||
| ~C-c l s~ | lsp-find-implementation | Find implementations of interface/class |
|
||||
| ~C-c l h~ | lsp-describe-thing-at-point | Show documentation for symbol at point |
|
||||
| ~C-c l a~ | lsp-execute-code-action | Show and execute code actions |
|
||||
| ~C-c l R~ | lsp-rename | Rename symbol across project |
|
||||
| ~C-c l f~ | lsp-format-buffer | Format current buffer |
|
||||
|
||||
**** Additional Useful Bindings
|
||||
You might also want to add these common LSP operations:
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(with-eval-after-load 'lsp-mode
|
||||
;; Workspace operations
|
||||
(define-key lsp-mode-map (kbd "C-c l w r") 'lsp-workspace-restart) ; Restart LSP server
|
||||
(define-key lsp-mode-map (kbd "C-c l w q") 'lsp-workspace-shutdown) ; Shutdown LSP server
|
||||
|
||||
;; Additional navigation
|
||||
(define-key lsp-mode-map (kbd "C-c l t") 'lsp-find-type-definition) ; Find type definition
|
||||
(define-key lsp-mode-map (kbd "C-c l g") 'lsp-find-declaration) ; Find declaration
|
||||
|
||||
;; Misc
|
||||
(define-key lsp-mode-map (kbd "C-c l i") 'lsp-organize-imports) ; Organize imports
|
||||
(define-key lsp-mode-map (kbd "C-c l l") 'lsp-lens-mode)) ; Toggle code lens
|
||||
#+end_src
|
||||
|
||||
**** IDE-like Key Bindings
|
||||
For those preferring more traditional IDE-like bindings:
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
;; Optional: More familiar IDE-like bindings
|
||||
(with-eval-after-load 'lsp-mode
|
||||
;; Common IDE bindings (disabled by default - uncomment to use)
|
||||
;; (define-key lsp-mode-map (kbd "M-.") 'lsp-find-definition) ; Go to definition
|
||||
;; (define-key lsp-mode-map (kbd "M-?") 'lsp-find-references) ; Find references
|
||||
;; (define-key lsp-mode-map (kbd "M-RET") 'lsp-execute-code-action) ; Show code actions
|
||||
)
|
||||
#+end_src
|
||||
|
||||
* Development Tools
|
||||
Configure completion, snippets, and syntax checking.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package company
|
||||
:hook (lsp-mode . company-mode)
|
||||
(use-package company
|
||||
:hook (lsp-mode . company-mode)
|
||||
:custom
|
||||
(company-minimum-prefix-length 1)
|
||||
(company-idle-delay 0.0))
|
||||
|
||||
(use-package company-box
|
||||
:hook (company-mode . company-box-mode))
|
||||
|
||||
(use-package yasnippet
|
||||
:config
|
||||
(yas-global-mode 1))
|
||||
|
||||
(use-package yasnippet-snippets
|
||||
:after yasnippet)
|
||||
|
||||
(use-package flycheck
|
||||
:init
|
||||
(global-flycheck-mode))
|
||||
(use-package which-key
|
||||
:init
|
||||
(which-key-mode)
|
||||
:diminish which-key-mode
|
||||
:custom
|
||||
(which-key-idle-delay 0.2)
|
||||
(which-key-popup-type 'side-window)
|
||||
(which-key-side-window-location 'bottom)
|
||||
(which-key-sort-order 'which-key-key-order)
|
||||
:config
|
||||
;; Make sure this is a proper alist
|
||||
(setq which-key-replacement-alist
|
||||
'(((nil . "prefix") . ("" . "prefix")) ;; Correct format
|
||||
((nil . "left") . ("" . "←"))
|
||||
((nil . "right") . ("" . "→")))))
|
||||
|
||||
;; Command Log Mode for debugging/demonstrations
|
||||
(use-package command-log-mode
|
||||
:commands command-log-mode)
|
||||
#+end_src
|
||||
|
||||
#+RESULTS:
|
||||
: t
|
||||
* Org Mode Configuration
|
||||
Configure Org Mode and Org Roam for note-taking and task management.
|
||||
|
||||
** Basic Org Settings
|
||||
Set up fundamental Org mode configurations.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
;; Task management
|
||||
(setq org-todo-keywords
|
||||
'((sequence "TODO" "IN-PROGRESS" "BLOCKED" "DONE")))
|
||||
|
||||
;; Tags configuration
|
||||
(setq org-tag-alist '(("work") ("garage")))
|
||||
|
||||
;; Agenda configuration
|
||||
(setq org-agenda-files '("~/Documents/notes/daily/"))
|
||||
#+end_src
|
||||
|
||||
** Org Roam
|
||||
Configure Org Roam for note-taking and personal knowledge management.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package org-roam
|
||||
:ensure t
|
||||
:custom
|
||||
(company-minimum-prefix-length 1)
|
||||
(company-idle-delay 0.0))
|
||||
;; Set up directories
|
||||
(org-roam-directory (file-truename "~/Documents/notes"))
|
||||
(org-roam-dailies-directory (file-truename "~/Documents/notes/daily"))
|
||||
(org-roam-completion-everywhere t)
|
||||
|
||||
;; Configure daily note templates
|
||||
(org-roam-dailies-capture-templates
|
||||
'(("d" "default" entry "* %<%I:%M %p>: %?"
|
||||
:if-new (file+head "%<%Y-%m-%d>.org" "#+title: %<%Y-%m-%d>\n"))))
|
||||
|
||||
(use-package company-box
|
||||
:hook (company-mode . company-box-mode))
|
||||
:bind
|
||||
;; Main Org Roam bindings
|
||||
(("C-c n l" . org-roam-buffer-toggle)
|
||||
("C-c n f" . org-roam-node-find)
|
||||
("C-c n i" . org-roam-node-insert)
|
||||
|
||||
;; Org mode specific bindings
|
||||
:map org-mode-map
|
||||
("C-M-i" . completion-at-point)
|
||||
|
||||
;; Dailies bindings
|
||||
:map org-roam-dailies-map
|
||||
("Y" . org-roam-dailies-capture-yesterday)
|
||||
("T" . org-roam-dailies-capture-tomorrow))
|
||||
|
||||
:bind-keymap
|
||||
("C-c n d" . org-roam-dailies-map)
|
||||
|
||||
(use-package yasnippet
|
||||
:config
|
||||
(yas-global-mode 1))
|
||||
;; Load dailies module
|
||||
(require 'org-roam-dailies)
|
||||
|
||||
;; Enable auto-sync
|
||||
(org-roam-db-autosync-mode))
|
||||
|
||||
(use-package yasnippet-snippets
|
||||
:after yasnippet)
|
||||
;; Ensure auto-sync is enabled globally
|
||||
(org-roam-db-autosync-mode)
|
||||
#+end_src
|
||||
|
||||
(use-package flycheck
|
||||
:init
|
||||
(global-flycheck-mode))
|
||||
#+RESULTS:
|
||||
: t
|
||||
|
||||
** Utility Functions
|
||||
Custom functions to enhance Org Roam functionality.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(defun org-roam-node-insert-immediate (arg &rest args)
|
||||
"Insert a node immediately without the capture process.
|
||||
ARG and ARGS are passed to `org-roam-node-insert'."
|
||||
(interactive "P")
|
||||
(let ((args (cons arg args))
|
||||
(org-roam-capture-templates (list (append (car org-roam-capture-templates)
|
||||
'(:immediate-finish t)))))
|
||||
(apply #'org-roam-node-insert args)))
|
||||
|
||||
;; Bind the immediate insert function
|
||||
(global-set-key (kbd "C-c n I") #'org-roam-node-insert-immediate)
|
||||
#+end_src
|
||||
|
||||
** Additional Org Settings
|
||||
Optional but useful Org mode configurations.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
;; Visual settings
|
||||
(setq org-hide-emphasis-markers t) ; Hide markup symbols
|
||||
(setq org-pretty-entities t) ; Show UTF8 characters
|
||||
|
||||
;; Behavior settings
|
||||
(setq org-return-follows-link t) ; Return follows links
|
||||
(setq org-startup-folded 'show2levels) ; Start with some levels shown
|
||||
|
||||
;; Capture templates
|
||||
(setq org-capture-templates
|
||||
'(("t" "Todo" entry (file+headline "~/Documents/notes/tasks.org" "Tasks")
|
||||
"* TODO %?\n %i\n %a")
|
||||
("n" "Note" entry (file+datetree "~/Documents/notes/notes.org")
|
||||
"* %?\nEntered on %U\n %i\n %a")))
|
||||
#+end_src
|
||||
|
||||
* Version Control
|
||||
|
|
@ -384,60 +804,118 @@ Magit configuration for Git integration.
|
|||
Configure VTerm for terminal emulation.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package vterm
|
||||
:commands vterm
|
||||
:custom
|
||||
(term-prompt-regexp "^[^#$%>\n]*[#$%>] *")
|
||||
(vterm-max-scrollback 10000))
|
||||
(use-package vterm
|
||||
:commands vterm
|
||||
:custom
|
||||
(term-prompt-regexp "^[^#$%>\n]*[#$%>] *")
|
||||
(vterm-max-scrollback 10000))
|
||||
|
||||
(use-package multi-vterm
|
||||
:after vterm
|
||||
:config
|
||||
(add-hook 'vterm-mode-hook
|
||||
(lambda ()
|
||||
(setq-local evil-insert-state-cursor 'box)
|
||||
(evil-insert-state))))
|
||||
|
||||
(use-package multi-vterm :ensure t)
|
||||
(use-package multi-vterm
|
||||
:after vterm
|
||||
:config
|
||||
(add-hook 'vterm-mode-hook
|
||||
(lambda ()
|
||||
(setq-local evil-insert-state-cursor 'box)
|
||||
(evil-insert-state))))
|
||||
:ensure t
|
||||
:config
|
||||
(add-hook 'vterm-mode-hook
|
||||
(lambda ()
|
||||
(setq-local evil-insert-state-cursor 'box)
|
||||
(evil-insert-state)))
|
||||
(define-key vterm-mode-map [return] #'vterm-send-return)
|
||||
(setq vterm-keymap-exceptions nil)
|
||||
(evil-define-key 'insert vterm-mode-map (kbd "C-e") #'vterm--self-insert)
|
||||
(evil-define-key 'insert vterm-mode-map (kbd "C-f") #'vterm--self-insert)
|
||||
(evil-define-key 'insert vterm-mode-map (kbd "C-a") #'vterm--self-insert)
|
||||
(evil-define-key 'insert vterm-mode-map (kbd "C-v") #'vterm--self-insert)
|
||||
(evil-define-key 'insert vterm-mode-map (kbd "C-b") #'vterm--self-insert)
|
||||
(evil-define-key 'insert vterm-mode-map (kbd "C-w") #'vterm--self-insert)
|
||||
(evil-define-key 'insert vterm-mode-map (kbd "C-u") #'vterm--self-insert)
|
||||
(evil-define-key 'insert vterm-mode-map (kbd "C-d") #'vterm--self-insert)
|
||||
(evil-define-key 'insert vterm-mode-map (kbd "C-n") #'vterm--self-insert)
|
||||
(evil-define-key 'insert vterm-mode-map (kbd "C-m") #'vterm--self-insert)
|
||||
(evil-define-key 'insert vterm-mode-map (kbd "C-p") #'vterm--self-insert)
|
||||
(evil-define-key 'insert vterm-mode-map (kbd "C-j") #'vterm--self-insert)
|
||||
(evil-define-key 'insert vterm-mode-map (kbd "C-k") #'Vterm--self-insert)
|
||||
(evil-define-key 'insert vterm-mode-map (kbd "C-r") #'vterm--self-insert)
|
||||
(evil-define-key 'insert vterm-mode-map (kbd "C-t") #'vterm--self-insert)
|
||||
(evil-define-key 'insert vterm-mode-map (kbd "C-g") #'vterm--self-insert)
|
||||
(evil-define-key 'insert vterm-mode-map (kbd "C-c") #'vterm--self-insert)
|
||||
(evil-define-key 'insert vterm-mode-map (kbd "C-SPC") #'vterm--self-insert)
|
||||
(evil-define-key 'normal vterm-mode-map (kbd "C-d") #'vterm--self-insert)
|
||||
(evil-define-key 'normal vterm-mode-map (kbd ",c") #'multi-vterm)
|
||||
(evil-define-key 'normal vterm-mode-map (kbd ",n") #'multi-vterm-next)
|
||||
(evil-define-key 'normal vterm-mode-map (kbd ",p") #'multi-vterm-prev)
|
||||
(evil-define-key 'normal vterm-mode-map (kbd "i") #'evil-insert-resume)
|
||||
(evil-define-key 'normal vterm-mode-map (kbd "o") #'evil-insert-resume)
|
||||
(evil-define-key 'normal vterm-mode-map (kbd "<return>") #'evil-insert-resume))
|
||||
#+end_src
|
||||
|
||||
#+RESULTS:
|
||||
: t
|
||||
|
||||
* Tree-sitter Configuration
|
||||
Modern syntax highlighting and parsing.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package treesit-auto
|
||||
:config
|
||||
(global-treesit-auto-mode))
|
||||
(use-package treesit-auto
|
||||
:ensure t
|
||||
:config
|
||||
(global-treesit-auto-mode))
|
||||
|
||||
(setq treesit-language-source-alist
|
||||
'((bash "https://github.com/tree-sitter/tree-sitter-bash")
|
||||
(cmake "https://github.com/uyha/tree-sitter-cmake")
|
||||
(css "https://github.com/tree-sitter/tree-sitter-css")
|
||||
(elisp "https://github.com/Wilfred/tree-sitter-elisp")
|
||||
(go "https://github.com/tree-sitter/tree-sitter-go")
|
||||
(html "https://github.com/tree-sitter/tree-sitter-html")
|
||||
(javascript "https://github.com/tree-sitter/tree-sitter-javascript" "master" "src")
|
||||
(json "https://github.com/tree-sitter/tree-sitter-json")
|
||||
(python "https://github.com/tree-sitter/tree-sitter-python")
|
||||
(typescript "https://github.com/tree-sitter/tree-sitter-typescript" "master" "typescript/src")
|
||||
(yaml "https://github.com/ikatyang/tree-sitter-yaml")))
|
||||
(setq treesit-language-source-alist
|
||||
'((bash "https://github.com/tree-sitter/tree-sitter-bash")
|
||||
(cmake "https://github.com/uyha/tree-sitter-cmake")
|
||||
(css "https://github.com/tree-sitter/tree-sitter-css")
|
||||
(elisp "https://github.com/Wilfred/tree-sitter-elisp")
|
||||
(go "https://github.com/tree-sitter/tree-sitter-go")
|
||||
(html "https://github.com/tree-sitter/tree-sitter-html")
|
||||
(javascript "https://github.com/tree-sitter/tree-sitter-javascript" "master" "src")
|
||||
(json "https://github.com/tree-sitter/tree-sitter-json")
|
||||
(python "https://github.com/tree-sitter/tree-sitter-python")
|
||||
(typescript "https://github.com/tree-sitter/tree-sitter-typescript" "master" "typescript/src")
|
||||
(yaml "https://github.com/ikatyang/tree-sitter-yaml")))
|
||||
|
||||
;; Install tree-sitter languages
|
||||
(defun efs/install-treesit-language (lang)
|
||||
"Install tree-sitter grammar for LANG if it's not already installed."
|
||||
(unless (treesit-language-available-p lang)
|
||||
(treesit-install-language-grammar lang)))
|
||||
;; Install tree-sitter languages
|
||||
(defun efs/install-treesit-language (lang)
|
||||
"Install tree-sitter grammar for LANG if it's not already installed."
|
||||
(unless (treesit-language-available-p lang)
|
||||
(treesit-install-language-grammar lang)))
|
||||
|
||||
(dolist (lang '(bash cmake css elisp go html javascript json python typescript yaml))
|
||||
(efs/install-treesit-language lang))
|
||||
(dolist (lang '(bash cmake css elisp go html javascript json python typescript yaml))
|
||||
(efs/install-treesit-language lang))
|
||||
|
||||
;; Remap major modes to tree-sitter versions
|
||||
(setq major-mode-remap-alist
|
||||
'((python-mode . python-ts-mode)
|
||||
(javascript-mode . js-ts-mode)
|
||||
(js-mode . js-ts-mode)
|
||||
(typescript-mode . typescript-ts-mode)
|
||||
(json-mode . json-ts-mode)
|
||||
(css-mode . css-ts-mode)
|
||||
(yaml-mode . yaml-ts-mode)
|
||||
(bash-mode . bash-ts-mode)
|
||||
(go-mode . go-ts-mode)))
|
||||
;; Remap major modes to tree-sitter versions
|
||||
(setq major-mode-remap-alist
|
||||
'((python-mode . python-ts-mode)
|
||||
(javascript-mode . js-ts-mode)
|
||||
(js-mode . js-ts-mode)
|
||||
(typescript-mode . typescript-ts-mode)
|
||||
(json-mode . json-ts-mode)
|
||||
(css-mode . css-ts-mode)
|
||||
(yaml-mode . yaml-ts-mode)
|
||||
(bash-mode . bash-ts-mode)
|
||||
(go-mode . go-ts-mode)))
|
||||
#+end_src
|
||||
|
||||
* Latex
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(with-eval-after-load 'ox-latex
|
||||
;; Add the `mimore` LaTeX class
|
||||
(add-to-list 'org-latex-classes
|
||||
'("mimore"
|
||||
"\\documentclass{mimore}
|
||||
[NO-DEFAULT-PACKAGES]
|
||||
[PACKAGES]
|
||||
[EXTRA]"
|
||||
("\\section{%s}" . "\\section*{%s}")
|
||||
("\\subsection{%s}" . "\\subsection*{%s}")
|
||||
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
|
||||
("\\paragraph{%s}" . "\\paragraph*{%s}")
|
||||
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))))
|
||||
#+end_src
|
||||
|
|
|
|||
Loading…
Reference in a new issue