diff options
author | Jacob Janzen <jjanzenn@proton.me> | 2024-08-07 22:34:10 -0500 |
---|---|---|
committer | Jacob Janzen <jjanzenn@proton.me> | 2024-08-07 22:34:10 -0500 |
commit | 3832e2c085e5137f78cdf5f0c1e9cf273ffbc338 (patch) | |
tree | a2bd6bd1119aacbaa23ede55ad3ff1c46a76ea57 /config | |
parent | 05a87bb0eb20345694a09c9e5e5930028c0c0339 (diff) |
complete my configuration migration
Diffstat (limited to 'config')
37 files changed, 983 insertions, 1082 deletions
diff --git a/config/discord/index.org b/config/discord/index.org new file mode 100644 index 0000000..4b828a4 --- /dev/null +++ b/config/discord/index.org @@ -0,0 +1,8 @@ +#+title: Dotfiles =/.config/discord= +Here is my discord configuration. + +* Directories +- [[../index.org][../]] + +* Files +- [[./settings.org][settings.json]] diff --git a/config/discord/settings.org b/config/discord/settings.org index 7323f78..9e0a786 100644 --- a/config/discord/settings.org +++ b/config/discord/settings.org @@ -1,6 +1,6 @@ #+title: Discord settings.json There really isn't much to this. I do set =SKIP_HOST_UPDATE= to =true= though to prevent it from trying to auto-update before it appears in my operating system repositories. -#+begin_src json :tangle yes +#+begin_src js-json :tangle ~/.config/discord/settings.json :mkdirp yes { "IS_MAXIMIZED": false, "IS_MINIMIZED": false, diff --git a/config/emacs/config.org b/config/emacs/config.org deleted file mode 100644 index 495f37c..0000000 --- a/config/emacs/config.org +++ /dev/null @@ -1,626 +0,0 @@ -#+title: Emacs Configuration -* Package Setup -Set up package archives including =melpa=, =org=, and =elpa=. -#+begin_src emacs-lisp - (require 'package) - - (setq package-archives '(("melpa" . "https://melpa.org/packages/") - ("org" . "https://orgmode.org/elpa/") - ("elpa" . "https://elpa.gnu.org/packages/"))) - - (package-initialize) - (unless package-archive-contents - (package-refresh-contents)) -#+end_src - -Install =use-package= for declarative package installation. Make =use-package= default to =ensure t= so that packages are enabled if they are declared. -#+begin_src emacs-lisp - (unless (package-installed-p 'use-package) - (package-install 'use-package)) - - (require 'use-package) - (setq use-package-always-ensure t) -#+end_src - -* User Interface -** Theming -Set the default font to the Source Code Pro nerd font variant. I use size 14 font. -#+begin_src emacs-lisp - (set-face-attribute 'default t :font "Sauce Code Pro Nerd Font-14") -#+end_src - -Use the Doom Nord light theme. -#+begin_src emacs-lisp - (use-package doom-themes - :config - (setq doom-themes-enable-bold t - doom-themes-enable-italic t) - (load-theme 'doom-nord-light t) - (doom-themes-org-config)) -#+end_src - -Use =doom-modeline= for a nicer modeline. -#+begin_src emacs-lisp - (use-package doom-modeline - :init (doom-modeline-mode 1)) -#+end_src - -** Clean UI -Disable the Emacs start screen and make the =scratch= buffer default to empty. -#+begin_src emacs-lisp - (setq inhibit-startup-screen t) - (setq initial-scratch-message nil) -#+end_src - -Disable scroll bar, tool bar, and menu bar. -#+begin_src emacs-lisp - (scroll-bar-mode -1) - (tool-bar-mode -1) - (menu-bar-mode -1) -#+end_src - -** Fancy Stuff -Use line numbers by default. -#+begin_src emacs-lisp - (global-display-line-numbers-mode 1) -#+end_src - -Highlight changes for an operation with =evil-goggles=. -#+begin_src emacs-lisp - (use-package evil-goggles - :after evil - :config - (evil-goggles-mode) - (evil-goggles-use-diff-faces)) -#+end_src - -Install nerd font icons. -#+begin_src emacs-lisp - (use-package nerd-icons) -#+end_src - -Scroll one line at a time. -#+begin_src emacs-lisp - (setq scroll-conservatively most-positive-fixnum) -#+end_src - -Create parent directories when they don't yet exist. -#+begin_src emacs-lisp - (defun jj/create-non-existent-directory () - (let ((parent-directory (file-name-directory buffer-file-name))) - (when (and (not (file-exists-p parent-directory)) - (y-or-n-p (format "Directory `%s' does not exist! Create it?" parent-directory))) - (make-directory parent-directory t)))) - (add-to-list 'find-file-not-found-functions #'jj/create-non-existent-directory) -#+end_src - - -** Whitespace Management -Use spaces over tabs and set tab width to 4. -#+begin_src emacs-lisp - (setq-default indent-tabs-mode nil) - (setq tab-width 4 - c-basic-offset tab-width) -#+end_src - -Delete trailing whitespace on save. -#+begin_src emacs-lisp - (defun jj/before-save-hook () - (unless (eql (with-current-buffer (current-buffer) major-mode) - 'markdown-mode) - (delete-trailing-whitespace))) - (add-hook 'before-save-hook #'jj/before-save-hook) -#+end_src - -** Backup Management -Don't create backup files. -#+begin_src emacs-lisp - (setq make-backup-files nil) -#+end_src - -** Customize =dired= -Use nerd font icons in =dired=. -#+begin_src emacs-lisp - (use-package nerd-icons-dired - :hook dired-mode) -#+end_src - -Use colours in =dired= with =diredfl=. -#+begin_src emacs-lisp - (use-package diredfl - :init (diredfl-global-mode 1)) -#+end_src - -* Tools -** Vi Keybindings -Use =vi= keybindings with =evil=. Set the undo system to =undo-fu=. Wrapped lines can be moved between with =j= and =k=. -#+begin_src emacs-lisp - (use-package evil - :init - (setq evil-want-keybinding nil) - :config - (evil-mode) - (evil-global-set-key 'motion "j" 'evil-next-visual-line) - (evil-global-set-key 'motion "k" 'evil-previous-visual-line) - :custom - (evil-undo-system 'undo-fu)) -#+end_src - -Use =evil-collection= to include =vi= keybindings in extra modes. -#+begin_src emacs-lisp - (use-package evil-collection - :after evil - :config - (evil-collection-init)) -#+end_src - -** Lisp Editing -Better Lisp editing with =lispy= and =lispyville=. -#+begin_src emacs-lisp - (use-package lispy - :hook emacs-lisp-mode) - (use-package lispyville - :after lispy - :hook lispy-mode) -#+end_src - -Better parentheses handling in lisp with =parinfer-rust-mode=. -#+begin_src emacs-lisp - (use-package parinfer-rust-mode - :hook emacs-lisp-mode - :init - (setq parinfer-rust-auto-download t)) -#+end_src - -** Undo -Better undo with =undo-fu=. -#+begin_src emacs-lisp - (use-package undo-fu) -#+end_src - -Make undo persistent when closing Emacs with =undo-fu-session=. -#+begin_src emacs-lisp - (use-package undo-fu-session - :init (undo-fu-session-global-mode 1)) -#+end_src - -** Lookup -Better lookup with =dumb-jump=. -#+begin_src emacs-lisp - (use-package dumb-jump - :init (add-hook 'xref-backend-functions #'dumb-jump-xref-activate)) -#+end_src - -** Version Control -Install Magit for Git integration. -#+begin_src emacs-lisp - (use-package magit) -#+end_src - -** Document Viewing -Replace =DocView= with a better document viewer from =pdf-tools=. -#+begin_src emacs-lisp - (use-package pdf-tools - :config - (pdf-tools-install) - :init - (add-hook 'pdf-view-mode-hook #'(lambda () (display-line-numbers-mode -1))) - (add-hook 'TeX-after-compilation-finished-functions - #'TeX-revert-document-buffer) - :config - (setq TeX-view-program-selection '((output-pdf "PDF Tools")) - TeX-view-program-list '(("PDF Tools" TeX-pdf-tools-sync-view)) - TeX-source-correlate-start-server t)) -#+end_src - -Save place in PDFs with =saveplace-pdf-view=. -#+begin_src emacs-lisp - (use-package saveplace-pdf-view - :config (save-place-mode 1)) -#+end_src - -** Org-Mode -Set my =org-mode= directory. -#+begin_src emacs-lisp -(setq org-directory "~/org") -#+end_src - -Hide emphasis markers because I can see if something is *bold*, /italic/, or =monospace= without needing to see the markers. -#+begin_src emacs-lisp -(setq org-hide-emphasis-markers t) -#+end_src - -Set up nicer looking bullet points. -- they look like circles -- instead of hyphens -#+begin_src emacs-lisp -(font-lock-add-keywords 'org-mode - '(("^ *\\([-]\\) " - (0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•")))))) -#+end_src - -Set up fonts. Don't use =monospace= by default. Do use it where necessary though. Also, make different heading levels different sizes. -#+begin_src emacs-lisp -(add-hook 'org-mode-hook 'variable-pitch-mode) -(custom-set-faces - '(variable-pitch ((t (:family "CMU Serif" :height 130 :weight thin)))) - '(fixed-pitch ((t (:family "SauceCodePro Nerd Font" :height 110 :weight regular)))) - '(org-block ((t (:inherit fixed-pitch)))) - '(org-code ((t (:inherit (shadow fixed-pitch))))) - '(org-document-info-keyword ((t (:inherit (shadow fixed-pitch))))) - '(org-meta-line ((t (:inherit (font-lock-comment-face fixed-pitch))))) - '(org-verbatim ((t (:inherit (shadow fixed-pitch))))) - '(org-table ((t (:inherit (shadow fixed-pitch))))) - '(org-document-title ((t (:inherit title :height 2.0 :underline nil)))) - '(org-level-1 ((t (:inherit outline-1 :weight: bold :height 1.75)))) - '(org-level-2 ((t (:inherit outline-2 :weight: bold :height 1.5)))) - '(org-level-2 ((t (:inherit outline-3 :weight: bold :height 1.25)))) - '(org-level-2 ((t (:inherit outline-4 :weight: bold :height 1.1)))) - '(org-level-4 ((t (:inherit outline-4 :height 1.1)))) - '(org-level-5 ((t (:inherit outline-5 :height 1.0)))) - ) -#+end_src - -Wrap lines and centre the view to make for a nicer reading experience. -#+begin_src emacs-lisp -(use-package visual-fill-column) -(add-hook 'org-mode-hook 'visual-line-mode) -(add-hook 'org-mode-hook #'(lambda () (display-line-numbers-mode -1))) -(defun jj/org-mode-visual-fill () - (setq visual-fill-column-width 100 - visual-fill-column-center-text t) - (visual-fill-column-mode 1)) -(add-hook 'org-mode-hook #'jj/org-mode-visual-fill) -#+end_src - -Increase the size of LaTeX previews. -#+begin_src emacs-lisp -(setq org-format-latex-options (plist-put org-format-latex-options :scale 2.0)) -#+end_src - -Follow links with the return key. -#+begin_src emacs-lisp -(setq org-return-follows-link t) -#+end_src - -Tangle on save. -#+begin_src emacs-lisp -(add-hook 'org-mode-hook - (lambda () - (add-hook 'after-save-hook #'org-babel-tangle))) -#+end_src - - -** Shell -Use =eshell= as an integrated shell. -#+begin_src emacs-lisp - (use-package eshell) -#+end_src - -** Language Servers -Add =eglot= keybindings. -#+begin_src emacs-lisp - (global-set-key (kbd "C-c r") 'eglot-rename) - (global-set-key (kbd "C-c a") 'eglot-code-actions) -#+end_src - -Install =tree-sitter=. -#+begin_src emacs-lisp - (use-package tree-sitter) - (use-package tree-sitter-langs) -#+end_src - -Define function to set up =eglot= automatically. -#+begin_src emacs-lisp - (defun jj/eglot-setup () - (eglot-ensure) - (tree-sitter-mode 1) - (tree-sitter-hl-mode 1)) -#+end_src - -** Completions -Use company for completions with no delay, starting immediately after first character is typed. -#+begin_src emacs-lisp - (use-package company - :config - (add-hook 'after-init-hook 'global-company-mode) - (setq company-idle-delay 0 - company-minimum-prefix-length 1 - company-selection-wrap-around t)) -#+end_src - -Use =vertico= as a completion user interface. -#+begin_src emacs-lisp - (use-package vertico - :custom - (vertico-cycle t) - :init - (vertico-mode)) -#+end_src - -Use =orderless= to allow typing any portion of a word that you want to search for. -#+begin_src emacs-lisp - (use-package orderless - :ensure t - :custom - (completion-styles '(orderless basic)) - (completion-category-overrides '((file (styles basic partial-completion))))) -#+end_src - -Get descriptions of items in =vertico= with =marginalia=. -#+begin_src emacs-lisp - (use-package marginalia - :bind (:map minibuffer-local-map - ("M-A" . marginalia-cycle)) - :init - (marginalia-mode)) -#+end_src - -Get nerd font icons in completions. -#+begin_src emacs-lisp - (use-package nerd-icons-completion - :config - (nerd-icons-completion-mode)) -#+end_src - -Use consult with =vertico= for extra functionality to various functions. -#+begin_src emacs-lisp - (use-package consult - :bind ( - ("C-c M-x" . consult-mode-command) - ("C-c h" . consult-history) - ("C-c k" . consult-kmacro) - ("C-c m" . consult-man) - ("C-c i" . consult-info) - ([remap Info-search] . consult-info) - ("C-x M-:" . consult-complex-command) - ("C-x b" . consult-buffer) - ("C-x 4 b" . consult-buffer-other-window) - ("C-x 5 b" . consult-buffer-other-frame) - ("C-x t b" . consult-buffer-other-tab) - ("C-x r b" . consult-bookmark) - ("C-x p b" . consult-project-buffer) - ("M-#" . consult-register-load) - ("M-'" . consult-register-store) - ("C-M-#" . consult-register) - ("M-y" . consult-yank-pop) - ("M-g e" . consult-compile-error) - ("M-g f" . consult-flycheck) - ("M-g g" . consult-goto-line) - ("M-g M-g" . consult-goto-line) - ("M-g o" . consult-outline) - ("M-g m" . consult-mark) - ("M-g k" . consult-global-mark) - ("M-g i" . consult-imenu) - ("M-g I" . consult-imenu-multi) - ("M-s d" . consult-fd) - ("M-s c" . consult-locate) - ("M-s g" . consult-grep) - ("M-s G" . consult-git-grep) - ("M-s r" . consult-ripgrep) - ("M-s l" . consult-line) - ("M-s L" . consult-line-multi) - ("M-s k" . consult-keep-lines) - ("M-s u" . consult-focus-lines) - ("M-s e" . consult-isearch-history) - :map isearch-mode-map - ("M-e" . consult-isearch-history) - ("M-s e" . consult-isearch-history) - ("M-s l" . consult-line) - ("M-s L" . consult-line-multi) - :map minibuffer-local-map - ("M-s" . consult-history) - ("M-r" . consult-history)) - :hook (completion-list-mode . consult-preview-at-point-mode) - :init - (setq register-preview-delay 0.5 - register-preview-function #'consult-register-format) - (advice-add #'register-preview :override #'consult-register-window) - (setq xref-show-xrefs-function #'consult-xref - xref-show-definitions-function #'consult-xref) - :config - (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)) - (setq consult-narrow-key "<")) -#+end_src - -Use Flycheck for syntax checking. -#+begin_src emacs-lisp - (use-package flycheck - :config - (add-hook 'after-init-hook #'global-flycheck-mode)) -#+end_src - -Use Flyspell for spell checking. -#+begin_src emacs-lisp - (dolist (hook '(text-mode-hook)) - (add-hook hook (lambda () (flyspell-mode 1)))) - (use-package flyspell-correct - :after flyspell - :bind (:map flyspell-mode-map ("C-;" . flyspell-correct-wrapper))) -#+end_src - -** Snippets -Use =yasnippet= for snippets so I don't need to type as much. -#+begin_src emacs-lisp - (use-package yasnippet - :init - (yas-global-mode 1) - :config - (global-set-key (kbd "C-c s") 'yas-insert-snippet)) -#+end_src - -Install snippet collection for =yasnippet=. -#+begin_src emacs-lisp - (use-package yasnippet-snippets) -#+end_src - -** Formatting -Automatically format with Apheleia and =clang-format=. -#+begin_src emacs-lisp - (use-package apheleia - :init (apheleia-global-mode +1)) - (use-package clang-format) -#+end_src - -** RSS -Use Emacs as an RSS feed with =elfeed=. -#+begin_src emacs-lisp - (use-package elfeed - :config - (global-set-key (kbd "C-c w") 'elfeed) - (global-set-key (kbd "C-c C-W") 'elfeed-update)) -#+end_src - -Make =elfeed= more powerful with =elfeed-goodies=. -#+begin_src emacs-lisp - (use-package elfeed-goodies - :after elfeed - :config - (elfeed-goodies/setup)) -#+end_src - -Store my feed in Org-mode [[./feed.org][here]]. -#+begin_src emacs-lisp - (use-package elfeed-org - :config - (elfeed-org) - (setq rmh-elfeed-org-files (list "~/.config/emacs/feed.org"))) -#+end_src - -** Deft -Use the Deft package to manage notes. -#+begin_src emacs-lisp - (use-package deft - :config - (global-set-key (kbd "C-c d") 'deft) - (setq deft-directory "~/notes/" - deft-default-extension "org")) -#+end_src - -* Languages -** Shell Script -Run =eglot= on shell script files. -#+begin_src emacs-lisp - (add-hook 'sh-mode-hook 'jj/eglot-setup) -#+end_src - -** C -Run =eglot= on C and C++ files. -#+begin_src emacs-lisp - (add-hook 'c-mode-hook 'jj/eglot-setup) - (add-hook 'c++-mode-hook 'jj/eglot-setup) - (add-hook 'cc-mode-hook 'jj/eglot-setup) -#+end_src - -** Web -Run =eglot= on HTML files. -#+begin_src emacs-lisp - (add-hook 'html-mode-hook 'jj/eglot-setup) -#+end_src - -Run =eglot= on CSS files. -#+begin_src emacs-lisp - (add-hook 'css-mode-hook 'jj/eglot-setup) -#+end_src - -Run =eglot= on JavaScript/Typescript files. -#+begin_src emacs-lisp - (add-hook 'js-json-mode-hook 'jj/eglot-setup) - (add-hook 'js-mode-hook 'jj/eglot-setup) - (use-package typescript-mode - :init - (add-hook 'typescript-mode-hook 'jj/eglot-setup)) -#+end_src - -** Python -Run =eglot= on Python files. -#+begin_src emacs-lisp - (add-hook 'python-mode-hook 'jj/eglot-setup) -#+end_src - -** TODO Rust -Run =eglot= on Rust files. (This does not work at all) -#+begin_src emacs-lisp - (use-package rust-mode - :init - (add-hook 'rust-mode-hook 'jj/eglot-setup)) -#+end_src - -** Go -Run =eglot= on Go files. -#+begin_src emacs-lisp - (use-package go-mode - :init - (add-hook 'go-mode-hook 'jj/eglot-setup)) -#+end_src - -Get documentation for Go variables, functions, and arguments. -#+begin_src emacs-lisp - (use-package go-eldoc - :init - (add-hook 'go-mode-hook 'go-eldoc-setup)) -#+end_src - -Automatically generate tests. -#+begin_src emacs-lisp - (use-package go-gen-test) -#+end_src - -Refactoring tools from =go-guru=. -#+begin_src emacs-lisp - (use-package go-guru - :hook (go-mode . go-guru-hl-identifier-mode)) -#+end_src - -** Lua -Run =eglot= on Lua files. -#+begin_src emacs-lisp - (use-package lua-mode - :init - (add-hook 'lua-mode-hook 'jj/eglot-setup)) -#+end_src - -** Markdown -Run =eglot= on Markdown files. -#+begin_src emacs-lisp - (use-package markdown-mode - :init - (add-hook 'markdown-mode-hook 'jj/eglot-setup)) -#+end_src - -** LaTeX -Run =eglot= on TeX files. -#+begin_src emacs-lisp - (add-hook 'tex-mode-hook 'jj/eglot-setup) -#+end_src - -Use AUCTeX for extra LaTeX integrations. -#+begin_src emacs-lisp - (use-package auctex - :config - (add-hook 'LaTeX-mode-hook 'jj/eglot-setup) - (add-hook 'LaTeX-mode-hook - (lambda () - (put 'LaTeX-mode 'eglot-language-id "latex")))) -#+end_src - -Use CDLaTeX for environment and macro insertion. -#+begin_src emacs-lisp - (use-package cdlatex - :config - (add-hook 'LaTeX-mode-hook #'turn-on-cdlatex)) -#+end_src - -** YAML -Run =eglot= on YAML files. -#+begin_src emacs-lisp - (use-package yaml-mode - :init - (add-hook 'yaml-mode-hook 'jj/eglot-setup)) -#+end_src diff --git a/config/emacs/feed.org b/config/emacs/feed.org index 045ac62..40bdc92 100644 --- a/config/emacs/feed.org +++ b/config/emacs/feed.org @@ -1,25 +1,29 @@ -* Blogs -:PROPERTIES: -:ID: elfeed -:END: -** http://feeds.feedburner.com/InformationIsBeautiful -** [[http://orgmode.org][Org Mode Links supported as well]] -** Software Development :dev: -*** Emacs :emacs:mustread: -**** http://www.terminally-incoherent.com/blog/feed -**** http://nullprogram.com/feed -**** entry-title: \(emacs\|org-mode\) -**** http://planet.emacsen.org/atom.xml -**** [[toobnix:154][EmacsConf]] -*** Web Development :web: -**** http://planet.phpunit.de/atom.xml -**** http://feeds.feedburner.com/symfony/blog -**** http://feeds.feedburner.com/qooxdoo/blog/content -*** Eclipse :eclipse: -**** http://blog.eclipse-tips.com/feeds/posts/default?alt=rss -**** http://ed-merks.blogspot.com/feeds/posts/default - A description of a feed can be written under any headline. - The text will be ignored by elfeed. -**** http://feeds.feedburner.com/eclipselive :ignore: -**** http://www.fosslc.org/drupal/rss.xml :video: -#+link: toobnix https://toobnix.org/feeds/videos.xml?videoChannelId= +#+title: Emacs RSS Feed + +#+begin_src org :tangle ~/.config/emacs/feed.org :mkdirp yes + ,* Blogs + :PROPERTIES: + :ID: elfeed + :END: + ,** http://feeds.feedburner.com/InformationIsBeautiful + ,** [[http://orgmode.org][Org Mode Links supported as well]] + ,** Software Development :dev: + ,*** Emacs :emacs:mustread: + ,**** http://www.terminally-incoherent.com/blog/feed + ,**** http://nullprogram.com/feed + ,**** entry-title: \(emacs\|org-mode\) + ,**** http://planet.emacsen.org/atom.xml + ,**** [[toobnix:154][EmacsConf]] + ,*** Web Development :web: + ,**** http://planet.phpunit.de/atom.xml + ,**** http://feeds.feedburner.com/symfony/blog + ,**** http://feeds.feedburner.com/qooxdoo/blog/content + ,*** Eclipse :eclipse: + ,**** http://blog.eclipse-tips.com/feeds/posts/default?alt=rss + ,**** http://ed-merks.blogspot.com/feeds/posts/default + A description of a feed can be written under any headline. + The text will be ignored by elfeed. + ,**** http://feeds.feedburner.com/eclipselive :ignore: + ,**** http://www.fosslc.org/drupal/rss.xml :video: + ,#+link: toobnix https://toobnix.org/feeds/videos.xml?videoChannelId= +#+end_src diff --git a/config/emacs/force-custom-file.org b/config/emacs/force-custom-file.org new file mode 100644 index 0000000..8b8a418 --- /dev/null +++ b/config/emacs/force-custom-file.org @@ -0,0 +1,8 @@ +#+title: Emacs Force the Usage of a =custom.el= File + +Force the usage of a =custom.el= file for customizations instead of placing them in =init.el=. +#+begin_src emacs-lisp :tangle ~/.config/emacs/force-custom-file.el :mkdirp yes + (setq custom-file (concat user-emacs-directory "custom.el")) + (when (file-exists-p custom-file) + (load custom-file)) +#+end_src diff --git a/config/emacs/index.org b/config/emacs/index.org new file mode 100644 index 0000000..6665f16 --- /dev/null +++ b/config/emacs/index.org @@ -0,0 +1,14 @@ +#+title: Dotfiles =/.config/emacs= +This is my Emacs configuration. I recommend starting in [[./init.org][init.el]] as that is the entry-point for the program. + +* Directories +- [[../index.org][../]] + +* Files +- [[./feed.org][feed.org]] +- [[./force-custom-file.org][force-custom-file.el]] +- [[./init.org][init.el]] +- [[./languages.org][languages.el]] +- [[./package-setup.org][package-setup.el]] +- [[./tools.org][tools.el]] +- [[./user-interface.org][user-interface.el]] diff --git a/config/emacs/init.el b/config/emacs/init.el deleted file mode 100644 index cc210a3..0000000 --- a/config/emacs/init.el +++ /dev/null @@ -1,5 +0,0 @@ -(setq custom-file (concat user-emacs-directory "custom.el")) -(when (file-exists-p custom-file) - (load custom-file)) - -(org-babel-load-file "~/.config/emacs/config.org") diff --git a/config/emacs/init.org b/config/emacs/init.org index 36131cf..7eec368 100644 --- a/config/emacs/init.org +++ b/config/emacs/init.org @@ -1,13 +1,25 @@ -#+title: Emacs =init.el= +#+title: Emacs Configuration +Load [[./force-custom-file.org][force-custom-file.el]] to ensure that =init.el= is not polluted by customizations. +#+begin_src emacs-lisp :tangle ~/.config/emacs/init.el :mkdirp yes + (load "~/.config/emacs/force-custom-file.el") +#+end_src + +Load [[./package-setup.org][package-setup.el]] to allow for package installation. +#+begin_src emacs-lisp :tangle ~/.config/emacs/init.el :mkdirp yes + (load "~/.config/emacs/package-setup.el") +#+end_src + +Load [[./user-interface.org][user-interface.el]] to clean up Emacs' user interface and make it look the way I like. +#+begin_src emacs-lisp :tangle ~/.config/emacs/init.el :mkdirp yes + (load "~/.config/emacs/user-interface.el") +#+end_src -Force the usage of a =custom.el= file for customizations. -#+begin_src emacs-lisp :tangle yes -(setq custom-file (concat user-emacs-directory "custom.el")) -(when (file-exists-p custom-file) - (load custom-file)) +Load [[./tools.org][tools.el]] to add functionality to Emacs. +#+begin_src emacs-lisp :tangle ~/.config/emacs/init.el :mkdirp yes + (load "~/.config/emacs/tools.el") #+end_src -Load the main configuration from [[./config.org][config.org]]. -#+begin_src emacs-lisp :tangle yes -(org-babel-load-file "~/.config/emacs/config.org") +Load [[./languages.org][languages.el]] to add language and language server protocol support. +#+begin_src emacs-lisp :tangle ~/.config/emacs/init.el :mkdirp yes + (load "~/.config/emacs/tools.el") #+end_src diff --git a/config/emacs/languages.org b/config/emacs/languages.org new file mode 100644 index 0000000..765659b --- /dev/null +++ b/config/emacs/languages.org @@ -0,0 +1,111 @@ +#+title: Emacs Programming Language Setup + +* Shell Script +Run =eglot= on shell script files. +#+begin_src emacs-lisp :tangle ~/.config/emacs/languages.el :mkdirp yes + (add-hook 'sh-mode-hook 'jj/eglot-setup) +#+end_src + +* C +Run =eglot= on C and C++ files. +#+begin_src emacs-lisp :tangle ~/.config/emacs/languages.el :mkdirp yes + (add-hook 'c-mode-hook 'jj/eglot-setup) + (add-hook 'c++-mode-hook 'jj/eglot-setup) + (add-hook 'cc-mode-hook 'jj/eglot-setup) +#+end_src + +* Web +Run =eglot= on HTML files. +#+begin_src emacs-lisp :tangle ~/.config/emacs/languages.el :mkdirp yes + (add-hook 'html-mode-hook 'jj/eglot-setup) +#+end_src + +Run =eglot= on CSS files. +#+begin_src emacs-lisp :tangle ~/.config/emacs/languages.el :mkdirp yes + (add-hook 'css-mode-hook 'jj/eglot-setup) +#+end_src + +Run =eglot= on JavaScript files. +#+begin_src emacs-lisp :tangle ~/.config/emacs/languages.el :mkdirp yes + (add-hook 'js-json-mode-hook 'jj/eglot-setup) + (add-hook 'js-mode-hook 'jj/eglot-setup) +#+end_src + +* Python +Run =eglot= on Python files. +#+begin_src emacs-lisp :tangle ~/.config/emacs/languages.el :mkdirp yes + (add-hook 'python-mode-hook 'jj/eglot-setup) +#+end_src + +* Go +Install Go support and run =eglot= on Go files. +#+begin_src emacs-lisp :tangle ~/.config/emacs/languages.el :mkdirp yes + (use-package go-mode + :init + (add-hook 'go-mode-hook 'jj/eglot-setup)) +#+end_src + +Get documentation for Go variables, functions, and arguments. +#+begin_src emacs-lisp :tangle ~/.config/emacs/languages.el :mkdirp yes + (use-package go-eldoc + :init + (add-hook 'go-mode-hook 'go-eldoc-setup)) +#+end_src + +Automatically generate tests in Go. +#+begin_src emacs-lisp :tangle ~/.config/emacs/languages.el :mkdirp yes + (use-package go-gen-test) +#+end_src + +Get refactoring tools from =go-guru=. +#+begin_src emacs-lisp :tangle ~/.config/emacs/languages.el :mkdirp yes + (use-package go-guru + :hook (go-mode . go-guru-hl-identifier-mode)) +#+end_src + +* Lua +Install Lua support and run =eglot= on Lua files. +#+begin_src emacs-lisp :tangle ~/.config/emacs/languages.el :mkdirp yes + (use-package lua-mode + :init + (add-hook 'lua-mode-hook 'jj/eglot-setup)) +#+end_src + +* Markdown +Install Markdown support and run =eglot= on Markdown files. +#+begin_src emacs-lisp :tangle ~/.config/emacs/languages.el :mkdirp yes + (use-package markdown-mode + :init + (add-hook 'markdown-mode-hook 'jj/eglot-setup)) +#+end_src + +* LaTeX +Run =eglot= on TeX files. +#+begin_src emacs-lisp :tangle ~/.config/emacs/languages.el :mkdirp yes + (add-hook 'tex-mode-hook 'jj/eglot-setup) +#+end_src + +Use AUCTeX for extra LaTeX integration. +#+begin_src emacs-lisp :tangle ~/.config/emacs/languages.el :mkdirp yes + (use-package auctex + :config + (add-hook 'LaTeX-mode-hook 'jj/eglot-setup) + (add-hook 'LaTeX-mode-hook + (lambda () + (put 'LaTeX-mode 'eglot-language-id "latex")))) +#+end_src + +Use CDLaTeX for environment and macro insertion. +#+begin_src emacs-lisp :tangle ~/.config/emacs/languages.el :mkdirp yes + (use-package cdlatex + :config + (add-hook 'LaTeX-mode-hook #'turn-on-cdlatex)) +#+end_src + +* YAML +Install YAML support and run =eglot= on YAML files. +#+begin_src emacs-lisp :tangle ~/.config/emacs/languages.el :mkdirp yes + (use-package yaml-mode + :init + (add-hook 'yaml-mode-hook 'jj/eglot-setup)) +#+end_src diff --git a/config/emacs/package-setup.org b/config/emacs/package-setup.org new file mode 100644 index 0000000..00d87dc --- /dev/null +++ b/config/emacs/package-setup.org @@ -0,0 +1,23 @@ +#+title: Emacs Package Setup + +Set up =melpa=, =org=, and =elpa= as package archives. +#+begin_src emacs-lisp :tangle ~/.config/emacs/package-setup.el :mkdirp yes + (require 'package) + + (setq package-archives '(("melpa" . "https://melpa.org/packages/") + ("org" . "https://orgmode.org/elpa/") + ("elpa" . "https://elpa.gnu.org/packages/"))) + + (package-initialize) + (unless package-archive-contents + (package-refresh-contents)) +#+end_src + +Install =use-package= for declarative package installation. Make =use-package= default to =ensure t= so that packages are enabled if they are declared. +#+begin_src emacs-lisp :tangle ~/.config/emacs/package-setup.el :mkdirp yes + (unless (package-installed-p 'use-package) + (package-install 'use-package)) + + (require 'use-package) + (setq use-package-always-ensure t) +#+end_src diff --git a/config/emacs/tools.org b/config/emacs/tools.org new file mode 100644 index 0000000..fd31c90 --- /dev/null +++ b/config/emacs/tools.org @@ -0,0 +1,377 @@ +#+title: Emacs Tool Setup + +* Vi Keybindings +Use =vi= keybindings with =evil=. Set the undo system to =undo-fu=. Wrapped lines can be moved between with =j= and =k=. +#+begin_src emacs-lisp :tangle ~/.config/emacs/tools.el :mkdirp yes + (use-package evil + :init + (setq evil-want-keybinding nil) + :config + (evil-mode) + (evil-global-set-key 'motion "j" 'evil-next-visual-line) + (evil-global-set-key 'motion "k" 'evil-previous-visual-line) + (evil-global-set-key 'motion (kbd "RET") nil) + :custom + (evil-undo-system 'undo-fu)) +#+end_src + +Use =evil-collection= to include =vi= keybindings in extra modes. +#+begin_src emacs-lisp :tangle ~/.config/emacs/tools.el :mkdirp yes + (use-package evil-collection + :after evil + :config + (evil-collection-init)) +#+end_src + +* Lisp Editing +Better Lisp editing with =lispy= and =lispyville=. +#+begin_src emacs-lisp :tangle ~/.config/emacs/tools.el :mkdirp yes + (use-package lispy + :hook emacs-lisp-mode) + (use-package lispyville + :after lispy + :hook lispy-mode) +#+end_src + +Better parentheses handling in lisp with =parinfer-rust-mode=. +#+begin_src emacs-lisp :tangle ~/.config/emacs/tools.el :mkdirp yes + (use-package parinfer-rust-mode + :hook emacs-lisp-mode + :init + (setq parinfer-rust-auto-download t)) +#+end_src + +* Undo +Better undo with =undo-fu=. +#+begin_src emacs-lisp :tangle ~/.config/emacs/tools.el :mkdirp yes + (use-package undo-fu) +#+end_src + +Make undo persistent when closing Emacs with =undo-fu-session=. +#+begin_src emacs-lisp :tangle ~/.config/emacs/tools.el :mkdirp yes + (use-package undo-fu-session + :init (undo-fu-session-global-mode 1)) +#+end_src + +* Lookup +Better lookup with =dumb-jump=. +#+begin_src emacs-lisp :tangle ~/.config/emacs/tools.el :mkdirp yes + (use-package dumb-jump + :init (add-hook 'xref-backend-functions #'dumb-jump-xref-activate)) +#+end_src + +* Version Control +Install Magit for Git integration. +#+begin_src emacs-lisp :tangle ~/.config/emacs/tools.el :mkdirp yes + (use-package magit) +#+end_src + +* Document Viewing +Replace =DocView= with a better document viewer from =pdf-tools=. +#+begin_src emacs-lisp :tangle ~/.config/emacs/tools.el :mkdirp yes + (use-package pdf-tools + :config + (pdf-tools-install) + :init + (add-hook 'pdf-view-mode-hook #'(lambda () (display-line-numbers-mode -1))) + (add-hook 'TeX-after-compilation-finished-functions + #'TeX-revert-document-buffer) + :config + (setq TeX-view-program-selection '((output-pdf "PDF Tools")) + TeX-view-program-list '(("PDF Tools" TeX-pdf-tools-sync-view)) + TeX-source-correlate-start-server t)) +#+end_src + +Save place in PDFs with =saveplace-pdf-view=. +#+begin_src emacs-lisp :tangle ~/.config/emacs/tools.el :mkdirp yes + (use-package saveplace-pdf-view + :config (save-place-mode 1)) +#+end_src + +* Org-Mode +Ensure that =org= is set up before any of this. +#+begin_src emacs-lisp :tangle ~/.config/emacs/tools.el :mkdirp yes + (require 'org) +#+end_src +Set my =org-mode= directory. +#+begin_src emacs-lisp :tangle ~/.config/emacs/tools.el :mkdirp yes + (setq org-directory "~/org") +#+end_src + +Hide emphasis markers because I can see if something is *bold*, /italic/, or =monospace= without needing to see the markers. +#+begin_src emacs-lisp :tangle ~/.config/emacs/tools.el :mkdirp yes + (setq org-hide-emphasis-markers t) +#+end_src + +Set up nicer looking bullet points. +- they look like circles +- instead of hyphens +#+begin_src emacs-lisp :tangle ~/.config/emacs/tools.el :mkdirp yes + (font-lock-add-keywords 'org-mode + '(("^ *\\([-]\\) " + (0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•")))))) +#+end_src + +Set up fonts. Don't use =monospace= by default. Do use it where necessary though. Also, make different heading levels different sizes. +#+begin_src emacs-lisp :tangle ~/.config/emacs/tools.el :mkdirp yes + (add-hook 'org-mode-hook 'variable-pitch-mode) + (custom-set-faces + '(variable-pitch ((t (:family "CMU Serif" :height 130 :weight thin)))) + '(fixed-pitch ((t (:family "SauceCodePro Nerd Font" :height 110 :weight regular)))) + '(org-block ((t (:inherit fixed-pitch)))) + '(org-code ((t (:inherit (shadow fixed-pitch))))) + '(org-document-info-keyword ((t (:inherit (shadow fixed-pitch))))) + '(org-meta-line ((t (:inherit (font-lock-comment-face fixed-pitch))))) + '(org-verbatim ((t (:inherit (shadow fixed-pitch))))) + '(org-table ((t (:inherit (shadow fixed-pitch))))) + '(org-document-title ((t (:inherit title :height 2.0 :underline nil)))) + '(org-level-1 ((t (:inherit outline-1 :weight: bold :height 1.75)))) + '(org-level-2 ((t (:inherit outline-2 :weight: bold :height 1.5)))) + '(org-level-2 ((t (:inherit outline-3 :weight: bold :height 1.25)))) + '(org-level-2 ((t (:inherit outline-4 :weight: bold :height 1.1)))) + '(org-level-4 ((t (:inherit outline-4 :height 1.1)))) + '(org-level-5 ((t (:inherit outline-5 :height 1.0)))) + ) +#+end_src + +Wrap lines and centre the view to make for a nicer reading experience. +#+begin_src emacs-lisp :tangle ~/.config/emacs/tools.el :mkdirp yes + (use-package visual-fill-column) + (add-hook 'org-mode-hook 'visual-line-mode) + (add-hook 'org-mode-hook #'(lambda () (display-line-numbers-mode -1))) + (defun jj/org-mode-visual-fill () + (setq visual-fill-column-width 100 + visual-fill-column-center-text t) + (visual-fill-column-mode 1)) + (add-hook 'org-mode-hook #'jj/org-mode-visual-fill) +#+end_src + +Increase the size of LaTeX previews. +#+begin_src emacs-lisp :tangle ~/.config/emacs/tools.el :mkdirp yes + (setq org-format-latex-options (plist-put org-format-latex-options :scale 2.0)) +#+end_src + +Follow links with the return key. +#+begin_src emacs-lisp :tangle ~/.config/emacs/tools.el :mkdirp yes + (setq org-return-follows-link t) +#+end_src + +Tangle on save. +#+begin_src emacs-lisp :tangle ~/.config/emacs/tools.el :mkdirp yes + (add-hook 'org-mode-hook + (lambda () + (add-hook 'after-save-hook #'org-babel-tangle))) +#+end_src + +* Shell +Use =eshell= as an integrated shell. +#+begin_src emacs-lisp :tangle ~/.config/emacs/tools.el :mkdirp yes + (use-package eshell) + (global-set-key (kbd "C-c e") 'eshell) +#+end_src + +* Language Servers +Add =eglot= keybindings. +#+begin_src emacs-lisp :tangle ~/.config/emacs/tools.el :mkdirp yes + (global-set-key (kbd "C-c r") 'eglot-rename) + (global-set-key (kbd "C-c a") 'eglot-code-actions) +#+end_src + +Install =tree-sitter=. +#+begin_src emacs-lisp :tangle ~/.config/emacs/tools.el :mkdirp yes + (use-package tree-sitter) + (use-package tree-sitter-langs) +#+end_src + +Define function to set up =eglot= automatically. +#+begin_src emacs-lisp :tangle ~/.config/emacs/tools.el :mkdirp yes + (defun jj/eglot-setup () + (eglot-ensure) + (tree-sitter-mode 1) + (tree-sitter-hl-mode 1)) +#+end_src + +* Completions +Use company for completions with no delay, starting immediately after first character is typed. +#+begin_src emacs-lisp :tangle ~/.config/emacs/tools.el :mkdirp yes + (use-package company + :config + (add-hook 'after-init-hook 'global-company-mode) + (setq company-idle-delay 0 + company-minimum-prefix-length 1 + company-selection-wrap-around t)) +#+end_src + +Use =vertico= as a completion user interface. +#+begin_src emacs-lisp :tangle ~/.config/emacs/tools.el :mkdirp yes + (use-package vertico + :custom + (vertico-cycle t) + :init + (vertico-mode)) +#+end_src + +Use =orderless= to allow typing any portion of a word that you want to search for. +#+begin_src emacs-lisp :tangle ~/.config/emacs/tools.el :mkdirp yes + (use-package orderless + :ensure t + :custom + (completion-styles '(orderless basic)) + (completion-category-overrides '((file (styles basic partial-completion))))) +#+end_src + +Get descriptions of items in =vertico= with =marginalia=. +#+begin_src emacs-lisp :tangle ~/.config/emacs/tools.el :mkdirp yes + (use-package marginalia + :bind (:map minibuffer-local-map + ("M-A" . marginalia-cycle)) + :init + (marginalia-mode)) +#+end_src + +Get nerd font icons in completions. +#+begin_src emacs-lisp :tangle ~/.config/emacs/tools.el :mkdirp yes + (use-package nerd-icons-completion + :config + (nerd-icons-completion-mode)) +#+end_src + +Use consult with =vertico= for extra functionality to various functions. +#+begin_src emacs-lisp :tangle ~/.config/emacs/tools.el :mkdirp yes + (use-package consult + :bind ( + ("C-c M-x" . consult-mode-command) + ("C-c h" . consult-history) + ("C-c k" . consult-kmacro) + ("C-c m" . consult-man) + ("C-c i" . consult-info) + ([remap Info-search] . consult-info) + ("C-x M-:" . consult-complex-command) + ("C-x b" . consult-buffer) + ("C-x 4 b" . consult-buffer-other-window) + ("C-x 5 b" . consult-buffer-other-frame) + ("C-x t b" . consult-buffer-other-tab) + ("C-x r b" . consult-bookmark) + ("C-x p b" . consult-project-buffer) + ("M-#" . consult-register-load) + ("M-'" . consult-register-store) + ("C-M-#" . consult-register) + ("M-y" . consult-yank-pop) + ("M-g e" . consult-compile-error) + ("M-g f" . consult-flycheck) + ("M-g g" . consult-goto-line) + ("M-g M-g" . consult-goto-line) + ("M-g o" . consult-outline) + ("M-g m" . consult-mark) + ("M-g k" . consult-global-mark) + ("M-g i" . consult-imenu) + ("M-g I" . consult-imenu-multi) + ("M-s d" . consult-fd) + ("M-s c" . consult-locate) + ("M-s g" . consult-grep) + ("M-s G" . consult-git-grep) + ("M-s r" . consult-ripgrep) + ("M-s l" . consult-line) + ("M-s L" . consult-line-multi) + ("M-s k" . consult-keep-lines) + ("M-s u" . consult-focus-lines) + ("M-s e" . consult-isearch-history) + :map isearch-mode-map + ("M-e" . consult-isearch-history) + ("M-s e" . consult-isearch-history) + ("M-s l" . consult-line) + ("M-s L" . consult-line-multi) + :map minibuffer-local-map + ("M-s" . consult-history) + ("M-r" . consult-history)) + :hook (completion-list-mode . consult-preview-at-point-mode) + :init + (setq register-preview-delay 0.5 + register-preview-function #'consult-register-format) + (advice-add #'register-preview :override #'consult-register-window) + (setq xref-show-xrefs-function #'consult-xref + xref-show-definitions-function #'consult-xref) + :config + (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)) + (setq consult-narrow-key "<")) +#+end_src + +Use Flycheck for syntax checking. +#+begin_src emacs-lisp :tangle ~/.config/emacs/tools.el :mkdirp yes + (use-package flycheck + :config + (add-hook 'after-init-hook #'global-flycheck-mode)) +#+end_src + +Use Flyspell for spell checking. +#+begin_src emacs-lisp :tangle ~/.config/emacs/tools.el :mkdirp yes + (dolist (hook '(text-mode-hook)) + (add-hook hook (lambda () (flyspell-mode 1)))) + (use-package flyspell-correct + :after flyspell + :bind (:map flyspell-mode-map ("C-;" . flyspell-correct-wrapper))) +#+end_src + +* Snippets +Use =yasnippet= for snippets so I don't need to type as much. +#+begin_src emacs-lisp :tangle ~/.config/emacs/tools.el :mkdirp yes + (use-package yasnippet + :init + (yas-global-mode 1) + :config + (global-set-key (kbd "C-c s") 'yas-insert-snippet)) +#+end_src + +Install snippet collection for =yasnippet=. +#+begin_src emacs-lisp :tangle ~/.config/emacs/tools.el :mkdirp yes + (use-package yasnippet-snippets) +#+end_src + +* Formatting +Automatically format with Apheleia and =clang-format=. +#+begin_src emacs-lisp :tangle ~/.config/emacs/tools.el :mkdirp yes + (use-package apheleia + :init (apheleia-global-mode +1)) + (use-package clang-format) +#+end_src + +* RSS +Use Emacs as an RSS feed with =elfeed=. +#+begin_src emacs-lisp :tangle ~/.config/emacs/tools.el :mkdirp yes + (use-package elfeed + :config + (global-set-key (kbd "C-c f") 'elfeed) + (global-set-key (kbd "C-c M-f") 'elfeed-update)) +#+end_src + +Make =elfeed= more powerful with =elfeed-goodies=. +#+begin_src emacs-lisp :tangle ~/.config/emacs/tools.el :mkdirp yes + (use-package elfeed-goodies + :after elfeed + :config + (elfeed-goodies/setup)) +#+end_src + +Store my feed in Org-mode [[./feed.org][here]]. +#+begin_src emacs-lisp :tangle ~/.config/emacs/tools.el :mkdirp yes + (use-package elfeed-org + :config + (elfeed-org) + (setq rmh-elfeed-org-files (list "~/.config/emacs/feed.org"))) +#+end_src + +* Deft +Use the Deft package to manage notes. +#+begin_src emacs-lisp :tangle ~/.config/emacs/tools.el :mkdirp yes + (use-package deft + :config + (global-set-key (kbd "C-c d") 'deft) + (setq deft-directory "~/notes/" + deft-default-extension "org")) +#+end_src diff --git a/config/emacs/user-interface.org b/config/emacs/user-interface.org new file mode 100644 index 0000000..c0dc399 --- /dev/null +++ b/config/emacs/user-interface.org @@ -0,0 +1,109 @@ +#+title: Emacs User Interface + +* Theming +Set the default font to the Source Code Pro nerd font variant. I use size 14 font. +#+begin_src emacs-lisp :tangle ~/.config/emacs/user-interface.el :mkdirp yes + (set-face-attribute 'default t :font "Sauce Code Pro Nerd Font-14") +#+end_src + +Use the Doom Nord light theme. +#+begin_src emacs-lisp :tangle ~/.config/emacs/user-interface.el :mkdirp yes + (use-package doom-themes + :config + (setq doom-themes-enable-bold t + doom-themes-enable-italic t) + (load-theme 'doom-nord-light t) + (doom-themes-org-config)) +#+end_src + +Use =doom-modeline= for a nicer modeline. +#+begin_src emacs-lisp :tangle ~/.config/emacs/user-interface.el :mkdirp yes + (use-package doom-modeline + :init (doom-modeline-mode 1)) +#+end_src + +* Clean UI +Disable the Emacs start screen and make the =scratch= buffer default to empty. +#+begin_src emacs-lisp :tangle ~/.config/emacs/user-interface.el :mkdirp yes + (setq inhibit-startup-screen t) + (setq initial-scratch-message nil) +#+end_src + +Disable scroll bar, tool bar, and menu bar. +#+begin_src emacs-lisp :tangle ~/.config/emacs/user-interface.el :mkdirp yes + (scroll-bar-mode -1) + (tool-bar-mode -1) + (menu-bar-mode -1) +#+end_src + +* Fancy Stuff +Use line numbers by default. +#+begin_src emacs-lisp :tangle ~/.config/emacs/user-interface.el :mkdirp yes + (global-display-line-numbers-mode 1) +#+end_src + +Highlight changes for an operation with =evil-goggles=. +#+begin_src emacs-lisp :tangle ~/.config/emacs/user-interface.el :mkdirp yes + (use-package evil-goggles + :after evil + :config + (evil-goggles-mode) + (evil-goggles-use-diff-faces)) +#+end_src + +Install nerd font icons. +#+begin_src emacs-lisp :tangle ~/.config/emacs/user-interface.el :mkdirp yes + (use-package nerd-icons) +#+end_src + +Scroll one line at a time. +#+begin_src emacs-lisp :tangle ~/.config/emacs/user-interface.el :mkdirp yes + (setq scroll-conservatively most-positive-fixnum) +#+end_src + +Create parent directories when they don't yet exist. +#+begin_src emacs-lisp :tangle ~/.config/emacs/user-interface.el :mkdirp yes + (defun jj/create-non-existent-directory () + (let ((parent-directory (file-name-directory buffer-file-name))) + (when (and (not (file-exists-p parent-directory)) + (y-or-n-p (format "Directory `%s' does not exist! Create it?" parent-directory))) + (make-directory parent-directory t)))) + (add-to-list 'find-file-not-found-functions #'jj/create-non-existent-directory) +#+end_src + + +* Whitespace Management +Use spaces over tabs and set tab width to 4. +#+begin_src emacs-lisp :tangle ~/.config/emacs/user-interface.el :mkdirp yes + (setq-default indent-tabs-mode nil) + (setq tab-width 4 + c-basic-offset tab-width) +#+end_src + +Delete trailing whitespace on save. +#+begin_src emacs-lisp :tangle ~/.config/emacs/user-interface.el :mkdirp yes + (defun jj/before-save-hook () + (unless (eql (with-current-buffer (current-buffer) major-mode) + 'markdown-mode) + (delete-trailing-whitespace))) + (add-hook 'before-save-hook #'jj/before-save-hook) +#+end_src + +* Backup Management +Don't create backup files. +#+begin_src emacs-lisp :tangle ~/.config/emacs/user-interface.el :mkdirp yes + (setq make-backup-files nil) +#+end_src + +* Customize =dired= +Use nerd font icons in =dired=. +#+begin_src emacs-lisp :tangle ~/.config/emacs/user-interface.el :mkdirp yes + (use-package nerd-icons-dired + :hook dired-mode) +#+end_src + +Use colours in =dired= with =diredfl=. +#+begin_src emacs-lisp :tangle ~/.config/emacs/user-interface.el :mkdirp yes + (use-package diredfl + :init (diredfl-global-mode 1)) +#+end_src diff --git a/config/fastfetch/index.org b/config/fastfetch/index.org new file mode 100644 index 0000000..67de5e3 --- /dev/null +++ b/config/fastfetch/index.org @@ -0,0 +1,8 @@ +#+title: Dotfiles =/.config/fastfetch= +This is my Fastfetch configuration. + +* Directories +- [[../index.org][../]] + +* Files +- [[./config.org][config.jsonc]] diff --git a/config/foot/foot.org b/config/foot/foot.org index 922964a..f0bbfd3 100644 --- a/config/foot/foot.org +++ b/config/foot/foot.org @@ -1,52 +1,52 @@ #+title: Foot Settings * Basic Settings Use Source Code Pro with Nerd Font in size 10. -#+begin_src ini :tangle yes -font=SauceCodePro Nerd Font:size=10 +#+begin_src conf :tangle ~/.config/foot.ini :mkdirp yes + font=SauceCodePro Nerd Font:size=10 #+end_src Add 6 pixel padding around the terminal. -#+begin_src ini :tangle yes -pad=6x6 +#+begin_src conf :tangle ~/.config/foot.ini :mkdirp yes + pad=6x6 #+end_src * URL Use Firefox to open URLs. -#+begin_src ini :tangle yes -[url] -launch=firefox ${url} +#+begin_src conf :tangle ~/.config/foot.ini :mkdirp yes + [url] + launch=firefox ${url} #+end_src * Mouse Hide the mouse when typing. -#+begin_src ini :tangle yes -[mouse] -hide-when-typing=yes +#+begin_src conf :tangle ~/.config/foot.ini :mkdirp yes + [mouse] + hide-when-typing=yes #+end_src * Colours The colours are defined here. I use a slightly transparent background. -#+begin_src ini :tangle yes -[colors] -alpha=0.9 -background=fcfcfc -foreground=5c6166 +#+begin_src conf :tangle ~/.config/foot.ini :mkdirp yes + [colors] + alpha=0.9 + background=fcfcfc + foreground=5c6166 -regular0=010101 -regular1=e7666a -regular2=80ab24 -regular3=eba54d -regular4=4196df -regular5=9870c3 -regular6=51b891 -regular7=c1c1c1 + regular0=010101 + regular1=e7666a + regular2=80ab24 + regular3=eba54d + regular4=4196df + regular5=9870c3 + regular6=51b891 + regular7=c1c1c1 -bright0=343434 -bright1=ee9295 -bright2=9fd32f -bright3=f0bc7b -bright4=6daee6 -bright5=b294d2 -bright6=75c7a8 -bright7=dbdbdb + bright0=343434 + bright1=ee9295 + bright2=9fd32f + bright3=f0bc7b + bright4=6daee6 + bright5=b294d2 + bright6=75c7a8 + bright7=dbdbdb #+end_src diff --git a/config/foot/index.org b/config/foot/index.org new file mode 100644 index 0000000..f076d68 --- /dev/null +++ b/config/foot/index.org @@ -0,0 +1,9 @@ +#+title: Dotfiles =/.config/foot= + +This is my Foot configuration. + +* Directories +- [[../index.org][../]] + +* Files +- [[./foot.org][foot.ini]] diff --git a/config/index.org b/config/index.org new file mode 100644 index 0000000..5f4a23b --- /dev/null +++ b/config/index.org @@ -0,0 +1,14 @@ +#+title: Dotfiles =/.config= +Here is where most configuration files are stored. + +* Directories +- [[../index.org][../]] +- [[./discord/index.org][discord/]] +- [[./emacs/index.org][emacs/]] +- [[./fastfetch/index.org][fastfetch/]] +- [[./foot/index.org][foot/]] +- [[./mpd/index.org][mpd/]] +- [[./ncmpcpp/index.org][ncmpcpp/]] +- [[./nvim/index.org][nvim/]] +- [[./sway/index.org][sway/]] +- [[./waybar/index.org][waybar/]] diff --git a/config/mpd/index.org b/config/mpd/index.org new file mode 100644 index 0000000..282ec07 --- /dev/null +++ b/config/mpd/index.org @@ -0,0 +1,9 @@ +#+title: Dotfiles =/.config/mpd= + +This is my music player daemon configuration. + +* Directories +- [[../index.org][../]] + +* Files +- [[./mpd.org][mpd.conf]] diff --git a/config/mpd/mpd.org b/config/mpd/mpd.org index 4fa290e..4eca326 100644 --- a/config/mpd/mpd.org +++ b/config/mpd/mpd.org @@ -1,68 +1,68 @@ #+title: MPD Settings * Directories Check for music files in =~/Music=. -#+begin_src conf :tangle yes -music_directory "~/Music" +#+begin_src conf :tangle ~/.config/mpd/mpd.conf :mkdirp yes + music_directory "~/Music" #+end_src Put playlists at =~/.config/mpd/playlists=. -#+begin_src conf :tangle yes -playlist_directory "~/.config/mpd/playlists" +#+begin_src conf :tangle ~/.config/mpd/mpd.conf :mkdirp yes + playlist_directory "~/.config/mpd/playlists" #+end_src Put database at =~/.config/mpd/database=. -#+begin_src conf :tangle yes -db_file "~/.config/mpd/database" +#+begin_src conf :tangle ~/.config/mpd/mpd.conf :mkdirp yes + db_file "~/.config/mpd/database" #+end_src Put log file at =~/.config/mpd/log=. -#+begin_src conf :tangle yes -log_file "~/.config/mpd/log" +#+begin_src conf :tangle ~/.config/mpd/mpd.conf :mkdirp yes + log_file "~/.config/mpd/log" #+end_src Put PID file at =~/.config/mpd/pid=. -#+begin_src conf :tangle yes -pid_file "~/.config/mpd/pid" +#+begin_src conf :tangle ~/.config/mpd/mpd.conf :mkdirp yes + pid_file "~/.config/mpd/pid" #+end_src Put the state file at =~/.config/mpd/state=. -#+begin_src conf :tangle yes -state_file "~/.config/mpd/state" +#+begin_src conf :tangle ~/.config/mpd/mpd.conf :mkdirp yes + state_file "~/.config/mpd/state" #+end_src Put the sticker file at =~/.config/mpd/sticker.sql=. -#+begin_src conf :tangle yes -sticker_file "~/.config/mpd/sticker.sql" +#+begin_src conf :tangle ~/.config/mpd/mpd.conf :mkdirp yes + sticker_file "~/.config/mpd/sticker.sql" #+end_src Use UTF-8 in the file system. -#+begin_src conf :tangle yes -filesystem_charset "UTF-8" +#+begin_src conf :tangle ~/.config/mpd/mpd.conf :mkdirp yes + filesystem_charset "UTF-8" #+end_src * Network Run MPD on =localhost=. -#+begin_src conf :tangle yes -bind_to_address "localhost" +#+begin_src conf :tangle ~/.config/mpd/mpd.conf :mkdirp yes + bind_to_address "localhost" #+end_src * Outputs Output to PipeWire. -#+begin_src conf :tangle yes -audio_output { - type "pipewire" - name "Pipewire" - mixer_type "hardware" - enabled "yes" -} +#+begin_src conf :tangle ~/.config/mpd/mpd.conf :mkdirp yes + audio_output { + type "pipewire" + name "Pipewire" + mixer_type "hardware" + enabled "yes" + } #+end_src Output to FIFO. -#+begin_src conf :tangle yes -audio_output { - type "fifo" - name "my_fifo" - path "~/.config/mpd/mpd.fifo" - format "44100:16:2" -} +#+begin_src conf :tangle ~/.config/mpd/mpd.conf :mkdirp yes + audio_output { + type "fifo" + name "my_fifo" + path "~/.config/mpd/mpd.fifo" + format "44100:16:2" + } #+end_src diff --git a/config/ncmpcpp/bindings.org b/config/ncmpcpp/bindings.org index 159d3ae..346b9ec 100644 --- a/config/ncmpcpp/bindings.org +++ b/config/ncmpcpp/bindings.org @@ -1,6 +1,6 @@ #+title: =ncmpcpp= Keyboard Bindings -Use =vi= motions. -#+begin_src txt :tangle bindings +Use =vi= motions in =ncmpcpp=. +#+begin_src txt :tangle ~/.config/ncmpcpp/bindings :mkdirp yes def_key "j" scroll_down def_key "k" diff --git a/config/ncmpcpp/config.org b/config/ncmpcpp/config.org index 18a2a0e..8195877 100644 --- a/config/ncmpcpp/config.org +++ b/config/ncmpcpp/config.org @@ -1,16 +1,16 @@ #+title: =ncmpcpp= Configuration Set the =ncmpcpp= directory to =~/.config/ncmpcpp/=. -#+begin_src conf :tangle config -ncmpcpp_directory = "~/.ncmpcpp" +#+begin_src conf :tangle ~/.config/ncmpcpp/config :mkdirp yes +ncmpcpp_directory = "~/.config/ncmpcpp" #+end_src Set the host/port pair to find the music player daemon at. -#+begin_src conf :tangle config +#+begin_src conf :tangle ~/.config/ncmpcpp/config :mkdirp yes mpd_host = "localhost" mpd_port = "6600" #+end_src Specify the location of the Music directory to be =~/Music=. -#+begin_src conf :tangle config +#+begin_src conf :tangle ~/.config/ncmpcpp/config :mkdirp yes mpd_music_dir = "~/Music" #+end_src diff --git a/config/ncmpcpp/index.org b/config/ncmpcpp/index.org new file mode 100644 index 0000000..317593c --- /dev/null +++ b/config/ncmpcpp/index.org @@ -0,0 +1,9 @@ +#+title: Dotfiles =/.config/ncmpcpp= +This is my =ncmpcpp= configuration. + +* Directories +- [[../index.org][../]] + +* Files +- [[./bindings.org][bindings]] +- [[./config.org][config]] diff --git a/config/nvim/index.org b/config/nvim/index.org new file mode 100644 index 0000000..38d0daa --- /dev/null +++ b/config/nvim/index.org @@ -0,0 +1,9 @@ +#+title: Dotfiles =/.config/nvim= +This is my Neovim configuration. The entry point for the program is [[./init.org][init.lua]]. + +* Directories +- [[../index.org][../]] +- [[./lua/index.org][lua/]] + +* Files +- [[./init.org][init.lua]] diff --git a/config/nvim/init.org b/config/nvim/init.org index 703e8e2..9c15739 100644 --- a/config/nvim/init.org +++ b/config/nvim/init.org @@ -1,37 +1,22 @@ #+title: Neovim Settings -This is the entry point for my Neovim configuration. +This is the entry point for my Neovim configuration. I don't use Neovim much these days, so it is very stripped back from what it once was. Emacs is much comfier for most uses, so Neovim is mostly relegated to editing system configuration files. Disable timeout to speed things up. -#+begin_src lua :tangle yes -vim.cmd([[set notimeout]]) +#+begin_src lua :tangle ~/.config/nvim/init.lua :mkdirp yes + vim.cmd([[set notimeout]]) #+end_src Install plugins in the [[./lua/plugins.org][plugins.lua]] file. -#+begin_src lua :tangle yes -require('plugins') +#+begin_src lua :tangle ~/.config/nvim/init.lua :mkdirp yes + require('plugins') #+end_src Set up behaviour in the [[./lua/behaviour.org][behaviour.lua]] file. -#+begin_src lua :tangle yes -require('behaviour') +#+begin_src lua :tangle ~/.config/nvim/init.lua :mkdirp yes + require('behaviour') #+end_src Set up appearance in the [[./lua/appearance.org][appearance.lua]] file. -#+begin_src lua :tangle yes -require('appearance') -#+end_src - -Set up formatting options in the [[./lua/format.org][format.lua]] file. -#+begin_src lua :tangle yes -require('format') -#+end_src - -Set up language servers in the [[./lua/languageServers.org][languageServers.lua]] file. -#+begin_src lua :tangle yes -require('languageServers') -#+end_src - -Set up auto-complete in the [[./lua/autocomplete.org][autocomplete.lua]] file. -#+begin_src lua :tangle yes -require('autocomplete') +#+begin_src lua :tangle ~/.config/nvim/init.lua :mkdirp yes + require('appearance') #+end_src diff --git a/config/nvim/lua/appearance.org b/config/nvim/lua/appearance.org index 6cbf4ba..946d420 100644 --- a/config/nvim/lua/appearance.org +++ b/config/nvim/lua/appearance.org @@ -1,11 +1,11 @@ #+title: Neovim Appearance Settings Use line numbers. -#+begin_src lua :tangle yes +#+begin_src lua :tangle ~/.config/nvim/lua/appearance.lua :mkdirp yes vim.opt.number = true #+end_src -Set colour scheme. -#+begin_src lua :tangle yes +Set colour scheme to the Ayu light theme. +#+begin_src lua :tangle ~/.config/nvim/lua/appearance.lua :mkdirp yes vim.cmd([[ set termguicolors let ayucolor="light" diff --git a/config/nvim/lua/autocomplete.org b/config/nvim/lua/autocomplete.org deleted file mode 100644 index 505e93c..0000000 --- a/config/nvim/lua/autocomplete.org +++ /dev/null @@ -1,57 +0,0 @@ -#+title: Neovim Auto-complete Settings -Set up auto-completion with LSP. -#+begin_src lua :tangle yes - local capabilities = require("cmp_nvim_lsp").default_capabilities() - - local lspconfig = require('lspconfig') - - local servers = { 'clangd', 'rust_analyzer', 'pyright', 'tsserver' } - for _, lsp in ipairs(servers) do - lspconfig[lsp].setup { - -- on_attach = my_custom_on_attach, - capabilities = capabilities, - } - end - - local luasnip = require 'luasnip' - - local cmp = require 'cmp' - cmp.setup { - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - mapping = cmp.mapping.preset.insert({ - ['<C-d>'] = cmp.mapping.scroll_docs(-4), - ['<C-f>'] = cmp.mapping.scroll_docs(4), - ['<C-Space>'] = cmp.mapping.complete(), - ['<CR>'] = cmp.mapping.confirm { - behavior = cmp.ConfirmBehavior.Replace, - select = true, - }, - ['<Tab>'] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - else - fallback() - end - end, { 'i', 's' }), - ['<S-Tab>'] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { 'i', 's' }), - }), - sources = { - { name = 'nvim_lsp' }, - { name = 'luasnip' }, - }, - } -#+end_src diff --git a/config/nvim/lua/behaviour.org b/config/nvim/lua/behaviour.org index d843d7b..871b65e 100644 --- a/config/nvim/lua/behaviour.org +++ b/config/nvim/lua/behaviour.org @@ -1,7 +1,7 @@ #+title: Neovim Behaviour Settings Use tabs with width 4. -#+begin_src lua :tangle yes +#+begin_src lua :tangle ~/.config/nvim/lua/behaviour.lua :mkdirp yes vim.opt.tabstop = 4 vim.opt.expandtab = true vim.opt.shiftwidth = 4 @@ -9,11 +9,11 @@ Use tabs with width 4. #+end_src Better command line completion. -#+begin_src lua :tangle yes +#+begin_src lua :tangle ~/.config/nvim/lua/behaviour.lua :mkdirp yes vim.opt.wildmode = 'longest,list' #+end_src Better management of file types. -#+begin_src lua :tangle yes +#+begin_src lua :tangle ~/.config/nvim/lua/behaviour.lua :mkdirp yes vim.cmd('filetype plugin indent on') #+end_src diff --git a/config/nvim/lua/format.org b/config/nvim/lua/format.org deleted file mode 100644 index 5b362d0..0000000 --- a/config/nvim/lua/format.org +++ /dev/null @@ -1,25 +0,0 @@ -#+title: Neovim Formatting Settings -Turn on =clang-format= in C, CUDA, C++, C#, Java, JavaScript, and JSON. -#+begin_src lua :tangle yes - vim.cmd([[ - let g:clang_format#code_style = 'file' - autocmd FileType c ClangFormatAutoEnable - autocmd FileType cuda ClangFormatAutoEnable - autocmd FileType cpp ClangFormatAutoEnable - autocmd FileType cs ClangFormatAutoEnable - autocmd FileType java ClangFormatAutoEnable - autocmd FileType javascript ClangFormatAutoEnable - autocmd FileType json ClangFormatAutoEnable - let g:vimtex_view_method = 'skim' - ]]) -#+end_src - -Auto-format Rust on save. -#+begin_src lua :tangle yes - vim.g.rustfmt_autosave = 1 -#+end_src - -Start making a table by placing a =|=. -#+begin_src lua :tangle yes - vim.g.table_mode_corner = '|' -#+end_src diff --git a/config/nvim/lua/index.org b/config/nvim/lua/index.org new file mode 100644 index 0000000..4af8e20 --- /dev/null +++ b/config/nvim/lua/index.org @@ -0,0 +1,11 @@ +#+title: Dotfiles =/.config/nvim/lua= + +This is where the modular components of my Neovim configuration are stored. + +* Directories +- [[../index.org][../]] + +* Files +- [[./appearance.org][appearance.lua]] +- [[./behaviour.org][behaviour.lua]] +- [[./plugins.org][plugins.lua]] diff --git a/config/nvim/lua/languageServers.org b/config/nvim/lua/languageServers.org deleted file mode 100644 index 8861ace..0000000 --- a/config/nvim/lua/languageServers.org +++ /dev/null @@ -1,92 +0,0 @@ -#+title: Neovim Language Server Configuration -* Keybindings -Set keys for LSP auto-completion. -#+begin_src lua :tangle yes - vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts) - vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts) - vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts) - vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts) - - -- Use an on_attach function to only map the following keys - -- after the language server attaches to the current buffer - local on_attach = function(client, bufnr) - -- Enable completion triggered by <c-x><c-o> - vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') - - local bufopts = { noremap=true, silent=true, buffer=bufnr } - vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts) - vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts) - vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts) - vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts) - vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts) - vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, bufopts) - vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, bufopts) - vim.keymap.set('n', '<space>wl', function() - print(vim.inspect(vim.lsp.buf.list_workspace_folders())) - end, bufopts) - vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts) - vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts) - vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts) - vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts) - vim.keymap.set('n', '<space>f', function() vim.lsp.buf.format { async = true } end, bufopts) - end -#+end_src - -* Languages -Turn on LSP for various languages. -#+begin_src lua :tangle yes - require('lspconfig')['awk_ls'].setup{ - on_attach = on_attach, - flags = lsp_flags, - } - - require('lspconfig')['bashls'].setup{ - on_attach = on_attach, - flags = lsp_flags, - } - - require('lspconfig')['fortls'].setup{ - on_attach = on_attach, - flags = lsp_flags, - } - - require('lspconfig')['hls'].setup{ - on_attach = on_attach, - flags = lsp_flags - } - - require('lspconfig')['pyright'].setup{ - on_attach = on_attach, - flags = lsp_flags, - } - - require('lspconfig')['tsserver'].setup{ - on_attach = on_attach, - flags = lsp_flags, - } - - require('lspconfig')['rust_analyzer'].setup{ - on_attach = on_attach, - flags = lsp_flags, - settings = { - ["rust-analyzer"] = {} - } - } - - require('lspconfig')['gopls'].setup{ - on_attach = on_attach, - flags = lsp_flags - } - - require('lspconfig')['clangd'].setup{ - on_attach = on_attach, - flags = lsp_flags - } - - require('lspconfig')['texlab'].setup{ - on_attach = on_attach, - flags = lsp_flags - } - - require('lspconfig')['perlpls'].setup{} -#+end_src diff --git a/config/nvim/lua/plugins.org b/config/nvim/lua/plugins.org index 0dab41b..2093a53 100644 --- a/config/nvim/lua/plugins.org +++ b/config/nvim/lua/plugins.org @@ -1,7 +1,7 @@ #+title: Neovim Plugins * Setup -Use =lazy= to manage plugins. -#+begin_src lua :tangle yes +Use =lazy= to manage plugins. This block activates =lazy=. +#+begin_src lua :tangle ~/.config/nvim/lua/plugins.lua :mkdirp yes local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not vim.loop.fs_stat(lazypath) then vim.fn.system({ @@ -9,7 +9,7 @@ Use =lazy= to manage plugins. "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", - "--branch=stable", -- latest stable release + "--branch=stable", lazypath, }) end @@ -17,33 +17,12 @@ Use =lazy= to manage plugins. #+end_src * Plugins -Install plugins here. -#+begin_src lua :tangle yes -require('lazy').setup({ - 'itchyny/lightline.vim', - 'ayu-theme/ayu-vim', - 'Raimondi/delimitMate', - 'bronson/vim-trailing-whitespace', - 'dhruvasagar/vim-table-mode', - 'rhysd/vim-clang-format', - 'chrisbra/csv.vim', - 'neovim/nvim-lspconfig', - { - 'nvim-treesitter/nvim-treesitter', - cmd = 'TSUpdate' - }, - 'junegunn/fzf', - 'junegunn/fzf.vim', - 'hrsh7th/nvim-cmp', - 'hrsh7th/cmp-nvim-lsp', - 'saadparwaiz1/cmp_luasnip', - 'L3MON4D3/LuaSnip', - { - 'fatih/vim-go', - cmd = 'GoUpdateBinaries', - }, - 'rust-lang/rust.vim', - 'neovimhaskell/haskell-vim', - 'lervag/vimtex', -}) +I use =lightline= for a nice status bar. The Ayu theme matches my overall colour scheme. =delimitmate= provides better delimiter handling. Trailing whitespace is highlighted with =vim-trailing-whitespace=. +#+begin_src lua :tangle ~/.config/nvim/lua/plugins.lua :mkdirp yes + require('lazy').setup({ + 'itchyny/lightline.vim', + 'ayu-theme/ayu-vim', + 'Raimondi/delimitMate', + 'bronson/vim-trailing-whitespace', + }) #+end_src diff --git a/config/sway/config.org b/config/sway/config.org index b4923e6..effe735 100644 --- a/config/sway/config.org +++ b/config/sway/config.org @@ -1,12 +1,12 @@ #+title: Sway Configuration * Variables Use =super= as modifier key. -#+begin_src conf :tangle config +#+begin_src conf :tangle ~/.config/sway/config :mkdirp yes set $mod Mod4 #+end_src Use =vi= motions as directional inputs. -#+begin_src conf :tangle config +#+begin_src conf :tangle ~/.config/sway/config :mkdirp yes set $left h set $down j set $up k @@ -14,72 +14,77 @@ Use =vi= motions as directional inputs. #+end_src Use =foot= as default terminal. -#+begin_src conf :tangle config +#+begin_src conf :tangle ~/.config/sway/config :mkdirp yes set $term foot #+end_src Use =wofi= as app launcher. -#+begin_src conf :tangle config +#+begin_src conf :tangle ~/.config/sway/config :mkdirp yes set $menu wofi --show drun --allow-images #+end_src * Startup Application Use =dbus= environment. -#+begin_src conf :tangle config +#+begin_src conf :tangle ~/.config/sway/config :mkdirp yes exec --no-startup-id dbus-update-activation-environment --all #+end_src Use =mako= as notification daemon. -#+begin_src conf :tangle config +#+begin_src conf :tangle ~/.config/sway/config :mkdirp yes exec mako #+end_src Launch PipeWire without =systemd=. -#+begin_src conf :tangle config +#+begin_src conf :tangle ~/.config/sway/config :mkdirp yes exec gentoo-pipewire-launcher & #+end_src Launch =blueman-applet= as Bluetooth daemon. -#+begin_src conf :tangle config +#+begin_src conf :tangle ~/.config/sway/config :mkdirp yes exec blueman-applet #+end_src Launch music player daemon. -#+begin_src conf :tangle config +#+begin_src conf :tangle ~/.config/sway/config :mkdirp yes exec mpd #+end_src Launch =mpdscribble= as scrobbler daemon. -#+begin_src conf :tangle config +#+begin_src conf :tangle ~/.config/sway/config :mkdirp yes exec mpdscribble #+end_src +Launch Emacs daemon. +#+begin_src conf :tangle ~/.config/sway/config :mkdirp yes + exec emacs --daemon +#+end_src + * Display I use a vertical monitor on the left and horizontal monitor on the right. -#+begin_src conf :tangle config +#+begin_src conf :tangle ~/.config/sway/config :mkdirp yes output HDMI-A-1 resolution 1920x1080 position 1080 140 output HDMI-A-2 resolution 1920x1080 transform 90 position 0 0 #+end_src Use the file at =~/.wallpaper= as my wallpaper. -#+begin_src conf :tangle config +#+begin_src conf :tangle ~/.config/sway/config :mkdirp yes output * bg ~/.wallpaper fill #+end_src Remove borders from windows. -#+begin_src conf :tangle config +#+begin_src conf :tangle ~/.config/sway/config :mkdirp yes default_border none default_floating_border none font pango:monospace 1 #+end_src Use 10 pixel gaps. -#+begin_src conf :tangle config +#+begin_src conf :tangle ~/.config/sway/config :mkdirp yes gaps inner 10 #+end_src Use =waybar= as a top bar. -#+begin_src conf :tangle config +#+begin_src conf :tangle ~/.config/sway/config :mkdirp yes bar { position top @@ -90,7 +95,7 @@ Use =waybar= as a top bar. * Input Use pointer acceleration. -#+begin_src conf :tangle config +#+begin_src conf :tangle ~/.config/sway/config :mkdirp yes input * { accel_profile "adaptive" pointer_accel -.5 @@ -99,44 +104,44 @@ Use pointer acceleration. * Controls Add ability to lock the screen with =swaylock=. Turn off the screen after 15 seconds on lock screen. -#+begin_src conf :tangle config +#+begin_src conf :tangle ~/.config/sway/config :mkdirp yes bindsym $mod+Control+l exec swaylock --ignore-empty-password --show-failed-attempts --image ~/.wallpaper exec swayidle -w timeout 15 'if pgrep -x swaylock; then swaymsg "output * power off"; fi' resume 'swaymsg "output * power on"' #+end_src Add keybinding to open a terminal emulator. -#+begin_src conf :tangle config +#+begin_src conf :tangle ~/.config/sway/config :mkdirp yes bindsym $mod+Return exec $term #+end_src Add keybinding for killing a window. -#+begin_src conf :tangle config +#+begin_src conf :tangle ~/.config/sway/config :mkdirp yes bindsym $mod+Shift+q kill #+end_src Add keybinding for opening an app launcher. -#+begin_src conf :tangle config +#+begin_src conf :tangle ~/.config/sway/config :mkdirp yes bindsym $mod+d exec $menu #+end_src Holding the modifier key allows moving a window. -#+begin_src conf :tangle config +#+begin_src conf :tangle ~/.config/sway/config :mkdirp yes floating_modifier $mod normal #+end_src Add keybinding for reloading the configuration. -#+begin_src conf :tangle config +#+begin_src conf :tangle ~/.config/sway/config :mkdirp yes bindsym $mod+Shift+c reload #+end_src Add keybinding to launch logout/power off/restart [[file:powerprompt.org][prompt]] which also activates with the power key. -#+begin_src conf :tangle config +#+begin_src conf :tangle ~/.config/sway/config :mkdirp yes bindsym $mod+Shift+e exec bash ~/.config/sway/powerprompt bindsym XF86PowerOff exec bash ~/.config/sway/powerprompt #+end_src Change focus keybindings. -#+begin_src conf :tangle config +#+begin_src conf :tangle ~/.config/sway/config :mkdirp yes bindsym $mod+$left focus left bindsym $mod+$down focus down bindsym $mod+$up focus up @@ -149,7 +154,7 @@ Change focus keybindings. #+end_src Move window keybindings. -#+begin_src conf :tangle config +#+begin_src conf :tangle ~/.config/sway/config :mkdirp yes bindsym $mod+Shift+$left move left bindsym $mod+Shift+$down move down bindsym $mod+Shift+$up move up @@ -162,7 +167,7 @@ Move window keybindings. #+end_src Change workspace keybindings. -#+begin_src conf :tangle config +#+begin_src conf :tangle ~/.config/sway/config :mkdirp yes bindsym $mod+1 workspace number 1 bindsym $mod+2 workspace number 2 bindsym $mod+3 workspace number 3 @@ -176,7 +181,7 @@ Change workspace keybindings. #+end_src Move window to workspace keybindings. -#+begin_src conf :tangle config +#+begin_src conf :tangle ~/.config/sway/config :mkdirp yes bindsym $mod+Shift+1 move container to workspace number 1 bindsym $mod+Shift+2 move container to workspace number 2 bindsym $mod+Shift+3 move container to workspace number 3 @@ -190,44 +195,44 @@ Move window to workspace keybindings. #+end_src Set split direction keybindings. -#+begin_src conf :tangle config +#+begin_src conf :tangle ~/.config/sway/config :mkdirp yes bindsym $mod+v splith bindsym $mod+s splitv #+end_src Toggle layout keybindings. -#+begin_src conf :tangle config +#+begin_src conf :tangle ~/.config/sway/config :mkdirp yes bindsym $mod+e layout toggle split #+end_src Define full screen keybinding. -#+begin_src conf :tangle config +#+begin_src conf :tangle ~/.config/sway/config :mkdirp yes bindsym $mod+f fullscreen #+end_src Define toggle floating keybinding. -#+begin_src conf :tangle config +#+begin_src conf :tangle ~/.config/sway/config :mkdirp yes bindsym $mod+Shift+space floating toggle #+end_src Move focus between floating and tiled layer keybinding. -#+begin_src conf :tangle config +#+begin_src conf :tangle ~/.config/sway/config :mkdirp yes bindsym $mod+space focus mode_toggle #+end_src Focus on the parent window keybinding. -#+begin_src conf :tangle config +#+begin_src conf :tangle ~/.config/sway/config :mkdirp yes bindsym $mod+a focus parent #+end_src Keybindings to move a window to the scratchpad and back from it. -#+begin_src conf :tangle config +#+begin_src conf :tangle ~/.config/sway/config :mkdirp yes bindsym $mod+Shift+minus move scratchpad bindsym $mod+minus scratchpad show #+end_src Add resize keybindings. -#+begin_src conf :tangle config +#+begin_src conf :tangle ~/.config/sway/config :mkdirp yes mode "resize" { bindsym $left resize shrink width 10px bindsym $down resize grow height 10px @@ -246,24 +251,24 @@ Add resize keybindings. #+end_src Add screenshot keybinding. -#+begin_src conf :tangle config +#+begin_src conf :tangle ~/.config/sway/config :mkdirp yes bindsym $mod+Shift+s exec grim -g "$(slurp)" - | wl-copy #+end_src Add volume keybindings. -#+begin_src conf :tangle config +#+begin_src conf :tangle ~/.config/sway/config :mkdirp yes bindsym XF86AudioRaiseVolume exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+ bindsym XF86AudioLowerVolume exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- bindsym XF86AudioMute exec wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle #+end_src Add pause keybinding. -#+begin_src conf :tangle config +#+begin_src conf :tangle ~/.config/sway/config :mkdirp yes bindsym XF86Eject exec mpc toggle #+end_src * Extras Load extra configuration. -#+begin_src conf :tangle config +#+begin_src conf :tangle ~/.config/sway/config :mkdirp yes include /etc/sway/config.d/* #+end_src diff --git a/config/sway/index.org b/config/sway/index.org new file mode 100644 index 0000000..4a19442 --- /dev/null +++ b/config/sway/index.org @@ -0,0 +1,11 @@ +#+title: Dotfiles =/.config/sway= + +This is my Sway configuration. + +* Directories +- [[../index.org][../]] + +* Files +- [[./config.org][config]] +- [[./poweraction.org][poweraction]] +- [[./powerprompt.org][powerprompt]] diff --git a/config/sway/poweraction.org b/config/sway/poweraction.org index 72931c7..68105ca 100644 --- a/config/sway/poweraction.org +++ b/config/sway/poweraction.org @@ -1,6 +1,6 @@ #+title: Sway Power Action Script -Run this shell script from power off menu to either log off or power off. -#+begin_src sh :tangle poweraction +Run this shell script from power off menu to either log off, restart, or power off. +#+begin_src sh :tangle ~/.config/sway/poweraction :mkdirp yes rm ~/.swaynaglock case $1 in logout) swaymsg exit;; diff --git a/config/sway/powerprompt.org b/config/sway/powerprompt.org index 796bead..dcc93fd 100644 --- a/config/sway/powerprompt.org +++ b/config/sway/powerprompt.org @@ -1,6 +1,6 @@ #+title: Sway Power Prompt Script Activate =swaynag= prompt with power-off options if the lock file is not present which executes an [[file:poweraction.org][action]]. -#+begin_src sh :tangle powerprompt +#+begin_src sh :tangle ~/.config/sway/powerprompt :mkdirp yes if test -f ~/.swaynaglock; then killall swaynag rm ~/.swaynaglock diff --git a/config/waybar/config.org b/config/waybar/config.org index a23d887..ebbbc81 100644 --- a/config/waybar/config.org +++ b/config/waybar/config.org @@ -1,18 +1,18 @@ #+title: Waybar Configuration * Layout -Define the layout of the bar. -#+begin_src js-json :tangle config - { - "height": 30, - "spacing": 4, - "modules-left": ["sway/workspaces", "sway/scratchpad"], - "modules-center": ["sway/window"], - "modules-right": ["mpd", "pulseaudio", "network", "cpu", "memory", "clock", "tray"], +Define the layout of the bar with workspaces and scratchpad on the left, the current window in the middle, and music player daemon, sound, network, CPU usage, memory usage, clock, and system tray on the right. +#+begin_src js-json :tangle ~/.config/waybar/config :mkdirp yes + { + "height": 30, + "spacing": 4, + "modules-left": ["sway/workspaces", "sway/scratchpad"], + "modules-center": ["sway/window"], + "modules-right": ["mpd", "pulseaudio", "network", "cpu", "memory", "clock", "tray"], #+end_src * Components -Define scratchpad component. -#+begin_src js-json :tangle config +Define scratchpad component. To show an icon and the count of items in it. +#+begin_src js-json :tangle ~/.config/waybar/config :mkdirp yes "sway/scratchpad": { "format": "{icon} {count}", "show-empty": false, @@ -22,8 +22,8 @@ Define scratchpad component. }, #+end_src -Define music player daemon component. -#+begin_src js-json :tangle config +Define music player daemon component to list the current song, album, artist, and position in the song with an icon representing the status. Clicking it opens a TUI interface to the daemon. +#+begin_src js-json :tangle ~/.config/waybar/config :mkdirp yes "mpd": { "format": "{stateIcon} {artist} - {album} - {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S}) [{songPosition}|{queueLength}] 🎵", "format-disconnected": "Disconnected 🎵", @@ -41,7 +41,7 @@ Define music player daemon component. #+end_src Define tray component. -#+begin_src js-json :tangle config +#+begin_src js-json :tangle ~/.config/waybar/config :mkdirp yes "tray": { "icon-size": 21, "spacing": 10, @@ -49,31 +49,31 @@ Define tray component. }, #+end_src -Define clock component. -#+begin_src js-json :tangle config +Define clock component to show the current time and a calendar in a tooltip. +#+begin_src js-json :tangle ~/.config/waybar/config :mkdirp yes "clock": { "format": "{:%H:%M\t%Y-%m-%d}", "tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>" }, #+end_src -Define CPU usage component. -#+begin_src js-json :tangle config +Define CPU usage component to show usage in percent with an icon. +#+begin_src js-json :tangle ~/.config/waybar/config :mkdirp yes "cpu": { "format": "{usage}% ", "tooltip": false }, #+end_src -Define memory usage component. -#+begin_src js-json :tangle config +Define memory usage component to show usage in percent with an icon. +#+begin_src js-json :tangle ~/.config/waybar/config :mkdirp yes "memory": { "format": "{}% " }, #+end_src -Define network component. -#+begin_src js-json :tangle config +Define network component to show a Wi-Fi icon if connected and a warning signal if not. +#+begin_src js-json :tangle ~/.config/waybar/config :mkdirp yes "network": { // "interface": "wlp2*", // (Optional) To force the use of this interface "format-wifi": "", @@ -85,8 +85,8 @@ Define network component. }, #+end_src -Define audio component. -#+begin_src js-json :tangle config +Define audio component to show the volume level and whether or not it is muted with an icon. Clicking it opens a GUI sound menu. +#+begin_src js-json :tangle ~/.config/waybar/config :mkdirp yes "pulseaudio": { // "scroll-step": 1, // %, can be a float "format": "{volume}% {icon}", diff --git a/config/waybar/index.org b/config/waybar/index.org new file mode 100644 index 0000000..b147916 --- /dev/null +++ b/config/waybar/index.org @@ -0,0 +1,9 @@ +#+title: Dotfiles =/.config/waybar= +This is where my Waybar configuration is located. + +* Directories +- [[../index.org][../]] + +* Files +- [[./config.org][config]] +- [[./style.org][style.css]] diff --git a/config/waybar/style.org b/config/waybar/style.org index 193b465..3f2ae62 100644 --- a/config/waybar/style.org +++ b/config/waybar/style.org @@ -1,7 +1,6 @@ #+title: Waybar Styling -* Global -Set global font, colours, and transitions. -#+begin_src css :tangle yes +Set global font, colours, and transitions to have a transparent background. The text is white with a small shadow. +#+begin_src css :tangle ~/.config/waybar/style.css :mkdirp yes window#waybar { font-family: FontAwesome, Roboto, Helvetica, Arial, sans-serif; font-size: 13px; @@ -13,26 +12,24 @@ Set global font, colours, and transitions. } #+end_src -* Button -Set global button styling. -#+begin_src css :tangle yes +Remove the border from buttons and make them square. +#+begin_src css :tangle ~/.config/waybar/style.css :mkdirp yes button { - box-shadow: inset 0 -3px transparent; border: none; border-radius: 0; } #+end_src -Set button hover styling -#+begin_src css :tangle yes +Hovering over a button should inherit the background colour and add a white border to the bottom. +#+begin_src css :tangle ~/.config/waybar/style.css :mkdirp yes button:hover { background: inherit; box-shadow: inset 0 -3px #ffffff; } #+end_src -Set workspace button styling. -#+begin_src css :tangle yes +Workspace buttons should have white with a small shadow, a little bit of extra horizontal padding, and a transparent background. +#+begin_src css :tangle ~/.config/waybar/style.css :mkdirp yes #workspaces button { padding: 0 5px; text-shadow: 1px 1px #64727D; @@ -41,40 +38,30 @@ Set workspace button styling. } #+end_src -Set button hover styling in workspaces. -#+begin_src css :tangle yes +Hovering over a workspace button should darken it. +#+begin_src css :tangle ~/.config/waybar/style.css :mkdirp yes #workspaces button:hover { background: rgba(0, 0, 0, 0.2); } #+end_src -Set button focused styling in workspaces. -#+begin_src css :tangle yes +The focused workspace should have a white bottom border. +#+begin_src css :tangle ~/.config/waybar/style.css :mkdirp yes #workspaces button.focused { background: transparent; - text-shadow: 1px 1px #64727D; box-shadow: inset 0 -3px #ffffff; } #+end_src -Set button urgent styling in workspaces. -#+begin_src css :tangle yes +Urgent workspaces should be red. +#+begin_src css :tangle ~/.config/waybar/style.css :mkdirp yes #workspaces button.urgent { background-color: #eb4d4b; } #+end_src -* Modes -Set global mode styling. -#+begin_src css :tangle yes - #mode { - background-color: #64727D; - border-bottom: 3px solid #ffffff; - } -#+end_src - -Set typical mode styling. -#+begin_src css :tangle yes +Add extra horizontal padding where needed. +#+begin_src css :tangle ~/.config/waybar/style.css :mkdirp yes #clock, #cpu, #memory, @@ -88,20 +75,19 @@ Set typical mode styling. #scratchpad, #mpd { padding: 0 10px; - color: #ffffff; } #+end_src -Add margins for workspaces and windows. -#+begin_src css :tangle yes +Add extra horizontal margins where needed. +#+begin_src css :tangle ~/.config/waybar/style.css :mkdirp yes #window, #workspaces { margin: 0 4px; } #+end_src -Omit margins on leftmost and rightmost workspaces. -#+begin_src css :tangle yes +Omit margins on the leftmost and rightmost workspaces. +#+begin_src css :tangle ~/.config/waybar/style.css :mkdirp yes .modules-left > widget:first-child > #workspaces { margin-left: 0; } @@ -112,31 +98,27 @@ Omit margins on leftmost and rightmost workspaces. } #+end_src -Set focus styling. -#+begin_src css :tangle yes - label:focus { - background-color: #000000; - } -#+end_src - -Set important mode styling. -#+begin_src css :tangle yes +Passive system tray icons are dimmed. +#+begin_src css :tangle ~/.config/waybar/style.css :mkdirp yes #tray > .passive { -gtk-icon-effect: dim; } +#+end_src +Tray icons that need attention are highlighted. +#+begin_src css :tangle ~/.config/waybar/style.css :mkdirp yes #tray > .needs-attention { -gtk-icon-effect: highlight; } #+end_src -Set scratchpad styling. -#+begin_src css :tangle yes +The scratchpad should be darkened and transparent when empty. +#+begin_src css :tangle ~/.config/waybar/style.css :mkdirp yes #scratchpad { background: rgba(0, 0, 0, 0.2); } #scratchpad.empty { - background-color: transparent; + background-color: transparent; } #+end_src |