diff --git a/.doom.d/config.el b/.doom.d/config.el new file mode 100644 index 0000000..c592624 --- /dev/null +++ b/.doom.d/config.el @@ -0,0 +1,149 @@ +;;; $DOOMDIR/config.el -*- lexical-binding: t; -*- + +;; Place your private configuration here! Remember, you do not need to run 'doom +;; sync' after modifying this file! + + +;; Some functionality uses this to identify you, e.g. GPG configuration, email +;; clients, file templates and snippets. +;; Initial Setup +(setq user-full-name "JaeYoo,Im" + user-mail-address "cpu3792@gmail.com") +(set-default-coding-systems 'utf-8) + +;; UI +(set-frame-parameter (selected-frame) 'alpha '(80 . 80)) +(add-to-list 'default-frame-alist '(alpha . (80 . 80))) +;(set-frame-parameter (selected-frame) 'fullscreen 'maximized) +;(add-to-list 'default-frame-alist '(fullscreen . maximized)) +(scroll-bar-mode 1) +(setq doom-modeline-major-mode-icon t) +(setq doom-modeline-major-mode-color-icon t) + +;; Doom exposes five (optional) variables for controlling fonts in Doom. Here +;; are the three important ones: +;; +;; + `doom-font' +;; + `doom-variable-pitch-font' +;; + `doom-big-font' -- used for `doom-big-font-mode'; use this for +;; presentations or streaming. +;; +;; They all accept either a font-spec, font string ("Input Mono-12"), or xlfd +;; font string. You generally only need these two: +;; (setq doom-font (font-spec :family "monospace" :size 12 :weight 'semi-light) +;; doom-variable-pitch-font (font-spec :family "sans" :size 13)) + +;; There are two ways to load a theme. Both assume the theme is installed and +;; available. You can either set `doom-theme' or manually load a theme with the +;; `load-theme' function. This is the default: +(setq doom-theme 'doom-palenight) + +;; If you use `org' and don't want your org files in the default location below, +;; change `org-directory'. It must be set before org loads! +(setq org-directory "~/Org/") +;;(setq org-roam-directory "~/Roam/") + +;; This determines the style of line numbers in effect. If set to `nil', line +;; numbers are disabled. For relative line numbers, set this to `relative'. +(setq display-line-numbers-type t) +(after! org + (add-hook 'org-mode-hook (lambda () (display-line-numbers-mode 0))) + (require 'org-tempo) + (add-to-list 'org-structure-template-alist '("sh" . "src shell")) + (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp")) + (add-to-list 'org-structure-template-alist '("py" . "src python")) + (add-to-list 'org-structure-template-alist '("hk" . "src haskell"))) + + +;; Roam +;;(use-package org-roam-server +;; :ensure t +;; :config +;; (setq org-roam-server-host "127.0.0.1" +;; org-roam-server-port 8080 +;; org-roam-server-authenticate nil +;; org-roam-server-export-inline-images t +;; org-roam-server-serve-files nil +;; org-roam-server-served-file-extensions '("pdf" "mp4" "ogv") +;; org-roam-server-network-poll t +;; org-roam-server-network-arrows nil +;; org-roam-server-network-label-truncate t +;; org-roam-server-network-label-truncate-length 60 +;; org-roam-server-network-label-wrap-length 20)) +;; +;;(defun org-roam-server-open () +;; "Ensure the server is active, then open the roam graph." +;; (interactive) +;; (smartparens-global-mode -1) +;; (org-roam-server-mode 1) +;; (browse-url-xdg-open (format "http://localhost:%d" org-roam-server-port)) +;; (smartparens-global-mode 1)) +;; +;;;; automatically enable server-mode +;;(after! org-roam +;; (smartparens-global-mode -1) +;; (org-roam-server-mode) +;; (smartparens-global-mode 1)) + +;; Dired +(evil-define-key 'normal dired-mode-map + (kbd "h") 'dired-up-directory + (kbd "l") 'dired-find-file) +(add-hook 'dired-mode-hook 'dired-hide-dotfiles-mode) +(evil-define-key 'normal 'dired-mode-map + (kbd "H") 'dired-hide-dotfiles-mode) + +;; Tramp +(setq tramp-default-method "ssh") +(customize-set-variable 'tramp-inline-compress-start-size nil) +(customize-set-variable 'tramp-copy-size-limit nil) + +;; Open with +(require 'openwith) +(setq large-file-warning-threshold nil) +(after! dired + (openwith-mode t) + (setq openwith-associations + (list (list (openwith-make-extension-regexp + '("mpg" "mpeg" "mp3" "mp4" "m4v" + "avi" "wmv" "wav" "mov" "flv" + "ogm" "ogg" "mkv")) + "mpv" + '(file))))) +;; Nov mode +(add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode)) + +;; Very large file +(use-package! vlf-setup + :defer-incrementally vlf-tune vlf-base vlf-write vlf-search vlf-occur vlf-follow vlf-ediff vlf) + +;; Key binding +(global-unset-key (kbd "C-j")) +(global-unset-key (kbd "C-k")) + +;; Time +(setq display-time-world-list + '(("Etc/UTC" "UTC") + ("Asia/Seoul" "Seoul") + ("Asia/Shanghai" "Shanghai"))) +(setq display-time-world-time-format "%a, %d %b %I:%M %p %Z") + + + + +;; Here are some additional functions/macros that could help you configure Doom: +;; +;; - `load!' for loading external *.el files relative to this one +;; - `use-package!' for configuring packages +;; - `after!' for running code after a package has loaded +;; - `add-load-path!' for adding directories to the `load-path', relative to +;; this file. Emacs searches the `load-path' when you load packages with +;; `require' or `use-package'. +;; - `map!' for binding new keys +;; +;; To get information about any of these functions/macros, move the cursor over +;; the highlighted symbol at press 'K' (non-evil users must press 'C-c c k'). +;; This will open documentation for it, including demos of how they are used. +;; +;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how +;; they are implemented. diff --git a/.doom.d/init.el b/.doom.d/init.el new file mode 100644 index 0000000..a5016a2 --- /dev/null +++ b/.doom.d/init.el @@ -0,0 +1,204 @@ +;;; init.el -*- lexical-binding: t; -*- + +;; This file controls what Doom modules are enabled and what order they load +;; in. Remember to run 'doom sync' after modifying it! + +;; NOTE Press 'SPC h d h' (or 'C-h d h' for non-vim users) to access Doom's +;; documentation. There you'll find a "Module Index" link where you'll find +;; a comprehensive list of Doom's modules and what flags they support. + +;; NOTE Move your cursor over a module's name (or its flags) and press 'K' (or +;; 'C-c c k' for non-vim users) to view its documentation. This works on +;; flags as well (those symbols that start with a plus). +;; +;; Alternatively, press 'gd' (or 'C-c c d') on a module to browse its +;; directory (for easy access to its source code). + +(doom! :input + ;;chinese + ;;japanese + ;;layout ; auie,ctsrnm is the superior home row + + :completion + company ; the ultimate code completion backend + ;;helm ; the *other* search engine for love and life + ;;ido ; the other *other* search engine... + ;;ivy ; a search engine for love and life + vertico ; the search engine of the future + + :ui + ;;deft ; notational velocity for Emacs + doom ; what makes DOOM look the way it does + doom-dashboard ; a nifty splash screen for Emacs + doom-quit ; DOOM quit-message prompts when you quit Emacs + (emoji +unicode) ; πŸ™‚ + hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW + ;;hydra + ;;indent-guides ; highlighted indent columns + ;;ligatures ; ligatures and symbols to make your code pretty again + ;;minimap ; show a map of the code on the side + modeline ; snazzy, Atom-inspired modeline, plus API + ;;nav-flash ; blink cursor line after big motions + ;;neotree ; a project drawer, like NERDTree for vim + ophints ; highlight the region an operation acts on + (popup +defaults) ; tame sudden yet inevitable temporary windows + ;;tabs ; a tab bar for Emacs + ;;treemacs ; a project drawer, like neotree but cooler + unicode ; extended unicode support for various languages + vc-gutter ; vcs diff in the fringe + vi-tilde-fringe ; fringe tildes to mark beyond EOB + ;;window-select ; visually switch windows + workspaces ; tab emulation, persistence & separate workspaces + ;;zen ; distraction-free coding or writing + + :editor + (evil +everywhere); come to the dark side, we have cookies + file-templates ; auto-snippets for empty files + fold ; (nigh) universal code folding + ;;(format +onsave) ; automated prettiness + ;;god ; run Emacs commands without modifier keys + ;;lispy ; vim for lisp, for people who don't like vim + ;;multiple-cursors ; editing in many places at once + ;;objed ; text object editing for the innocent + ;;parinfer ; turn lisp into python, sort of + ;;rotate-text ; cycle region at point between text candidates + snippets ; my elves. They type so I don't have to + ;;word-wrap ; soft wrapping with language-aware indent + + :emacs + (dired +icons) ; making dired pretty [functional] + electric ; smarter, keyword-based electric-indent + (ibuffer +icons) ; interactive buffer management + undo ; persistent, smarter undo for your inevitable mistakes + vc ; version-control and Emacs, sitting in a tree + + :term + eshell ; the elisp shell that works everywhere + ;;shell ; simple shell REPL for Emacs + ;;term ; basic terminal emulator for Emacs + ;;vterm ; the best terminal emulation in Emacs + + :checkers + syntax ; tasing you for every semicolon you forget + ;;(spell +flyspell) ; tasing you for misspelling mispelling + ;;grammar ; tasing grammar mistake every you make + + :tools + ;;ansible + ;;debugger ; FIXME stepping through code, to help you add bugs + ;;direnv + ;;docker + ;;editorconfig ; let someone else argue about tabs vs spaces + ;;ein ; tame Jupyter notebooks with emacs + (eval +overlay) ; run code, run (also, repls) + ;;gist ; interacting with github gists + lookup ; navigate your code and its documentation + lsp ; M-x vscode + magit ; a git porcelain for Emacs + ;;make ; run make tasks from Emacs + ;;pass ; password manager for nerds + pdf ; pdf enhancements + ;;prodigy ; FIXME managing external services & code builders + ;;rgb ; creating color strings + ;;taskrunner ; taskrunner for all your projects + ;;terraform ; infrastructure as code + ;;tmux ; an API for interacting with tmux + ;;upload ; map local to remote projects via ssh/ftp + + :os + (:if IS-MAC macos) ; improve compatibility with macOS + ;;tty ; improve the terminal Emacs experience + + :lang + ;;agda ; types of types of types of types... + ;;beancount ; mind the GAAP + (cc +lsp) ; C > C++ == 1 + ;;clojure ; java with a lisp + ;;common-lisp ; if you've seen one lisp, you've seen them all + ;;coq ; proofs-as-programs + ;;crystal ; ruby at the speed of c + ;;csharp ; unity, .NET, and mono shenanigans + ;;data ; config/data formats + ;;(dart +flutter) ; paint ui and not much else + ;;dhall + ;;elixir ; erlang done right + ;;elm ; care for a cup of TEA? + emacs-lisp ; drown in parentheses + ;;erlang ; an elegant language for a more civilized age + ;;ess ; emacs speaks statistics + ;;factor + ;;faust ; dsp, but you get to keep your soul + ;;fsharp ; ML stands for Microsoft's Language + ;;fstar ; (dependent) types and (monadic) effects and Z3 + ;;gdscript ; the language you waited for + ;;(go +lsp) ; the hipster dialect + (haskell +dante) ; a language that's lazier than I am + ;;hy ; readability of scheme w/ speed of python + ;;idris ; a language you can depend on + json ; At least it ain't XML + ;;(java +meghanada) ; the poster child for carpal tunnel syndrome + ;;javascript ; all(hope(abandon(ye(who(enter(here)))))) + ;;julia ; a better, faster MATLAB + ;;kotlin ; a better, slicker Java(Script) + (latex ; writing papers in Emacs has never been so fun + +cdlatex ; Enable cdlatex for fast math insertion. + +fold) ; Use TeX-fold (from auctex) to fold LaTeX macros to unicode, and make folding hook-based and less manual. + ;;lean ; for folks with too much to prove + ;;ledger ; be audit you can be + ;;lua ; one-based indices? one-based indices + markdown ; writing docs for people to ignore + ;;nim ; python + lisp at the speed of c + ;;nix ; I hereby declare "nix geht mehr!" + ;;ocaml ; an objective camel + (org ; organize your plain life in plain text + ;;+brain ; Enables org-brain integration. + +dragndrop ; Enables drag-and-drop support for images and files; inserts inline previews for images and an icon+link for other media types. + +gnuplot ; Installs gnuplot & gnuplot-mode, which enables rendering images from gnuplot src blocks or plotting tables with org-plot/gnuplot (bound to SPC m b p, by default). + ;;+hugo ; Enables integration with hugo to export from Emacs well-formed (blackfriday) markdown. + ;;+journal ; Enables org-journal integration. + ;;+jupyter ; Enables Jupyter integration for babel. + +noter ; Enables org-noter integration. Keeps notes in sync with a document. Requires pdf-tools (:tools pdf) or DocView or nov.el to be enabled. + +pandoc ; Enables pandoc integration into the Org exporter. + ;;+pomodoro ; Enables a pomodoro timer for clocking time on tasks. + ;;+present ; Enables integration with reveal.js, beamer and org-tree-slide, so Emacs can be used for presentations. It automatically downloads reveal.js. + +pretty ; Enables pretty unicode symbols for bullets and priorities, and better syntax highlighting for latex. Keep in mind: this can be expensive. If org becomes too slow, it’d be wise to disable this flag. + +roam2 ; Enables org-roam integration. This requires sqlite3 to be installed on your system. + ) + ;;php ; perl's insecure younger brother + ;;plantuml ; diagrams for confusing people more + ;;purescript ; javascript, but functional + python ; beautiful is better than ugly + ;;qt ; the 'cutest' gui framework ever + ;;racket ; a DSL for DSLs + ;;raku ; the artist formerly known as perl6 + ;;rest ; Emacs as a REST client + ;;rst ; ReST in peace + ;;(ruby +rails) ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"} + (rust +lsp) ; Fe2O3.unwrap().unwrap().unwrap().unwrap() + ;;scala ; java, but good + ;;(scheme +guile) ; a fully conniving family of lisps + sh ; she sells {ba,z,fi}sh shells on the C xor + ;;sml + ;;solidity ; do you need a blockchain? No. + ;;swift ; who asked for emoji variables? + ;;terra ; Earth and Moon in alignment for performance. + ;;web ; the tubes + ;;yaml ; JSON, but readable + ;;zig ; C, but simpler + + :email + (mu4e +org +gmail) + ;;notmuch + ;;(wanderlust +gmail) + + :app + ;;calendar + ;;emms + ;;everywhere ; *leave* Emacs!? You must be joking + ;;irc ; how neckbeards socialize + ;;(rss +org) ; emacs as an RSS reader + ;;twitter ; twitter client https://twitter.com/vnought + + :config + ;;literate + (default +bindings +smartparens)) diff --git a/.doom.d/packages.el b/.doom.d/packages.el new file mode 100644 index 0000000..82ef263 --- /dev/null +++ b/.doom.d/packages.el @@ -0,0 +1,57 @@ +;; -*- no-byte-compile: t; -*- +;;; $DOOMDIR/packages.el + +;; To install a package with Doom you must declare them here and run 'doom sync' +;; on the command line, then restart Emacs for the changes to take effect -- or +;; use 'M-x doom/reload'. + + +;; To install SOME-PACKAGE from MELPA, ELPA or emacsmirror: +;(package! some-package) + +;; To install a package directly from a remote git repo, you must specify a +;; `:recipe'. You'll find documentation on what `:recipe' accepts here: +;; https://github.com/raxod502/straight.el#the-recipe-format +;(package! another-package +; :recipe (:host github :repo "username/repo")) + +;; If the package you are trying to install does not contain a PACKAGENAME.el +;; file, or is located in a subdirectory of the repo, you'll need to specify +;; `:files' in the `:recipe': +;(package! this-package +; :recipe (:host github :repo "username/repo" +; :files ("some-file.el" "src/lisp/*.el"))) + +;; If you'd like to disable a package included with Doom, you can do so here +;; with the `:disable' property: +;(package! builtin-package :disable t) + +;; You can override the recipe of a built in package without having to specify +;; all the properties for `:recipe'. These will inherit the rest of its recipe +;; from Doom or MELPA/ELPA/Emacsmirror: +;(package! builtin-package :recipe (:nonrecursive t)) +;(package! builtin-package-2 :recipe (:repo "myfork/package")) + +;; Specify a `:branch' to install a package from a particular branch or tag. +;; This is required for some packages whose default branch isn't 'master' (which +;; our package manager can't deal with; see raxod502/straight.el#279) +;(package! builtin-package :recipe (:branch "develop")) + +;; Use `:pin' to specify a particular commit to install. +;(package! builtin-package :pin "1a2b3c4d5e") + + +;; Doom's packages are pinned to a specific commit and updated from release to +;; release. The `unpin!' macro allows you to unpin single packages... +;(unpin! pinned-package) +;; ...or multiple packages +;(unpin! pinned-package another-pinned-package) +;; ...Or *all* packages (NOT RECOMMENDED; will likely break things) +;(unpin! t) + + +;;(package! org-roam-server) +(package! dired-hide-dotfiles) +(package! openwith) +(package! nov) +(package! vlf) diff --git a/.emacs.d.vanilla/desktop.org b/.emacs.d.vanilla/desktop.org new file mode 100644 index 0000000..209aabc --- /dev/null +++ b/.emacs.d.vanilla/desktop.org @@ -0,0 +1,283 @@ +#+TITLE: Desktop + +* Exwm Desktop +#+begin_src config :tangle ~/.emacs.d/exwm/EXWM.desktop :mkdirp yes +[Desktop Entry] +Name=EXWM +Comment=Emacs Window Manager +Exec=sh /home/jaeus/.emacs.d/exwm/start-exwm.sh +TryExec=sh +Type=Application +X-LightDM-DesktopName=exwm +DesktopNames=exwm +#+end_src + +#+begin_src shell :tangle ~/.emacs.d/exwm/start-exwm.sh :mkdirp yes +#!/bin/sh +# Set the screen DPI (uncomment this if needed!) +# xrdb ~/.emacs.d/exwm/Xresources + +# Run the screen compositor +#picom & +#picom -b --config /home/jaeus/.config/i3/picom.conf & +# Enable screen locking on suspend +xss-lock -- slock & + +# Fire it up +exec dbus-launch --exit-with-session emacs -mm --debug-init -l ~/.emacs.d/desktop.el + +#+end_src + + +* Configuration +#+begin_src emacs-lisp :tangle ~/.emacs.d/desktop.el + (defun efs/run-in-background (command) + (let ((command-parts (split-string command "[ ]+"))) + (apply #'call-process `(,(car command-parts) nil 0 nil ,@(cdr command-parts))))) + + (defun efs/set-wallpaper () + (interactive) + ;; NOTE: You will need to update this to a valid background path! + (start-process-shell-command + "dwall" nil "dwall -s colony")) + + (defun efs/exwm-init-hook () + ;; Make workspace 1 be the one where we land at startup + (exwm-workspace-switch-create 1) + + ;; Open eshell by default + ;;(eshell) + + ;; NOTE: The next two are disabled because we now use Polybar! + + ;; Show battery status in the mode line + ;;(display-battery-mode 1) + + ;; Show the time and date in modeline + ;;(setq display-time-day-and-date t) + ;;(display-time-mode 1) + ;; Also take a look at display-time-format and format-time-string + + ;; Start the Polybar panel + (efs/start-panel) + + ;; Launch apps that will run in the background + ;;(efs/run-in-background "dunst") + (efs/run-in-background "nm-applet") + ;(efs/run-in-background "xmobar -x 0 /home/jaeus/.config/xmobar/xmobarrc0") + ;(efs/run-in-background "xmobar -x 1 /home/jaeus/.config/xmobar/xmobarrc1") + (efs/run-in-background "picom -b --config /home/jaeus/.config/i3/picom.conf") + (efs/run-in-background "dwall -s firewatch") + (efs/run-in-background "volumeicon") + (efs/run-in-background "blueberry-tray") + (efs/run-in-background "seafile-applet") + (efs/run-in-background "green-tunnel -s") + (efs/run-in-background "/home/jaeus/.emacs.d/exwm/run_xmodmap.sh") + (efs/run-in-background "/home/jaeus/.emacs.d/exwm/run_fcitx.sh")) + + (defun efs/exwm-update-class () + (exwm-workspace-rename-buffer exwm-class-name)) + + (defun efs/exwm-update-title () + (pcase exwm-class-name + ("Firefox" (exwm-workspace-rename-buffer (format "Firefox: %s" exwm-title))))) + + ;; This function isn't currently used, only serves as an example how to + ;; position a window + (defun efs/position-window () + (let* ((pos (frame-position)) + (pos-x (car pos)) + (pos-y (cdr pos))) + + (exwm-floating-move (- pos-x) (- pos-y)))) + + (defun efs/configure-window-by-class () + (interactive) + (pcase exwm-class-name + ("vivaldi-stable" (exwm-workspace-move-window 2)) + ("Sol" (exwm-workspace-move-window 3)) + ("mpv" (exwm-floating-toggle-floating) + (exwm-layout-toggle-mode-line)))) + + ;; This function should be used only after configuring autorandr! + (defun efs/update-displays () + (efs/run-in-background "autorandr --change --force") + (efs/set-wallpaper) + (message "Display config: %s" + (string-trim (shell-command-to-string "autorandr --current")))) + + (use-package exwm + :config + ;; Set the default number of workspaces + (setq exwm-workspace-number 10) + + ;; When window "class" updates, use it to set the buffer name + (add-hook 'exwm-update-class-hook #'efs/exwm-update-class) + + ;; When window title updates, use it to set the buffer name + (add-hook 'exwm-update-title-hook #'efs/exwm-update-title) + + ;; Configure windows as they're created + (add-hook 'exwm-manage-finish-hook #'efs/configure-window-by-class) + + ;; When EXWM starts up, do some extra confifuration + (add-hook 'exwm-init-hook #'efs/exwm-init-hook) + + ;; Rebind CapsLock to Ctrl + ;;(start-process-shell-command "xmodmap" nil "xmodmap /home/jaeus/.emacs.d/exwm/Xmodmap") + + ;; NOTE: Uncomment the following two options if you want window buffers + ;; to be available on all workspaces! + + ;; Automatically move EXWM buffer to current workspace when selected + ;; (setq exwm-layout-show-all-buffers t) + + ;; Display all EXWM buffers in every workspace buffer list + ;; (setq exwm-workspace-show-all-buffers t) + + ;; NOTE: Uncomment this option if you want to detach the minibuffer! + ;; Detach the minibuffer (show it with exwm-workspace-toggle-minibuffer) + ;;(setq exwm-workspace-minibuffer-position 'top) + + ;; Set the screen resolution (update this to be the correct resolution for your screen!) + (require 'exwm-randr) + (exwm-randr-enable) + (start-process-shell-command "xrandr" nil "xrandr --output DP-4 --primary --mode 2560x1440 --pos 0x0 --rotate normal --output HDMI-0 --mode 1920x1080 --pos 2560x0 --rotate normal") + + ;; This will need to be updated to the name of a display! You can find + ;; the names of your displays by looking at arandr or the output of xrandr + (setq exwm-randr-workspace-monitor-plist '(2 "HDMI-0" 3 "HDMI-0")) + + ;; NOTE: Uncomment these lines after setting up autorandr! + ;; React to display connectivity changes, do initial display update + ;; (add-hook 'exwm-randr-screen-change-hook #'efs/update-displays) + ;; (efs/update-displays) + + ;; Set the wallpaper after changing the resolution + (efs/set-wallpaper) + + ;; NOTE: This is disabled because we now use Polybar! + ;; Load the system tray before exwm-init + ;(require 'exwm-systemtray) + ;(setq exwm-systemtray-height 32) + ;(exwm-systemtray-enable) + + ;; Automatically send the mouse cursor to the selected workspace's display + (setq exwm-workspace-warp-cursor t) + + ;; Window focus should follow the mouse pointer + (setq mouse-autoselect-window t + focus-follows-mouse t) + + ;; These keys should always pass through to Emacs + (setq exwm-input-prefix-keys + '(?\C-x + ?\C-u + ?\C-h + ?\M-x + ?\M-` + ?\M-& + ?\M-: + ?\C-\M-j ;; Buffer list + ?\C-\ )) ;; Ctrl+Space + + ;; Ctrl+Q will enable the next key to be sent directly + (define-key exwm-mode-map [?\C-q] 'exwm-input-send-next-key) + + ;; Set up global key bindings. These always work, no matter the input state! + ;; Keep in mind that changing this list after EXWM initializes has no effect. + (setq exwm-input-global-keys + `( + ;; Reset to line-mode (C-c C-k switches to char-mode via exwm-input-release-keyboard) + ([?\s-r] . exwm-reset) + + ;; Move between windows + ([?\s-h] . windmove-left) + ([?\s-l] . windmove-right) + ([?\s-k] . windmove-up) + ([?\s-j] . windmove-down) + + ;; Launch applications via shell command + ([?\s-&] . (lambda (command) + (interactive (list (read-shell-command "$ "))) + (start-process-shell-command command nil command))) + + ;; Switch workspace + ([?\s-w] . exwm-workspace-switch) + ([?\s-`] . (lambda () (interactive) (exwm-workspace-switch-create 0))) + + ;; 's-N': Switch to certain workspace with Super (Win) plus a number key (0 - 9) + ,@(mapcar (lambda (i) + `(,(kbd (format "s-%d" i)) . + (lambda () + (interactive) + (exwm-workspace-switch-create ,i)))) + (number-sequence 0 9)))) + + (exwm-input-set-key (kbd "s-SPC") 'counsel-linux-app) + + (exwm-enable)) + + (use-package desktop-environment + :after exwm + :config (desktop-environment-mode) + :custom + (desktop-environment-brightness-small-increment "2%+") + (desktop-environment-brightness-small-decrement "2%-") + (desktop-environment-brightness-normal-increment "5%+") + (desktop-environment-brightness-normal-decrement "5%-")) + + ;; Make sure the server is started (better to do this in your main Emacs config!) + (server-start) + + (defvar efs/polybar-process nil + "Holds the process of the running Polybar instance, if any") + + + (defun dw/polybar-exwm-workspace () + (pcase exwm-workspace-current-index + (0 "πŸ‘Ώ") + (1 "πŸ’»") + (2 "🏻") + (3 "🎈") + (4 "πŸ‘€"))) + + (defun dw/polybar-exwm-workspace-path () + (let ((workspace-path (frame-parameter nil 'bufler-workspace-path-formatted))) + (if workspace-path + (substring-no-properties workspace-path) + ""))) + + (defun efs/kill-panel () + (interactive) + (when efs/polybar-process + (ignore-errors + (kill-process efs/polybar-process))) + (setq efs/polybar-process nil)) + + (defun efs/start-panel () + (interactive) + (efs/kill-panel) + (setq efs/polybar-process (start-process-shell-command "polybar" nil "polybar panel"))) + + (defun efs/send-polybar-hook (module-name hook-index) + (start-process-shell-command "polybar-msg" nil (format "polybar-msg hook %s %s" module-name hook-index))) + + (defun efs/send-polybar-exwm-workspace () + (efs/send-polybar-hook "exwm-workspace" 1)) + + ;; Update panel indicator when workspace changes + (add-hook 'exwm-workspace-switch-hook #'efs/send-polybar-exwm-workspace) + + (defun efs/disable-desktop-notifications () + (interactive) + (start-process-shell-command "notify-send" nil "notify-send \"DUNST_COMMAND_PAUSE\"")) + + (defun efs/enable-desktop-notifications () + (interactive) + (start-process-shell-command "notify-send" nil "notify-send \"DUNST_COMMAND_RESUME\"")) + + (defun efs/toggle-desktop-notifications () + (interactive) + (start-process-shell-command "notify-send" nil "notify-send \"DUNST_COMMAND_TOGGLE\"")) +#+end_src diff --git a/.emacs.d.vanilla/emacs.org b/.emacs.d.vanilla/emacs.org new file mode 100644 index 0000000..017369e --- /dev/null +++ b/.emacs.d.vanilla/emacs.org @@ -0,0 +1,1151 @@ +#+TITLE: Emacs Configuration +#+AUTHOR: JaeYoo-Im, (cpu3792@gmail.com) + + +* Global Settings +#+begin_src emacs-lisp + (defvar gvar/default-font-size 100) + (defvar gvar/default-variable-font-size 100) + (defvar gvar/frame-transparency '(80 . 80)) + (setq gc-cons-threshold (* 2 1000 1000)) + (setq user-emacs-directory "~/.cache/emacs") + (set-default-coding-systems 'utf-8) + (setq-default tab-width 4) + (setq-default evil-shift-width tab-width) + (setq large-file-warning-threshold nil) +#+end_src +* Package Related +** Package Repo +#+begin_src emacs-lisp + (require 'package) + (setq package-archives '(("melpa" . "https://melpa.org/packages/") + ("org" . "https://orgmode.org/elpa/") + ("elpa" . "https://elpa.gnu.org/packages/"))) + ;;(unless package-archive-contents + ;; (package-refresh-contents)) + (package-initialize) +#+end_src +** use-package +#+begin_src emacs-lisp + ;; Initialize use-package on non-Linux platforms + (unless (package-installed-p 'use-package) + (package-install 'use-package)) + + (require 'use-package) + (setq use-package-always-ensure t) + + ;;(use-package auto-package-update + ;; :custom + ;; (auto-package-update-interval 7) + ;; (auto-package-update-prompt-before-update t) + ;; (auto-package-update-hide-results t) + ;; :config + ;; (auto-package-update-maybe) + ;; (auto-package-update-at-time "09:00")) +#+end_src + + +** Straight +https://github.com/raxod502/straight.el +#+begin_src emacs-lisp + (defvar bootstrap-version) + (let ((bootstrap-file + (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) + (bootstrap-version 5)) + (unless (file-exists-p bootstrap-file) + (with-current-buffer + (url-retrieve-synchronously + "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el" + 'silent 'inhibit-cookies) + (goto-char (point-max)) + (eval-print-last-sexp))) + (load bootstrap-file nil 'nomessage)) + + (setq straight-use-package-by-default t) + ;; Use package install from git + (straight-use-package 'use-package) +#+end_src + + +* No-Littering +#+begin_src emacs-lisp + (use-package no-littering) ; make ~/.emacs.d clean + ;; no-littering doesn't set this by default so we must place + ;; auto save files in the same path as it uses for sessions + (setq auto-save-file-name-transforms + `((".*" ,(no-littering-expand-var-file-name "auto-save/") t))) + + (setq inhibit-startup-message t) +#+end_src + +* Performance Optimization +** Garbage Collection +#+begin_src emacs-lisp + (setq gc-cons-threshold most-positive-fixnum) + (defconst 1mb 1048576) + (defconst 20mb 20971520) + (defconst 30mb 31457280) + (defconst 50mb 52428800) + + (defun fk/defer-garbage-collection () + (setq gc-cons-threshold most-positive-fixnum)) + + (defun fk/restore-garbage-collection () + (run-at-time 1 nil (lambda () (setq gc-cons-threshold 30mb)))) + + (add-hook 'emacs-startup-hook 'fk/restore-garbage-collection 100) + (add-hook 'minibuffer-setup-hook 'fk/defer-garbage-collection) + (add-hook 'minibuffer-exit-hook 'fk/restore-garbage-collection) + + (setq read-process-output-max 1mb) ;; lsp-mode's performance suggest +#+end_src + + +* EVIL Mode +#+begin_src emacs-lisp + (defun ju/evil-hook() + (dolist (mode '(custom-mode + erc-mode)) + (add-to-list 'evil-emacs-state-modes mode))) + (use-package undo-tree + :init + (global-undo-tree-mode 1)) + (use-package evil + :ensure t + :init + (setq evil-want-integration t) + (setq evil-want-keybinding nil) + (setq evil-want-C-u-scroll t) + (setq evil-want-C-i-jump nil) + (setq evil-undo-system 'undo-tree) + :config + (add-hook 'evil-mode-hook 'ju/evil-hook) + (evil-mode 1) + (define-key evil-insert-state-map (kbd "C-h") 'evil-delete-backward-char-and-join) + + ;; Use visual line motions even outside of visual-line-mode buffers + (evil-global-set-key 'motion "j" 'evil-next-visual-line) + (evil-global-set-key 'motion "k" 'evil-previous-visual-line) + (evil-set-initial-state 'messages-buffer-mode 'normal) + (evil-set-initial-state 'dashboard-mode 'normal)) + + (use-package evil-numbers + :after evil + :config ;; unfortunately C-x is emacs common key binding. + (define-key evil-normal-state-map (kbd "g =") 'evil-numbers/inc-at-pt) + (define-key evil-normal-state-map (kbd "g -") 'evil-numbers/dec-at-pt) + (define-key evil-visual-state-map (kbd "g =") 'evil-numbers/inc-at-pt) + (define-key evil-visual-state-map (kbd "g -") 'evil-numbers/dec-at-pt)) + (use-package evil-nerd-commenter + :after evil + :config + (define-key evil-normal-state-map (kbd "g c") 'evilnc-comment-or-uncomment-lines) + (define-key evil-visual-state-map (kbd "g c") 'evilnc-comment-or-uncomment-lines)) + + (use-package evil-collection + :after evil + :ensure t + :config + (evil-collection-init)) +#+end_src + +** TODO Check Tips +https://github.com/noctuid/evil-guide +https://nathantypanski.com/blog/2014-08-03-a-vim-like-emacs-config.html + +* GUI +** Initial Configuration +#+begin_src emacs-lisp + (scroll-bar-mode -1) ; Disable visible scrollbar + (tool-bar-mode -1) ; Disable the toolbar + (tooltip-mode -1) ; Disable tooltips + (set-fringe-mode 10) ; Give some breathing room + + (menu-bar-mode -1) ; Disable the menu bar + (setq visible-bell t) +#+end_src + +** Line number +#+begin_src emacs-lisp + (column-number-mode) + (global-display-line-numbers-mode t) + ;; Disable line numbers for some modes + (dolist (mode '(org-mode-hook + vterm-mode-hook + shell-mode-hook + treemacs-mode-hook + dired-mode-hook + eshell-mode-hook)) + (add-hook mode (lambda () (display-line-numbers-mode 0)))) +#+end_src +* Theme +#+begin_src emacs-lisp + (use-package doom-themes + :ensure t) + (setq doom_themes-enable-bold t + doom-themes-enablbe-italic t) + (load-theme 'doom-palenight t) + + (use-package doom-modeline + :init (doom-modeline-mode 1) + :custom ((doom-modeline-height 15))) + + ;; Set frame transparency + (set-frame-parameter (selected-frame) 'alpha gvar/frame-transparency) + (add-to-list 'default-frame-alist `(alpha . ,gvar/frame-transparency)) + ;;(set-frame-parameter (selected-frame) 'fullscreen 'maximized) + ;;(add-to-list 'default-frame-alist '(fullscreen . maximized)) +#+end_src +* Dashboard +#+begin_src emacs-lisp + (use-package dashboard + :ensure t + :init + (setq dashboard-set-heading-icons t) + (setq dashboard-set-file-icons t) + ;;(setq dashboard-banner-logo-title "Emacs is more than a text editor!") + ;;(dashboard-startup-banner 'logo) + (setq dashboard-startup-banner "/home/jaeus/.emacs.d/logos/emacs-e.png") + (setq dashboard-center-content t) + (setq dashboard-week-agenda t) + (setq dashboard-agenda-time-string-format "%d/%m/%Y %A %H:%M") + (setq dashboard-items '((recents . 10) + (agenda . 5) + (bookmarks . 5) + (projects . 5) + (registers . 5))) + (setq dashboard-set-navigator t) + ;; Format: "(icon title help action face prefix suffix)" + (setq dashboard-navigator-buttons + `((;; Github + (,(all-the-icons-octicon "mark-github" :height 1.1 :v-adjust 0.0) + "Github" + "Browse github" + (lambda (&rest _) (browse-url "https://github.com/JaeYoo-Im/"))) + ;; Codebase + ;;(,(all-the-icons-faicon "briefcase" :height 1.1 :v-adjust -0.1) + ;; "Codebase" + ;; "My assigned tickets" + ;; (lambda (&rest _) (browse-url "https://hipo.codebasehq.com/tickets"))) + ;; Perspective + (,(all-the-icons-octicon "history" :height 1.1 :v-adjust 0.0) + "Reload last session" + "Reload last session" + (lambda (&rest _) (persp-state-load persp-state-default-file)))))) + :config + (dashboard-setup-startup-hook) + (dashboard-modify-heading-icons '((recents . "file-text") + (bookmarks . "book")))) +#+end_src +* Fonts +#+begin_src emacs-lisp + (set-face-attribute 'default nil :font "Fira Code Retina" :height gvar/default-font-size) + (set-face-attribute 'fixed-pitch nil :font "Fira Code Retina" :height gvar/default-font-size) + (set-face-attribute 'variable-pitch nil :font "Cantarell" :height gvar/default-variable-font-size :weight 'regular) + (set-fontset-font t 'hangul (font-spec :family "NanumGothic" :size 15)) +#+end_src +** Text Scale Key bindings +#+begin_src emacs-lisp + ;(global-set-key (kbd "C-=") 'text-scale-increase) + ;(global-set-key (kbd "C--") 'text-scale-decrease) + ;(global-set-key (kbd "") 'text-scale-increase) + ;(global-set-key (kbd "") 'text-scale-decrease) + (use-package default-text-scale + :defer 1 + :config + (default-text-scale-mode)) +#+end_src +* Emojify +#+begin_src emacs-lisp + (use-package emojify + :hook (after-init . global-emojify-mode)) +#+end_src +* Which Key +#+begin_src emacs-lisp + (use-package which-key + :defer 0 + :diminish which-key-mode + :config + (which-key-mode) + (setq which-key-idle-delay 0.5)) +#+end_src + +* General Key Binding +#+begin_src emacs-lisp + (use-package general + :ensure t + :config + (general-evil-setup t) + (general-create-definer ju/leader-key-def + :keymaps '(normal insert visual emacs) + :prefix "SPC" + :global-prefix "C-SPC")) + + (ju/leader-key-def + "." 'find-file + ;; Buffer + "b" '(:ignore t :which-key "buffer handling") + "b b" '(ibuffer :which-key "IBuffer") + "b k" '(kill-current-buffer :which-key "Kill current buffer") + "b n" '(next-buffer :which-key "Next buffer") + "b p" '(previous-buffer :which-key "Previous buffer") + "b B" '(ibuffer-list-buffers :which-key "IBuffer List Buffers") + "b K" '(kill-buffer :which-key "IBuffer Kill Buffers") + ;; Eshell + "e h" '(counsel-esh-history :which "Kill history") + "e s" '(eshell :which "run eshell") + ;; Workspace + ;; Counsel + "f" '(:ignore t :which-key "file op.") + "f r" '(counsel-recentf :which-key "Recent files") + "f R" '(revert-buffer :which-key "Revert Buffer") + "t t" '(toggle-truncate-lines :which-key "Toggle truncate lines") + ;; Shortcut + "f d a" '(lambda () (interactive) (find-file (expand-file-name "~/Roam/Agenda"))) + "f d e" '(lambda () (interactive) (find-file (expand-file-name "~/.emacs.d/emacs.org")) :which-key "open emacs config")) +#+end_src + +#+begin_src emacs-lisp + ;; Key binding + ;; Make ESC quit prompts + (global-set-key (kbd "") 'keyboard-escape-quit) + ;; this annoying binding. + (global-unset-key (kbd "C-j")) + (global-unset-key (kbd "C-k")) + (global-unset-key (kbd "S-SPC")) ;; use only S-\ +#+end_src +* Auto Save & reverting +#+begin_src emacs-lisp + (use-package diminish) + (use-package super-save + :defer 1 + :diminish super-save-mode + :config + (super-save-mode +1) + (setq super-save-auto-save-when-idle t)) + (setq global-auto-revert-non-file-buffers t) + (global-auto-revert-mode 1) +#+end_src +* Tramp +#+begin_src emacs-lisp + ;; tramp default is scp + (setq tramp-default-method "ssh") +#+end_src +* Company +#+begin_src emacs-lisp + + ;(use-package company + ; :after lsp-mode + ; :hook (lsp-mode . company-mode) + ; :bind (:map company-active-map + ; ("" . company-complete-selection)) + ; (:map lsp-mode-map + ; ("" . company-indent-or-complete-common)) + ; :custom + ; (company-minimum-prefix-length 1) + ; (company-idle-delay 0.0)) + + ;(use-package company-box + ; :hook (company-mode . company-box-mode)) + +#+end_src + +** Prescient +#+begin_src emacs-lisp + (use-package prescient + :hook (dashboard-after-initialize . prescient-persist-mode)) + ;;(use-package company-prescient + ;; :after company + ;; :config (company-prescient-mode)) +#+end_src + +* FlyCheck +#+begin_src emacs-lisp + (use-package flycheck + :ensure t + :defer t + :init (global-flycheck-mode t)) +#+end_src +* Snippet +#+begin_src emacs-lisp + ;;(use-package yasnippet + ;; Expand snippets with `C-j', not with `TAB'. Use `TAB' to always + ;; jump to next field, even when company window is active. If there + ;; is need to complete company's selection, use `C-s' + ;; (`company-complete-selection'). + ;;:custom + ;;(yas-indent-line nil) + ;;(yas-inhibit-overlay-modification-protection t) + ;;:custom-face + ;;(yas-field-highlight-face ((t (:inherit region)))) + ;;:bind* + ;;(("C-j" . yas-expand) + ;; :map yas-minor-mode-map + ;; ("TAB" . nil) + ;; ("" . nil) + ;; :map yas-keymap + ;; ("TAB" . (lambda () (interactive) (company-abort) (yas-next-field))) + ;; ("" . (lambda () (interactive) (company-abort) (yas-next-field)))) + ;;:hook + ;;(dashboard-after-initialize . yas-global-mode) + ;;(snippet-mode . (lambda () (setq-local require-final-newline nil)))) +#+end_src +* Counsel +#+begin_src emacs-lisp + (use-package counsel + :bind (("M-x" . counsel-M-x) + ;;("C-M-j" . counsel-switch-buffer) + :map minibuffer-local-map + ("C-r" . 'counsel-minibuffer-history)) + :custom + (counsel-linux-app-format-function #'counsel-linux-app-format-function-name-only) + :config + ;; Don't use ^ as initial input. Set this here because `counsel' defines more + ;; of its own, on top of the defaults. + (setq ivy-initial-inputs-alist nil) + (counsel-mode 1)) +#+end_src + +* World Time +#+begin_src emacs-lisp + (setq display-time-world-list + '(("Etc/UTC" "UTC") + ("Asia/Seoul" "Seoul") + ("Asia/Shanghai" "Shanghai"))) + (setq display-time-world-time-format "%a, %d %b %I:%M %p %Z") +#+end_src + +* IVY +#+begin_src emacs-lisp + (use-package ivy + :diminish + :bind (("C-s" . swiper) + :map ivy-minibuffer-map + ("TAB" . ivy-alt-done) + ("C-l" . ivy-alt-done) + ("C-j" . ivy-next-line) + ("C-k" . ivy-previous-line) + :map ivy-switch-buffer-map + ("C-k" . ivy-previous-line) + ("C-l" . ivy-done) + ("C-d" . ivy-switch-buffer-kill) + :map ivy-reverse-i-search-map + ("C-k" . ivy-previous-line) + ("C-d" . ivy-reverse-i-search-kill)) + :config + (ivy-mode 1)) + + (use-package ivy-rich + :after ivy + :init + (ivy-rich-mode 1) + (ivy-rich-project-root-cache-mode 1)) + + (use-package ivy-posframe + :disabled + :after ivy + :diminish + :custom-face + (ivy-posframe-border ((t (:background "#ffffff")))) + :config + (setq ivy-posframe-height-minibuffer nil) + (setq ivy-posframe-parameters '((internal-border-width . 1))) + (ivy-posframe-mode +1)) + + (use-package ivy-prescient + :after counsel + :custom + (ivy-prescient-enable-filtering nil) + :config + ;; Uncomment the following line to have sorting remembered across sessions! + ;(prescient-persist-mode 1) + (ivy-prescient-mode 1)) + (use-package all-the-icons-ivy + :init (add-hook 'after-init-hook 'all-the-icons-ivy-setup)) + +#+end_src +* Avy (like easymotion) +#+begin_src emacs-lisp + (use-package avy + :commands (avy-goto-char avy-goto-word-0 avy-goto-line)) + (ju/leader-key-def + "v" '(:ignore t :which-key "Avy") + "vc" '(avy-goto-char :which-key "Avy Goto Char") + "vw" '(avy-goto-word-0 :which-key "Avy Goto Word") + "vl" '(avy-goto-line :which-key "Avy Goto Line")) +#+end_src +* Projectile +#+begin_src emacs-lisp + (use-package projectile + :diminish projectile-mode + :config (projectile-mode) + :custom ((projectile-completion-system 'ivy)) + :bind-keymap + ("C-c p" . projectile-command-map) + :init + ;; NOTE: Set this to the folder where you keep your Git repos! + (when (file-directory-p "~/Projects/Code") + (setq projectile-project-search-path '("~/Projects/Code"))) + (setq projectile-switch-project-action #'dw/switch-project-action)) + (use-package counsel-projectile + :after projectile + :config (counsel-projectile-mode)) + (ju/leader-key-def + "p." 'counsel-projectile-find-file + "ps" 'counsel-projectile-switch-project + "pg" 'counsel-projectile-rg + "pp" 'counsel-projectile + "pc" 'projectile-compile-project + "pd" 'projectile-dired) + (defun dw/switch-project-action () + "Switch to a workspace with the project name and start `magit-status'." + ;; TODO: Switch to EXWM workspace 1? + (persp-switch (projectile-project-name)) + (magit-status)) + +#+end_src + +* Perspective +#+begin_src emacs-lisp + (use-package perspective + :demand t + :bind (("C-M-j" . persp-counsel-switch-buffer) + ("C-M-k" . persp-switch) + ("C-M-n" . persp-next) + ("C-x k" . persp-kill-buffer*)) + :custom + (persp-initial-frame-name "Main") + :config + ;; Running `persp-mode' multiple times resets the perspective list... + (unless (equal persp-mode t) + (persp-mode))) +#+end_src + +* Helpful +#+begin_src emacs-lisp + ;; (use-package helpful + ;; :commands (helpful-callable helpful-variable helpful-command helpful-key) + ;; :custom + ;; (counsel-describe-function-function #'helpful-callable) + ;; (counsel-describe-variable-function #'helpful-variable) + ;; :bind + ;; ([remap describe-function] . counsel-describe-function) + ;; ([remap describe-command] . helpful-command) + ;; ([remap describe-variable] . counsel-describe-variable) + ;; ([remap describe-key] . helpful-key)) +#+end_src +* Hydra +#+begin_src emacs-lisp + ;;(use-package hydra + ;; :defer t) + + ;;(defhydra hydra-text-scale (:timeout 4) + ;; "scale text" + ;; ("j" text-scale-increase "in") + ;; ("k" text-scale-decrease "out") + ;; ("f" nil "finished" :exit t)) + + ;;(gvar/leader-keys + ;; "ts" '(hydra-text-scale/body :which-key "scale text")) +#+end_src +* HI-TOOD +#+begin_src emacs-lisp + + (use-package hl-todo + :hook (prog-mode . hl-todo-mode) + :hook (yaml-mode . hl-todo-mode) + :config + (setq hl-todo-highlight-punctuation ":" + hl-todo-keyword-faces + `(;; For things that need to be done, just not today. + ("TODO" warning bold) + ;; For problems that will become bigger problems later if not + ;; fixed ASAP. + ("FIXME" error bold) + ;; For tidbits that are unconventional and not intended uses of the + ;; constituent parts, and may break in a future update. + ("HACK" font-lock-constant-face bold) + ;; For things that were done hastily and/or hasn't been thoroughly + ;; tested. It may not even be necessary! + ("REVIEW" font-lock-keyword-face bold) + ;; For especially important gotchas with a given implementation, + ;; directed at another user other than the author. + ("NOTE" success bold) + ;; For things that just gotta go and will soon be gone. + ("DEPRECATED" font-lock-doc-face bold) + ;; For a known bug that needs a workaround + ("BUG" error bold) + ;; For warning about a problematic or misguiding code + ("XXX" font-lock-constant-face bold)))) + +#+end_src +* Org mode +#+begin_src emacs-lisp + (defun efs/org-font-setup () + ;; Replace list hyphen with dot + (font-lock-add-keywords 'org-mode + '(("^ *\\([-]\\) " + (0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "β€’")))))) + + ;; Set faces for heading levels + (dolist (face '((org-level-1 . 1.5) + (org-level-2 . 1.4) + (org-level-3 . 1.3) + (org-level-4 . 1.2) + (org-level-5 . 1.1) + (org-level-6 . 1.0) + (org-level-7 . 1.0) + (org-level-8 . 1.0))) + (set-face-attribute (car face) nil :font "Cantarell" :weight 'regular :height (cdr face))) + + ;; Ensure that anything that should be fixed-pitch in Org files appears that way + (set-face-attribute 'org-block nil :foreground nil :inherit 'fixed-pitch) + (set-face-attribute 'org-table nil :inherit 'fixed-pitch) + (set-face-attribute 'org-formula nil :inherit 'fixed-pitch) + (set-face-attribute 'org-code nil :inherit '(shadow fixed-pitch)) + (set-face-attribute 'org-table nil :inherit '(shadow fixed-pitch)) + (set-face-attribute 'org-verbatim nil :inherit '(shadow fixed-pitch)) + (set-face-attribute 'org-special-keyword nil :inherit '(font-lock-comment-face fixed-pitch)) + (set-face-attribute 'org-meta-line nil :inherit '(font-lock-comment-face fixed-pitch)) + (set-face-attribute 'org-checkbox nil :inherit 'fixed-pitch) + (set-face-attribute 'line-number nil :inherit 'fixed-pitch) + (set-face-attribute 'line-number-current-line nil :inherit 'fixed-pitch)) + + (defun efs/org-mode-setup () + (org-indent-mode) + (variable-pitch-mode 1) + (visual-line-mode 1)) + + (use-package org + :pin org + :commands (org-capture org-agenda) + :hook (org-mode . efs/org-mode-setup) + :config + (setq org-ellipsis " β–Ύ") + + (setq org-agenda-start-with-log-mode t) + (setq org-log-done 'time) + (setq org-log-into-drawer t) + + (setq org-agenda-files + '("/home/jaeus/Roam/Agenda/Agenda-2021-6th.org")) + + ;(require 'org-habit) + ;(add-to-list 'org-modules 'org-habit) + ;(setq org-habit-graph-column 60) + + ;(setq org-todo-keywords + ; '((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d!)") + ; (sequence "BACKLOG(b)" "PLAN(p)" "READY(r)" "ACTIVE(a)" "REVIEW(v)" "WAIT(w@/!)" "HOLD(h)" "|" "COMPLETED(c)" "CANC(k@)"))) + + ;(setq org-refile-targets + ; '(("Archive.org" :maxlevel . 1) + ; ("Tasks.org" :maxlevel . 1))) + + ;;; Save Org buffers after refiling! + ;(advice-add 'org-refile :after 'org-save-all-org-buffers) + + ;(setq org-tag-alist + ; '((:startgroup) + ; ; Put mutually exclusive tags here + ; (:endgroup) + ; ("@errand" . ?E) + ; ("@home" . ?H) + ; ("@work" . ?W) + ; ("agenda" . ?a) + ; ("planning" . ?p) + ; ("publish" . ?P) + ; ("batch" . ?b) + ; ("note" . ?n) + ; ("idea" . ?i))) + + ;; Configure custom agenda views + ;(setq org-agenda-custom-commands + ; '(("d" "Dashboard" + ; ((agenda "" ((org-deadline-warning-days 7))) + ; (todo "NEXT" + ; ((org-agenda-overriding-header "Next Tasks"))) + ; (tags-todo "agenda/ACTIVE" ((org-agenda-overriding-header "Active Projects"))))) + + ; ("n" "Next Tasks" + ; ((todo "NEXT" + ; ((org-agenda-overriding-header "Next Tasks"))))) + + ; ("W" "Work Tasks" tags-todo "+work-email") + + ; ;; Low-effort next actions + ; ("e" tags-todo "+TODO=\"NEXT\"+Effort<15&+Effort>0" + ; ((org-agenda-overriding-header "Low Effort Tasks") + ; (org-agenda-max-todos 20) + ; (org-agenda-files org-agenda-files))) + + ; ("w" "Workflow Status" + ; ((todo "WAIT" + ; ((org-agenda-overriding-header "Waiting on External") + ; (org-agenda-files org-agenda-files))) + ; (todo "REVIEW" + ; ((org-agenda-overriding-header "In Review") + ; (org-agenda-files org-agenda-files))) + ; (todo "PLAN" + ; ((org-agenda-overriding-header "In Planning") + ; (org-agenda-todo-list-sublevels nil) + ; (org-agenda-files org-agenda-files))) + ; (todo "BACKLOG" + ; ((org-agenda-overriding-header "Project Backlog") + ; (org-agenda-todo-list-sublevels nil) + ; (org-agenda-files org-agenda-files))) + ; (todo "READY" + ; ((org-agenda-overriding-header "Ready for Work") + ; (org-agenda-files org-agenda-files))) + ; (todo "ACTIVE" + ; ((org-agenda-overriding-header "Active Projects") + ; (org-agenda-files org-agenda-files))) + ; (todo "COMPLETED" + ; ((org-agenda-overriding-header "Completed Projects") + ; (org-agenda-files org-agenda-files))) + ; (todo "CANC" + ; ((org-agenda-overriding-header "Cancelled Projects") + ; (org-agenda-files org-agenda-files))))))) + + ;(setq org-capture-templates + ; `(("t" "Tasks / Projects") + ; ("tt" "Task" entry (file+olp "~/Projects/Code/emacs-from-scratch/OrgFiles/Tasks.org" "Inbox") + ; "* TODO %?\n %U\n %a\n %i" :empty-lines 1) + + ; ("j" "Journal Entries") + ; ("jj" "Journal" entry + ; (file+olp+datetree "~/Projects/Code/emacs-from-scratch/OrgFiles/Journal.org") + ; "\n* %<%I:%M %p> - Journal :journal:\n\n%?\n\n" + ; ;; ,(dw/read-file-as-string "~/Notes/Templates/Daily.org") + ; :clock-in :clock-resume + ; :empty-lines 1) + ; ("jm" "Meeting" entry + ; (file+olp+datetree "~/Projects/Code/emacs-from-scratch/OrgFiles/Journal.org") + ; "* %<%I:%M %p> - %a :meetings:\n\n%?\n\n" + ; :clock-in :clock-resume + ; :empty-lines 1) + + ; ("w" "Workflows") + ; ("we" "Checking Email" entry (file+olp+datetree "~/Projects/Code/emacs-from-scratch/OrgFiles/Journal.org") + ; "* Checking Email :email:\n\n%?" :clock-in :clock-resume :empty-lines 1) + + ; ("m" "Metrics Capture") + ; ("mw" "Weight" table-line (file+headline "~/Projects/Code/emacs-from-scratch/OrgFiles/Metrics.org" "Weight") + ; "| %U | %^{Weight} | %^{Notes} |" :kill-buffer t))) + + ;(define-key global-map (kbd "C-c j") + ; (lambda () (interactive) (org-capture nil "jj"))) + + (efs/org-font-setup)) + (use-package org-superstar :after org :hook (org-mode . org-superstar-mode)) + (use-package org-attach-screenshot) + (use-package org-download) + + (defun efs/org-mode-visual-fill () + (setq visual-fill-column-width 100 + visual-fill-column-center-text t) + (visual-fill-column-mode 1)) + + (use-package visual-fill-column + :hook (org-mode . efs/org-mode-visual-fill)) + + (with-eval-after-load 'org + (org-babel-do-load-languages + 'org-babel-load-languages + '((emacs-lisp . t) + (python . t))) + + (push '("conf-unix" . conf-unix) org-src-lang-modes)) + + (with-eval-after-load 'org + ;; This is needed as of Org 9.2 + (require 'org-tempo) + + (add-to-list 'org-structure-template-alist '("sh" . "src shell")) + (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp")) + (add-to-list 'org-structure-template-alist '("hs" . "src haskell")) + (add-to-list 'org-structure-template-alist '("py" . "src python"))) +#+end_src + +** Org Roam +#+begin_src emacs-lisp + (use-package org-roam + :straight t + :hook + (after-init . org-roam-mode) + :custom + (org-roam-directory "~/Roam/") + (org-roam-completion-everywhere t) + (org-roam-completion-system 'ivy)) +#+end_src +** Org Roam Server +#+begin_src emacs-lisp + (use-package org-roam-server + :ensure t + :config + (setq org-roam-server-host "127.0.0.1" + org-roam-server-port 23799 + org-roam-server-authenticate nil + org-roam-server-export-inline-images t + org-roam-server-serve-files t + org-roam-server-served-file-extensions '("pdf" "mp4" "ogv") + org-roam-server-network-poll t + org-roam-server-network-arrows nil + org-roam-server-network-label-truncate t + org-roam-server-network-label-truncate-length 60 + org-roam-server-network-label-wrap-length 20)) +#+end_src +** Org present +#+begin_src emacs-lisp + (defun dw/org-present-prepare-slide () + (org-overview) + (org-show-entry) + (org-show-children)) + + (defun dw/org-present-hook () + (setq-local face-remapping-alist '((default (:height 1.5) variable-pitch) + (header-line (:height 4.5) variable-pitch) + (org-code (:height 1.55) org-code) + (org-verbatim (:height 1.55) org-verbatim) + (org-bloc (:height 1.25) org-block) + (org-block-begin-line (:height 0.7) org-block))) + (setq header-line-format " ") + (org-display-inline-images) + (dw/org-present-prepare-slide)) + + (defun dw/org-present-quit-hook () + (setq-local face-remapping-alist '((default variable-pitch default))) + (setq header-line-format nil) + (org-present-small) + (org-remove-inline-images)) + + (defun dw/org-present-prev () + (interactive) + (org-present-prev) + (dw/org-present-prepare-slide)) + + (defun dw/org-present-next () + (interactive) + (org-present-next) + (dw/org-present-prepare-slide)) + + (use-package org-present + :bind (:map org-present-mode-keymap + ("C-c C-j" . dw/org-present-next) + ("C-c C-k" . dw/org-present-prev)) + :hook ((org-present-mode . dw/org-present-hook) + (org-present-mode-quit . dw/org-present-quit-hook))) +#+end_src +* Magit +#+begin_src emacs-lisp + (use-package magit + :commands (magit-status magit-get-current-branch) + :custom + (magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1)) + + ;; NOTE: Make sure to configure a GitHub token before using this package! + ;; - https://magit.vc/manual/forge/Token-Creation.html#Token-Creation + ;; - https://magit.vc/manual/ghub/Getting-Started.html#Getting-Started + (use-package forge + :after magit) + (use-package magit-todos + :defer t) + (use-package git-link) + (ju/leader-key-def + "g" 'magit) + (use-package git-gutter + :straight git-gutter-fringe + ;;:diminish + :hook ((text-mode . git-gutter-mode) + (prog-mode . git-gutter-mode)) + :config + (setq git-gutter:update-interval 2) + (require 'git-gutter-fringe) + (set-face-foreground 'git-gutter-fr:added "LightGreen") + (fringe-helper-define 'git-gutter-fr:added nil + "XXXXXXXXXX" + "XXXXXXXXXX" + "XXXXXXXXXX" + ".........." + ".........." + "XXXXXXXXXX" + "XXXXXXXXXX" + "XXXXXXXXXX" + ".........." + ".........." + "XXXXXXXXXX" + "XXXXXXXXXX" + "XXXXXXXXXX") + + (set-face-foreground 'git-gutter-fr:modified "LightGoldenrod") + (fringe-helper-define 'git-gutter-fr:modified nil + "XXXXXXXXXX" + "XXXXXXXXXX" + "XXXXXXXXXX" + ".........." + ".........." + "XXXXXXXXXX" + "XXXXXXXXXX" + "XXXXXXXXXX" + ".........." + ".........." + "XXXXXXXXXX" + "XXXXXXXXXX" + "XXXXXXXXXX") + + (set-face-foreground 'git-gutter-fr:deleted "LightCoral") + (fringe-helper-define 'git-gutter-fr:deleted nil + "XXXXXXXXXX" + "XXXXXXXXXX" + "XXXXXXXXXX" + ".........." + ".........." + "XXXXXXXXXX" + "XXXXXXXXXX" + "XXXXXXXXXX" + ".........." + ".........." + "XXXXXXXXXX" + "XXXXXXXXXX" + "XXXXXXXXXX") + + ;; These characters are used in terminal mode + (setq git-gutter:modified-sign "≑") + (setq git-gutter:added-sign "≑") + (setq git-gutter:deleted-sign "≑") + (set-face-foreground 'git-gutter:added "LightGreen") + (set-face-foreground 'git-gutter:modified "LightGoldenrod") + (set-face-foreground 'git-gutter:deleted "LightCoral")) +#+end_src + +* Rainbow Delimiters +#+begin_src emacs-lisp + (use-package rainbow-delimiters + :hook (prog-mode . rainbow-delimiters-mode)) +#+end_src + + +* Vterm +#+begin_src emacs-lisp + (use-package vterm + :commands vterm + :config + (setq term-prompt-regexp "^[^#$%>\n]*[#$%>] *") ;; Set this to match your custom shell prompt + ;;(setq vterm-shell "zsh") ;; Set this to customize the shell to launch + (setq vterm-max-scrollback 10000)) +#+end_src + + +* Eshell +** EXEC-PATH-FROM-SHELL +#+begin_src shell + (when (not (package-installed-p 'exec-path-from-shell)) + (package-refresh-contents) + (package-install 'exec-path-from-shell)) + (exec-path-from-shell-initialize) +#+end_src +** Config +#+begin_src emacs-lisp + (when (eq system-type 'windows-nt) + (setq explicit-shell-file-name "powershell.exe") + (setq explicit-powershell.exe-args '())) + (defun dw/get-prompt-path () + (let* ((current-path (eshell/pwd)) + (git-output (shell-command-to-string "git rev-parse --show-toplevel")) + (has-path (not (string-match "^fatal" git-output)))) + (if (not has-path) + (abbreviate-file-name current-path) + (string-remove-prefix (file-name-directory git-output) current-path)))) + + (defun dw/eshell-prompt () + (let ((current-branch (magit-get-current-branch))) + (concat + "\n" + (propertize (system-name) 'face `(:foreground "#62aeed")) + (propertize " ΰ₯ " 'face `(:foreground "white")) + (propertize (dw/get-prompt-path) 'face `(:foreground "#82cfd3")) + (when current-branch + (concat + (propertize " β€’ " 'face `(:foreground "white")) + (propertize (concat "ξ‚  " current-branch) 'face `(:foreground "#c475f0")))) + (propertize " β€’ " 'face `(:foreground "white")) + (propertize (format-time-string "%I:%M:%S %p") 'face `(:foreground "#5a5b7f")) + (if (= (user-uid) 0) + (propertize "\n#" 'face `(:foreground "red2")) + (propertize "\nΞ»" 'face `(:foreground "#aece4a"))) + (propertize " " 'face `(:foreground "white"))))) + + (defun efs/configure-eshell () + ;; Save command history when commands are entered + (add-hook 'eshell-pre-command-hook 'eshell-save-some-history) + + ;; Truncate buffer for performance + (add-to-list 'eshell-output-filter-functions 'eshell-truncate-buffer) + + ;; Bind some useful keys for evil-mode + (evil-define-key '(normal insert visual) eshell-mode-map (kbd "C-r") 'counsel-esh-history) + (evil-define-key '(normal insert visual) eshell-mode-map (kbd "") 'eshell-bol) + (evil-normalize-keymaps) + + (setq eshell-prompt-function 'dw/eshell-prompt + eshell-prompt-regexp "^Ξ» " + eshell-history-size 10000 + eshell-buffer-maximum-lines 10000 + eshell-hist-ignoredups t + eshell-scroll-to-bottom-on-input t)) + + (use-package eshell-git-prompt + :after eshell) + + (use-package eshell + :hook (eshell-first-time-mode . efs/configure-eshell) + :config + + (with-eval-after-load 'esh-opt + (setq eshell-destroy-buffer-when-process-dies t) + (setq eshell-visual-commands '("htop" "zsh" "vim")))) +#+end_src + +* App Launcher +#+begin_src emacs-lisp + (straight-use-package + '(app-launcher :type git :host github :repo "SebastienWae/app-launcher")) +#+end_src + +* Dired +#+begin_src emacs-lisp + (use-package dired + :ensure nil + :straight nil + :commands (dired dired-jump) + :bind (("C-x C-j" . dired-jump)) + :custom ((dired-listing-switches "-agho --group-directories-first")) + :config + (evil-collection-define-key 'normal 'dired-mode-map + "h" 'dired-single-up-directory + "l" 'dired-single-buffer)) + (autoload 'dired-omit-mode "dired-x") + (add-hook 'dired-load-hook + (lambda () + (interactive) + (dired-collapse))) + ;; to use h,l key + (use-package dired-single + :commands (dired dired-jump)) + (use-package diredfl + :hook (dired-mode . diredfl-mode)) + + ;; from doom emacs + (defun +dired-enable-git-info-h () + "Enable `dired-git-info-mode' in git repos." + (and (not (file-remote-p default-directory)) + (locate-dominating-file "." ".git") + (dired-git-info-mode 1))) + (use-package dired-git-info) + (use-package diff-hl + :hook (dired-mode . diff-hl-dired-mode-unless-remote) + :hook (magit-post-refresh . diff-hl-magit-post-refresh) + :config + ;; use margin instead of fringe + (diff-hl-margin-mode)) + (use-package dired-rsync + :config + (bind-key "C-c C-r" 'dired-rsync dired-mode-map)) + ;;(use-package ranger) + (use-package all-the-icons-dired + :hook (dired-mode . all-the-icons-dired-mode) + :config + ;; HACK Fixes #1929: icons break file renaming in Emacs 27+, because the icon + ;; is considered part of the filename, so we disable icons while we're in + ;; wdired-mode. + ;;(when EMACS27+ + (defvar +wdired-icons-enabled -1)) + + ;;(defadvice! +dired-disable-icons-in-wdired-mode-a (&rest _) + ;; :before #'wdired-change-to-wdired-mode + ;; (setq-local +wdired-icons-enabled (if all-the-icons-dired-mode 1 -1)) + ;; (when all-the-icons-dired-mode + ;; (all-the-icons-dired-mode -1))) + + ;;(defadvice! +dired-restore-icons-after-wdired-mode-a (&rest _) + ;; :after #'wdired-change-to-dired-mode + ;; (all-the-icons-dired-mode +wdired-icons-enabled)))) + ;;(use-package fd-dired) + + (use-package dired-hide-dotfiles + :hook (dired-mode . dired-hide-dotfiles-mode) + :config + (evil-collection-define-key 'normal 'dired-mode-map + "H" 'dired-hide-dotfiles-mode)) + +#+end_src + +* Openwith +#+begin_src emacs-lisp + (use-package openwith + :after dired + :config + (setq larget-file-warning-threshold nil) + (openwith-mode t) + (setq openwith-associations + (list (list (openwith-make-extension-regexp + '("mpg" "mpeg" "mp3" "mp4" "m4v" + "avi" "wmv" "wav" "mov" "flv" + "ogm" "ogg" "mkv")) + "mpv" + '(file))))) + ;;(list (openwith-make-extension-regexp + ;; '("pdf")) + ;; "evince" + ;; '(file))))) +#+end_src +* VLF (very large file) +#+begin_src emacs-lisp + (use-package vlf + :config (progn + (require 'vlf-setup))) +#+end_src + +* Nov (EPUB file association) +#+begin_src emacs-lisp + (use-package nov) + (add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode)) +#+end_src + + + +* LSP-MODE +#+begin_src emacs-lisp + (use-package lsp-mode + :init + ;; set prefix for lsp-command-keymap (few alternatives - "C-l", "C-c l") + (setq lsp-keymap-prefix "C-c l") + :hook (;; replace XXX-mode with concrete major-mode(e. g. python-mode) + (c++-mode . lsp) + (verilog-mode . lsp) + ;; if you want which-key integration + (lsp-mode . lsp-enable-which-key-integration)) + :commands lsp) + + ;; optionally + (use-package lsp-ui :commands lsp-ui-mode) + ;; if you are ivy user + (use-package lsp-ivy :commands lsp-ivy-workspace-symbol) + (use-package lsp-treemacs :commands lsp-treemacs-errors-list) + ;; optionally if you want to use debugger + (use-package dap-mode) + ;; (use-package dap-LANGUAGE) to load the dap adapter for your language + +#+end_src + +* Language Support +** Haskell +#+begin_src emacs-lisp + (use-package haskell-mode) +#+end_src +** Verilog/System verilog +using =svlangserver= +#+begin_src shell + sudo npm install -g @imc-trading/svlangserver + paru -S verilator +#+end_src diff --git a/.emacs.d.vanilla/exwm/EXWM.desktop b/.emacs.d.vanilla/exwm/EXWM.desktop new file mode 100644 index 0000000..7a5d2c2 --- /dev/null +++ b/.emacs.d.vanilla/exwm/EXWM.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Name=EXWM +Comment=Emacs Window Manager +Exec=sh /home/jaeus/.emacs.d/exwm/start-exwm.sh +TryExec=sh +Type=Application +X-LightDM-DesktopName=exwm +DesktopNames=exwm diff --git a/.emacs.d.vanilla/exwm/start-exwm.sh b/.emacs.d.vanilla/exwm/start-exwm.sh new file mode 100644 index 0000000..7fe2324 --- /dev/null +++ b/.emacs.d.vanilla/exwm/start-exwm.sh @@ -0,0 +1,12 @@ +#!/bin/sh +# Set the screen DPI (uncomment this if needed!) +# xrdb ~/.emacs.d/exwm/Xresources + +# Run the screen compositor +#picom & +#picom -b --config /home/jaeus/.config/i3/picom.conf & +# Enable screen locking on suspend +xss-lock -- slock & + +# Fire it up +exec dbus-launch --exit-with-session emacs -mm --debug-init -l ~/.emacs.d/desktop.el diff --git a/.emacs.d.vanilla/init.el b/.emacs.d.vanilla/init.el new file mode 100644 index 0000000..67060fc --- /dev/null +++ b/.emacs.d.vanilla/init.el @@ -0,0 +1,34 @@ +(setq vc-follow-symlinks t) +(with-eval-after-load 'ox-latex +(add-to-list 'org-latex-classes + '("org-plain-latex" + "\\documentclass{article} + [NO-DEFAULT-PACKAGES] + [PACKAGES] + [EXTRA]" + ("\\section{%s}" . "\\section*{%s}") + ("\\subsection{%s}" . "\\subsection*{%s}") + ("\\subsubsection{%s}" . "\\subsubsection*{%s}") + ("\\paragraph{%s}" . "\\paragraph*{%s}") + ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))) +(org-babel-load-file + (expand-file-name + "emacs.org" + user-emacs-directory)) +(setq-default indent-tabs-mode t) +(setq tab-width 4) ; or any other preferred value +(defvaralias 'c-basic-offset 'tab-width) +(defvaralias 'cperl-indent-level 'tab-width) +(custom-set-variables + ;; custom-set-variables was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + '(org-agenda-files nil) + '(package-selected-packages '(no-littering doom-themes evil-numbers use-package))) +(custom-set-faces + ;; custom-set-faces was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + ) diff --git a/.emacs.d.vanilla/logos/emacs-e.png b/.emacs.d.vanilla/logos/emacs-e.png new file mode 100644 index 0000000..0c5cd63 Binary files /dev/null and b/.emacs.d.vanilla/logos/emacs-e.png differ