home/natto/emacs: minor changes

Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
This commit is contained in:
2024-06-02 16:04:14 +05:30
parent d0a53ea9a3
commit 194f03c578
4 changed files with 95 additions and 71 deletions

View File

@@ -7,7 +7,7 @@
#+begin_src emacs-lisp #+begin_src emacs-lisp
; -*- lexical-binding: t; -*- ; -*- lexical-binding: t; -*-
(set-frame-font "Fira Code 13" nil t) (set-frame-font "Fira Code 13" nil t)
;(add-to-list 'default-frame-alist '(font . "Fira Code-13")) (add-to-list 'default-frame-alist '(font . "Fira Code-13"))
#+end_src #+end_src
** Some mode settings based on personal preferences ** Some mode settings based on personal preferences
@@ -54,11 +54,14 @@
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/")) (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
(package-initialize) (package-initialize)
(require 'use-package) (require 'use-package)
#+end_src
*** Profiling
#+begin_src emacs-lisp
(use-package benchmark-init (use-package benchmark-init
:ensure t
:config :config
;; To disable collection of benchmark data after init is done. ;; To disable collection of benchmark data after init is done.
(add-hook 'after-init-hook 'benchmark-init/deactivate)) :init (benchmark-init/deactivate))
#+end_src #+end_src
** Visual packages ** Visual packages
@@ -74,13 +77,15 @@
(use-package catppuccin-theme (use-package catppuccin-theme
:config :config
(load-theme 'catppuccin t) (load-theme 'catppuccin t)
(setq dark-theme t)) :custom
(dark-theme t))
#+end_src #+end_src
** Configure Selectrum ** Configure Selectrum
Enable selectrum Enable selectrum
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package selectrum (use-package selectrum
:defer t
:config :config
(selectrum-mode +1)) (selectrum-mode +1))
#+end_src #+end_src
@@ -130,7 +135,6 @@ Add selectrum-prescient
(evil-mode 1)) (evil-mode 1))
#+end_src #+end_src
*** Configure undo tree *** Configure undo tree
To undo and redo easily like vi To undo and redo easily like vi
#+begin_src emacs-lisp #+begin_src emacs-lisp
@@ -151,7 +155,10 @@ To undo and redo easily like vi
** Treemacs ** Treemacs
*** Configure treemacs *** Configure treemacs
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package treemacs) (use-package treemacs
:defer t
:config
(treemacs-project-follow-mode))
#+end_src #+end_src
#+begin_src emacs-lisp #+begin_src emacs-lisp
@@ -165,12 +172,14 @@ To undo and redo easily like vi
*** Configure lsp-mode *** Configure lsp-mode
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package lsp-mode (use-package lsp-mode
:defer t
:commands lsp) :commands lsp)
#+end_src #+end_src
*** Configure lsp-ui *** Configure lsp-ui
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package lsp-ui (use-package lsp-ui
:defer t
:init :init
(setq lsp-ui-doc-delay 1.0 (setq lsp-ui-doc-delay 1.0
lsp-ui-doc-show-with-mouse t lsp-ui-doc-show-with-mouse t
@@ -178,22 +187,22 @@ To undo and redo easily like vi
lsp-ui-doc-show-with-cursor t) lsp-ui-doc-show-with-cursor t)
:config :config
(lsp-ui-peek-enable 1) (lsp-ui-peek-enable 1)
(lsp-ui-doc-enable 1)) (lsp-ui-doc-enable 1)
#+end_src :hook (lsp-mode . lsp-ui-mode))
*** Language specific LSP packages
#+begin_src emacs-lisp
(use-package lsp-haskell)
#+end_src #+end_src
*** Configure flycheck *** Configure flycheck
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package flycheck) (use-package flycheck
:defer t)
#+end_src #+end_src
*** Configure dap-mode *** Configure dap-mode
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package dap-mode) (use-package dap-mode
:defer t
:hook ((lsp-mode . dap-mode)
(lsp-mode . dap-ui-mode)))
#+end_src #+end_src
** Company ** Company
@@ -205,7 +214,8 @@ For autocomplete
:config :config
(add-to-list 'company-backends 'company-dabbrev) (add-to-list 'company-backends 'company-dabbrev)
(setq company-backends (append '(company-files) (remove 'company-files company-backends))) (setq company-backends (append '(company-files) (remove 'company-files company-backends)))
(company-mode 1)) :hook (after-init . global-company-mode))
#+end_src #+end_src
*** Configure company-quickhelp *** Configure company-quickhelp
@@ -230,31 +240,30 @@ For autocomplete
** Direnv ** Direnv
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package direnv (use-package direnv
:defer t
:config :config
(direnv-mode)) (direnv-mode))
#+end_src #+end_src
** STM32 ** Languages
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package stm32-emacs) (use-package lsp-haskell
#+end_src :mode "\\.hs\\'")
(use-package lsp-latex
** Lang support :mode "\\.tex\\'")
#+begin_src emacs-lisp (use-package rustic
(use-package haskell-mode) :mode "\\.rs\\'")
(use-package lsp-latex) (use-package typescript-mode
(use-package rustic) :mode ("\\.ts\\'" "\\.tsx\\'"))
(use-package typescript-mode) (use-package wgsl-mode
(use-package yuck-mode) :mode "\\.wgsl\\'")
(use-package wgsl-mode)
(use-package nix-mode (use-package nix-mode
:mode "\\.nix\\'") :mode "\\.nix\\'")
(use-package hcl-mode (use-package hcl-mode
:mode :mode
"\\.hcl\\'" "\\.hcl\\'"
"\\.nomad\\'") "\\.nomad\\'")
(use-package go-mode) (use-package go-mode
:mode "\\.go\\'")
#+end_src #+end_src
** Magit ** Magit
@@ -262,8 +271,8 @@ For autocomplete
(use-package magit :defer t) (use-package magit :defer t)
#+end_src #+end_src
* VTerm ** VTerm
** Configure vterm *** Configure vterm
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package vterm (use-package vterm
:config :config
@@ -288,17 +297,27 @@ For autocomplete
#+end_src #+end_src
** Centaur Tabs ** Centaur Tabs
#+begin_src emacs-lisp Do not use centaur tabs for now
#+begin_src emacs-lisp :tangle no
(use-package centaur-tabs (use-package centaur-tabs
:defer t
:custom
(centaur-tabs-style "rounded")
(centaur-tabs-height 18)
(centaur-tabs-set-modified-marker t)
(centaur-tabs-set-icons t)
:config :config
(setq centaur-tabs-style "rounded" (centaur-tabs-mode t)
centaur-tabs-height 18
centaur-tabs-set-modified-marker t
centaur-tabs-set-icons t)
(centaur-tabs-group-by-projectile-project) (centaur-tabs-group-by-projectile-project)
(centaur-tabs-mode nil)
(set-face-attribute 'tab-line nil :inherit 'centaur-tabs-unselected) (set-face-attribute 'tab-line nil :inherit 'centaur-tabs-unselected)
(centaur-tabs-headline-match)) (centaur-tabs-headline-match)
:bind
(:map evil-normal-state-map
("M-," . centaur-tabs-forward)
("M-." . centaur-tabs-backward))
(:map evil-motion-state-map
("M-," . centaur-tabs-forward)
("M-." . centaur-tabs-backward)))
#+end_src #+end_src
** Misc packages ** Misc packages
@@ -322,38 +341,38 @@ For autocomplete
(use-package flex-autopair) (use-package flex-autopair)
#+end_src #+end_src
* Org ** Org
** Add org-mode ** Add org-mode
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package org (use-package org
:after evil
:defer t :defer t
:after evil
:config :config
(setq evil-want-C-i-jump nil
org-adapt-indentation t
org-src-fontify-natively t
org-src-strip-leading-and-trailing-blank-lines t
org-src-preserve-indentation t
org-src-tab-acts-natively t)
(define-key org-mode-map (kbd "RET") 'org-return-and-maybe-indent) (define-key org-mode-map (kbd "RET") 'org-return-and-maybe-indent)
(evil-define-key 'normal org-mode-map (kbd "TAB") 'org-cycle)) (evil-define-key 'normal org-mode-map (kbd "TAB") 'org-cycle)
:custom
(evil-want-C-i-jump nil)
(org-adapt-indentation t)
(org-src-fontify-natively t)
(org-src-strip-leading-and-trailing-blank-lines t)
(org-src-preserve-indentation t)
(org-src-tab-acts-natively t))
#+end_src #+end_src
** Add org-bullets ** Add org-bullets
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package org-bullets (use-package org-bullets
:defer t :defer t
:config :hook ((org-mode . org-bullets-mode)))
(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))))
#+end_src #+end_src
** Babel and exports ** Babel and exports
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package htmlize :defer t) (use-package htmlize :defer t)
(add-to-list 'org-latex-packages-alist '("" "minted"))
(setq org-latex-listings 'minted)
(setq org-latex-pdf-process (setq org-latex-listings 'minted
org-latex-packages-alist '(("" "minted"))
org-latex-pdf-process
'("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f" '("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
"pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f" "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
"pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f")) "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"))
@@ -363,10 +382,8 @@ For autocomplete
(org-babel-do-load-languages (org-babel-do-load-languages
'org-babel-load-languages 'org-babel-load-languages
'((awk . t) '((python . t)
(python . t)
(C . t) (C . t)
(shell . t)
(sql . t) (sql . t)
(latex . t))) (latex . t)))
#+end_src #+end_src
@@ -385,8 +402,7 @@ For autocomplete
switched to doom modeline after using my own modeline for a while switched to doom modeline after using my own modeline for a while
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package doom-modeline (use-package doom-modeline
:ensure t :init (doom-modeline-mode 1))
:hook (after-init . doom-modeline-mode))
#+end_src #+end_src
* Pop-up terminal * Pop-up terminal
@@ -425,6 +441,7 @@ Compilation shortcuts for standalone files
("java" (concat "java " full)) ("java" (concat "java " full))
("py" (concat "python " full)) ("py" (concat "python " full))
("cpp" (concat "g++ " full " -o " file " && " file " && rm " file)) ("cpp" (concat "g++ " full " -o " file " && " file " && rm " file))
("cc" (concat "g++ " full " -o " file " && " file " && rm " file))
("hs" (concat "runhaskell " full)) ("hs" (concat "runhaskell " full))
("sh" (concat "sh " full)) ("sh" (concat "sh " full))
("js" (concat "node " full)) ("js" (concat "node " full))
@@ -455,7 +472,8 @@ not using this anymore
*** Misc binds *** Misc binds
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package general) (use-package general
:ensure t)
(setq evil-states (setq evil-states
'(visual normal motion)) '(visual normal motion))
@@ -475,18 +493,16 @@ not using this anymore
:keymaps '(global override vterm-mode-map) :keymaps '(global override vterm-mode-map)
:states evil-states :states evil-states
"M-o" 'treemacs "M-o" 'treemacs
"M-S-v" 'split-window-vertically "M-s-v" 'split-window-vertically
"M-S-h" 'split-window-horizontally "M-s-h" 'split-window-horizontally
"M-h" 'windmove-left "M-h" 'windmove-left
"M-j" 'windmove-down "M-j" 'windmove-down
"M-k" 'windmove-up "M-k" 'windmove-up
"M-l" 'windmove-right "M-l" 'windmove-right
"M-C-h" 'shrink-window-horizontally "M-C-h" 'shrink-window-horizontally
"M-C-j" 'enlarge-window-horizontally "M-C-l" 'enlarge-window-horizontally
"M-C-k" 'shrink-window "M-C-j" 'shrink-window
"M-C-l" 'enlarge-window "M-C-k" 'enlarge-window
"M-," 'centaur-tabs-backward
"M-." 'centaur-tabs-forward
"C-q" 'delete-window "C-q" 'delete-window
"M-C-S-q" 'kill-buffer-and-window "M-C-S-q" 'kill-buffer-and-window
"M-w" 'centaur-tabs--kill-this-buffer-dont-ask "M-w" 'centaur-tabs--kill-this-buffer-dont-ask
@@ -505,6 +521,6 @@ not using this anymore
"<f5>" (lambda () (interactive) (run-in-vterm (candrun)))) "<f5>" (lambda () (interactive) (run-in-vterm (candrun))))
(general-define-key (general-define-key
:keymaps 'vterm-mode-map :keymaps 'vterm-mode-map
"<f2>" 'vterm-toggle-forward "<f3>" 'vterm-toggle-forward
"<f3>" 'vterm-toggle-backward))) "<f2>" 'vterm-toggle-backward)))
#+end_src #+end_src

View File

@@ -1,2 +1,8 @@
(delete-file (expand-file-name "~/.emacs.d/config.el")) (defconst config-org (expand-file-name "config.org" user-emacs-directory))
(org-babel-load-file (expand-file-name "~/.emacs.d/config.org")) (defconst config-el (expand-file-name "config.el" user-emacs-directory))
(unless (file-exists-p config-el)
(require 'org)
(org-babel-tangle-file config-org config-el))
(load-file config-el)

View File

@@ -13,7 +13,7 @@
./wayland.nix ./wayland.nix
./pkgs.nix ./pkgs.nix
./stuff.nix ./stuff.nix
#./emacs.nix ./emacs.nix
./gtk.nix ./gtk.nix
./dunst.nix ./dunst.nix
./git.nix ./git.nix

View File

@@ -13,6 +13,8 @@ let
}; };
in in
{ {
nixpkgs.overlays = [ inputs.emacs-overlay.overlays.default ];
home = { home = {
file = with config; { file = with config; {
"config.org" = { "config.org" = {