this config was based off of uncle daves emacs who i am forever grateful to for allowing me a user friendly entry point to emacs check out uncle daves repo at https://github.com/daedreth/UncleDavesEmacs
(let ((default-directory (concat user-emacs-directory
(convert-standard-filename "lisp/"))))
(normal-top-level-add-to-load-path '("."))
(normal-top-level-add-subdirs-to-load-path))
(setq org-ellipsis " ")
(setq org-src-fontify-natively t)
(setq org-src-tab-acts-natively t)
(setq org-confirm-babel-evaluate nil)
(setq org-export-with-smart-quotes t)
(setq org-src-window-setup 'current-window)
;; (add-hook 'org-mode-hook 'org-indent-mode)
;; (remove-hook 'org-mode-hook 'org-indent-mode)
(use-package org-journal
:straight t
:defer t
:custom
(org-journal-dir "~/notes/journal/")
(org-journal-date-format "%A, %d %B %Y"))
(use-package htmlize
:straight t)
(use-package ob-mermaid
:straight t
:config
(setq ob-mermaid-cli-path "/usr/bin/mmdc")
(org-babel-do-load-languages
'org-babel-load-languages
'((mermaid . t)
(scheme . t))
)
(add-to-list 'org-structure-template-alist
'("mer" . "src mermaid :file name.png\n"))
)
(use-package plantuml-mode
:custom
(plantuml-executable-path "/usr/bin/plantuml")
(plantuml-default-exec-mode 'executable)
(org-plantuml-executable-path "/usr/bin/plantuml")
(org-plantuml-default-exec-mode 'executable)
:config
(org-babel-do-load-languages
'org-babel-load-languages
'((plantuml . t))) ; this line activates plantuml
)
(add-hook 'org-mode-hook
'(lambda ()
(visual-line-mode 1)))
(add-hook 'org-mode-hook
'(lambda ()
(flyspell-mode 1)))
edit the stuff in a src block with proper modes
(global-set-key (kbd "C-c '") 'org-edit-src-code)
Hitting tab after an “<el” in an org-mode file will create a template for elisp insertion.
(add-to-list 'org-structure-template-alist
'("el" . "src emacs-lisp\n"))
One of the best things about org is the ability to export your file to many formats. Here is how we add more of them!
;; (when (file-directory-p "/usr/share/emacs/site-lisp/tex-utils")
;; (add-to-list 'load-path "/usr/share/emacs/site-lisp/tex-utils")
;; (require 'xdvi-search))
(setq org-todo-keywords
'((sequence "TODO(t)" "PLAN(p)" "WAIT(w@)" "|" "DONE(d!)" "CANCELED(c@)" "MISSED(m@)")))
(setq org-refile-targets '((nil :maxlevel . 9)
(org-agenda-files :maxlevel . 9)))
(setq org-outline-path-complete-in-steps nil) ; Refile in a single go
(setq org-refile-use-outline-path t) ; Show full paths for refiling
Everything regarding the WM or DE-like functionality is bundled here
The only time I actually had to use comments, this is for ease of removal if you happen to not like exwm.
(use-package exwm
:straight (exwm :type git :host github :repo "emacs-straight/exwm" :files ("*" (:exclude ".git")))
:config
;; necessary to configure exwm manually
(require 'exwm-config)
;; fringe size, most people prefer 1
(fringe-mode 3)
;; emacs as a daemon, use "emacsclient <filename>" to seamlessly edit files from the terminal directly in the exwm instance
(server-start)
;; fix slack window parenting issues
(add-to-list 'exwm-manage-configurations '((equal exwm-class-name "Slack") managed t))
;; this fixes issues with ido mode, if you use helm, get rid of it
;; (exwm-config-ido)
;; a number between 1 and 9, exwm creates workspaces dynamically so I like starting out with 1
(setq exwm-workspace-number 5)
(add-to-list 'exwm-manage-configurations '((equal exwm-class-name "Slack") managed t))
;; make x buffers available on all workspaces
(setq exwm-workspace-show-all-buffers t)
(setq exwm-layout-show-all-buffers t)
;; this is a way to declare truly global/always working keybindings
;; this is a nifty way to go back from char mode to line mode without using the mouse
(exwm-input-set-key (kbd "s-r") #'exwm-reset)
(exwm-input-set-key (kbd "s-k") #'exwm-workspace-delete)
(exwm-input-set-key (kbd "s-w") #'exwm-workspace-swap)
(exwm-input-set-key (kbd "s-n") 'ibuffer)
(exwm-input-set-key (kbd "s-m") 'next-buffer)
(exwm-input-set-key (kbd "s-,") 'previous-buffer)
(exwm-input-set-key (kbd "s-/") 'kill-current-buffer)
(exwm-input-set-key (kbd "s-h") 'windmove-left)
(exwm-input-set-key (kbd "s-j") 'windmove-down)
(exwm-input-set-key (kbd "s-k") 'windmove-up)
(exwm-input-set-key (kbd "s-l") 'windmove-right)
(exwm-input-set-key (kbd "s-;") 'delete-window)
(exwm-input-set-key (kbd "s-s h") 'split-window-right)
(exwm-input-set-key (kbd "s-s j") 'split-window-below)
(exwm-input-set-key (kbd "s-s k") 'split-and-follow-horizontally)
(exwm-input-set-key (kbd "s-s l") 'split-and-follow-vertically)
;; the next loop will bind s-<number> to switch to the corresponding workspace
(dotimes (i 10)
(exwm-input-set-key (kbd (format "s-%d" i))
`(lambda ()
(interactive)
(exwm-workspace-switch-create ,i))))
;; the simplest launcher, I keep it in only if dmenu eventually stopped working or something
(exwm-input-set-key (kbd "s-&")
(lambda (command)
(interactive (list (read-shell-command "$ ")))
(start-process-shell-command command nil command)))
;; an easy way to make keybindings work *only* in line mode
(push ?\C-q exwm-input-prefix-keys)
(define-key exwm-mode-map [?\C-q] #'exwm-input-send-next-key)
;; simulation keys are keys that exwm will send to the exwm buffer upon inputting a key combination
(exwm-input--set-simulation-keys
'(
;; movement
([?\C-b] . left)
([?\M-b] . C-left)
([?\C-f] . right)
([?\M-f] . C-right)
([?\C-p] . up)
([?\C-n] . down)
([?\C-a] . home)
([?\C-e] . end)
([?\M-v] . prior)
([?\C-v] . next)
([?\C-d] . delete)
([?\C-k] . (S-end delete))
;; cut/paste
([?\C-w] . ?\C-x)
([?\M-w] . ?\C-c)
([?\C-y] . ?\C-v)
;; search
([?\C-f] . ?\C-f)
;; movement
([?\M-h] . return)
([?\M-m] . return)
([?\M-l] . right)
([?\M-k] . down)
([?\M-j] . left)
([?\M-\\] . prior)
([?\M-'] . next)))
(add-hook 'exwm-manage-finish-hook
(lambda ()
(when (and exwm-class-name
(string= exwm-class-name "XTerm"))
(exwm-input-set-local-simulation-keys '(([?\C-c ?\C-c] . ?\C-c))))))
;; this little bit will make sure that XF86 keys work in exwm buffers as well
(dolist (k '(XF86AudioLowerVolume
XF86AudioRaiseVolume
XF86PowerOff
XF86AudioMute
XF86AudioPlay
XF86AudioStop
XF86AudioPrev
XF86AudioNext
XF86ScreenSaver
XF68Back
XF86Forward
Scroll_Lock
print))
(cl-pushnew k exwm-input-prefix-keys))
(require 'exwm-randr)
(setq exwm-randr-workspace-monitor-plist '(0 "DP-0" 1 "DP-0" 2 "DP-0" 3 "DP-0" ))
(add-hook 'exwm-randr-screen-change-hook
(lambda ()
(start-process-shell-command
"xrandr" nil " xrandr --output HDMI-0 --off --output DP-0 --mode 5120x1440 -r 240 --pos 0x0 --rotate normal --output DP-1 --off --output DP-2 --off --output DP-3 --off --output DP-4 --off --output DP-5 --off")))
(exwm-randr-enable)
;; this just enables exwm, it started automatically once everything is ready
(exwm-enable))'
;; (shell-command "picom --config ~/.config/picom.conf -b")
(setq x-no-window-manager t)
(use-package desktop-environment
:straight t
:config
(desktop-environment-mode))
(use-package exwm-edit
:straight t)
(require 'exwm-systemtray)
(exwm-systemtray-enable)
(use-package dmenu
:straight t
:bind
("s-SPC" . 'dmenu))
switch window uses an ace type jump if more than 2 windows are open
(use-package switch-window
:straight t
:config
(setq switch-window-input-style 'minibuffer)
(setq switch-window-increase 4)
(setq switch-window-threshold 2)
(setq switch-window-shortcut-style 'qwerty)
(setq switch-window-qwerty-shortcuts
'("a" "s" "d" "f" "j" "k" "l" "i" "o"))
:bind
([remap other-window] . switch-window))
After you split a window, your focus remains in the previous one. This annoyed me so much I wrote these two, they take care of it.
(defun split-and-follow-horizontally ()
(interactive)
(split-window-below)
(balance-windows)
(other-window 1))
(global-set-key (kbd "C-x 2") 'split-and-follow-horizontally)
(defun split-and-follow-vertically ()
(interactive)
(split-window-right)
(balance-windows)
(other-window 1))
(global-set-key (kbd "C-x 3") 'split-and-follow-vertically)
Dashboard with recent files and projects
(use-package dashboard
:straight t
:config
(dashboard-setup-startup-hook)
(setq dashboard-startup-banner "~/.emacs.d/img/dashLogo.png")
(setq dashboard-items '((recents . 5)
(projects . 5)))
(setq dashboard-banner-logo-title "TAYMACS"))
(setq display-time-24hr-format nil)
(setq display-time-format "%H:%M %m/%d")
This turns on the clock globally.
(display-time-mode 1)
(use-package eloud
:straight t
:config
(setq eloud-espeak-path "/usr/bin/espeak"))
Your modeline is sacred, and if you have a lot of modes enabled, as you will if you use this config,
you might end up with a lot of clutter there, the package diminish
disables modes on the mode line but keeps
them running, it just prevents them from showing up and taking up space.
THIS WILL BE REMOVED SOON AS USE-PACKAGE HAS THE FUNCTIONALITY BUILT IN
Edit this list as you see fit!
(use-package diminish
:straight t
:init
(diminish 'which-key-mode)
(diminish 'linum-relative-mode)
(diminish 'hungry-delete-mode)
(diminish 'visual-line-mode)
(diminish 'subword-mode)
(diminish 'beacon-mode)
(diminish 'irony-mode)
(diminish 'page-break-lines-mode)
(diminish 'auto-revert-mode)
(diminish 'rainbow-delimiters-mode)
(diminish 'editorconfig-mode)
(diminish 'subl-mode)
(diminish 'emo-mode)
(diminish 'org-indent-mode)
(diminish 'projectile-mode)
(diminish 'helm-mode)
(diminish 'company-mode)
(diminish 'undo-tree-mode)
(diminish 'ivy-mode)
(diminish 'flycheck-mode)
(diminish 'evil-collection-unimpaired-mode)
(diminish 'yas-minor-mode)
(diminish 'org-src-mode)
(diminish 'eldoc-mode)
(diminish 'coverlay-minor-mode)
(diminish 'css-in-js-mode)
(diminish 'rainbow-mode))
- State “DONE” from “TODO” [2023-01-25 Wed 20:18]
(use-package alert
:straight t
:init
(setq alert-default-style 'notifications)) ;using wired-notif
Doing C-x k
should kill the current buffer at all times, we have ibuffer
for more sophisticated thing.
(defun kill-current-buffer ()
"Kills the current buffer."
(interactive)
(kill-buffer (current-buffer)))
(global-set-key (kbd "C-x k") 'kill-current-buffer)
Unless you have the muscle memory, I recommend omitting this bit, as you may lose progress for no reason when working.
(setq kill-buffer-query-functions (delq 'process-kill-buffer-query-function kill-buffer-query-functions))
I don’t understand how ibuffer isn’t the default option by now. It’s vastly superior in terms of ergonomics and functionality, you can delete buffers, rename buffer, move buffers, organize buffers etc.
(global-set-key (kbd "C-x b") 'ibuffer)
If you feel like you know how ibuffer works and need not to be asked for confirmation after every serious command, enable this as follows.
;;(setq ibuffer-expert t)
(when (fboundp 'eww)
(defun xah-rename-eww-buffer ()
"Rename `eww-mode' buffer so sites open in new page.
URL `http://xahlee.info/emacs/emacs/emacs_eww_web_browser.html'
Version 2017-11-10"
(let (($title (plist-get eww-data :title)))
(when (eq major-mode 'eww-mode )
(if $title
(rename-buffer (concat "eww " $title ) t)
(rename-buffer "eww" t)))))
(add-hook 'eww-after-render-hook 'xah-rename-eww-buffer))
Pretty self-explanatory, useful as hell if you use exwm.
(use-package sudo-edit
:straight t
:bind
("s-e" . sudo-edit))
;; autoname buffers
(add-hook 'exwm-update-class-hook
(lambda ()
(exwm-workspace-rename-buffer exwm-class-name)))
;; Posframe is a pop-up tool that must be manually installed for dap-mode
(use-package posframe
:straight t)
;; (use-package helm-posframe
;; :config
;; (helm-posframe-enable))
(use-package ivy-posframe
:config
(ivy-posframe-enable))
;; (when (posframe-workable-p)
;; (posframe-show " *my-posframe-buffer*"
;; :string "This is a test"
;; :position (point)))
(use-package helm-system-packages
:straight t)
(use-package helpful
:straight t
:bind
("C-h f" . #'helpful-callable)
("C-h v" . #'helpful-variable)
("C-h k" . #'helpful-key)
("C-h x" . #'helpful-command)
("C-c C-d" . #'helpful-at-point)
:config
(setq counsel-describe-function-function #'helpful-callable)
(setq counsel-describe-variable-function #'helpful-variable))
(use-package counsel
:config
(counsel-mode))
;; (message counsel-switch-buffer-preview-virtual-buffers)
(use-package ivy
:bind
("C-c C-r" . 'ivy-resume)
("<f6>" . 'ivy-resume)
("M-x" . 'counsel-M-x)
("C-x C-f" . 'counsel-find-file)
("C-x C-b" . 'ivy-switch-buffer)
("C-c g" . 'counsel-git)
("C-c j" . 'counsel-git-grep)
("C-c k" . 'counsel-ag)
("C-x l" . 'counsel-locate)
("s-SPC" . 'counsel-linux-app)
(:map ivy-minibuffer-map ; make it more like helm
("C-m" . ivy-alt-done)
("C-j" . ivy-done)
("C-l" . ivy-backward-kill-word))
;; ("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)
(setq ivy-use-virtual-buffers t)
(setq enable-recursive-minibuffers t)
;; enable this if you want `swiper' to use it
;; (setq search-default-mode #'char-fold-to-regexp)
;; (global-set-key "\C-s" 'swiper)
;; (global-set-key (kbd "<f1> f") 'counsel-describe-function)
;; (global-set-key (kbd "<f1> v") 'counsel-describe-variable)
;; (global-set-key (kbd "<f1> o") 'counsel-describe-symbol)
;; (global-set-key (kbd "<f1> l") 'counsel-find-library)
;; (global-set-key (kbd "<f2> i") 'counsel-info-lookup-symbol)
;; (global-set-key (kbd "<f2> u") 'counsel-unicode-char)
;; (global-set-key (kbd "C-S-o") 'counsel-rhythmbox)
;; (define-key minibuffer-local-map (kbd "C-r") 'counsel-minibuffer-history)
)
(use-package ivy-posframe
:config
;; (setq ivy-posframe-display-functions-alist '((t . ivy-posframe-display)))
(setq ivy-posframe-display-functions-alist '((t . ivy-posframe-display-at-frame-center)))
;; (setq ivy-posframe-display-functions-alist '((t . ivy-posframe-display-at-point)))
(ivy-posframe-mode 1))
(setq ivy-posframe-parameters
'((left-fringe . 8)
(right-fringe . 8)))
;; (use-package ivy-rich
;; :after ivy
;; :init
;; (ivy-rich-mode 1)
;; :config
;; (setq ivy-format-function #'ivy-format-function-line)
;; (setq ivy-rich-display-transformers-list
;; (plist-put ivy-rich-display-transformers-list
;; 'ivy-switch-buffer
;; '(:columns
;; ((ivy-rich-candidate (:width 40))
;; (ivy-rich-switch-buffer-indicators (:width 4 :face error :align right)); return the buffer indicators
;; (ivy-rich-switch-buffer-major-mode (:width 12 :face warning)) ; return the major mode info
;; (ivy-rich-switch-buffer-project (:width 15 :face success)) ; return project name using `projectile'
;; (ivy-rich-switch-buffer-path (:width (lambda (x) (ivy-rich-switch-buffer-shorten-path x (ivy-rich-minibuffer-width 0.3)))))) ; return file path relative to project root or `default-directory' if project is nil
;; :predicate
;; (lambda (cand)
;; (if-let ((buffer (get-buffer cand)))
;; ;; Don't mess with EXWM buffers
;; (with-current-buffer buffer
;; (not (derived-mode-p 'exwm-mode)))))))))
(use-package ivy-rich
:after ivy
:init
(ivy-rich-mode 1))
Quickly edit ~/.emacs.d/config.org
(defun config-visit ()
(interactive)
(find-file "~/.emacs.d/config.org"))
(global-set-key (kbd "C-c e") 'config-visit)
Simply pressing Control-c r
will reload this file, very handy.
You can also manually invoke config-reload
.
(defun config-reload ()
"Reloads ~/.emacs.d/config.org at runtime"
(interactive)
(org-babel-load-file (expand-file-name "~/.emacs.d/config.org")))
(global-set-key (kbd "C-c r") 'config-reload)
automatic cheat sheet once you press part of a key series
(use-package which-key
:straight t
:bind
("C-h W" . 'which-key-show-full-keymap)
("C-h C-w" . 'which-key-show-full-major-mode)
:config
(which-key-mode))
;; (which-key-show-full-keymap 'ivy-minibuffer-map)
(defun play-youtube (url)
"plays youtube."
(interactive "sUrl of video: ")
(shell-command (concat "youtube-dl " url " --add-metadata --write-info-json &" ))
(emms-add-file (substring (shell-command-to-string (concat "youtube-dl " url " --get-filename ")) 0 -1)))
(use-package ement
:straight (ement :type git :host github :repo "alphapapa/ement.el")
:config (ement-connect :user-id "@tay:vexillomancy.org" :uri-prefix "http://localhost:8008" :password (auth-source-pick-first-password
:host "matrix.vexillomancy.org"
:user "tay")))
This also hides some of the channel messages to avoid cluttering the buffer. The other line changes the prompt for each channel buffer to match the channel name, this way you always know who you are typing to.
(setq erc-nick "htayj")
(setq erc-prompt (lambda () (concat "[" (buffer-name) "]")))
(setq erc-hide-list '("JOIN" "PART" "QUIT"))
(setq erc-interpret-mirc-color t)
(setq erc-modules
'(completion log notifications hl-nicks netsplit fill button match track readonly networks ring autojoin noncommands irccontrols move-to-prompt stamp menu list))
'(erc-prompt-for-password nil)
(setq erc-track-exclude-types '("JOIN" "KICK" "NICK" "PART" "333" "353"))
this changes the erc
history to include the server I connect to often.
(setq erc-server-history-list '("irc.libera.chat"
"irc.deft.com"
"localhost"))
(setq erc-autojoin-channels-alist '( ("libera.chat" "#pine64" "#fsf" "#searx" "#guix" "#emacs" "#hurd" "#guix" "#lisp" "##trans" "##transgeeks") ))
(setq erc-autojoin-timing 'ident)
(setq erc-track-exclude
'("##latinitas" "##latin" "#EsperantoAmeriko#1" "#kulupupitokipona#1"))
You can even highlight nicks to make the buffers a bit more visually pleasing and easier to look at.
(use-package erc-hl-nicks
:straight t
:config
(erc-update-modules))
;; (add-to-list 'load-path "~/elim/elisp")
;; (load-library "garak")
another irc client
(use-package circe
:straight t)
There is many backends, many players and codecs for EMMS, we use mpd now.
The non XF86 keys are made to be somewhat logical to follow and easy to remember. At the bottom part of the configuration, you will notice how XF86 keys are used by default, so unless you keyboard is broken it should work out of the box. Obviously you might have to adjust server-name and server-port to fit your configuration.
(use-package emms
:straight t
:config
(require 'emms-setup)
;; (require 'emms-player-mpd)
(emms-all) ; don't change this to values you see on stackoverflow questions if you expect emms to work
(setq emms-seek-seconds 5)
(emms-default-players)
(setq emms-player-list '(emms-player-mpd))
(setq emms-info-functions '(emms-info-mpd))
(setq emms-player-mpd-server-name "localhost")
(setq emms-player-mpd-server-port "6600")
(setq emms-source-file-default-directory "~/Media/")
:bind
;; ("s-m p" . emms)
;; ("s-m b" . emms-smart-browse)
;; ("s-m r" . emms-player-mpd-update-all-reset-cache)
("<XF86AudioPrev>" . emms-previous)
("<XF86AudioNext>" . emms-next)
("<XF86AudioPlay>" . emms-pause)
("<XF86AudioPause>" . emms-pause)
("<XF86AudioStop>" . emms-stop))
We use non-default settings for the socket, to use the built in mpc
functionality we need to set up a variable.
Adjust according to your setup.
(setq mpc-host "localhost:6601")
;; (use-package emms-player-mpv
;; :straight t
;; :config
;; (add-to-list 'emms-player-list 'emms-player-mpv))
If you have an absolutely massive music library, it might be a good idea to get rid of mpc-update
and only invoke it manually when needed.
(defun mpd/start-music-daemon ()
"Start MPD, connects to it and syncs the metadata cache."
(interactive)
(shell-command "mpd")
(mpd/update-database)
(emms-player-mpd-connect)
(emms-cache-set-from-mpd-all)
(message "MPD Started!"))
;;(global-set-key (kbd "s-m c") 'mpd/start-music-daemon)
(defun mpd/kill-music-daemon ()
"Stops playback and kill the music daemon."
(interactive)
(emms-stop)
(call-process "killall" nil nil nil "mpd")
(message "MPD Killed!"))
;;(global-set-key (kbd "s-m k") 'mpd/kill-music-daemon)
(defun mpd/update-database ()
"Updates the MPD database synchronously."
(interactive)
(call-process "mpc" nil nil nil "update")
(message "MPD Database Updated!"))
;;(global-set-key (kbd "s-m u") 'mpd/update-database)
This is a set of bindings to my XF86 keys that invokes pulsemixer with the correct parameters
It goes without saying that you are free to modify the modifier as you see fit, 4 is good enough for me though.
(defconst volumeModifier "4")
(defun audio/mute ()
(interactive)
(start-process "audio-mute" nil "pulsemixer" "--toggle-mute"))
(defun audio/raise-volume ()
(interactive)
(start-process "raise-volume" nil "pulsemixer" "--change-volume" (concat "+" volumeModifier)))
(defun audio/lower-volume ()
(interactive)
(start-process "lower-volume" nil "pulsemixer" "--change-volume" (concat "-" volumeModifier)))
You can also change those if you’d like, but I highly recommend keeping ‘em the same, chances are, they will just work.
(global-set-key (kbd "<XF86AudioMute>") 'audio/mute)
(global-set-key (kbd "<XF86AudioRaiseVolume>") 'audio/raise-volume)
(global-set-key (kbd "<XF86AudioLowerVolume>") 'audio/lower-volume)
(setq-default dired-listing-switches "-alh")
(use-package all-the-icons-dired
:straight t
:hook (dired-mode . all-the-icons-dired-mode)
)
(defvar my-term-shell "/bin/bash")
(defadvice ansi-term (before force-bash)
(interactive (list my-term-shell)))
(ad-activate 'ansi-term)
(use-package elpher
:straight t)
(use-package ace-link
:straight t
:config
(ace-link-setup-default)
)
replacing gnus with elfeed
(use-package gptel
:straight t
:config
(gptel-make-ollama "Ollama" ;Any name of your choosing
:host "d:11434" ;Where it's running
:stream t ;Stream responses
:models '("dolphin-phi")) ;List of models
)
;; (use-package mu4e
;; :straight t)
(setq
rmail-primary-inbox-list '("pop://taylor%[email protected]")
rmail-preserve-inbox t
user-full-name "Taylor Hardy"
user-mail-address "[email protected]")
use byzanz to record the screen, with ability to select region
(defun emacs-byzanz-record (&optional w h x y)
(interactive)
(add-to-list 'display-buffer-alist
(cons "emacs-record" (cons #'display-buffer-no-window nil)))
(async-shell-command (format "byzanz-record -e \"bash -c 'exec -a emacs_record sleep infinity'\" %s" (concat (getenv "HOME") "/" (subseq (number-to-string (float-time)) 0 10) ".gif")) "emacs-record")
)
(defun emacs-byzanz-record-stop ()
(interactive)
(shell-command "pkill -xef 'emacs_record infinity'")
)
(defun byzanz-record-region ()
(interactive)
(when window-system
(call-process "import" nil nil nil ".newScreen.png")
(let ((width (shell-command-to-string "identify -format '%w' .newScreen.png"))
(height (shell-command-to-string "identify -format '%h' .newScreen.png"))
(xoff (shell-command-to-string "identify -format '%X' .newScreen.png"))
(yoff (shell-command-to-string "identify -format '%Y' .newScreen.png")))
(message (format "capturing on: w:%s h:%s X:%s Y:%s" width height xoff yoff))
(message (format "byzanz-record -w %s -h %s -x %s -y %s -e \"bash -c 'exec -a emacs_record sleep infinity'\" %s" width height xoff yoff (concat (getenv "HOME") "/" (subseq (number-to-string (float-time)) 0 10) ".gif")) )
(add-to-list 'display-buffer-alist
(cons "emacs-record" (cons #'display-buffer-no-window nil)))
(async-shell-command (format "byzanz-record -w %s -h %s -x %s -y %s -e \"bash -c 'exec -a emacs_record sleep infinity'\" %s" width height xoff yoff (concat (getenv "HOME") "/" (subseq (number-to-string (float-time)) 0 10) ".gif")) "emacs-record" )
)
(call-process "rm" nil nil nil ".newScreen.png")
(message "byzanz capture started")) )
I use eww for most browsing, and I use qutebrowser when I need to open something in an external browser.
(setq browse-url-browser-function 'eww-browse-url
browse-url-generic-program "qutebrowser")
(setq eww-search-prefix "http://www.duckduckgo.com/lite?q=")
;; (setq eww-search-prefix "http://localhost/?preferences=eJx9VsFu5DYM_Zr6YiTodg89zaFoUewCBbJosr0atER7uJZErSSPo3x9qRmPR55se8ggpqnHR_KRsoKEIwfCeBjRYQDTGHDjDCMe0D18fW4MKzDloYE5sWLrDSY8nJ8GVnM8vIQZGwjqSCfsEmvIhz_BRGzICkznA79eLRbTkfXhy9PzSxNhwIjl3OHnJh3R4iFSQW8Cxtmk2LHrHC5dgn49rpk6ecnmhOHAII-PHMaGo4LwEFMWnoZHUqzx1IA-gVOouzXICkEReiNWdCM5SZus7rtuTf6nX35faCJLjva2PtfPGHghXVscCKXaUDj0GMauo1QQOGhHU-0BbyYHUrG2RbTgEqk2qiMbEMSoCCULeWezRcshtymAi0Yat2Mweta6cBjIYBTDRGqCKPB2jqQKOBvSiUNAJ8Xd_AJqTUl4lm7FM4k3B7bGDnOfR7RxTebDa-XtMsAtBrkTaeJZXOUf5OKxHEVAUWLjji_zaLD1BnIL3leE9KzR1a4V6DVOhiPzD9OPrAhMa1ETlGQShOSLDivnQQcu_btGtPwNcbpTQSJ2EHZ9_75Id9pL6lUJtkpvKWsevWDvCEqERBavRSw6-z5z2jklkWTGCnoOPThN6gdkZhelePFYedc1tXwirDmlk4W3XTSfPa1sEk-ZE8cjT-BuZS4kT5zvyrfOeks77Q4BLBjqA66YeRxXtVX68ENsLwN5M4KfWkshcKXekUaZU4hpJ4T6dDWOKVt2Rmq3YxmnvYZtXzqy1eOq-zoDxDbykBYI2GoKqCSBvKajZzWVv1F0t2Bf6ocJzJ4Is7kb6EK2LIO2_KxQ19Cy3QoTpdRDOlXUNjFXytg36OZKyUC_4g6B3ESgam3CPMhG362KDx8__vpaYfRBtlftcAQxlZ8V9zLjG-ZlDC7HK5htDK49XPiVJnaPknzMjp0ssF1H1ircTWwtmw1JdKghQX3ccB8TPoZ6oCLPQe2C9JR6aRqmd118P8ceMaS5r0VSk7lNtx5bjYNcEmUsd_2uRVLpogdRkfTOe3JjKai3K5-dpDcmd92-lqGX07sSyLTJVmiLJe6nsVSjZ57eGeWeipTyvblIcRMkOajSjd_8o1_cfw7i5sgeXUDPlQQuyrl4NOj2Vy87fD_MlxPX82ep_W_KZ8_bte7NLODx8IljklsM5XtB1uH5Av3szi1DuVMDmwL2JIS735RCUe0fT5_FdwniIG_-IftgaMLuyGnCfOO-4ZfNe3kQ95cAorHQff37LwGR1YtBrM9ohk6icrBwVsrZdk5YShVAlFVMn15evjxXsa8urlOXr7MsnzBGdlEjskCJ_S8t36lz&q=" )
shrface for eww that is more like org mode
(use-package shrface
:defer t
:straight t
:config
(shrface-basic)
(shrface-trial)
(setq shrface-href-versatile t))
(use-package eww
:init
(add-hook 'eww-after-render-hook #'shrface-mode)
:config
(require 'shrface))
sometimes i load a page and it has a lot of animated images and it makes eww crawl, or it has big images that make the page hard to read, so I dont open images by default, but this neat script i found lets you turn on and off images.
(defun my/eww-toggle-images ()
"Toggle whether images are loaded and reload the current page from cache."
(interactive)
(setq-local shr-inhibit-images (not shr-inhibit-images))
(eww-reload t)
(message "Images are now %s"
(if shr-inhibit-images "off" "on")))
;; (define-key eww-mode-map (kbd "I") #'my/eww-toggle-images)
;; (define-key eww-link-keymap (kbd "I") #'my/eww-toggle-images)
;; minimal rendering by default
(setq-default shr-inhibit-images t) ; toggle with `I`
(setq-default shr-use-fonts nil) ; toggle with `F`
this highlights syntax in eww, good for elisp snippets on the wiki.
;; syntax highlighting
(use-package language-detection
:straight t
:config
(require 'cl-lib)
(defun eww-tag-pre (dom)
(let ((shr-folding-mode 'none)
(shr-current-font 'default))
(shr-ensure-newline)
(insert (eww-fontify-pre dom))
(shr-ensure-newline)))
(defun eww-fontify-pre (dom)
(with-temp-buffer
(shr-generic dom)
(let ((mode (eww-buffer-auto-detect-mode)))
(when mode
(eww-fontify-buffer mode)))
(buffer-string)))
(defun eww-fontify-buffer (mode)
(delay-mode-hooks (funcall mode))
(font-lock-default-function mode)
(font-lock-default-fontify-region (point-min)
(point-max)
nil))
(defun eww-buffer-auto-detect-mode ()
(let* ((map '((ada ada-mode)
(awk awk-mode)
(c c-mode)
(cpp c++-mode)
(clojure clojure-mode lisp-mode)
(csharp csharp-mode java-mode)
(css css-mode)
(dart dart-mode)
(delphi delphi-mode)
(emacslisp emacs-lisp-mode)
(erlang erlang-mode)
(fortran fortran-mode)
(fsharp fsharp-mode)
(go go-mode)
(groovy groovy-mode)
(haskell haskell-mode)
(html html-mode)
(java java-mode)
(javascript javascript-mode)
(json json-mode javascript-mode)
(latex latex-mode)
(lisp lisp-mode)
(lua lua-mode)
(matlab matlab-mode octave-mode)
(objc objc-mode c-mode)
(perl perl-mode)
(php php-mode)
(prolog prolog-mode)
(python python-mode)
(r r-mode)
(ruby ruby-mode)
(rust rust-mode)
(scala scala-mode)
(shell shell-script-mode)
(smalltalk smalltalk-mode)
(sql sql-mode)
(swift swift-mode)
(visualbasic visual-basic-mode)
(xml sgml-mode)))
(language (language-detection-string
(buffer-substring-no-properties (point-min) (point-max))))
(modes (cdr (assoc language map)))
(mode (cl-loop for mode in modes
when (fboundp mode)
return mode)))
(message (format "%s" language))
(when (fboundp mode)
mode)))
(setq shr-external-rendering-functions
'((pre . eww-tag-pre))))
(setq shr-indentation 2
shr-width 90)
I don’t need scrot to take screenshots, or shutter or whatever tools you might have. This is enough. These won’t work in the terminal version or the virtual console, obvious reasons.
(defun daedreth/take-screenshot ()
"Takes a fullscreen screenshot of the current workspace"
(interactive)
(when window-system
(loop for i downfrom 3 to 1 do
(progn
(message (concat (number-to-string i) "..."))
(sit-for 1)))
(message "Cheese!")
(sit-for 1)
(start-process "screenshot" nil "import" "-window" "root"
(concat (getenv "HOME") "/" (subseq (number-to-string (float-time)) 0 10) ".png"))
(message "Screenshot taken!")))
(global-set-key (kbd "<print>") 'daedreth/take-screenshot)
(defun daedreth/take-screenshot-region ()
"Takes a screenshot of a region selected by the user."
(interactive)
(when window-system
(call-process "import" nil nil nil ".newScreen.png")
(call-process "convert" nil nil nil ".newScreen.png" "-shave" "1x1"
(concat (getenv "HOME") "/" (subseq (number-to-string (float-time)) 0 10) ".png"))
(call-process "rm" nil nil nil ".newScreen.png")))
(global-set-key (kbd "S-<print>") 'daedreth/take-screenshot-region)
(global-set-key (kbd "C-c o") 'daedreth/take-screenshot-region)
sometimes need better than ansi-term
(use-package vterm
:straight t)
similar to vterm
;; (use-package eat
;; :straight t)
(straight-use-package
'(eat :type git
:host codeberg
:repo "htayj/emacs-eat"
:branch "bold-is-bright-option"
:files ("*.el" ("term" "term/*.el") "*.texi"
"*.ti" ("terminfo/e" "terminfo/e/*")
("terminfo/65" "terminfo/65/*")
("integration" "integration/*")
(:exclude ".dir-locals.el" "*-tests.el"))))
(use-package magit
:straight t
:config
(setq magit-push-always-verify nil)
(setq git-commit-summary-max-length 80)
:bind
("C-c g" . sudo-edit))
(use-package diff-hl
:straight t
:config
(global-diff-hl-mode))
(use-package forge
:straight t
:after magit)
(use-package code-review
:straight '(code-review :type git :host github :repo "phelrine/code-review" :branch "fix/closql-update")
:config
(setq code-review-auth-login-marker 'forge))
;; (straight-use-package '(tsx-mode :type git :host github :repo "phelrine/code-review" :branch "fix/closql-update"))
(use-package modus-themes
:straight t
:init
(setq modus-vivendi-theme-slanted-constructs t
modus-vivendi-theme-bold-constructs t
modus-vivendi-theme-visible-fringes t
modus-vivendi-theme-3d-modeline t
modus-vivendi-theme-subtle-diffs t
modus-vivendi-theme-intense-standard-completions t
modus-vivendi-theme-distinct-org-blocks t
modus-vivendi-theme-rainbow-org-src-blocks t
modus-vivendi-theme-proportional-fonts t
modus-vivendi-theme-rainbow-headings t
modus-vivendi-theme-section-headings t)
:config
(load-theme 'modus-vivendi t))
;; Set default font
(set-face-attribute 'default nil
:foundry "DIGITAL" :family "vt220"
:height 110
:inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant 'normal :weight 'medium :height 321 :width 'normal )
;; set fallback font for emoji
(set-fontset-font t nil (font-spec :size 20 :name "Unifont"))
;;; use this font
;; ftcrhb:-V.R.-Bm437 IBM VGA 9x16-regular-normal-normal-*-16-*-*-*-m-*-iso10646-1 (#x0C)
(setq ansi-color-names-vector
["#303030" "#f2241f" "#67b11d" "#b1951d" "#4f97d7" "#a31db1" "#28def0" "#b2b2b2"])
;; (setq ansi-color-blue ((t (:background "#0000aa" :foreground "#0000aa"))))
;; (setq ansi-color-bright-black ((t (:background "#555555" :foreground "#555555"))))
;; (setq ansi-color-bright-blue ((t (:background "#5555ff" :foreground "#5555ff"))))
;; (setq ansi-color-bright-cyan ((t (:background "#55ffff" :foreground "#55ffff"))))
;; (setq ansi-color-bright-green ((t (:background "#55ff55" :foreground "#55ff55"))))
;; (setq ansi-color-bright-magenta ((t (:background "#ff55ff" :foreground "#ff55ff"))))
;; (setq ansi-color-bright-red ((t (:background "#ff5555" :foreground "#ff5555"))))
;; (setq ansi-color-bright-yellow ((t (:background "#ffff55" :foreground "#ffff55"))))
;; (setq ansi-color-cyan ((t (:background "#00aaaa" :foreground "#00aaaa"))))
;; (setq ansi-color-green ((t (:background "#00aa00" :foreground "#00aa00"))))
;; (setq ansi-color-magenta ((t (:background "#aa00aa" :foreground "#aa00aa"))))
;; (setq ansi-color-red ((t (:background "#aa0000" :foreground "#aa0000"))))
;; (setq ansi-color-white ((t (:background "#aaaaaa" :foreground "#aaaaaa"))))
;; (setq ansi-color-yellow ((t (:background "#aa5500" :foreground "#aa5500"))))
add emoji rendering
(use-package emojify
:straight t)
M-x all-the-icons-install-fonts
(use-package all-the-icons
:straight t)
(require 'treesit)
(require 'eglot)
(use-package evil
:straight t
:init
(setq evil-want-integration t)
(setq evil-want-keybinding nil)
:custom
(evil-undo-system 'undo-tree)
(evil-search-module 'isearch)
:config
(evil-mode 1)
(setq evil-search-module 'isearch)
(define-key evil-insert-state-map (kbd "C-g") 'evil-normal-state))
(use-package evil-collection
:after evil
:straight t
:config
(evil-collection-init)
(setq evil-want-keybinding t)
(evil-set-initial-state 'eaf-mode 'emacs)
(evil-set-initial-state 'exwm-mode 'emacs))
(use-package evil-surround
:straight t
:config
(global-evil-surround-mode 1))
(use-package undo-tree
:straight t
:config
(setq undo-tree-history-directory-alist '(("." . "~/.emacs.d/undo")))
(global-undo-tree-mode))
M - can be replaced with major mode leaders - middle line H - can be replaced with backwards - first line L - can be replaced with forwards - last line K - replace with read man command {,} - can be replaced with back/forward paragraph
s - can be replaced - rarely used, shortcut for `cl` R - can be replaced - never used, trouble with `C-g` Z - can be replaced - duplicated with emacs keys X - can be replaced - never used, odd behavior
U - undefined
yy is the same as Y? shouldnt Y be rest of line?
These are setting that do not depend on packages and are built-in enhancements to the UI.
(setq inhibit-startup-message t)
If you like using any of those, change -1
to 1
.
(tool-bar-mode -1)
(menu-bar-mode -1)
(scroll-bar-mode -1)
(setq locale-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(prefer-coding-system 'utf-8)
(setq visible-bell nil)
I don’t use either, you might want to turn those from nil
to t
if you do.
(setq make-backup-files nil)
(setq auto-save-default nil)
(defalias 'yes-or-no-p 'y-or-n-p)
use asynchronous processes wherever possible
(use-package async
:straight t
:init (dired-async-mode 1))
This makes sure that everything can be a project.
(use-package projectile
:straight t
:init (projectile-mode 1)
:custom
(projectile-indexing-method 'hybrid)
;; :custom
;; (projectile-completion-system)
:bind ("C-c p" . 'projectile-command-map))
(use-package helm-projectile
:straight t
:config (helm-projectile-on))
(use-package helm-rg
:straight t)
(use-package counsel-projectile
:straight t
:config (counsel-projectile-mode))
;; (setq projectile-project-search-path '("~/ttui/" "~/terminus/" ))
(global-set-key (kbd "<f5>") 'projectile-compile-project)
(use-package apheleia
:straight t
:config
(apheleia-global-mode +1)
(setf (alist-get 'tsx-mode apheleia-mode-alist)
'(prettier-typescript))
(setf (alist-get 'tsx-ts-mode apheleia-mode-alist)
'(prettier-typescript)))
(require 'treesit)
(use-package paredit
:straight t
:config
(autoload 'enable-paredit-mode "paredit" "Turn on pseudo-structural editing of Lisp code." t)
(add-hook 'emacs-lisp-mode-hook #'enable-paredit-mode)
(add-hook 'eval-expression-minibuffer-setup-hook #'enable-paredit-mode)
(add-hook 'ielm-mode-hook #'enable-paredit-mode)
(add-hook 'lisp-mode-hook #'enable-paredit-mode)
(add-hook 'lisp-interaction-mode-hook #'enable-paredit-mode)
(add-hook 'scheme-mode-hook #'enable-paredit-mode))
(use-package symex
:straight t
:config
(setq symex--user-evil-keyspec
'(("h" . symex-go-down)
("l" . symex-go-up)
("j" . symex-go-forward)
("k" . symex-go-backward)
("M-h" . symex-descend-branch)
("M-l" . symex-climb-branch)
("C-M-h" . symex-goto-lowest)
("C-M-l" . symex-goto-highest)))
(symex-initialize)
(global-set-key (kbd "s-;") 'symex-mode-interface)
(evil-define-key 'insert symex-mode-map
(kbd "C-g") 'symex-mode-interface)
:hook
'(elisp-mode clojure-mode common-lisp-mode))
shows box with documentation instead of minibuffer
(use-package eldoc-box
:straight t
:config
(add-hook 'eglot-managed-mode-hook #'eldoc-box-hover-at-point-mode t)
(add-hook 'lsp-managed-mode-hook #'eldoc-box-hover-at-point-mode t)
(add-hook 'emacs-lisp-mode-hook #'eldoc-box-hover-at-point-mode t))
I prefer C-n
and C-p
to move around the items, so I remap those accordingly.
(use-package company
:straight t
:bind (:map company-active-map
("<tab>" . company-complete-selection))
:config
(setq company-idle-delay 0)
(setq company-minimum-prefix-length 1))
Be it for code or prose, completion is a must.
After messing around with auto-completion
for a while I decided to drop it
in favor of company
, and it turns out to have been a great decision.
Each category also has additional settings.
(use-package rust-mode
:straight t
:hook
(eglot-ensure)
:init
(setq rust-mode-treesitter-derive t))
**** bbcode
(use-package bbcode-mode)
**** bbcode
(use-package bbcode-mode)
Requires libclang to be installed.
(with-eval-after-load 'company
(add-hook 'c++-mode-hook 'company-mode)
(add-hook 'c-mode-hook 'company-mode))
(use-package company-c-headers
:straight t)
(use-package company-irony
:straight t
:config
(setq company-backends '((company-c-headers
company-dabbrev-code
company-irony))))
(use-package irony
:straight t
:config
(add-hook 'c++-mode-hook 'irony-mode)
(add-hook 'c-mode-hook 'irony-mode)
(add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options))
(add-hook 'python-mode-hook 'flycheck-mode)
(with-eval-after-load 'company
(add-hook 'python-mode-hook 'company-mode))
(use-package company-jedi
:straight t
:config
(require 'company)
(add-to-list 'company-backends 'company-jedi))
(defun python-mode-company-init ()
(setq-local company-backends '((company-jedi
company-etags
company-dabbrev-code))))
(use-package company-jedi
:straight t
:config
(require 'company)
(add-hook 'python-mode-hook 'python-mode-company-init))
(use-package cider
:straight t)
(add-hook 'emacs-lisp-mode-hook 'eldoc-mode)
(add-hook 'emacs-lisp-mode-hook 'company-mode)
(use-package slime
:straight t
:config
(setq inferior-lisp-program "/usr/bin/sbcl")
(setq slime-contribs '(slime-fancy))
(setq slime-lisp-host "localhost"))
(use-package slime-company
:straight t
:init
(require 'company)
(slime-setup '(slime-fancy slime-company)))
(add-hook 'lua-mode-hook 'flycheck-mode)
(add-hook 'lua-mode-hook 'company-mode)
(defun custom-lua-repl-bindings ()
(local-set-key (kbd "C-c C-s") 'lua-show-process-buffer)
(local-set-key (kbd "C-c C-h") 'lua-hide-process-buffer))
(defun lua-mode-company-init ()
(setq-local company-backends '((company-lua
company-etags
company-dabbrev-code))))
(use-package company-lua
:straight t
:config
(require 'company)
(setq lua-indent-level 4)
(setq lua-indent-string-contents t)
(add-hook 'lua-mode-hook 'custom-lua-repl-bindings)
(add-hook 'lua-mode-hook 'lua-mode-company-init))
(add-hook 'shell-mode-hook 'flycheck-mode)
(add-hook 'shell-mode-hook 'company-mode)
(defun shell-mode-company-init ()
(setq-local company-backends '((company-shell
company-shell-env
company-etags
company-dabbrev-code))))
(use-package company-shell
:straight t
:config
(require 'company)
(add-hook 'shell-mode-hook 'shell-mode-company-init))
(use-package haskell-mode
:straight t)
(autoload 'drools-mode "drools-mode")
(defun set-extension-mode (extension mode)
(setq auto-mode-alist
(cons (cons (concat "\\" extension "\\'") mode)
auto-mode-alist) ) )
(set-extension-mode ".drl" 'drools-mode)
(set-extension-mode ".dslr" 'drools-mode)
(add-hook 'drools-mode-hook 'my-drools-hook)
(defun drools-return-and-indent()
(interactive)
(newline) (indent-for-tab-command) )
(defun my-drools-hook ()
(setq indent-tabs-mode nil)
(local-set-key [?\C-m] 'drools-return-and-indent) )
;; (use-package scala-mode
;; :straight t
;; :interpreter
;; ("scala" . scala-mode))
;; (use-package sbt-mode
;; :commands sbt-start sbt-command
;; :straight t
;; :config
;; ;; WORKAROUND: https://github.com/ensime/emacs-sbt-mode/issues/31
;; ;; allows using SPACE when in the minibuffer
;; (substitute-key-definition
;; 'minibuffer-complete-word
;; 'self-insert-command
;; minibuffer-local-completion-map)
;; ;; sbt-supershell kills sbt-mode: https://github.com/hvesalai/emacs-sbt-mode/issues/152
;; (setq sbt:program-options '("-Dsbt.supershell=false"))
;; )
;; Add metals backend for lsp-mode
;; (use-package lsp-metals
;; :straight t
;; :config (setq lsp-metals-treeview-show-when-views-received nil))
;; ;; Enable nice rendering of documentation on hover
;; (use-package lsp-ui
;; :straight t)
;; Add company-lsp backend for metals
;; (use-package company-lsp
;; :straight t)
;; Use the Debug Adapter Protocol for running tests and debugging
;; (use-package dap-mode
;; :straight t
;; :hook
;; (lsp-mode . dap-mode)
;; (lsp-mode . dap-ui-mode))
(use-package coverlay
:straight t)
(use-package origami
:straight t)
;; (use-package css-in-js-mode
;; :straight (css-in-js-mode :type git :host github :repo "orzechowskid/tree-sitter-css-in-js"))
;; (require 'css-in-js)
(use-package markdown-mode) ;; required for eglot eldoc
;; (use-package tsx-mode
;; :straight (tsx-mode :type git :host github :repo "orzechowskid/tsx-mode.el" :branch "emacs29")
;; :after eglot
;; :config
;; (add-to-list 'auto-mode-alist '("\\.tsx?\\'" . tsx-mode))
;; (add-to-list 'auto-mode-alist '("\\.ts?\\'" . tsx-mode)))
;; ;; (define- derived-mode typescript-tsx-mode typescript-mode "TSX"
;; "Major mode for editing TSX files.
;; ;; Refer to Typescript documentation for syntactic differences between normal and TSX
;; ;; variants of Typescript.")
;; (use-package flymake-eslint
;; :straight t
;; :config
;; (add-hook 'tsxs-mode
;; (lambda ()
;; (flymake-eslint-enable)))
;; (add-hook 'tsx-ts-mode
;; (lambda ()
;; (flymake-eslint-enable)))
;; )
;; (add-to-list 'auto-mode-alist '("\\.tsx?\\'" . typescript-tsx-mode))
;; (defun typescript-tsx-mode-fix-tree-sitter()
;; (set (make-local-variable 'tree-sitter-hl-use-font-lock-keywords) nil))
;; (add-hook 'typescript-tsx-mode-hook #'typescript-tsx-mode-fix-tree-sitter)
;; (add-hook 'typescript-tsx-mode-hook #'tree-sitter-hl-mode)
;; (use-package tide
;; :straight t
;; :config
;; (defun setup-tide-mode ()
;; (interactive)
;; (tide-setup)
;; (flycheck-mode +1)
;; (setq flycheck-check-syntax-automatically '(save mode-enabled))
;; (eldoc-mode +1)
;; (tide-hl-identifier-mode +1)
;; ;; company is an optional dependency. You have to
;; ;; install it separately via package-install
;; ;; `M-x package-install [ret] company`
;; (company-mode +1))
;; ;; aligns annotation to the right hand side
;; (setq company-tooltip-align-annotations t)
;; ;; formats the buffer before saving
;; (add-hook 'before-save-hook nil)
;; (add-hook 'typescript-mode-hook #'setup-tide-mode))
;; (add-hook 'web-mode-hook
;; (lambda ()
;; (when (string-equal "tsx" (file-name-extension buffer-file-name))
;; (setup-tide-mode))))
(use-package apheleia
:straight t
:config
(apheleia-global-mode +1)
(cl-pushnew '(eslint-typescript . ("~/eslint_d.sh" file)) apheleia-formatters :test #'equal)
(setf (alist-get 'tsx-mode apheleia-mode-alist)
'(eslint-typescript))
(setf (alist-get 'js-json-mode apheleia-mode-alist)
'(eslint-typescript))
(setf (alist-get 'tsx-ts-mode apheleia-mode-alist)
'(eslint-typescript)))
;; typescript repl
;; (use-package ts-comint
;; :straight t
;; :config
;; (add-hook 'tsx-mode-hook
;; (lambda ()
;; (local-set-key (kbd "C-x C-e") 'ts-send-last-sexp)
;; (local-set-key (kbd "C-M-x") 'ts-send-last-sexp-and-go)
;; (local-set-key (kbd "C-c b") 'ts-send-buffer)
;; (local-set-key (kbd "C-c C-b") 'ts-send-buffer-and-go)
;; (local-set-key (kbd "C-c l") 'ts-load-file-and-go)))
;; (add-hook 'tsx-ts-mode-hook
;; (lambda ()
;; (local-set-key (kbd "C-x C-e") 'ts-send-last-sexp)
;; (local-set-key (kbd "C-M-x") 'ts-send-last-sexp-and-go)
;; (local-set-key (kbd "C-c b") 'ts-send-buffer)
;; (local-set-key (kbd "C-c C-b") 'ts-send-buffer-and-go)
;; (local-set-key (kbd "C-c l") 'ts-load-file-and-go))))
(use-package evil-lispy
:straight t)
(use-package kotlin-mode
:straight t)
(use-package vue-html-mode
:straight t)
(use-package vue-mode
:straight t)
(use-package emmet-mode
:straight t)
(use-package web-mode
:straight t
:init
(add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.tpl\\.php\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.[agj]sp\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.as[cp]x\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.erb\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.mustache\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.djhtml\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.vue\\'" . web-mode))
(add-hook 'editorconfig-custom-hooks
(lambda (hash) (setq web-mode-block-padding 0)))
(add-hook 'web-mode-hook 'company-mode)
;; (add-hook 'web-mode-hook 'yas-minor-mode)
:config
(setq web-mode-enable-auto-indentation nil)
(setq web-mode-content-types-alist '(("jsx" . "\\.js[x]?\\'"))))
;; (use-package acutex)
(use-package tex ;
:defer t
:straight auctex
:config
(setq TeX-auto-save t))
(use-package auctex
:straight t)
(setq ConTeXt-Mark-version "IV")
(add-hook 'ConTeXt-mode-hook
(lambda()
(setq TeX-command-default "ConTeXt Full")))
(add-to-list 'auto-mode-alist '("\\.mkiv\\'" . ConTeXt-mode))
(add-to-list 'auto-mode-alist '("\\.mkvi\\'" . ConTeXt-mode))
(with-eval-after-load "context"
(add-to-list 'TeX-file-extensions "mkvi" t)
(add-to-list 'TeX-file-extensions "mkiv" t))
(add-to-list 'exec-path "/home/tay/context/tex/texmf-linux-64/bin")
;; (setenv PATH "/home/tay/context/tex/texmf-linux-64/bin:/home/tay/.pyenv/shims:/home/tay/context/tex/texmf-linux-64/bin:/usr/bin:/usr/condabin:/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/cuda/bin:/opt/cuda/nsight_compute:/opt/cuda/nsight_systems/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl")
;; abolish tabs
(setq-default indent-tabs-mode nil)
(setq tab-stop-list (number-sequence 2 120 2))
minor mode not set up?
Emacs treats camelCase strings as a single word by default, this changes said behaviour.
(global-subword-mode 1)
autocomplete pairs
(setq electric-pair-pairs '(
(?\{ . ?\})
(?\( . ?\))
(?\[ . ?\])
(?\" . ?\")))
And now to enable it
(electric-pair-mode t)
shows color of hex color
(use-package rainbow-mode
:straight t
:init
(add-hook 'prog-mode-hook 'rainbow-mode))
highlight matching paren
(show-paren-mode 1)
Colors parentheses and other delimiters depending on their depth
(use-package rainbow-delimiters
:straight t
:init
(add-hook 'prog-mode-hook #'rainbow-delimiters-mode))
grow region over levels of semantic objects.
(use-package expand-region
:straight t
:bind ("C-M-q" . er/expand-region))
Backspace or Delete will get rid of all whitespace until the next non-whitespace character is encountered.
(use-package hungry-delete
:straight t
:config
(global-hungry-delete-mode))
Relative line numbers
(use-package linum-relative
:straight t
:config
(setq linum-relative-current-symbol "")
(add-hook 'prog-mode-hook 'linum-relative-mode))
(use-package compile-eslint
:straight (compile-eslint :type git :host github :repo "Fuco1/compile-eslint")
:config (push 'eslint compilation-error-regexp-alist)) ;; optional
(defun my/ansi-colorize-buffer ()
(let ((buffer-read-only nil))
(ansi-color-apply-on-region (point-min) (point-max))))
(add-hook 'compilation-filter-hook 'my/ansi-colorize-buffer)
(global-set-key (kbd "C-c d m") 'emms)
(global-set-key (kbd "C-c a d") 'emms-add-dired)
(global-set-key (kbd "C-c a f") 'emms-add-find)
(global-set-key (kbd "C-c d s") 'emms-streams)
(global-set-key (kbd "C-c d n") 'emms-next)
(global-set-key (kbd "C-c d p") 'emms-previous)
(global-set-key (kbd "C-c d SPC") 'emms-pause)
(global-set-key (kbd "C-c w w") 'eww)
(global-set-key (kbd "C-c j") 'org-capture)