From 7b0ea5cbdaaa5b8392777ad207c74cb27411eab1 Mon Sep 17 00:00:00 2001 From: Jacob Janzen Date: Tue, 1 Oct 2024 17:42:59 -0500 Subject: the big refactor --- .gitignore | 1 + Makefile | 61 +++- common/.clang-format.org | 9 + common/.config/alacritty/alacritty.toml.org | 55 +++ common/.config/emacs/feed.org.org | 39 ++ common/.config/emacs/force-custom-file.el.org | 8 + common/.config/emacs/init.el.org | 10 + common/.config/emacs/languages.el.org | 148 ++++++++ common/.config/emacs/package-setup.el.org | 25 ++ common/.config/emacs/tools.el.org | 391 ++++++++++++++++++++ common/.config/emacs/user-interface.el.org | 131 +++++++ common/.config/fastfetch/config.jsonc.org | 92 +++++ common/.config/fastfetch/config.org | 92 ----- common/.config/nvim/init.lua.org | 27 ++ common/.config/nvim/init.org | 27 -- common/.config/nvim/lua/appearance.lua.org | 15 + common/.config/nvim/lua/appearance.org | 15 - common/.config/nvim/lua/behaviour.lua.org | 19 + common/.config/nvim/lua/behaviour.org | 19 - common/.config/nvim/lua/plugins.lua.org | 27 ++ common/.config/nvim/lua/plugins.org | 27 -- common/.config/sketchybar/plugins/battery.sh.org | 46 +++ common/.config/sketchybar/plugins/clock.sh.org | 7 + common/.config/sketchybar/plugins/cpu.sh.org | 7 + common/.config/sketchybar/plugins/front_app.sh.org | 9 + common/.config/sketchybar/plugins/mem.sh.org | 16 + common/.config/sketchybar/plugins/space.sh.org | 7 + common/.config/sketchybar/plugins/volume.sh.org | 21 ++ common/.config/sketchybar/sketchybarrc.org | 77 ++++ common/.config/skhd/skhdrc.org | 80 +++++ common/.config/yabai/yabairc.org | 68 ++++ common/.gitconfig.org.gpg | Bin 0 -> 929 bytes common/.local/share/fonts/NFM.tar.gz | Bin 2150400 -> 0 bytes common/.profile.org | 19 + common/.zshrc.org | 130 +++++++ common/clang-format.org | 9 - common/gitconfig.org.gpg | Bin 929 -> 0 bytes common/profile.org | 19 - common/zshrc.org | 130 ------- extract_src.py | 4 + install | 83 ----- macos.local/.clang-format.org | 1 + macos.local/.config/alacritty | 1 + macos.local/.config/emacs | 1 + macos.local/.config/fastfetch | 1 + macos.local/.config/nvim | 1 + macos.local/.config/sketchybar | 1 + macos.local/.config/skhd | 1 + macos.local/.config/yabai | 1 + macos.local/.gitconfig.org.gpg | 1 + macos.local/.gnupg/gpg-agent.org | 6 + macos.local/.local/bin/launcher.org | 13 + macos.local/.local/share/fonts | 1 + macos.local/.profile.org | 1 + macos.local/.ssh/config.org | 12 + macos.local/.wallpaper | 1 + macos.local/.zshrc.org | 1 + .../Emacs.app/Contents/MacOS/Emacs.org | 9 + macos/.config/alacritty/alacritty.org | 55 --- macos/.config/emacs | 1 - macos/.config/fastfetch | 1 - macos/.config/nvim | 1 - macos/.config/sketchybar/plugins/battery.org | 46 --- macos/.config/sketchybar/plugins/clock.org | 7 - macos/.config/sketchybar/plugins/cpu.org | 7 - macos/.config/sketchybar/plugins/front_app.org | 9 - macos/.config/sketchybar/plugins/mem.org | 16 - macos/.config/sketchybar/plugins/space.org | 7 - macos/.config/sketchybar/plugins/volume.org | 21 -- macos/.config/sketchybar/sketchybarrc.org | 77 ---- macos/.config/skhd/skhdrc.org | 80 ----- macos/.config/yabai/yabairc.org | 68 ---- macos/.gnupg/gpg-agent.org | 6 - macos/.local/bin/launcher.org | 13 - macos/.local/share/fonts | 1 - macos/.ssh/config.org | 12 - macos/.wallpaper | 1 - .../Emacs.app/Contents/MacOS/Emacs.org | 9 - macos/clang-format.org | 1 - macos/gitconfig.org.gpg | 1 - macos/profile.org | 1 - macos/zshrc.org | 1 - nixos/.flake/home/programs/emacs/feed.org.org | 40 +-- .../home/programs/emacs/force-custom-file.el.org | 9 +- nixos/.flake/home/programs/emacs/languages.el.org | 149 +------- .../home/programs/emacs/package-setup.el.org | 26 +- nixos/.flake/home/programs/emacs/tools.el.org | 392 +-------------------- .../home/programs/emacs/user-interface.el.org | 132 +------ 88 files changed, 1603 insertions(+), 1610 deletions(-) create mode 100644 .gitignore create mode 100644 common/.clang-format.org create mode 100644 common/.config/alacritty/alacritty.toml.org create mode 100644 common/.config/emacs/feed.org.org create mode 100644 common/.config/emacs/force-custom-file.el.org create mode 100644 common/.config/emacs/init.el.org create mode 100644 common/.config/emacs/languages.el.org create mode 100644 common/.config/emacs/package-setup.el.org create mode 100644 common/.config/emacs/tools.el.org create mode 100644 common/.config/emacs/user-interface.el.org create mode 100644 common/.config/fastfetch/config.jsonc.org delete mode 100644 common/.config/fastfetch/config.org create mode 100644 common/.config/nvim/init.lua.org delete mode 100644 common/.config/nvim/init.org create mode 100644 common/.config/nvim/lua/appearance.lua.org delete mode 100644 common/.config/nvim/lua/appearance.org create mode 100644 common/.config/nvim/lua/behaviour.lua.org delete mode 100644 common/.config/nvim/lua/behaviour.org create mode 100644 common/.config/nvim/lua/plugins.lua.org delete mode 100644 common/.config/nvim/lua/plugins.org create mode 100755 common/.config/sketchybar/plugins/battery.sh.org create mode 100755 common/.config/sketchybar/plugins/clock.sh.org create mode 100755 common/.config/sketchybar/plugins/cpu.sh.org create mode 100755 common/.config/sketchybar/plugins/front_app.sh.org create mode 100755 common/.config/sketchybar/plugins/mem.sh.org create mode 100755 common/.config/sketchybar/plugins/space.sh.org create mode 100755 common/.config/sketchybar/plugins/volume.sh.org create mode 100755 common/.config/sketchybar/sketchybarrc.org create mode 100644 common/.config/skhd/skhdrc.org create mode 100644 common/.config/yabai/yabairc.org create mode 100644 common/.gitconfig.org.gpg delete mode 100644 common/.local/share/fonts/NFM.tar.gz create mode 100644 common/.profile.org create mode 100644 common/.zshrc.org delete mode 100644 common/clang-format.org delete mode 100644 common/gitconfig.org.gpg delete mode 100644 common/profile.org delete mode 100644 common/zshrc.org mode change 100644 => 100755 extract_src.py delete mode 100755 install create mode 120000 macos.local/.clang-format.org create mode 120000 macos.local/.config/alacritty create mode 120000 macos.local/.config/emacs create mode 120000 macos.local/.config/fastfetch create mode 120000 macos.local/.config/nvim create mode 120000 macos.local/.config/sketchybar create mode 120000 macos.local/.config/skhd create mode 120000 macos.local/.config/yabai create mode 120000 macos.local/.gitconfig.org.gpg create mode 100644 macos.local/.gnupg/gpg-agent.org create mode 100755 macos.local/.local/bin/launcher.org create mode 120000 macos.local/.local/share/fonts create mode 120000 macos.local/.profile.org create mode 100644 macos.local/.ssh/config.org create mode 120000 macos.local/.wallpaper create mode 120000 macos.local/.zshrc.org create mode 100755 macos.local/Applications/Emacs.app/Contents/MacOS/Emacs.org delete mode 100644 macos/.config/alacritty/alacritty.org delete mode 120000 macos/.config/emacs delete mode 120000 macos/.config/fastfetch delete mode 120000 macos/.config/nvim delete mode 100644 macos/.config/sketchybar/plugins/battery.org delete mode 100644 macos/.config/sketchybar/plugins/clock.org delete mode 100644 macos/.config/sketchybar/plugins/cpu.org delete mode 100644 macos/.config/sketchybar/plugins/front_app.org delete mode 100644 macos/.config/sketchybar/plugins/mem.org delete mode 100644 macos/.config/sketchybar/plugins/space.org delete mode 100644 macos/.config/sketchybar/plugins/volume.org delete mode 100644 macos/.config/sketchybar/sketchybarrc.org delete mode 100644 macos/.config/skhd/skhdrc.org delete mode 100644 macos/.config/yabai/yabairc.org delete mode 100644 macos/.gnupg/gpg-agent.org delete mode 100644 macos/.local/bin/launcher.org delete mode 120000 macos/.local/share/fonts delete mode 100644 macos/.ssh/config.org delete mode 120000 macos/.wallpaper delete mode 100644 macos/Applications/Emacs.app/Contents/MacOS/Emacs.org delete mode 120000 macos/clang-format.org delete mode 120000 macos/gitconfig.org.gpg delete mode 120000 macos/profile.org delete mode 120000 macos/zshrc.org mode change 100644 => 120000 nixos/.flake/home/programs/emacs/feed.org.org mode change 100644 => 120000 nixos/.flake/home/programs/emacs/force-custom-file.el.org mode change 100644 => 120000 nixos/.flake/home/programs/emacs/languages.el.org mode change 100644 => 120000 nixos/.flake/home/programs/emacs/package-setup.el.org mode change 100644 => 120000 nixos/.flake/home/programs/emacs/tools.el.org mode change 100644 => 120000 nixos/.flake/home/programs/emacs/user-interface.el.org diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..90c47da --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +tmp.org diff --git a/Makefile b/Makefile index c03029d..266e19d 100644 --- a/Makefile +++ b/Makefile @@ -1,38 +1,89 @@ -.PHONY: install update nixos-update nixos-install +.PHONY: install update macos-update macos-install nixos-update nixos-install fonts -SYSTEM = $(shell uname -n) +# Determine the current system from its hostname. +# My university network changes my hostname on my laptop. I use the disgusting system_profiler pipeline to get the real hostname +# if the uname command fails +SYSTEM := $(shell uname -n) +ifeq ($(wildcard src/$(project)/*),) + SYSTEM = $(shell system_profiler SPSoftwareDataType | grep "Computer Name" | xargs | sed 's/Computer Name: //' | sed 's/$$/.local/') +endif + +# Set directories SRCDIR = ./$(SYSTEM) DSTDIR = $(HOME) +FONTSDIR = .local/share/fonts +# Get the list of files that need to be generated SOURCES := $(shell find -L $(SRCDIR)/ -type f) -CONFIGS := $(subst $(SRCDIR)/,$(DSTDIR)/,$(SOURCES:%.org=%)) +NOGPG := $(SOURCES:%.gpg=%) +NOORG := $(NOGPG:%.org=%) +CONFIGS := $(subst $(SRCDIR)/,$(DSTDIR)/,$(NOORG)) +# Set any extra targets based on the hostname UPDATE_TARGET := INSTALL_TARGET := - ifeq ($(SYSTEM), nixos) UPDATE_TARGET += nixos-update INSTALL_TARGET += nixos-install +else ifeq ($(SYSTEM), macos.local) + UPDATE_TARGET += macos-update + INSTALL_TARGET += macos-install endif +# update by default, install first all: update - update: install $(UPDATE_TARGET) +# install configs and any additional targets install: $(CONFIGS) $(INSTALL_TARGET) +# ignored files +%.tar.gz: + : + +# install encrypted org configs +$(DSTDIR)/%: $(SRCDIR)/%.org.gpg + mkdir -p $(dir $@) + gpg -d --batch $< 1> tmp.org + python3 ./extract_src.py tmp.org $@ + rm tmp.org + +# install org configs $(DSTDIR)/%: $(SRCDIR)/%.org mkdir -p $(dir $@) python3 ./extract_src.py $< $@ +# install generic files $(DSTDIR)/%: $(SRCDIR)/% mkdir -p $(dir $@) cp $< $@ +# install fonts +fonts: $(DSTDIR)/$(FONTSDIR)/.ComputerModern $(DSTDIR)/$(FONTSDIR)/.SauceCodePro + -fc-cache -f +$(DSTDIR)/$(FONTSDIR)/.ComputerModern: $(SRCDIR)/$(FONTSDIR)/ComputerModern.tar.gz + mkdir -p $(DSTDIR)/$(FONTSDIR) + tar xf $(SRCDIR)/$(FONTSDIR)/ComputerModern.tar.gz -C $(DSTDIR)/$(FONTSDIR) + touch $(DSTDIR)/$(FONTSDIR)/.ComputerModern +$(DSTDIR)/$(FONTSDIR)/.SauceCodePro: $(SRCDIR)/$(FONTSDIR)/SauceCodePro.tar.gz + mkdir -p $(DSTDIR)/$(FONTSDIR) + tar xf $(SRCDIR)/$(FONTSDIR)/SauceCodePro.tar.gz -C $(DSTDIR)/$(FONTSDIR) + touch $(DSTDIR)/$(FONTSDIR)/.SauceCodePro + +# macos update just runs brew upgrade +macos-update: install + brew upgrade + +# macos install also install fonts and tells System Events to update the wallpaper +macos-install: $(CONFIGS) fonts + osascript -e "tell application \"System Events\" to tell every desktop to set picture to \"/$$HOME/.wallpaper\" as POSIX file" + +# nixos update backs up the flake lock file nixos-update: install nix flake update $(DSTDIR)/.flake cp $(DSTDIR)/.flake/flake.lock $(SRCDIR)/.flake sudo nixos-rebuild switch --flake $(DSTDIR)/.flake +# nixos install runs nixos-rebuild switch to install everything declaratively nixos-install: $(CONFIGS) sudo nixos-rebuild switch --flake $(DSTDIR)/.flake diff --git a/common/.clang-format.org b/common/.clang-format.org new file mode 100644 index 0000000..6c38b3b --- /dev/null +++ b/common/.clang-format.org @@ -0,0 +1,9 @@ +#+title: Clang-Format Settings +Use a style similar to Linux kernel style (but with 4-wide indents and spaces over tabs). +#+begin_src yaml :tangle ~/.clang-format +BasedOnStyle: LLVM +IndentWidth: 4 +BreakBeforeBraces: Linux +AllowShortIfStatementsOnASingleLine: false +IndentCaseLabels: false +#+end_src diff --git a/common/.config/alacritty/alacritty.toml.org b/common/.config/alacritty/alacritty.toml.org new file mode 100644 index 0000000..992ed63 --- /dev/null +++ b/common/.config/alacritty/alacritty.toml.org @@ -0,0 +1,55 @@ +#+title: Alacritty Configuration + +Remove window decorations. +#+begin_src conf :tangle ~/.config/alacritty/alacritty.toml :mkdirp yes + [window] + decorations = "None" +#+end_src + +Make the window slightly transparent. +#+begin_src conf :tangle ~/.config/alacritty/alacritty.toml :mkdirp yes + opacity = 0.9 +#+end_src + +Add slight padding around the text. +#+begin_src conf :tangle ~/.config/alacritty/alacritty.toml :mkdirp yes + padding = { x = 6, y = 6 } +#+end_src + +Allow use of option as an alt key on Mac OS. +#+begin_src conf :tangle ~/.config/alacritty/alacritty.toml :mkdirp yes + option_as_alt = "Both" +#+end_src + +Use the same font as normal. +#+begin_src conf :tangle ~/.config/alacritty/alacritty.toml :mkdirp yes + [font] + normal = { family = "SauceCodePro Nerd Font", style = "Regular" } + size = 14 +#+end_src + +#+begin_src conf :tangle ~/.config/alacritty/alacritty.toml :mkdirp yes + [colors.primary] + background = '#ece0c9' + foreground = '#191916' + + [colors.normal] + black = '#191916' + red = '#ac4438' + green = '#354d52' + yellow = '#ba9151' + blue = '#465b91' + magenta = '#5b5489' + cyan = '#4e6062' + white = '#c9ad7a' + + [colors.bright] + black = '#293c3c' + red = '#d8611c' + green = '#4b7b53' + yellow = '#d8974b' + blue = '#2f3d91' + magenta = '#735e82' + cyan = '#6b8f92' + white = '#ece0c9' +#+end_src diff --git a/common/.config/emacs/feed.org.org b/common/.config/emacs/feed.org.org new file mode 100644 index 0000000..f0de605 --- /dev/null +++ b/common/.config/emacs/feed.org.org @@ -0,0 +1,39 @@ +#+title: Emacs RSS Feed + +#+begin_src org :tangle ~/.config/emacs/feed.org :mkdirp yes + ,* Blogs + :PROPERTIES: + :ID: elfeed + :END: + ,** Journalism :journalism: + ,*** [[https://waxy.org/feed/][Waxy.org]] + ,*** [[https://pluralistic.net/feed/][Cory Doctorow]] :technology:software:fiction: + ,** Computer Science :cs: + ,*** [[https://a.exozy.me/index.xml][Some Random Website]] :math:algorithms:fiction: + ,** Technology :technology: + ,*** [[https://ciechanow.ski/atom.xml][Bartosz Ciechanowshki]] + ,*** [[https://www.citationneeded.news/rss/][Citation Needed]] + ,*** [[https://www.lilysthings.org/blog/rss.xml][The Cool Blog]] + ,** Software :software: + ,*** [[https://eieio.games/feed.xml][eieio.games]] + ,*** [[https://ersei.net/en/blog.atom][Ersei]] + ,*** [[https://lilysthings.org/blog/rss.xml][Lily's Things]] + ,*** [[https://ntietz.com/atom.xml][Technically a Blog]] + ,*** [[https://alexwlchan.net/atom.xml][Alex Chan]] + ,*** [[https://eaton-works.com/feed.atom][Eaton Works]] :hacking: + ,*** [[https://computer.rip/rss.xml][Computer's Are Bad]] :technology: + ,*** [[https://mark.stosberg.com/rss/][Mark Stosberg]] :biking: + ,*** [[https://maia.crimew.gay/feed.xml][Maia Crimew]] :internet:hacking: + ,*** [[https://drewdevault.com/blog/index.xml][Drew DeVault]] + ,** Comics :comic: + ,*** [[https://xkcd.com/atom.xml][XKCD]] + ,** People I know + ,*** [[https://www.weavingwatersexpedition.com/news?format=rss][Weaving Waters Expedition]] :journalism: + ,*** [[https://pinkish.bearblog.dev/feed/][Pinkish]] :software: + ,*** [[https://jjanzen.ca/rss.xml][Me]] :software:review: + ,** Internet Infrastructure :internet:software: + ,*** [[https://daniel.haxx.se/blog/feed/][cURL]] + ,*** [[https://blog.archive.org/feed/][Archive.org]] + ,** Reviews :review: + ,*** [[https://mountainofink.com/?format=rss][Mountain of Ink]] +#+end_src diff --git a/common/.config/emacs/force-custom-file.el.org b/common/.config/emacs/force-custom-file.el.org new file mode 100644 index 0000000..8b8a418 --- /dev/null +++ b/common/.config/emacs/force-custom-file.el.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/common/.config/emacs/init.el.org b/common/.config/emacs/init.el.org new file mode 100644 index 0000000..4f13b21 --- /dev/null +++ b/common/.config/emacs/init.el.org @@ -0,0 +1,10 @@ +#+title: Emacs Configuration + +Load files for config. +#+begin_src emacs-lisp :tangle ~/.config/emacs/init.el :mkdirp yes + (load "~/.config/emacs/force-custom-file.el") + (load "~/.config/emacs/package-setup.el") + (load "~/.config/emacs/user-interface.el") + (load "~/.config/emacs/tools.el") + (load "~/.config/emacs/languages.el") +#+end_src diff --git a/common/.config/emacs/languages.el.org b/common/.config/emacs/languages.el.org new file mode 100644 index 0000000..3ee63e0 --- /dev/null +++ b/common/.config/emacs/languages.el.org @@ -0,0 +1,148 @@ +#+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 + +Run =eglot= on CMake files. +#+begin_src emacs-lisp :tangle ~/.config/emacs/languages.el :mkdirp yes + (use-package cmake-mode + :init + (add-hook 'cmake-mode-hook 'jj/eglot-setup)) +#+end_src + +Turn off C mode in =lex= and =yacc= files. +#+begin_src emacs-lisp :tangle ~/.config/emacs/languages.el :mkdirp yes + (add-to-list 'auto-mode-alist '("\\.l$" . prog-mode)) + (add-to-list 'auto-mode-alist '("\\.y$" . prog-mode)) +#+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 + +Better Lisp editing with =lispy=. +#+begin_src emacs-lisp :tangle ~/.config/emacs/languages.el :mkdirp yes + (use-package lispy + :hook (emacs-lisp-mode . lispy-mode)) + (use-package lispyville + :after lispy + :hook (lispy-mode . lispyville-mode)) +#+end_src + +Better parentheses handling in lisp with =parinfer-rust-mode=. +#+begin_src emacs-lisp :tangle ~/.config/emacs/languages.el :mkdirp yes + (use-package parinfer-rust-mode + :hook (emacs-lisp-mode . parinfer-rust-mode) + :init + (setq parinfer-rust-auto-download t)) +#+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 + +* Nix +Install =nix= support and run =eglot= on =nix= files. +#+begin_src emacs-lisp :tangle ~/.config/emacs/languages.el :mkdirp yes + (use-package nix-mode + :mode "\\.nix\\'") +#+end_src diff --git a/common/.config/emacs/package-setup.el.org b/common/.config/emacs/package-setup.el.org new file mode 100644 index 0000000..6ed238c --- /dev/null +++ b/common/.config/emacs/package-setup.el.org @@ -0,0 +1,25 @@ +#+title: Emacs Package Setup +Install =straight= for better package management. +#+begin_src emacs-lisp :tangle ~/.config/emacs/package-setup.el :mkdirp yes + (defvar bootstrap-version) + (let ((bootstrap-file + (expand-file-name + "straight/repos/straight.el/bootstrap.el" + (or (bound-and-true-p straight-base-dir) + user-emacs-directory))) + (bootstrap-version 7)) + (unless (file-exists-p bootstrap-file) + (with-current-buffer + (url-retrieve-synchronously + "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el" + 'silent 'inhibit-cookies) + (goto-char (point-max)) + (eval-print-last-sexp))) + (load bootstrap-file nil 'nomessage)) +#+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 + (straight-use-package 'use-package) + (setq straight-use-package-by-default t) +#+end_src diff --git a/common/.config/emacs/tools.el.org b/common/.config/emacs/tools.el.org new file mode 100644 index 0000000..d52c1b6 --- /dev/null +++ b/common/.config/emacs/tools.el.org @@ -0,0 +1,391 @@ +#+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 + +* 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 + +* Remote Editing +#+begin_src emacs-lisp :tangle ~/.config/emacs/tools.el :mkdirp yes +(setq tramp-default-method "ssh") +#+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 + (use-package 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 :font ,jj/var-font))) + `(fixed-pitch ((t :font ,jj/mono-font))) + '(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 + (defun org-babel-tangle-config () + (when (string-suffix-p ".org" (buffer-file-name)) + (org-babel-tangle))) + (add-hook 'org-mode-hook + (lambda () + (add-hook 'after-save-hook #'org-babel-tangle-config))) +#+end_src + +Enable Org Crypt. +#+begin_src emacs-lisp :tangle ~/.config/emacs/tools.el :mkdirp yes + (org-crypt-use-before-save-magic) + (setq org-tags-exclude-from-inheritance '("crypt")) + (setq org-crypt-key nil) + (setq auto-save-default nil) +#+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 + +* Reference Management +Use Biblio and Citar to manage citations. +#+begin_src emacs-lisp :tangle ~/.config/emacs/tools.el :mkdirp yes + (use-package biblio) + (use-package citar + :custom + (citar-bibliography '("~/bib/references.bib")) + :hook + (LaTeX-mode . citar-capf-setup) + (org-mode . citar-capf-setup)) + (use-package citar-embark + :after citar embark + :no-require + :config (citar-embark-mode)) +#+end_src diff --git a/common/.config/emacs/user-interface.el.org b/common/.config/emacs/user-interface.el.org new file mode 100644 index 0000000..ff4bd34 --- /dev/null +++ b/common/.config/emacs/user-interface.el.org @@ -0,0 +1,131 @@ +#+title: Emacs User Interface + +* Theming +Set up Source Code Pro with Nerd Font patches as default font and Computer Modern as a variable pitch font. +#+begin_src emacs-lisp :tangle ~/.config/emacs/user-interface.el :mkdirp yes + (defvar jj/mono-font) + (defvar jj/var-font) + (pcase system-type + (`gnu/linux + (when (eq (system-name) "gentoo")) + (setq jj/mono-font "SauceCodePro Nerd Font-11") + (setq jj/var-font "CMU Serif-14")) + (`darwin + (setq jj/mono-font "SauceCodePro Nerd Font-14:weight=thin") + (setq jj/var-font "CMU Serif-18"))) + (add-to-list 'default-frame-alist + `(font . ,jj/mono-font)) +#+end_src + +Use my custom Doom Disco light theme. +#+begin_src emacs-lisp :tangle ~/.config/emacs/user-interface.el :mkdirp yes + (use-package doom-themes + :straight (doom-themes :type git :host github :repo "doomemacs/themes" + :fork (:host github + :repo "JacobJanzen/emacs-doom-themes")) + :config + (setq doom-themes-enable-bold t + doom-themes-enable-italic t) + (load-theme 'doom-disco t) + (doom-themes-org-config)) + +(add-to-list 'default-frame-alist '(alpha-background . 90)) +#+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 + +Remove the title bar. +#+begin_src emacs-lisp :tangle ~/.config/emacs/user-interface.el :mkdirp yes + (add-to-list 'default-frame-alist '(undecorated . t)) +#+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 . nerd-icons-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/common/.config/fastfetch/config.jsonc.org b/common/.config/fastfetch/config.jsonc.org new file mode 100644 index 0000000..7a2d099 --- /dev/null +++ b/common/.config/fastfetch/config.jsonc.org @@ -0,0 +1,92 @@ +#+title: Fastfetch Settings +Open a JSON object. +#+begin_src js :tangle ~/.config/fastfetch/config.jsonc :mkdirp yes + { +#+end_src + +Use a =sixel= image for the logo. +#+begin_src js :tangle ~/.config/fastfetch/config.jsonc :mkdirp yes + "logo": { + "type": "raw", + "source": "~/.config/fastfetch/logo.sixel", + "width": 40, + "height": 19 + }, +#+end_src + +Two spaces between an item and its key. +#+begin_src js :tangle ~/.config/fastfetch/config.jsonc :mkdirp yes + "display": { + "separator": " " + }, +#+end_src + +Define the modules in the =fastfetch= display. +#+begin_src js :tangle ~/.config/fastfetch/config.jsonc :mkdirp yes + "modules": [ + "title", + { + "type": "custom", + "format": "──────────────────────────────────" + }, + { + "type": "os", + "key": "" + }, + { + "type": "kernel", + "key": "󰞸" + }, + { + "type": "uptime", + "key": "" + }, + { + "type": "packages", + "key": "" + }, + { + "type": "shell", + "key": "" + }, + { + "type": "display", + "key": "󰍹" + }, + { + "type": "wm", + "key": "" + }, + { + "type": "terminal", + "key": "" + }, + { + "type": "cpu", + "key": "" + }, + { + "type": "gpu", + "key": "" + }, + { + "type": "memory", + "key": "" + }, + { + "type": "disk", + "key": "" + }, + { + "type": "locale", + "key": "" + }, + "break", + "colors" + ] +#+end_src + +Close the JSON object. +#+begin_src js :tangle ~/.config/fastfetch/config.jsonc :mkdirp yes +} +#+end_src diff --git a/common/.config/fastfetch/config.org b/common/.config/fastfetch/config.org deleted file mode 100644 index 7a2d099..0000000 --- a/common/.config/fastfetch/config.org +++ /dev/null @@ -1,92 +0,0 @@ -#+title: Fastfetch Settings -Open a JSON object. -#+begin_src js :tangle ~/.config/fastfetch/config.jsonc :mkdirp yes - { -#+end_src - -Use a =sixel= image for the logo. -#+begin_src js :tangle ~/.config/fastfetch/config.jsonc :mkdirp yes - "logo": { - "type": "raw", - "source": "~/.config/fastfetch/logo.sixel", - "width": 40, - "height": 19 - }, -#+end_src - -Two spaces between an item and its key. -#+begin_src js :tangle ~/.config/fastfetch/config.jsonc :mkdirp yes - "display": { - "separator": " " - }, -#+end_src - -Define the modules in the =fastfetch= display. -#+begin_src js :tangle ~/.config/fastfetch/config.jsonc :mkdirp yes - "modules": [ - "title", - { - "type": "custom", - "format": "──────────────────────────────────" - }, - { - "type": "os", - "key": "" - }, - { - "type": "kernel", - "key": "󰞸" - }, - { - "type": "uptime", - "key": "" - }, - { - "type": "packages", - "key": "" - }, - { - "type": "shell", - "key": "" - }, - { - "type": "display", - "key": "󰍹" - }, - { - "type": "wm", - "key": "" - }, - { - "type": "terminal", - "key": "" - }, - { - "type": "cpu", - "key": "" - }, - { - "type": "gpu", - "key": "" - }, - { - "type": "memory", - "key": "" - }, - { - "type": "disk", - "key": "" - }, - { - "type": "locale", - "key": "" - }, - "break", - "colors" - ] -#+end_src - -Close the JSON object. -#+begin_src js :tangle ~/.config/fastfetch/config.jsonc :mkdirp yes -} -#+end_src diff --git a/common/.config/nvim/init.lua.org b/common/.config/nvim/init.lua.org new file mode 100644 index 0000000..0f7dffa --- /dev/null +++ b/common/.config/nvim/init.lua.org @@ -0,0 +1,27 @@ +#+title: Neovim Settings +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 ~/.config/nvim/init.lua :mkdirp yes + vim.cmd([[set notimeout]]) +#+end_src + +Fix unable to open swap file issue. +#+begin_src lua :tangle ~/.config/nvim/init.lua :mkdirp yes + vim.cmd([[set directory=~/.local/share/nvim/swap//]]) +#+end_src + +Install plugins in the [[./lua/plugins.org][plugins.lua]] file. +#+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 ~/.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 ~/.config/nvim/init.lua :mkdirp yes + require('appearance') +#+end_src diff --git a/common/.config/nvim/init.org b/common/.config/nvim/init.org deleted file mode 100644 index 0f7dffa..0000000 --- a/common/.config/nvim/init.org +++ /dev/null @@ -1,27 +0,0 @@ -#+title: Neovim Settings -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 ~/.config/nvim/init.lua :mkdirp yes - vim.cmd([[set notimeout]]) -#+end_src - -Fix unable to open swap file issue. -#+begin_src lua :tangle ~/.config/nvim/init.lua :mkdirp yes - vim.cmd([[set directory=~/.local/share/nvim/swap//]]) -#+end_src - -Install plugins in the [[./lua/plugins.org][plugins.lua]] file. -#+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 ~/.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 ~/.config/nvim/init.lua :mkdirp yes - require('appearance') -#+end_src diff --git a/common/.config/nvim/lua/appearance.lua.org b/common/.config/nvim/lua/appearance.lua.org new file mode 100644 index 0000000..1f1d534 --- /dev/null +++ b/common/.config/nvim/lua/appearance.lua.org @@ -0,0 +1,15 @@ +#+title: Neovim Appearance Settings +Use line numbers. +#+begin_src lua :tangle ~/.config/nvim/lua/appearance.lua :mkdirp yes + vim.opt.number = true +#+end_src + +Turn on syntax highlighting. +#+begin_src lua :tangle ~/.config/nvim/lua/appearance.lua :mkdirp yes + vim.cmd([[ + set notermguicolors + syntax on + colorscheme default + set background=light + ]]) +#+end_src diff --git a/common/.config/nvim/lua/appearance.org b/common/.config/nvim/lua/appearance.org deleted file mode 100644 index 1f1d534..0000000 --- a/common/.config/nvim/lua/appearance.org +++ /dev/null @@ -1,15 +0,0 @@ -#+title: Neovim Appearance Settings -Use line numbers. -#+begin_src lua :tangle ~/.config/nvim/lua/appearance.lua :mkdirp yes - vim.opt.number = true -#+end_src - -Turn on syntax highlighting. -#+begin_src lua :tangle ~/.config/nvim/lua/appearance.lua :mkdirp yes - vim.cmd([[ - set notermguicolors - syntax on - colorscheme default - set background=light - ]]) -#+end_src diff --git a/common/.config/nvim/lua/behaviour.lua.org b/common/.config/nvim/lua/behaviour.lua.org new file mode 100644 index 0000000..871b65e --- /dev/null +++ b/common/.config/nvim/lua/behaviour.lua.org @@ -0,0 +1,19 @@ +#+title: Neovim Behaviour Settings + +Use tabs with width 4. +#+begin_src lua :tangle ~/.config/nvim/lua/behaviour.lua :mkdirp yes + vim.opt.tabstop = 4 + vim.opt.expandtab = true + vim.opt.shiftwidth = 4 + vim.opt.autoindent = true +#+end_src + +Better command line completion. +#+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 ~/.config/nvim/lua/behaviour.lua :mkdirp yes + vim.cmd('filetype plugin indent on') +#+end_src diff --git a/common/.config/nvim/lua/behaviour.org b/common/.config/nvim/lua/behaviour.org deleted file mode 100644 index 871b65e..0000000 --- a/common/.config/nvim/lua/behaviour.org +++ /dev/null @@ -1,19 +0,0 @@ -#+title: Neovim Behaviour Settings - -Use tabs with width 4. -#+begin_src lua :tangle ~/.config/nvim/lua/behaviour.lua :mkdirp yes - vim.opt.tabstop = 4 - vim.opt.expandtab = true - vim.opt.shiftwidth = 4 - vim.opt.autoindent = true -#+end_src - -Better command line completion. -#+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 ~/.config/nvim/lua/behaviour.lua :mkdirp yes - vim.cmd('filetype plugin indent on') -#+end_src diff --git a/common/.config/nvim/lua/plugins.lua.org b/common/.config/nvim/lua/plugins.lua.org new file mode 100644 index 0000000..f3027f9 --- /dev/null +++ b/common/.config/nvim/lua/plugins.lua.org @@ -0,0 +1,27 @@ +#+title: Neovim Plugins +* Setup +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({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", + lazypath, + }) + end + vim.opt.rtp:prepend(lazypath) +#+end_src + +* Plugins +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', + 'Raimondi/delimitMate', + 'bronson/vim-trailing-whitespace', + }) +#+end_src diff --git a/common/.config/nvim/lua/plugins.org b/common/.config/nvim/lua/plugins.org deleted file mode 100644 index f3027f9..0000000 --- a/common/.config/nvim/lua/plugins.org +++ /dev/null @@ -1,27 +0,0 @@ -#+title: Neovim Plugins -* Setup -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({ - "git", - "clone", - "--filter=blob:none", - "https://github.com/folke/lazy.nvim.git", - "--branch=stable", - lazypath, - }) - end - vim.opt.rtp:prepend(lazypath) -#+end_src - -* Plugins -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', - 'Raimondi/delimitMate', - 'bronson/vim-trailing-whitespace', - }) -#+end_src diff --git a/common/.config/sketchybar/plugins/battery.sh.org b/common/.config/sketchybar/plugins/battery.sh.org new file mode 100755 index 0000000..d3918e2 --- /dev/null +++ b/common/.config/sketchybar/plugins/battery.sh.org @@ -0,0 +1,46 @@ +#+title: SketchyBar Battery Plugin + +Get the percentage and charging status. +#+begin_src sh :tangle ~/.config/sketchybar/plugins/battery.sh :mkdirp yes :tangle-mode o755 + #!/bin/sh + PERCENTAGE="$(pmset -g batt | grep -Eo "\d+%" | cut -d% -f1)" + CHARGING="$(pmset -g batt | grep 'AC Power')" +#+end_src + +Exit if no percentage was reported. +#+begin_src sh :tangle ~/.config/sketchybar/plugins/battery.sh :mkdirp yes :tangle-mode o755 + if [ "$PERCENTAGE" = "" ]; then + exit 0 + fi +#+end_src + +Choose the icon based on the percentage. +#+begin_src sh :tangle ~/.config/sketchybar/plugins/battery.sh :mkdirp yes :tangle-mode o755 + if [[ "$CHARGING" != "" ]]; then + case "${PERCENTAGE}" in + 9[0-9]|100) ICON="󰂅" + ;; + [6-8][0-9]) ICON="󰂉" + ;; + [3-5][0-9]) ICON="󰂇" + ;; + [1-2][0-9]) ICON="󰢜" + ;; + ,*) ICON="󰁺" + esac + else + case "${PERCENTAGE}" in + 9[0-9]|100) ICON="󰁹" + ;; + [6-8][0-9]) ICON="󰁿" + ;; + [3-5][0-9]) ICON="󰁼" + ;; + [1-2][0-9]) ICON="󰁺" + ;; + ,*) ICON="" + esac + fi + + sketchybar --set "$NAME" icon="$ICON" label="${PERCENTAGE}%" +#+end_src diff --git a/common/.config/sketchybar/plugins/clock.sh.org b/common/.config/sketchybar/plugins/clock.sh.org new file mode 100755 index 0000000..1ab5ec3 --- /dev/null +++ b/common/.config/sketchybar/plugins/clock.sh.org @@ -0,0 +1,7 @@ +#+title: SketchyBar Clock Plugin + +Get the date and set it as the label. +#+begin_src sh :tangle ~/.config/sketchybar/plugins/clock.sh :mkdirp yes :tangle-mode o755 + #!/bin/sh + sketchybar --set "$NAME" label="$(date '+%Y-%m-%d %H:%M')" +#+end_src diff --git a/common/.config/sketchybar/plugins/cpu.sh.org b/common/.config/sketchybar/plugins/cpu.sh.org new file mode 100755 index 0000000..199d89b --- /dev/null +++ b/common/.config/sketchybar/plugins/cpu.sh.org @@ -0,0 +1,7 @@ +#+title: SketchyBar CPU Plugin + +Get the CPU percentage and display it. +#+begin_src sh :tangle ~/.config/sketchybar/plugins/cpu.sh :mkdirp yes :tangle-mode o755 + #!/bin/sh + sketchybar --set "$NAME" icon='󰍛' label="$(top -l 2 | grep -E "^CPU" | tail -1 | awk '{ print $3 + $5"%" }')" +#+end_src diff --git a/common/.config/sketchybar/plugins/front_app.sh.org b/common/.config/sketchybar/plugins/front_app.sh.org new file mode 100755 index 0000000..44917e4 --- /dev/null +++ b/common/.config/sketchybar/plugins/front_app.sh.org @@ -0,0 +1,9 @@ +#+title: SketchyBar Front App Plugin + +Get the name of the focused application. +#+begin_src sh :tangle ~/.config/sketchybar/plugins/front_app.sh :mkdirp yes :tangle-mode o755 + #!/bin/sh + if [ "$SENDER" = "front_app_switched" ]; then + sketchybar --set "$NAME" label="$INFO" + fi +#+end_src diff --git a/common/.config/sketchybar/plugins/mem.sh.org b/common/.config/sketchybar/plugins/mem.sh.org new file mode 100755 index 0000000..ef3feef --- /dev/null +++ b/common/.config/sketchybar/plugins/mem.sh.org @@ -0,0 +1,16 @@ +#+title: SketchyBar Memory Plugin + +Get the memory in use and return that as a percent. +#+begin_src sh :tangle ~/.config/sketchybar/plugins/mem.sh :mkdirp yes :tangle-mode o755 + #!/bin/sh + hw_pagesize="$(sysctl -n hw.pagesize)" + mem_total="$(($(sysctl -n hw.memsize) / 1024))" + pages_app="$(($(sysctl -n vm.page_pageable_internal_count) - $(sysctl -n vm.page_purgeable_count)))" + pages_wired="$(vm_stat | awk '/ wired/ { print $4 }')" + pages_compressed="$(vm_stat | awk '/ occupied/ { printf $5 }')" + pages_compressed="${pages_compressed:-0}" + mem_used="$(((pages_app + ${pages_wired//.} + ${pages_compressed//.}) * hw_pagesize / 1024))" + + mem_percent=$((mem_perc=$mem_used * 100 / $mem_total)) + sketchybar --set "$NAME" icon="󰆼" label="$mem_percent%" +#+end_src diff --git a/common/.config/sketchybar/plugins/space.sh.org b/common/.config/sketchybar/plugins/space.sh.org new file mode 100755 index 0000000..97581aa --- /dev/null +++ b/common/.config/sketchybar/plugins/space.sh.org @@ -0,0 +1,7 @@ +#+title: SketchyBar Space Plugin + +Get the current space. +#+begin_src sh :tangle ~/.config/sketchybar/plugins/space.sh :mkdirp yes :tangle-mode o755 + #!/bin/sh + sketchybar --set "$NAME" background.drawing="$SELECTED" +#+end_src diff --git a/common/.config/sketchybar/plugins/volume.sh.org b/common/.config/sketchybar/plugins/volume.sh.org new file mode 100755 index 0000000..c53b2a1 --- /dev/null +++ b/common/.config/sketchybar/plugins/volume.sh.org @@ -0,0 +1,21 @@ +#+title: SketchyBar Volume Plugin + +Set an icon based on the current volume and return the volume and the icon. +#+begin_src sh :tangle ~/.config/sketchybar/plugins/volume.sh :mkdirp yes :tangle-mode o755 + #!/bin/sh + if [ "$SENDER" = "volume_change" ]; then + VOLUME="$INFO" + + case "$VOLUME" in + [6-9][0-9]|100) ICON="󰕾" + ;; + [3-5][0-9]) ICON="󰖀" + ;; + [1-9]|[1-2][0-9]) ICON="󰕿" + ;; + ,*) ICON="󰖁" + esac + + sketchybar --set "$NAME" icon="$ICON" label="$VOLUME%" + fi +#+end_src diff --git a/common/.config/sketchybar/sketchybarrc.org b/common/.config/sketchybar/sketchybarrc.org new file mode 100755 index 0000000..316eaf3 --- /dev/null +++ b/common/.config/sketchybar/sketchybarrc.org @@ -0,0 +1,77 @@ +#+title: SketchyBar Configuration + +Set the plugin directory. +#+begin_src sh :tangle ~/.config/sketchybar/sketchybarrc :mkdirp yes :tangle-mode o755 + PLUGIN_DIR="$CONFIG_DIR/plugins" +#+end_src + +Place the bar at the of the screen with full transparency. +#+begin_src sh :tangle ~/.config/sketchybar/sketchybarrc :mkdirp yes :tangle-mode o755 + sketchybar --bar position=top height=40 blur_radius=30 color=0x00000000 +#+end_src + +Add small padding to left and right, use Symbols font for icons and Source Code Pro for text. Make all text white and add padding on left and right for labels and icons. +#+begin_src sh :tangle ~/.config/sketchybar/sketchybarrc :mkdirp yes :tangle-mode o755 + default=( + padding_left=5 + padding_right=5 + icon.font="Symbols Nerd Font:Bold:17.0" + label.font="Sauce Code Pro Nerd Font:Bold:14.0" + icon.color=0xffffffff + label.color=0xffffffff + icon.padding_left=4 + icon.padding_right=4 + label.padding_left=4 + label.padding_right=4 + ) + sketchybar --default "${default[@]}" +#+end_src + +Add clickable space icons for 10 spaces. +#+begin_src sh :tangle ~/.config/sketchybar/sketchybarrc :mkdirp yes :tangle-mode o755 + SPACE_ICONS=("1" "2" "3" "4" "5" "6" "7" "8" "9" "10") + for i in "${!SPACE_ICONS[@]}" + do + sid="$(($i+1))" + space=( + space="$sid" + icon="${SPACE_ICONS[i]}" + icon.padding_left=7 + icon.padding_right=7 + background.color=0x40ffffff + background.corner_radius=5 + background.height=25 + label.drawing=off + script="$PLUGIN_DIR/space.sh" + click_script="yabai -m space --focus $sid" + ) + sketchybar --add space space."$sid" left --set space."$sid" "${space[@]}" + done +#+end_src + +Add a chevron before listing the open application. +#+begin_src sh :tangle ~/.config/sketchybar/sketchybarrc :mkdirp yes :tangle-mode o755 + sketchybar --add item chevron left \ + --set chevron icon=󰅂 label.drawing=off \ + --add item front_app left \ + --set front_app icon.drawing=off script="$PLUGIN_DIR/front_app.sh" \ + --subscribe front_app front_app_switched +#+end_src + +Display a clock, volume, battery, CPU usage, and memory usage on the right. +#+begin_src sh :tangle ~/.config/sketchybar/sketchybarrc :mkdirp yes :tangle-mode o755 + sketchybar --add item clock right \ + --set clock update_freq=10 icon=󰥔 script="$PLUGIN_DIR/clock.sh" \ + --add item volume right \ + --set volume script="$PLUGIN_DIR/volume.sh" \ + --subscribe volume volume_change \ + --add item battery right \ + --set battery update_freq=120 script="$PLUGIN_DIR/battery.sh" \ + --subscribe battery system_woke power_source_change \ + --add item cpu right \ + --set cpu update_freq=10 script="$PLUGIN_DIR/cpu.sh" \ + --add item mem right \ + --set mem update_freq=10 script="$PLUGIN_DIR/mem.sh" + + sketchybar --update +#+end_src diff --git a/common/.config/skhd/skhdrc.org b/common/.config/skhd/skhdrc.org new file mode 100644 index 0000000..e628cd4 --- /dev/null +++ b/common/.config/skhd/skhdrc.org @@ -0,0 +1,80 @@ +#+title: =skhd= Configuration + +Add keybinding to open a terminal emulator. +#+begin_src conf :tangle ~/.config/skhd/skhdrc :mkdirp yes + cmd - return : /opt/homebrew/bin/alacritty +#+end_src + +Add keybinding for killing a window. +#+begin_src conf :tangle ~/.config/skhd/skhdrc :mkdirp yes + cmd + shift - q : yabai -m window --close +#+end_src + +Add keybinding for opening an app launcher. +#+begin_src conf :tangle ~/.config/skhd/skhdrc :mkdirp yes + cmd - d : ~/.local/bin/launcher +#+end_src + +Add keybinding for reloading the configuration. +#+begin_src conf :tangle ~/.config/skhd/skhdrc :mkdirp yes + cmd + shift - c : yabai --restart-service && skhd --restart-service && brew services restart sketchybar +#+end_src + +Change focus keybindings. +#+begin_src conf :tangle ~/.config/skhd/skhdrc :mkdirp yes + cmd - h : yabai -m window --focus west || yabai -m display --focus west + cmd - j : yabai -m window --focus south || yabai -m display --focus south + cmd - k : yabai -m window --focus north || yabai -m display --focus north + cmd - l : yabai -m window --focus east || yabai -m display --focus east +#+end_src + +Move window keybindings. +#+begin_src conf :tangle ~/.config/skhd/skhdrc :mkdirp yes + shift + cmd - h : yabai -m window --warp west + shift + cmd - j : yabai -m window --warp south + shift + cmd - k : yabai -m window --warp north + shift + cmd - l : yabai -m window --warp east +#+end_src + +Change workspace keybindings. +#+begin_src conf :tangle ~/.config/skhd/skhdrc :mkdirp yes + cmd - 1 : yabai -m space --focus 1 + cmd - 2 : yabai -m space --focus 2 + cmd - 3 : yabai -m space --focus 3 + cmd - 4 : yabai -m space --focus 4 + cmd - 5 : yabai -m space --focus 5 + cmd - 6 : yabai -m space --focus 6 + cmd - 7 : yabai -m space --focus 7 + cmd - 8 : yabai -m space --focus 8 + cmd - 9 : yabai -m space --focus 9 + cmd - 0 : yabai -m space --focus 10 +#+end_src + +Move window to workspace keybindings. +#+begin_src conf :tangle ~/.config/skhd/skhdrc :mkdirp yes + cmd + shift - 1 : yabai -m window --space 1 + cmd + shift - 2 : yabai -m window --space 2 + cmd + shift - 3 : yabai -m window --space 3 + cmd + shift - 4 : yabai -m window --space 4 + cmd + shift - 5 : yabai -m window --space 5 + cmd + shift - 6 : yabai -m window --space 6 + cmd + shift - 7 : yabai -m window --space 7 + cmd + shift - 8 : yabai -m window --space 8 + cmd + shift - 9 : yabai -m window --space 9 + cmd + shift - 0 : yabai -m window --space 10 +#+end_src + +Define full screen keybinding. +#+begin_src conf :tangle ~/.config/skhd/skhdrc :mkdirp yes + cmd + shift - f : yabai -m window --toggle zoom-fullscreen +#+end_src + +Define toggle floating keybinding. +#+begin_src conf :tangle ~/.config/skhd/skhdrc :mkdirp yes + cmd + shift - space : yabai -m window --toggle float +#+end_src + +Add screenshot keybinding. +#+begin_src conf :tangle ~/.config/skhd/skhdrc :mkdirp yes + shift + ctrl - s : open /System/Applications/Utilities/Screenshot.app +#+end_src diff --git a/common/.config/yabai/yabairc.org b/common/.config/yabai/yabairc.org new file mode 100644 index 0000000..4307c1f --- /dev/null +++ b/common/.config/yabai/yabairc.org @@ -0,0 +1,68 @@ +#+title: Yabai Configuration + +Load script additions automatically. +#+begin_src sh :tangle ~/.config/yabai/yabairc :mkdirp yes + yabai -m signal --add event=dock_did_restart action="sudo /opt/homebrew/bin/yabai --load-sa" + sudo /opt/homebrew/bin/yabai --load-sa +#+end_src + +Tile the windows. +#+begin_src sh :tangle ~/.config/yabai/yabairc :mkdirp yes + yabai -m config layout bsp +#+end_src + +Automatically balance window sizes. +#+begin_src sh :tangle ~/.config/yabai/yabairc :mkdirp yes + yabai -m config auto_balance on +#+end_src + +Use 10 pixel gaps. +#+begin_src sh :tangle ~/.config/yabai/yabairc :mkdirp yes + yabai -m config top_padding 10 + yabai -m config bottom_padding 10 + yabai -m config left_padding 10 + yabai -m config right_padding 10 + yabai -m config window_gap 10 +#+end_src + +Remove window shadows unless the window is floating. +#+begin_src sh :tangle ~/.config/yabai/yabairc :mkdirp yes + yabai -m config window_shadow float +#+end_src + +Move mouse to focused window anad focus on the window that the mouse is on. +#+begin_src sh :tangle ~/.config/yabai/yabairc :mkdirp yes + yabai -m config focus_follows_mouse autoraise + yabai -m config mouse_follows_focus on +#+end_src + +Control windows if =cmd= is held. +#+begin_src sh :tangle ~/.config/yabai/yabairc :mkdirp yes + yabai -m config mouse_modifier cmd +#+end_src + +Move windows with left click. +#+begin_src sh :tangle ~/.config/yabai/yabairc :mkdirp yes + yabai -m config mouse_action1 move +#+end_src + +Resize windows with right click. +#+begin_src sh :tangle ~/.config/yabai/yabairc :mkdirp yes + yabai -m config mouse_action2 resize +#+end_src + +Update Positions when the window is dropped. +#+begin_src sh :tangle ~/.config/yabai/yabairc :mkdirp yes + yabai -m mouse_drop_action swap +#+end_src + +Don't manage some apps. +#+begin_src sh :tangle ~/.config/yabai/yabairc :mkdirp yes + yabai -m rule --add app="^System Settings$" manage=off + yabai -m rule --add app="^Calculator$" manage=off +#+end_src + +Make windows management aware of SketchyBar. +#+begin_src sh :tangle ~/.config/yabai/yabairc :mkdirp yes + yabai -m config external_bar all:$(sketchybar --query bar | jq .height):0 +#+end_src diff --git a/common/.gitconfig.org.gpg b/common/.gitconfig.org.gpg new file mode 100644 index 0000000..12954b7 Binary files /dev/null and b/common/.gitconfig.org.gpg differ diff --git a/common/.local/share/fonts/NFM.tar.gz b/common/.local/share/fonts/NFM.tar.gz deleted file mode 100644 index b862584..0000000 Binary files a/common/.local/share/fonts/NFM.tar.gz and /dev/null differ diff --git a/common/.profile.org b/common/.profile.org new file mode 100644 index 0000000..99c0908 --- /dev/null +++ b/common/.profile.org @@ -0,0 +1,19 @@ +#+TITLE: =.profile= Settings +Add items to the path. +#+begin_src sh :tangle ~/.profile +export PATH="$HOME/.local/share/fzf-zsh-plugin/bin:$HOME/node_modules/.bin:$HOME/.emacs.d/bin:$HOME/bin:$HOME/gems/bin:$HOME/.local/bin:$HOME/go/bin:/usr/local/bin:/Library/TeX/texbin/:$PATH" +#+end_src + +Set =GPG_TTY= on Mac OS. +#+begin_src sh :tangle ~/.profile + if [ "$(uname)" = 'Darwin' ] && ps -e | grep -q 'emacs --daemon'; then + export GPG_TTY=$(tty) + fi +#+end_src + +Fix =pipx= path on Mac OS. +#+begin_src sh :tangle ~/.profile + if [ "$(uname)" = 'Darwin' ]; then + PIPX_HOME="$HOME/.local/pipx" + fi +#+end_src diff --git a/common/.zshrc.org b/common/.zshrc.org new file mode 100644 index 0000000..02601e5 --- /dev/null +++ b/common/.zshrc.org @@ -0,0 +1,130 @@ +#+title: ZSH Configuration +Set up completions. +#+begin_src sh :tangle ~/.zshrc :mkdirp yes + zstyle ':completion:*' completer _expand _complete _ignored _approximate + zstyle ':completion:*' matcher-list '' 'm:{[:lower:]}={[:upper:]}' 'r:|[._-]=** r:|=**' 'l:|=* r:|=*' + zstyle :compinstall filename '/home/jjanzen/.zshrc' + autoload -U compinit promptinit + compinit + promptinit +#+end_src + +Enable Gentoo completions on my Gentoo system. +#+begin_src sh :tangle ~/.zshrc :mkdirp yes + if [ "$(uname)" = 'Linux' ] && grep -q 'ID=gentoo' /etc/os-release; then + prompt gentoo + fi +#+end_src + +Set up the history with 1000 entries and ignored duplicate commands. +#+begin_src sh :tangle ~/.zshrc :mkdirp yes + HISTFILE=~/.histfile + HISTSIZE=1000 + SAVEHIST=1000 + setopt hist_ignore_all_dups +#+end_src + +Enable automatic =cd=. +#+begin_src sh :tangle ~/.zshrc :mkdirp yes + setopt autocd +#+end_src + +Enable extended glob. +#+begin_src sh :tangle ~/.zshrc :mkdirp yes + setopt extendedglob +#+end_src + +If a glob returns nothing, don't keep the =*=. +#+begin_src sh :tangle ~/.zshrc :mkdirp yes + setopt nullglob +#+end_src + +Report the status of background jobs immediately. +#+begin_src sh :tangle ~/.zshrc :mkdirp yes + setopt notify +#+end_src + +Disable the beep. +#+begin_src sh :tangle ~/.zshrc :mkdirp yes + unsetopt beep +#+end_src + +Use =vi= keybindings. +#+begin_src sh :tangle ~/.zshrc :mkdirp yes + bindkey -v +#+end_src + +Use =lesspipe= back end for =less= if it is installed. +#+begin_src sh :tangle ~/.zshrc :mkdirp yes + which lesspipe.sh &> /dev/null && export LESSOPEN="|lesspipe.sh %s" +#+end_src + +Use =eza= as my =ls= command if it is installed. +#+begin_src sh :tangle ~/.zshrc :mkdirp yes + which eza &> /dev/null && alias ls=eza +#+end_src + +Use Neovim as my =vi= and =vim= application if it is installed. +#+begin_src sh :tangle ~/.zshrc :mkdirp yes + which nvim &> /dev/null && alias vi=nvim && alias vim=nvim +#+end_src + +If the Firefox binary is called =firefox-bin=, let =firefox= also run =firefox-bin=. +#+begin_src sh :tangle ~/.zshrc :mkdirp yes + which firefox-bin &> /dev/null && alias firefox=firefox-bin +#+end_src + +Lazy =ls= shortcuts. +#+begin_src sh :tangle ~/.zshrc :mkdirp yes + alias ll='ls -alF' + alias la='ls -a' + alias l='ls -F' + alias sl='ls' +#+end_src + +*** Prompt +Define function to write out icons for the git status. +#+begin_src sh :tangle ~/.zshrc :mkdirp yes + parse_git_dirty() { + git_status="$(git status 2> /dev/null)" + [[ "$git_status" =~ "use \"git push\" to publish your local commits" ]] && echo -n " %F{green}%f" + [[ "$git_status" =~ "Changes to be committed:" ]] && echo -n " %F{magenta}%f" + [[ "$git_status" =~ "Changes not staged for commit:" ]] && echo -n " %F{yellow}%f" + [[ "$git_status" =~ "Untracked files:" ]] && echo -n " %F{red}%f" + } +#+end_src + +Enable git status in the prompt. +#+begin_src sh :tangle ~/.zshrc :mkdirp yes + setopt prompt_subst + autoload -Uz vcs_info + precmd () { vcs_info } + zstyle ':vcs_info:*' formats ' %F{blue}%b%f' # git(main) +#+end_src + +Define the prompt as follows: +- Error code (if applicable) +- Path using =~= for the home directory and truncating if too long +- Git branch +- Git status +- =$= to mark the start of the prompt +#+begin_src sh :tangle ~/.zshrc :mkdirp yes + PS1='%(?..%B%F{red}[%?%\]%f%b )%F{green}%20<...<%~%<<%f$vcs_info_msg_0_$(parse_git_dirty) $ ' +#+end_src + +Enable VPN shortcut. +#+begin_src sh :tangle ~/.zshrc :mkdirp yes + if [ "$(uname)" = 'Linux' ] && grep -q 'ID=gentoo' /etc/os-release; then + vpn () { + if test -f /tmp/vpn.lock; then + echo turning off vpn... + doas /usr/bin/wg-quick down gentoo-CA-340 + rm /tmp/vpn.lock + else + echo turning on vpn... + doas /usr/bin/wg-quick up gentoo-CA-340 + touch /tmp/vpn.lock + fi + } + fi +#+end_src diff --git a/common/clang-format.org b/common/clang-format.org deleted file mode 100644 index 6c38b3b..0000000 --- a/common/clang-format.org +++ /dev/null @@ -1,9 +0,0 @@ -#+title: Clang-Format Settings -Use a style similar to Linux kernel style (but with 4-wide indents and spaces over tabs). -#+begin_src yaml :tangle ~/.clang-format -BasedOnStyle: LLVM -IndentWidth: 4 -BreakBeforeBraces: Linux -AllowShortIfStatementsOnASingleLine: false -IndentCaseLabels: false -#+end_src diff --git a/common/gitconfig.org.gpg b/common/gitconfig.org.gpg deleted file mode 100644 index 12954b7..0000000 Binary files a/common/gitconfig.org.gpg and /dev/null differ diff --git a/common/profile.org b/common/profile.org deleted file mode 100644 index 99c0908..0000000 --- a/common/profile.org +++ /dev/null @@ -1,19 +0,0 @@ -#+TITLE: =.profile= Settings -Add items to the path. -#+begin_src sh :tangle ~/.profile -export PATH="$HOME/.local/share/fzf-zsh-plugin/bin:$HOME/node_modules/.bin:$HOME/.emacs.d/bin:$HOME/bin:$HOME/gems/bin:$HOME/.local/bin:$HOME/go/bin:/usr/local/bin:/Library/TeX/texbin/:$PATH" -#+end_src - -Set =GPG_TTY= on Mac OS. -#+begin_src sh :tangle ~/.profile - if [ "$(uname)" = 'Darwin' ] && ps -e | grep -q 'emacs --daemon'; then - export GPG_TTY=$(tty) - fi -#+end_src - -Fix =pipx= path on Mac OS. -#+begin_src sh :tangle ~/.profile - if [ "$(uname)" = 'Darwin' ]; then - PIPX_HOME="$HOME/.local/pipx" - fi -#+end_src diff --git a/common/zshrc.org b/common/zshrc.org deleted file mode 100644 index 02601e5..0000000 --- a/common/zshrc.org +++ /dev/null @@ -1,130 +0,0 @@ -#+title: ZSH Configuration -Set up completions. -#+begin_src sh :tangle ~/.zshrc :mkdirp yes - zstyle ':completion:*' completer _expand _complete _ignored _approximate - zstyle ':completion:*' matcher-list '' 'm:{[:lower:]}={[:upper:]}' 'r:|[._-]=** r:|=**' 'l:|=* r:|=*' - zstyle :compinstall filename '/home/jjanzen/.zshrc' - autoload -U compinit promptinit - compinit - promptinit -#+end_src - -Enable Gentoo completions on my Gentoo system. -#+begin_src sh :tangle ~/.zshrc :mkdirp yes - if [ "$(uname)" = 'Linux' ] && grep -q 'ID=gentoo' /etc/os-release; then - prompt gentoo - fi -#+end_src - -Set up the history with 1000 entries and ignored duplicate commands. -#+begin_src sh :tangle ~/.zshrc :mkdirp yes - HISTFILE=~/.histfile - HISTSIZE=1000 - SAVEHIST=1000 - setopt hist_ignore_all_dups -#+end_src - -Enable automatic =cd=. -#+begin_src sh :tangle ~/.zshrc :mkdirp yes - setopt autocd -#+end_src - -Enable extended glob. -#+begin_src sh :tangle ~/.zshrc :mkdirp yes - setopt extendedglob -#+end_src - -If a glob returns nothing, don't keep the =*=. -#+begin_src sh :tangle ~/.zshrc :mkdirp yes - setopt nullglob -#+end_src - -Report the status of background jobs immediately. -#+begin_src sh :tangle ~/.zshrc :mkdirp yes - setopt notify -#+end_src - -Disable the beep. -#+begin_src sh :tangle ~/.zshrc :mkdirp yes - unsetopt beep -#+end_src - -Use =vi= keybindings. -#+begin_src sh :tangle ~/.zshrc :mkdirp yes - bindkey -v -#+end_src - -Use =lesspipe= back end for =less= if it is installed. -#+begin_src sh :tangle ~/.zshrc :mkdirp yes - which lesspipe.sh &> /dev/null && export LESSOPEN="|lesspipe.sh %s" -#+end_src - -Use =eza= as my =ls= command if it is installed. -#+begin_src sh :tangle ~/.zshrc :mkdirp yes - which eza &> /dev/null && alias ls=eza -#+end_src - -Use Neovim as my =vi= and =vim= application if it is installed. -#+begin_src sh :tangle ~/.zshrc :mkdirp yes - which nvim &> /dev/null && alias vi=nvim && alias vim=nvim -#+end_src - -If the Firefox binary is called =firefox-bin=, let =firefox= also run =firefox-bin=. -#+begin_src sh :tangle ~/.zshrc :mkdirp yes - which firefox-bin &> /dev/null && alias firefox=firefox-bin -#+end_src - -Lazy =ls= shortcuts. -#+begin_src sh :tangle ~/.zshrc :mkdirp yes - alias ll='ls -alF' - alias la='ls -a' - alias l='ls -F' - alias sl='ls' -#+end_src - -*** Prompt -Define function to write out icons for the git status. -#+begin_src sh :tangle ~/.zshrc :mkdirp yes - parse_git_dirty() { - git_status="$(git status 2> /dev/null)" - [[ "$git_status" =~ "use \"git push\" to publish your local commits" ]] && echo -n " %F{green}%f" - [[ "$git_status" =~ "Changes to be committed:" ]] && echo -n " %F{magenta}%f" - [[ "$git_status" =~ "Changes not staged for commit:" ]] && echo -n " %F{yellow}%f" - [[ "$git_status" =~ "Untracked files:" ]] && echo -n " %F{red}%f" - } -#+end_src - -Enable git status in the prompt. -#+begin_src sh :tangle ~/.zshrc :mkdirp yes - setopt prompt_subst - autoload -Uz vcs_info - precmd () { vcs_info } - zstyle ':vcs_info:*' formats ' %F{blue}%b%f' # git(main) -#+end_src - -Define the prompt as follows: -- Error code (if applicable) -- Path using =~= for the home directory and truncating if too long -- Git branch -- Git status -- =$= to mark the start of the prompt -#+begin_src sh :tangle ~/.zshrc :mkdirp yes - PS1='%(?..%B%F{red}[%?%\]%f%b )%F{green}%20<...<%~%<<%f$vcs_info_msg_0_$(parse_git_dirty) $ ' -#+end_src - -Enable VPN shortcut. -#+begin_src sh :tangle ~/.zshrc :mkdirp yes - if [ "$(uname)" = 'Linux' ] && grep -q 'ID=gentoo' /etc/os-release; then - vpn () { - if test -f /tmp/vpn.lock; then - echo turning off vpn... - doas /usr/bin/wg-quick down gentoo-CA-340 - rm /tmp/vpn.lock - else - echo turning on vpn... - doas /usr/bin/wg-quick up gentoo-CA-340 - touch /tmp/vpn.lock - fi - } - fi -#+end_src diff --git a/extract_src.py b/extract_src.py old mode 100644 new mode 100755 index 665c4c4..766bf1a --- a/extract_src.py +++ b/extract_src.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +import os +from stat import ST_MODE import sys import re @@ -27,3 +29,5 @@ with open(sys.argv[1], "r") as inp: if min_spaces == -1 or min_spaces > spaces: min_spaces = spaces curr.append(re.sub(r"^(\s*),(\*|,\*|#\+|,#\+)", r"\1\2", line)) + + os.chmod(sys.argv[2], os.stat(sys.argv[1])[ST_MODE]) diff --git a/install b/install deleted file mode 100755 index 52acedb..0000000 --- a/install +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/sh - -echo 'backing up previous log file to ~/.update-home-old.log' -mv ~/.update-home.log ~/.update-home-old.log >> /dev/null 2>&1 - -if ! test -d ~/.dotfiles; then - echo '.dotfiles should be at ~/.dotfiles; reinstalling dotfiles at ~/.dotfiles...' - git clone git@git.sr.ht:~jjanzen/.dotfiles ~/.dotfiles >> ~/.update-home.log 2>&1 -fi - -echo 'retrieving the latest changes (any unmerged local changes will be stashed)...' -{ - git stash - git checkout main - git pull --rebase -} >> ~/.update-home.log 2>&1 - -CWD=$(pwd) - -if [ "$(uname)" = 'Darwin' ]; then - echo 'detected Mac OS; installing Mac OS configuration...' - cd ~/.dotfiles/macos/ || exit -elif [ "$(uname)" = 'Linux' ] && grep -q 'ID=nixos' /etc/os-release; then - echo 'detected NixOS; installing NixOS configuration...' - cd ~/.dotfiles/nixos/ || exit -else - echo 'unsupported operating system' - exit 1 -fi - -echo 'installing configuration files...' -find -L -- . -type f -name "*\.org" | while read -r file; do - echo " installing $file..." - emacs --batch "$file" -f package-initialize --eval '(org-babel-tangle)' >> ~/.update-home.log 2>&1 -done -find -L -- . -type f -name "*\.org\.gpg" | while read -r file; do - echo " installing $file..." - gpg -d --batch "$file" 1> tmp.org 2>> ~/.update-home.log - emacs --batch tmp.org -f package-initialize --eval '(org-babel-tangle)' >> ~/.update-home.log 2>&1 - rm tmp.org -done - -echo 'installing wallpaper...' -cp .wallpaper ~/.wallpaper -if [ "$(uname)" = 'Darwin' ]; then - osascript -e "tell application \"System Events\" to tell every desktop to set picture to \"/$HOME/.wallpaper\" as POSIX file" -fi - -if [ "$(uname)" = 'Linux' ] && grep -q 'ID=nixos' /etc/os-release; then - echo 'installing NixOS flake' - sudo cp ./.flake/system/hardware-configuration.nix ~/.flake/system - sudo cp ./.flake/home/.wallpaper ~/.flake/home - sudo cp ./.flake/flake.lock ~/.flake - sudo nixos-rebuild switch --flake "$HOME/.flake#nixos" -fi - -if [ "$(uname)" = 'Darwin' ]; then - fonts_changed=false - echo 'installing fonts...' - mkdir -p ~/.local/share/fonts - if ! test -d ~/.local/share/fonts/ComputerModern; then - echo ' Computer Modern font missing. Installing...' - tar xf .local/share/fonts/ComputerModern.tar.gz -C ~/.local/share/fonts >> ~/.update-home.log 2>&1 - fonts_changed=true - fi - if ! test -f ~/.local/share/fonts/NFM.ttf; then - echo ' Nerd Font Mono font missing. Installing...' - tar xf .local/share/fonts/NFM.tar.gz -C ~/.local/share/fonts >> ~/.update-home.log 2>&1 - fonts_changed=true - fi - if ! test -d ~/.local/share/fonts/SauceCodePro; then - echo ' Source Code Pro Nerd Font missing. Installing...' - tar xf .local/share/fonts/SauceCodePro.tar.gz -C ~/.local/share/fonts >> ~/.update-home.log 2>&1 - fonts_changed=true - fi - - if [ $fonts_changed = true ]; then - echo ' updating the font cache...' - fc-cache -f >> ~/.update-home.log - fi -fi - -cd "$CWD" || exit diff --git a/macos.local/.clang-format.org b/macos.local/.clang-format.org new file mode 120000 index 0000000..4b4ef61 --- /dev/null +++ b/macos.local/.clang-format.org @@ -0,0 +1 @@ +../common/.clang-format.org \ No newline at end of file diff --git a/macos.local/.config/alacritty b/macos.local/.config/alacritty new file mode 120000 index 0000000..bfce794 --- /dev/null +++ b/macos.local/.config/alacritty @@ -0,0 +1 @@ +../../common/.config/alacritty \ No newline at end of file diff --git a/macos.local/.config/emacs b/macos.local/.config/emacs new file mode 120000 index 0000000..f4e5e56 --- /dev/null +++ b/macos.local/.config/emacs @@ -0,0 +1 @@ +../../common/.config/emacs \ No newline at end of file diff --git a/macos.local/.config/fastfetch b/macos.local/.config/fastfetch new file mode 120000 index 0000000..a73d684 --- /dev/null +++ b/macos.local/.config/fastfetch @@ -0,0 +1 @@ +../../common/.config/fastfetch \ No newline at end of file diff --git a/macos.local/.config/nvim b/macos.local/.config/nvim new file mode 120000 index 0000000..a0abd03 --- /dev/null +++ b/macos.local/.config/nvim @@ -0,0 +1 @@ +../../common/.config/nvim \ No newline at end of file diff --git a/macos.local/.config/sketchybar b/macos.local/.config/sketchybar new file mode 120000 index 0000000..b808184 --- /dev/null +++ b/macos.local/.config/sketchybar @@ -0,0 +1 @@ +../../common/.config/sketchybar \ No newline at end of file diff --git a/macos.local/.config/skhd b/macos.local/.config/skhd new file mode 120000 index 0000000..3aa80d0 --- /dev/null +++ b/macos.local/.config/skhd @@ -0,0 +1 @@ +../../common/.config/skhd \ No newline at end of file diff --git a/macos.local/.config/yabai b/macos.local/.config/yabai new file mode 120000 index 0000000..d2b69c5 --- /dev/null +++ b/macos.local/.config/yabai @@ -0,0 +1 @@ +../../common/.config/yabai \ No newline at end of file diff --git a/macos.local/.gitconfig.org.gpg b/macos.local/.gitconfig.org.gpg new file mode 120000 index 0000000..b4b87c9 --- /dev/null +++ b/macos.local/.gitconfig.org.gpg @@ -0,0 +1 @@ +../common/.gitconfig.org.gpg \ No newline at end of file diff --git a/macos.local/.gnupg/gpg-agent.org b/macos.local/.gnupg/gpg-agent.org new file mode 100644 index 0000000..8de64d2 --- /dev/null +++ b/macos.local/.gnupg/gpg-agent.org @@ -0,0 +1,6 @@ +#+title: GPG Agent Conf +Add =pinentry= program for Mac OS. + +#+begin_src conf :tangle ~/.gnupg/gpg-agent.conf + pinentry-program /opt/homebrew/bin/pinentry-mac +#+end_src diff --git a/macos.local/.local/bin/launcher.org b/macos.local/.local/bin/launcher.org new file mode 100755 index 0000000..f74d094 --- /dev/null +++ b/macos.local/.local/bin/launcher.org @@ -0,0 +1,13 @@ +#+title: Application Launcher Script + +Search several locations for applications with =choose=. +#+begin_src sh :tangle ~/.local/bin/launcher :mkdirp yes :tangle-mode o755 + #!/bin/sh + app="$(ls /Applications/ /Applications/Utilities/ /System/Applications/ /System/Applications/Utilities/ ~/Applications/ | grep '\.app$' | sed 's/\.app$//g' | choose -f "SauceCodePro Nerd Font" -s 15 -b ece0c9).app" +#+end_src + +Try opening the app in each location. +#+begin_src sh :tangle ~/.local/bin/launcher :mkdirp yes :tangle-mode o755 + open -n "$HOME/Applications/$app" || open -n "/Applications/$app" || open -n "/System/Applications/Utilities/$app" || open -n "/System/Applications/$app" || open -n "/Applications/Utilities/$app" + +#+end_src diff --git a/macos.local/.local/share/fonts b/macos.local/.local/share/fonts new file mode 120000 index 0000000..9ab89c4 --- /dev/null +++ b/macos.local/.local/share/fonts @@ -0,0 +1 @@ +../../../common/.local/share/fonts \ No newline at end of file diff --git a/macos.local/.profile.org b/macos.local/.profile.org new file mode 120000 index 0000000..6341fcf --- /dev/null +++ b/macos.local/.profile.org @@ -0,0 +1 @@ +../common/.profile.org \ No newline at end of file diff --git a/macos.local/.ssh/config.org b/macos.local/.ssh/config.org new file mode 100644 index 0000000..e78c4fb --- /dev/null +++ b/macos.local/.ssh/config.org @@ -0,0 +1,12 @@ +#+title: SSH Configuration +Keys should be added to the SSH agent. +#+begin_src conf :tangle ~/.ssh/config :mkdirp yes + Host * + UseKeychain yes + AddKeysToAgent yes + IdentityFile ~/.ssh/id_ed25519 + + Host aviary + HostName aviary.cs.umanitoba.ca + User janzenj2 +#+end_src diff --git a/macos.local/.wallpaper b/macos.local/.wallpaper new file mode 120000 index 0000000..ec41b94 --- /dev/null +++ b/macos.local/.wallpaper @@ -0,0 +1 @@ +../common/.wallpaper \ No newline at end of file diff --git a/macos.local/.zshrc.org b/macos.local/.zshrc.org new file mode 120000 index 0000000..ccbdc43 --- /dev/null +++ b/macos.local/.zshrc.org @@ -0,0 +1 @@ +../common/.zshrc.org \ No newline at end of file diff --git a/macos.local/Applications/Emacs.app/Contents/MacOS/Emacs.org b/macos.local/Applications/Emacs.app/Contents/MacOS/Emacs.org new file mode 100755 index 0000000..03c5152 --- /dev/null +++ b/macos.local/Applications/Emacs.app/Contents/MacOS/Emacs.org @@ -0,0 +1,9 @@ +#+title: Emacs Client Application + +#+begin_src sh :tangle ~/Applications/Emacs.app/Contents/MacOS/Emacs :mkdirp yes :tangle-mode o755 + #!/bin/sh + if ! ps -e | grep -q '[E]macs --bg-daemon'; then + /opt/homebrew/bin/emacs --daemon + fi + /opt/homebrew/bin/emacsclient -c &> /dev/null +#+end_src diff --git a/macos/.config/alacritty/alacritty.org b/macos/.config/alacritty/alacritty.org deleted file mode 100644 index 992ed63..0000000 --- a/macos/.config/alacritty/alacritty.org +++ /dev/null @@ -1,55 +0,0 @@ -#+title: Alacritty Configuration - -Remove window decorations. -#+begin_src conf :tangle ~/.config/alacritty/alacritty.toml :mkdirp yes - [window] - decorations = "None" -#+end_src - -Make the window slightly transparent. -#+begin_src conf :tangle ~/.config/alacritty/alacritty.toml :mkdirp yes - opacity = 0.9 -#+end_src - -Add slight padding around the text. -#+begin_src conf :tangle ~/.config/alacritty/alacritty.toml :mkdirp yes - padding = { x = 6, y = 6 } -#+end_src - -Allow use of option as an alt key on Mac OS. -#+begin_src conf :tangle ~/.config/alacritty/alacritty.toml :mkdirp yes - option_as_alt = "Both" -#+end_src - -Use the same font as normal. -#+begin_src conf :tangle ~/.config/alacritty/alacritty.toml :mkdirp yes - [font] - normal = { family = "SauceCodePro Nerd Font", style = "Regular" } - size = 14 -#+end_src - -#+begin_src conf :tangle ~/.config/alacritty/alacritty.toml :mkdirp yes - [colors.primary] - background = '#ece0c9' - foreground = '#191916' - - [colors.normal] - black = '#191916' - red = '#ac4438' - green = '#354d52' - yellow = '#ba9151' - blue = '#465b91' - magenta = '#5b5489' - cyan = '#4e6062' - white = '#c9ad7a' - - [colors.bright] - black = '#293c3c' - red = '#d8611c' - green = '#4b7b53' - yellow = '#d8974b' - blue = '#2f3d91' - magenta = '#735e82' - cyan = '#6b8f92' - white = '#ece0c9' -#+end_src diff --git a/macos/.config/emacs b/macos/.config/emacs deleted file mode 120000 index f4e5e56..0000000 --- a/macos/.config/emacs +++ /dev/null @@ -1 +0,0 @@ -../../common/.config/emacs \ No newline at end of file diff --git a/macos/.config/fastfetch b/macos/.config/fastfetch deleted file mode 120000 index a73d684..0000000 --- a/macos/.config/fastfetch +++ /dev/null @@ -1 +0,0 @@ -../../common/.config/fastfetch \ No newline at end of file diff --git a/macos/.config/nvim b/macos/.config/nvim deleted file mode 120000 index a0abd03..0000000 --- a/macos/.config/nvim +++ /dev/null @@ -1 +0,0 @@ -../../common/.config/nvim \ No newline at end of file diff --git a/macos/.config/sketchybar/plugins/battery.org b/macos/.config/sketchybar/plugins/battery.org deleted file mode 100644 index d3918e2..0000000 --- a/macos/.config/sketchybar/plugins/battery.org +++ /dev/null @@ -1,46 +0,0 @@ -#+title: SketchyBar Battery Plugin - -Get the percentage and charging status. -#+begin_src sh :tangle ~/.config/sketchybar/plugins/battery.sh :mkdirp yes :tangle-mode o755 - #!/bin/sh - PERCENTAGE="$(pmset -g batt | grep -Eo "\d+%" | cut -d% -f1)" - CHARGING="$(pmset -g batt | grep 'AC Power')" -#+end_src - -Exit if no percentage was reported. -#+begin_src sh :tangle ~/.config/sketchybar/plugins/battery.sh :mkdirp yes :tangle-mode o755 - if [ "$PERCENTAGE" = "" ]; then - exit 0 - fi -#+end_src - -Choose the icon based on the percentage. -#+begin_src sh :tangle ~/.config/sketchybar/plugins/battery.sh :mkdirp yes :tangle-mode o755 - if [[ "$CHARGING" != "" ]]; then - case "${PERCENTAGE}" in - 9[0-9]|100) ICON="󰂅" - ;; - [6-8][0-9]) ICON="󰂉" - ;; - [3-5][0-9]) ICON="󰂇" - ;; - [1-2][0-9]) ICON="󰢜" - ;; - ,*) ICON="󰁺" - esac - else - case "${PERCENTAGE}" in - 9[0-9]|100) ICON="󰁹" - ;; - [6-8][0-9]) ICON="󰁿" - ;; - [3-5][0-9]) ICON="󰁼" - ;; - [1-2][0-9]) ICON="󰁺" - ;; - ,*) ICON="" - esac - fi - - sketchybar --set "$NAME" icon="$ICON" label="${PERCENTAGE}%" -#+end_src diff --git a/macos/.config/sketchybar/plugins/clock.org b/macos/.config/sketchybar/plugins/clock.org deleted file mode 100644 index 1ab5ec3..0000000 --- a/macos/.config/sketchybar/plugins/clock.org +++ /dev/null @@ -1,7 +0,0 @@ -#+title: SketchyBar Clock Plugin - -Get the date and set it as the label. -#+begin_src sh :tangle ~/.config/sketchybar/plugins/clock.sh :mkdirp yes :tangle-mode o755 - #!/bin/sh - sketchybar --set "$NAME" label="$(date '+%Y-%m-%d %H:%M')" -#+end_src diff --git a/macos/.config/sketchybar/plugins/cpu.org b/macos/.config/sketchybar/plugins/cpu.org deleted file mode 100644 index 199d89b..0000000 --- a/macos/.config/sketchybar/plugins/cpu.org +++ /dev/null @@ -1,7 +0,0 @@ -#+title: SketchyBar CPU Plugin - -Get the CPU percentage and display it. -#+begin_src sh :tangle ~/.config/sketchybar/plugins/cpu.sh :mkdirp yes :tangle-mode o755 - #!/bin/sh - sketchybar --set "$NAME" icon='󰍛' label="$(top -l 2 | grep -E "^CPU" | tail -1 | awk '{ print $3 + $5"%" }')" -#+end_src diff --git a/macos/.config/sketchybar/plugins/front_app.org b/macos/.config/sketchybar/plugins/front_app.org deleted file mode 100644 index 44917e4..0000000 --- a/macos/.config/sketchybar/plugins/front_app.org +++ /dev/null @@ -1,9 +0,0 @@ -#+title: SketchyBar Front App Plugin - -Get the name of the focused application. -#+begin_src sh :tangle ~/.config/sketchybar/plugins/front_app.sh :mkdirp yes :tangle-mode o755 - #!/bin/sh - if [ "$SENDER" = "front_app_switched" ]; then - sketchybar --set "$NAME" label="$INFO" - fi -#+end_src diff --git a/macos/.config/sketchybar/plugins/mem.org b/macos/.config/sketchybar/plugins/mem.org deleted file mode 100644 index ef3feef..0000000 --- a/macos/.config/sketchybar/plugins/mem.org +++ /dev/null @@ -1,16 +0,0 @@ -#+title: SketchyBar Memory Plugin - -Get the memory in use and return that as a percent. -#+begin_src sh :tangle ~/.config/sketchybar/plugins/mem.sh :mkdirp yes :tangle-mode o755 - #!/bin/sh - hw_pagesize="$(sysctl -n hw.pagesize)" - mem_total="$(($(sysctl -n hw.memsize) / 1024))" - pages_app="$(($(sysctl -n vm.page_pageable_internal_count) - $(sysctl -n vm.page_purgeable_count)))" - pages_wired="$(vm_stat | awk '/ wired/ { print $4 }')" - pages_compressed="$(vm_stat | awk '/ occupied/ { printf $5 }')" - pages_compressed="${pages_compressed:-0}" - mem_used="$(((pages_app + ${pages_wired//.} + ${pages_compressed//.}) * hw_pagesize / 1024))" - - mem_percent=$((mem_perc=$mem_used * 100 / $mem_total)) - sketchybar --set "$NAME" icon="󰆼" label="$mem_percent%" -#+end_src diff --git a/macos/.config/sketchybar/plugins/space.org b/macos/.config/sketchybar/plugins/space.org deleted file mode 100644 index 97581aa..0000000 --- a/macos/.config/sketchybar/plugins/space.org +++ /dev/null @@ -1,7 +0,0 @@ -#+title: SketchyBar Space Plugin - -Get the current space. -#+begin_src sh :tangle ~/.config/sketchybar/plugins/space.sh :mkdirp yes :tangle-mode o755 - #!/bin/sh - sketchybar --set "$NAME" background.drawing="$SELECTED" -#+end_src diff --git a/macos/.config/sketchybar/plugins/volume.org b/macos/.config/sketchybar/plugins/volume.org deleted file mode 100644 index c53b2a1..0000000 --- a/macos/.config/sketchybar/plugins/volume.org +++ /dev/null @@ -1,21 +0,0 @@ -#+title: SketchyBar Volume Plugin - -Set an icon based on the current volume and return the volume and the icon. -#+begin_src sh :tangle ~/.config/sketchybar/plugins/volume.sh :mkdirp yes :tangle-mode o755 - #!/bin/sh - if [ "$SENDER" = "volume_change" ]; then - VOLUME="$INFO" - - case "$VOLUME" in - [6-9][0-9]|100) ICON="󰕾" - ;; - [3-5][0-9]) ICON="󰖀" - ;; - [1-9]|[1-2][0-9]) ICON="󰕿" - ;; - ,*) ICON="󰖁" - esac - - sketchybar --set "$NAME" icon="$ICON" label="$VOLUME%" - fi -#+end_src diff --git a/macos/.config/sketchybar/sketchybarrc.org b/macos/.config/sketchybar/sketchybarrc.org deleted file mode 100644 index 316eaf3..0000000 --- a/macos/.config/sketchybar/sketchybarrc.org +++ /dev/null @@ -1,77 +0,0 @@ -#+title: SketchyBar Configuration - -Set the plugin directory. -#+begin_src sh :tangle ~/.config/sketchybar/sketchybarrc :mkdirp yes :tangle-mode o755 - PLUGIN_DIR="$CONFIG_DIR/plugins" -#+end_src - -Place the bar at the of the screen with full transparency. -#+begin_src sh :tangle ~/.config/sketchybar/sketchybarrc :mkdirp yes :tangle-mode o755 - sketchybar --bar position=top height=40 blur_radius=30 color=0x00000000 -#+end_src - -Add small padding to left and right, use Symbols font for icons and Source Code Pro for text. Make all text white and add padding on left and right for labels and icons. -#+begin_src sh :tangle ~/.config/sketchybar/sketchybarrc :mkdirp yes :tangle-mode o755 - default=( - padding_left=5 - padding_right=5 - icon.font="Symbols Nerd Font:Bold:17.0" - label.font="Sauce Code Pro Nerd Font:Bold:14.0" - icon.color=0xffffffff - label.color=0xffffffff - icon.padding_left=4 - icon.padding_right=4 - label.padding_left=4 - label.padding_right=4 - ) - sketchybar --default "${default[@]}" -#+end_src - -Add clickable space icons for 10 spaces. -#+begin_src sh :tangle ~/.config/sketchybar/sketchybarrc :mkdirp yes :tangle-mode o755 - SPACE_ICONS=("1" "2" "3" "4" "5" "6" "7" "8" "9" "10") - for i in "${!SPACE_ICONS[@]}" - do - sid="$(($i+1))" - space=( - space="$sid" - icon="${SPACE_ICONS[i]}" - icon.padding_left=7 - icon.padding_right=7 - background.color=0x40ffffff - background.corner_radius=5 - background.height=25 - label.drawing=off - script="$PLUGIN_DIR/space.sh" - click_script="yabai -m space --focus $sid" - ) - sketchybar --add space space."$sid" left --set space."$sid" "${space[@]}" - done -#+end_src - -Add a chevron before listing the open application. -#+begin_src sh :tangle ~/.config/sketchybar/sketchybarrc :mkdirp yes :tangle-mode o755 - sketchybar --add item chevron left \ - --set chevron icon=󰅂 label.drawing=off \ - --add item front_app left \ - --set front_app icon.drawing=off script="$PLUGIN_DIR/front_app.sh" \ - --subscribe front_app front_app_switched -#+end_src - -Display a clock, volume, battery, CPU usage, and memory usage on the right. -#+begin_src sh :tangle ~/.config/sketchybar/sketchybarrc :mkdirp yes :tangle-mode o755 - sketchybar --add item clock right \ - --set clock update_freq=10 icon=󰥔 script="$PLUGIN_DIR/clock.sh" \ - --add item volume right \ - --set volume script="$PLUGIN_DIR/volume.sh" \ - --subscribe volume volume_change \ - --add item battery right \ - --set battery update_freq=120 script="$PLUGIN_DIR/battery.sh" \ - --subscribe battery system_woke power_source_change \ - --add item cpu right \ - --set cpu update_freq=10 script="$PLUGIN_DIR/cpu.sh" \ - --add item mem right \ - --set mem update_freq=10 script="$PLUGIN_DIR/mem.sh" - - sketchybar --update -#+end_src diff --git a/macos/.config/skhd/skhdrc.org b/macos/.config/skhd/skhdrc.org deleted file mode 100644 index e628cd4..0000000 --- a/macos/.config/skhd/skhdrc.org +++ /dev/null @@ -1,80 +0,0 @@ -#+title: =skhd= Configuration - -Add keybinding to open a terminal emulator. -#+begin_src conf :tangle ~/.config/skhd/skhdrc :mkdirp yes - cmd - return : /opt/homebrew/bin/alacritty -#+end_src - -Add keybinding for killing a window. -#+begin_src conf :tangle ~/.config/skhd/skhdrc :mkdirp yes - cmd + shift - q : yabai -m window --close -#+end_src - -Add keybinding for opening an app launcher. -#+begin_src conf :tangle ~/.config/skhd/skhdrc :mkdirp yes - cmd - d : ~/.local/bin/launcher -#+end_src - -Add keybinding for reloading the configuration. -#+begin_src conf :tangle ~/.config/skhd/skhdrc :mkdirp yes - cmd + shift - c : yabai --restart-service && skhd --restart-service && brew services restart sketchybar -#+end_src - -Change focus keybindings. -#+begin_src conf :tangle ~/.config/skhd/skhdrc :mkdirp yes - cmd - h : yabai -m window --focus west || yabai -m display --focus west - cmd - j : yabai -m window --focus south || yabai -m display --focus south - cmd - k : yabai -m window --focus north || yabai -m display --focus north - cmd - l : yabai -m window --focus east || yabai -m display --focus east -#+end_src - -Move window keybindings. -#+begin_src conf :tangle ~/.config/skhd/skhdrc :mkdirp yes - shift + cmd - h : yabai -m window --warp west - shift + cmd - j : yabai -m window --warp south - shift + cmd - k : yabai -m window --warp north - shift + cmd - l : yabai -m window --warp east -#+end_src - -Change workspace keybindings. -#+begin_src conf :tangle ~/.config/skhd/skhdrc :mkdirp yes - cmd - 1 : yabai -m space --focus 1 - cmd - 2 : yabai -m space --focus 2 - cmd - 3 : yabai -m space --focus 3 - cmd - 4 : yabai -m space --focus 4 - cmd - 5 : yabai -m space --focus 5 - cmd - 6 : yabai -m space --focus 6 - cmd - 7 : yabai -m space --focus 7 - cmd - 8 : yabai -m space --focus 8 - cmd - 9 : yabai -m space --focus 9 - cmd - 0 : yabai -m space --focus 10 -#+end_src - -Move window to workspace keybindings. -#+begin_src conf :tangle ~/.config/skhd/skhdrc :mkdirp yes - cmd + shift - 1 : yabai -m window --space 1 - cmd + shift - 2 : yabai -m window --space 2 - cmd + shift - 3 : yabai -m window --space 3 - cmd + shift - 4 : yabai -m window --space 4 - cmd + shift - 5 : yabai -m window --space 5 - cmd + shift - 6 : yabai -m window --space 6 - cmd + shift - 7 : yabai -m window --space 7 - cmd + shift - 8 : yabai -m window --space 8 - cmd + shift - 9 : yabai -m window --space 9 - cmd + shift - 0 : yabai -m window --space 10 -#+end_src - -Define full screen keybinding. -#+begin_src conf :tangle ~/.config/skhd/skhdrc :mkdirp yes - cmd + shift - f : yabai -m window --toggle zoom-fullscreen -#+end_src - -Define toggle floating keybinding. -#+begin_src conf :tangle ~/.config/skhd/skhdrc :mkdirp yes - cmd + shift - space : yabai -m window --toggle float -#+end_src - -Add screenshot keybinding. -#+begin_src conf :tangle ~/.config/skhd/skhdrc :mkdirp yes - shift + ctrl - s : open /System/Applications/Utilities/Screenshot.app -#+end_src diff --git a/macos/.config/yabai/yabairc.org b/macos/.config/yabai/yabairc.org deleted file mode 100644 index 4307c1f..0000000 --- a/macos/.config/yabai/yabairc.org +++ /dev/null @@ -1,68 +0,0 @@ -#+title: Yabai Configuration - -Load script additions automatically. -#+begin_src sh :tangle ~/.config/yabai/yabairc :mkdirp yes - yabai -m signal --add event=dock_did_restart action="sudo /opt/homebrew/bin/yabai --load-sa" - sudo /opt/homebrew/bin/yabai --load-sa -#+end_src - -Tile the windows. -#+begin_src sh :tangle ~/.config/yabai/yabairc :mkdirp yes - yabai -m config layout bsp -#+end_src - -Automatically balance window sizes. -#+begin_src sh :tangle ~/.config/yabai/yabairc :mkdirp yes - yabai -m config auto_balance on -#+end_src - -Use 10 pixel gaps. -#+begin_src sh :tangle ~/.config/yabai/yabairc :mkdirp yes - yabai -m config top_padding 10 - yabai -m config bottom_padding 10 - yabai -m config left_padding 10 - yabai -m config right_padding 10 - yabai -m config window_gap 10 -#+end_src - -Remove window shadows unless the window is floating. -#+begin_src sh :tangle ~/.config/yabai/yabairc :mkdirp yes - yabai -m config window_shadow float -#+end_src - -Move mouse to focused window anad focus on the window that the mouse is on. -#+begin_src sh :tangle ~/.config/yabai/yabairc :mkdirp yes - yabai -m config focus_follows_mouse autoraise - yabai -m config mouse_follows_focus on -#+end_src - -Control windows if =cmd= is held. -#+begin_src sh :tangle ~/.config/yabai/yabairc :mkdirp yes - yabai -m config mouse_modifier cmd -#+end_src - -Move windows with left click. -#+begin_src sh :tangle ~/.config/yabai/yabairc :mkdirp yes - yabai -m config mouse_action1 move -#+end_src - -Resize windows with right click. -#+begin_src sh :tangle ~/.config/yabai/yabairc :mkdirp yes - yabai -m config mouse_action2 resize -#+end_src - -Update Positions when the window is dropped. -#+begin_src sh :tangle ~/.config/yabai/yabairc :mkdirp yes - yabai -m mouse_drop_action swap -#+end_src - -Don't manage some apps. -#+begin_src sh :tangle ~/.config/yabai/yabairc :mkdirp yes - yabai -m rule --add app="^System Settings$" manage=off - yabai -m rule --add app="^Calculator$" manage=off -#+end_src - -Make windows management aware of SketchyBar. -#+begin_src sh :tangle ~/.config/yabai/yabairc :mkdirp yes - yabai -m config external_bar all:$(sketchybar --query bar | jq .height):0 -#+end_src diff --git a/macos/.gnupg/gpg-agent.org b/macos/.gnupg/gpg-agent.org deleted file mode 100644 index 8de64d2..0000000 --- a/macos/.gnupg/gpg-agent.org +++ /dev/null @@ -1,6 +0,0 @@ -#+title: GPG Agent Conf -Add =pinentry= program for Mac OS. - -#+begin_src conf :tangle ~/.gnupg/gpg-agent.conf - pinentry-program /opt/homebrew/bin/pinentry-mac -#+end_src diff --git a/macos/.local/bin/launcher.org b/macos/.local/bin/launcher.org deleted file mode 100644 index f74d094..0000000 --- a/macos/.local/bin/launcher.org +++ /dev/null @@ -1,13 +0,0 @@ -#+title: Application Launcher Script - -Search several locations for applications with =choose=. -#+begin_src sh :tangle ~/.local/bin/launcher :mkdirp yes :tangle-mode o755 - #!/bin/sh - app="$(ls /Applications/ /Applications/Utilities/ /System/Applications/ /System/Applications/Utilities/ ~/Applications/ | grep '\.app$' | sed 's/\.app$//g' | choose -f "SauceCodePro Nerd Font" -s 15 -b ece0c9).app" -#+end_src - -Try opening the app in each location. -#+begin_src sh :tangle ~/.local/bin/launcher :mkdirp yes :tangle-mode o755 - open -n "$HOME/Applications/$app" || open -n "/Applications/$app" || open -n "/System/Applications/Utilities/$app" || open -n "/System/Applications/$app" || open -n "/Applications/Utilities/$app" - -#+end_src diff --git a/macos/.local/share/fonts b/macos/.local/share/fonts deleted file mode 120000 index 9ab89c4..0000000 --- a/macos/.local/share/fonts +++ /dev/null @@ -1 +0,0 @@ -../../../common/.local/share/fonts \ No newline at end of file diff --git a/macos/.ssh/config.org b/macos/.ssh/config.org deleted file mode 100644 index e78c4fb..0000000 --- a/macos/.ssh/config.org +++ /dev/null @@ -1,12 +0,0 @@ -#+title: SSH Configuration -Keys should be added to the SSH agent. -#+begin_src conf :tangle ~/.ssh/config :mkdirp yes - Host * - UseKeychain yes - AddKeysToAgent yes - IdentityFile ~/.ssh/id_ed25519 - - Host aviary - HostName aviary.cs.umanitoba.ca - User janzenj2 -#+end_src diff --git a/macos/.wallpaper b/macos/.wallpaper deleted file mode 120000 index ec41b94..0000000 --- a/macos/.wallpaper +++ /dev/null @@ -1 +0,0 @@ -../common/.wallpaper \ No newline at end of file diff --git a/macos/Applications/Emacs.app/Contents/MacOS/Emacs.org b/macos/Applications/Emacs.app/Contents/MacOS/Emacs.org deleted file mode 100644 index 03c5152..0000000 --- a/macos/Applications/Emacs.app/Contents/MacOS/Emacs.org +++ /dev/null @@ -1,9 +0,0 @@ -#+title: Emacs Client Application - -#+begin_src sh :tangle ~/Applications/Emacs.app/Contents/MacOS/Emacs :mkdirp yes :tangle-mode o755 - #!/bin/sh - if ! ps -e | grep -q '[E]macs --bg-daemon'; then - /opt/homebrew/bin/emacs --daemon - fi - /opt/homebrew/bin/emacsclient -c &> /dev/null -#+end_src diff --git a/macos/clang-format.org b/macos/clang-format.org deleted file mode 120000 index 960b79e..0000000 --- a/macos/clang-format.org +++ /dev/null @@ -1 +0,0 @@ -../common/clang-format.org \ No newline at end of file diff --git a/macos/gitconfig.org.gpg b/macos/gitconfig.org.gpg deleted file mode 120000 index e4cb6ab..0000000 --- a/macos/gitconfig.org.gpg +++ /dev/null @@ -1 +0,0 @@ -../common/gitconfig.org.gpg \ No newline at end of file diff --git a/macos/profile.org b/macos/profile.org deleted file mode 120000 index 7db75e0..0000000 --- a/macos/profile.org +++ /dev/null @@ -1 +0,0 @@ -../common/profile.org \ No newline at end of file diff --git a/macos/zshrc.org b/macos/zshrc.org deleted file mode 120000 index 8a52724..0000000 --- a/macos/zshrc.org +++ /dev/null @@ -1 +0,0 @@ -../common/zshrc.org \ No newline at end of file diff --git a/nixos/.flake/home/programs/emacs/feed.org.org b/nixos/.flake/home/programs/emacs/feed.org.org deleted file mode 100644 index f0de605..0000000 --- a/nixos/.flake/home/programs/emacs/feed.org.org +++ /dev/null @@ -1,39 +0,0 @@ -#+title: Emacs RSS Feed - -#+begin_src org :tangle ~/.config/emacs/feed.org :mkdirp yes - ,* Blogs - :PROPERTIES: - :ID: elfeed - :END: - ,** Journalism :journalism: - ,*** [[https://waxy.org/feed/][Waxy.org]] - ,*** [[https://pluralistic.net/feed/][Cory Doctorow]] :technology:software:fiction: - ,** Computer Science :cs: - ,*** [[https://a.exozy.me/index.xml][Some Random Website]] :math:algorithms:fiction: - ,** Technology :technology: - ,*** [[https://ciechanow.ski/atom.xml][Bartosz Ciechanowshki]] - ,*** [[https://www.citationneeded.news/rss/][Citation Needed]] - ,*** [[https://www.lilysthings.org/blog/rss.xml][The Cool Blog]] - ,** Software :software: - ,*** [[https://eieio.games/feed.xml][eieio.games]] - ,*** [[https://ersei.net/en/blog.atom][Ersei]] - ,*** [[https://lilysthings.org/blog/rss.xml][Lily's Things]] - ,*** [[https://ntietz.com/atom.xml][Technically a Blog]] - ,*** [[https://alexwlchan.net/atom.xml][Alex Chan]] - ,*** [[https://eaton-works.com/feed.atom][Eaton Works]] :hacking: - ,*** [[https://computer.rip/rss.xml][Computer's Are Bad]] :technology: - ,*** [[https://mark.stosberg.com/rss/][Mark Stosberg]] :biking: - ,*** [[https://maia.crimew.gay/feed.xml][Maia Crimew]] :internet:hacking: - ,*** [[https://drewdevault.com/blog/index.xml][Drew DeVault]] - ,** Comics :comic: - ,*** [[https://xkcd.com/atom.xml][XKCD]] - ,** People I know - ,*** [[https://www.weavingwatersexpedition.com/news?format=rss][Weaving Waters Expedition]] :journalism: - ,*** [[https://pinkish.bearblog.dev/feed/][Pinkish]] :software: - ,*** [[https://jjanzen.ca/rss.xml][Me]] :software:review: - ,** Internet Infrastructure :internet:software: - ,*** [[https://daniel.haxx.se/blog/feed/][cURL]] - ,*** [[https://blog.archive.org/feed/][Archive.org]] - ,** Reviews :review: - ,*** [[https://mountainofink.com/?format=rss][Mountain of Ink]] -#+end_src diff --git a/nixos/.flake/home/programs/emacs/feed.org.org b/nixos/.flake/home/programs/emacs/feed.org.org new file mode 120000 index 0000000..d074855 --- /dev/null +++ b/nixos/.flake/home/programs/emacs/feed.org.org @@ -0,0 +1 @@ +../../../../../common/.config/emacs/feed.org.org \ No newline at end of file diff --git a/nixos/.flake/home/programs/emacs/force-custom-file.el.org b/nixos/.flake/home/programs/emacs/force-custom-file.el.org deleted file mode 100644 index 8b8a418..0000000 --- a/nixos/.flake/home/programs/emacs/force-custom-file.el.org +++ /dev/null @@ -1,8 +0,0 @@ -#+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/nixos/.flake/home/programs/emacs/force-custom-file.el.org b/nixos/.flake/home/programs/emacs/force-custom-file.el.org new file mode 120000 index 0000000..06a4dc7 --- /dev/null +++ b/nixos/.flake/home/programs/emacs/force-custom-file.el.org @@ -0,0 +1 @@ +../../../../../common/.config/emacs/force-custom-file.el.org \ No newline at end of file diff --git a/nixos/.flake/home/programs/emacs/languages.el.org b/nixos/.flake/home/programs/emacs/languages.el.org deleted file mode 100644 index 3ee63e0..0000000 --- a/nixos/.flake/home/programs/emacs/languages.el.org +++ /dev/null @@ -1,148 +0,0 @@ -#+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 - -Run =eglot= on CMake files. -#+begin_src emacs-lisp :tangle ~/.config/emacs/languages.el :mkdirp yes - (use-package cmake-mode - :init - (add-hook 'cmake-mode-hook 'jj/eglot-setup)) -#+end_src - -Turn off C mode in =lex= and =yacc= files. -#+begin_src emacs-lisp :tangle ~/.config/emacs/languages.el :mkdirp yes - (add-to-list 'auto-mode-alist '("\\.l$" . prog-mode)) - (add-to-list 'auto-mode-alist '("\\.y$" . prog-mode)) -#+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 - -Better Lisp editing with =lispy=. -#+begin_src emacs-lisp :tangle ~/.config/emacs/languages.el :mkdirp yes - (use-package lispy - :hook (emacs-lisp-mode . lispy-mode)) - (use-package lispyville - :after lispy - :hook (lispy-mode . lispyville-mode)) -#+end_src - -Better parentheses handling in lisp with =parinfer-rust-mode=. -#+begin_src emacs-lisp :tangle ~/.config/emacs/languages.el :mkdirp yes - (use-package parinfer-rust-mode - :hook (emacs-lisp-mode . parinfer-rust-mode) - :init - (setq parinfer-rust-auto-download t)) -#+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 - -* Nix -Install =nix= support and run =eglot= on =nix= files. -#+begin_src emacs-lisp :tangle ~/.config/emacs/languages.el :mkdirp yes - (use-package nix-mode - :mode "\\.nix\\'") -#+end_src diff --git a/nixos/.flake/home/programs/emacs/languages.el.org b/nixos/.flake/home/programs/emacs/languages.el.org new file mode 120000 index 0000000..dd60c9f --- /dev/null +++ b/nixos/.flake/home/programs/emacs/languages.el.org @@ -0,0 +1 @@ +../../../../../common/.config/emacs/languages.el.org \ No newline at end of file diff --git a/nixos/.flake/home/programs/emacs/package-setup.el.org b/nixos/.flake/home/programs/emacs/package-setup.el.org deleted file mode 100644 index 6ed238c..0000000 --- a/nixos/.flake/home/programs/emacs/package-setup.el.org +++ /dev/null @@ -1,25 +0,0 @@ -#+title: Emacs Package Setup -Install =straight= for better package management. -#+begin_src emacs-lisp :tangle ~/.config/emacs/package-setup.el :mkdirp yes - (defvar bootstrap-version) - (let ((bootstrap-file - (expand-file-name - "straight/repos/straight.el/bootstrap.el" - (or (bound-and-true-p straight-base-dir) - user-emacs-directory))) - (bootstrap-version 7)) - (unless (file-exists-p bootstrap-file) - (with-current-buffer - (url-retrieve-synchronously - "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el" - 'silent 'inhibit-cookies) - (goto-char (point-max)) - (eval-print-last-sexp))) - (load bootstrap-file nil 'nomessage)) -#+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 - (straight-use-package 'use-package) - (setq straight-use-package-by-default t) -#+end_src diff --git a/nixos/.flake/home/programs/emacs/package-setup.el.org b/nixos/.flake/home/programs/emacs/package-setup.el.org new file mode 120000 index 0000000..c0f3ead --- /dev/null +++ b/nixos/.flake/home/programs/emacs/package-setup.el.org @@ -0,0 +1 @@ +../../../../../common/.config/emacs/package-setup.el.org \ No newline at end of file diff --git a/nixos/.flake/home/programs/emacs/tools.el.org b/nixos/.flake/home/programs/emacs/tools.el.org deleted file mode 100644 index d52c1b6..0000000 --- a/nixos/.flake/home/programs/emacs/tools.el.org +++ /dev/null @@ -1,391 +0,0 @@ -#+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 - -* 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 - -* Remote Editing -#+begin_src emacs-lisp :tangle ~/.config/emacs/tools.el :mkdirp yes -(setq tramp-default-method "ssh") -#+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 - (use-package 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 :font ,jj/var-font))) - `(fixed-pitch ((t :font ,jj/mono-font))) - '(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 - (defun org-babel-tangle-config () - (when (string-suffix-p ".org" (buffer-file-name)) - (org-babel-tangle))) - (add-hook 'org-mode-hook - (lambda () - (add-hook 'after-save-hook #'org-babel-tangle-config))) -#+end_src - -Enable Org Crypt. -#+begin_src emacs-lisp :tangle ~/.config/emacs/tools.el :mkdirp yes - (org-crypt-use-before-save-magic) - (setq org-tags-exclude-from-inheritance '("crypt")) - (setq org-crypt-key nil) - (setq auto-save-default nil) -#+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 - -* Reference Management -Use Biblio and Citar to manage citations. -#+begin_src emacs-lisp :tangle ~/.config/emacs/tools.el :mkdirp yes - (use-package biblio) - (use-package citar - :custom - (citar-bibliography '("~/bib/references.bib")) - :hook - (LaTeX-mode . citar-capf-setup) - (org-mode . citar-capf-setup)) - (use-package citar-embark - :after citar embark - :no-require - :config (citar-embark-mode)) -#+end_src diff --git a/nixos/.flake/home/programs/emacs/tools.el.org b/nixos/.flake/home/programs/emacs/tools.el.org new file mode 120000 index 0000000..ff0296b --- /dev/null +++ b/nixos/.flake/home/programs/emacs/tools.el.org @@ -0,0 +1 @@ +../../../../../common/.config/emacs/tools.el.org \ No newline at end of file diff --git a/nixos/.flake/home/programs/emacs/user-interface.el.org b/nixos/.flake/home/programs/emacs/user-interface.el.org deleted file mode 100644 index ff4bd34..0000000 --- a/nixos/.flake/home/programs/emacs/user-interface.el.org +++ /dev/null @@ -1,131 +0,0 @@ -#+title: Emacs User Interface - -* Theming -Set up Source Code Pro with Nerd Font patches as default font and Computer Modern as a variable pitch font. -#+begin_src emacs-lisp :tangle ~/.config/emacs/user-interface.el :mkdirp yes - (defvar jj/mono-font) - (defvar jj/var-font) - (pcase system-type - (`gnu/linux - (when (eq (system-name) "gentoo")) - (setq jj/mono-font "SauceCodePro Nerd Font-11") - (setq jj/var-font "CMU Serif-14")) - (`darwin - (setq jj/mono-font "SauceCodePro Nerd Font-14:weight=thin") - (setq jj/var-font "CMU Serif-18"))) - (add-to-list 'default-frame-alist - `(font . ,jj/mono-font)) -#+end_src - -Use my custom Doom Disco light theme. -#+begin_src emacs-lisp :tangle ~/.config/emacs/user-interface.el :mkdirp yes - (use-package doom-themes - :straight (doom-themes :type git :host github :repo "doomemacs/themes" - :fork (:host github - :repo "JacobJanzen/emacs-doom-themes")) - :config - (setq doom-themes-enable-bold t - doom-themes-enable-italic t) - (load-theme 'doom-disco t) - (doom-themes-org-config)) - -(add-to-list 'default-frame-alist '(alpha-background . 90)) -#+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 - -Remove the title bar. -#+begin_src emacs-lisp :tangle ~/.config/emacs/user-interface.el :mkdirp yes - (add-to-list 'default-frame-alist '(undecorated . t)) -#+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 . nerd-icons-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/nixos/.flake/home/programs/emacs/user-interface.el.org b/nixos/.flake/home/programs/emacs/user-interface.el.org new file mode 120000 index 0000000..8a7f782 --- /dev/null +++ b/nixos/.flake/home/programs/emacs/user-interface.el.org @@ -0,0 +1 @@ +../../../../../common/.config/emacs/user-interface.el.org \ No newline at end of file -- cgit v1.2.3