mirror of
https://gitlab.com/dwt1/dotfiles.git
synced 2026-04-23 11:30:23 +10:00
XDG compliant doom dir
This commit is contained in:
6
.config/doom/aliases
Normal file
6
.config/doom/aliases
Normal file
@@ -0,0 +1,6 @@
|
||||
alias ls exa -al --color=always --group-directories-first
|
||||
alias ff find-file $1
|
||||
alias doomsync ~/.emacs.d/bin/doom sync
|
||||
alias doomdoctor ~/.emacs.d/bin/doom doctor
|
||||
alias doomupgrade ~/.emacs.d/bin/doom upgrade
|
||||
alias doompurge ~/.emacs.d/bin/doom purge
|
||||
423
.config/doom/config.el
Normal file
423
.config/doom/config.el
Normal file
@@ -0,0 +1,423 @@
|
||||
(map! :leader
|
||||
:desc "List bookmarks"
|
||||
"b L" #'list-bookmarks
|
||||
:leader
|
||||
:desc "Save current bookmarks to bookmark file"
|
||||
"b w" #'bookmark-save)
|
||||
|
||||
(setq centaur-tabs-set-bar 'over
|
||||
centaur-tabs-set-icons t
|
||||
centaur-tabs-gray-out-icons 'buffer
|
||||
centaur-tabs-height 24
|
||||
centaur-tabs-set-modified-marker t
|
||||
centaur-tabs-style "bar"
|
||||
centaur-tabs-modified-marker "•")
|
||||
(map! :leader
|
||||
:desc "Toggle tabs globally"
|
||||
"t c" #'centaur-tabs-mode
|
||||
:leader
|
||||
:desc "Toggle tabs local display"
|
||||
"t C" #'centaur-tabs-local-mode)
|
||||
(evil-define-key 'normal centaur-tabs-mode-map (kbd "g <right>") 'centaur-tabs-forward ; default Doom binding is 'g t'
|
||||
(kbd "g <left>") 'centaur-tabs-backward ; default Doom binding is 'g T'
|
||||
(kbd "g <down>") 'centaur-tabs-forward-group
|
||||
(kbd "g <up>") 'centaur-tabs-backward-group)
|
||||
|
||||
(map! :leader
|
||||
:desc "Dired"
|
||||
"d d" #'dired
|
||||
:leader
|
||||
:desc "Dired jump to current"
|
||||
"d j" #'dired-jump
|
||||
(:after dired
|
||||
(:map dired-mode-map
|
||||
:leader
|
||||
:desc "Peep-dired image previews"
|
||||
"d p" #'peep-dired
|
||||
:leader
|
||||
:desc "Dired view file"
|
||||
"d v" #'dired-view-file)))
|
||||
;; Make 'h' and 'l' go back and forward in dired. Much faster to navigate the directory structure!
|
||||
(evil-define-key 'normal dired-mode-map
|
||||
(kbd "h") 'dired-up-directory
|
||||
(kbd "l") 'dired-open-file) ; use dired-find-file instead if not using dired-open package
|
||||
;; If peep-dired is enabled, you will get image previews as you go up/down with 'j' and 'k'
|
||||
(evil-define-key 'normal peep-dired-mode-map
|
||||
(kbd "j") 'peep-dired-next-file
|
||||
(kbd "k") 'peep-dired-prev-file)
|
||||
(add-hook 'peep-dired-hook 'evil-normalize-keymaps)
|
||||
;; Get file icons in dired
|
||||
(add-hook 'dired-mode-hook 'all-the-icons-dired-mode)
|
||||
;; With dired-open plugin, you can launch external programs for certain extensions
|
||||
;; For example, I set all .png files to open in 'sxiv' and all .mp4 files to open in 'mpv'
|
||||
(setq dired-open-extensions '(("gif" . "sxiv")
|
||||
("jpg" . "sxiv")
|
||||
("png" . "sxiv")
|
||||
("mkv" . "mpv")
|
||||
("mp4" . "mpv")))
|
||||
|
||||
(setq doom-theme 'doom-one)
|
||||
(map! :leader
|
||||
:desc "Load new theme"
|
||||
"h t" #'counsel-load-theme)
|
||||
|
||||
(custom-set-variables
|
||||
'(elfeed-feeds
|
||||
(quote
|
||||
(("https://www.reddit.com/r/linux.rss" reddit linux)
|
||||
("https://www.gamingonlinux.com/article_rss.php" gaming linux)
|
||||
("https://hackaday.com/blog/feed/" hackaday linux)
|
||||
("https://opensource.com/feed" opensource linux)
|
||||
("https://linux.softpedia.com/backend.xml" softpedia linux)
|
||||
("https://itsfoss.com/feed/" itsfoss linux)
|
||||
("https://www.zdnet.com/topic/linux/rss.xml" zdnet linux)
|
||||
("https://www.phoronix.com/rss.php" phoronix linux)
|
||||
("http://feeds.feedburner.com/d0od" omgubuntu linux)
|
||||
("https://www.computerworld.com/index.rss" computerworld linux)
|
||||
("https://www.networkworld.com/category/linux/index.rss" networkworld linux)
|
||||
("https://www.techrepublic.com/rssfeeds/topic/open-source/" techrepublic linux)
|
||||
("https://betanews.com/feed" betanews linux)
|
||||
("http://lxer.com/module/newswire/headlines.rss" lxer linux)
|
||||
("https://distrowatch.com/news/dwd.xml" distrowatch linux)))))
|
||||
|
||||
(emms-all)
|
||||
(emms-default-players)
|
||||
(emms-mode-line 1)
|
||||
(emms-playing-time 1)
|
||||
(setq emms-source-file-default-directory "~/Music/Non-Classical/70s-80s/"
|
||||
emms-playlist-buffer-name "*Music*"
|
||||
emms-info-asynchronously t
|
||||
emms-source-file-directory-tree-function 'emms-source-file-directory-tree-find)
|
||||
(map! :leader
|
||||
:desc "Go to emms playlist"
|
||||
"a a" #'emms-playlist-mode-go
|
||||
:leader
|
||||
:desc "Emms pause track"
|
||||
"a x" #'emms-pause
|
||||
:leader
|
||||
:desc "Emms stop track"
|
||||
"a s" #'emms-stop
|
||||
:leader
|
||||
:desc "Emms play previous track"
|
||||
"a p" #'emms-previous
|
||||
:leader
|
||||
:desc "Emms play next track"
|
||||
"a n" #'emms-next)
|
||||
|
||||
(map! :leader
|
||||
:desc "Evaluate elisp in buffer"
|
||||
"e b" #'eval-buffer
|
||||
:leader
|
||||
:desc "Evaluate defun"
|
||||
"e d" #'eval-defun
|
||||
:leader
|
||||
:desc "Evaluate elisp expression"
|
||||
"e e" #'eval-expression
|
||||
:leader
|
||||
:desc "Evaluate last sexpression"
|
||||
"e l" #'eval-last-sexp
|
||||
:leader
|
||||
:desc "Evaluate elisp in region"
|
||||
"e r" #'eval-region)
|
||||
|
||||
(setq browse-url-browser-function 'eww-browse-url)
|
||||
(map! :leader
|
||||
:desc "Eww web browser"
|
||||
"e w" #'eww
|
||||
:leader
|
||||
:desc "Eww reload page"
|
||||
"e R" #'eww-reload
|
||||
:leader
|
||||
:desc "Search web for text between BEG/END"
|
||||
"s w" #'eww-search-words)
|
||||
|
||||
(setq doom-font (font-spec :family "Mononoki Nerd Font" :size 15)
|
||||
doom-variable-pitch-font (font-spec :family "Ubuntu" :size 15)
|
||||
doom-big-font (font-spec :family "Mononoki Nerd Font" :size 24))
|
||||
(after! doom-themes
|
||||
(setq doom-themes-enable-bold t
|
||||
doom-themes-enable-italic t))
|
||||
(custom-set-faces!
|
||||
'(font-lock-comment-face :slant italic)
|
||||
'(font-lock-keyword-face :slant italic))
|
||||
|
||||
(setq ivy-posframe-display-functions-alist
|
||||
'((swiper . ivy-posframe-display-at-point)
|
||||
(complete-symbol . ivy-posframe-display-at-point)
|
||||
(counsel-M-x . ivy-display-function-fallback)
|
||||
(counsel-esh-history . ivy-posframe-display-at-window-center)
|
||||
(counsel-describe-function . ivy-display-function-fallback)
|
||||
(counsel-describe-variable . ivy-display-function-fallback)
|
||||
(counsel-find-file . ivy-display-function-fallback)
|
||||
(counsel-recentf . ivy-display-function-fallback)
|
||||
(counsel-register . ivy-posframe-display-at-frame-bottom-window-center)
|
||||
(dmenu . ivy-posframe-display-at-frame-top-center)
|
||||
(nil . ivy-posframe-display))
|
||||
ivy-posframe-height-alist
|
||||
'((swiper . 20)
|
||||
(dmenu . 20)
|
||||
(t . 10)))
|
||||
(ivy-posframe-mode 1) ; 1 enables posframe-mode, 0 disables it.
|
||||
|
||||
(map! :leader
|
||||
:desc "Ivy push view"
|
||||
"v p" #'ivy-push-view
|
||||
:leader
|
||||
:desc "Ivy switch view"
|
||||
"v s" #'ivy-switch-view)
|
||||
|
||||
(setq display-line-numbers-type t)
|
||||
(map! :leader
|
||||
:desc "Comment or uncomment lines"
|
||||
"TAB TAB" #'comment-line
|
||||
:leader
|
||||
:desc "Toggle line numbers"
|
||||
"t l" #'doom/toggle-line-numbers
|
||||
:leader
|
||||
:desc "Toggle line highlight in frame"
|
||||
"t h" #'hl-line-mode
|
||||
:leader
|
||||
:desc "Toggle line highlight globally"
|
||||
"t H" #'global-hl-line-mode
|
||||
:leader
|
||||
:desc "Toggle truncate lines"
|
||||
"t t" #'toggle-truncate-lines)
|
||||
|
||||
(after! mastodon
|
||||
(setq mastodon-instance-url "https://mastodon.technology/"))
|
||||
|
||||
(add-to-list 'load-path "/usr/local/share/emacs/site-lisp/mu4e")
|
||||
;;(require 'smtpmail)
|
||||
(setq user-mail-address "derek@distrotube.com"
|
||||
user-full-name "Derek Taylor"
|
||||
;; I have my mbsyncrc in a different folder on my system, to keep it separate from the
|
||||
;; mbsyncrc available publicly in my dotfiles. You MUST edit the following line.
|
||||
;; Be sure that the following command is: "mbsync -c ~/.config/mu4e/mbsyncrc -a"
|
||||
mu4e-get-mail-command "mbsync -c ~/.config/mu4e-dt/mbsyncrc -a"
|
||||
mu4e-update-interval 300
|
||||
mu4e-main-buffer-hide-personal-addresses t
|
||||
message-send-mail-function 'smtpmail-send-it
|
||||
starttls-use-gnutls t
|
||||
smtpmail-starttls-credentials '(("smtp.1and1.com" 587 nil nil))
|
||||
mu4e-sent-folder "/account-1/Sent"
|
||||
mu4e-drafts-folder "/account-1/Drafts"
|
||||
mu4e-trash-folder "/account-1/Trash"
|
||||
mu4e-maildir-shortcuts
|
||||
'(("/account-1/Inbox" . ?i)
|
||||
("/account-1/Sent Items" . ?s)
|
||||
("/account-1/Drafts" . ?d)
|
||||
("/account-1/Trash" . ?t)))
|
||||
|
||||
;; (defvar my-mu4e-account-alist
|
||||
;; '(("acc1-domain"
|
||||
;; (mu4e-sent-folder "/acc1-domain/Sent")
|
||||
;; (mu4e-drafts-folder "/acc1-domain/Drafts")
|
||||
;; (mu4e-trash-folder "/acc1-domain/Trash")
|
||||
;; (mu4e-compose-signature
|
||||
;; (concat
|
||||
;; "Ricky Bobby\n"
|
||||
;; "acc1@domain.com\n"))
|
||||
;; (user-mail-address "acc1@domain.com")
|
||||
;; (smtpmail-default-smtp-server "smtp.domain.com")
|
||||
;; (smtpmail-smtp-server "smtp.domain.com")
|
||||
;; (smtpmail-smtp-user "acc1@domain.com")
|
||||
;; (smtpmail-stream-type starttls)
|
||||
;; (smtpmail-smtp-service 587))
|
||||
;; ("acc2-domain"
|
||||
;; (mu4e-sent-folder "/acc2-domain/Sent")
|
||||
;; (mu4e-drafts-folder "/acc2-domain/Drafts")
|
||||
;; (mu4e-trash-folder "/acc2-domain/Trash")
|
||||
;; (mu4e-compose-signature
|
||||
;; (concat
|
||||
;; "Suzy Q\n"
|
||||
;; "acc2@domain.com\n"))
|
||||
;; (user-mail-address "acc2@domain.com")
|
||||
;; (smtpmail-default-smtp-server "smtp.domain.com")
|
||||
;; (smtpmail-smtp-server "smtp.domain.com")
|
||||
;; (smtpmail-smtp-user "acc2@domain.com")
|
||||
;; (smtpmail-stream-type starttls)
|
||||
;; (smtpmail-smtp-service 587))
|
||||
;; ("acc3-domain"
|
||||
;; (mu4e-sent-folder "/acc3-domain/Sent")
|
||||
;; (mu4e-drafts-folder "/acc3-domain/Drafts")
|
||||
;; (mu4e-trash-folder "/acc3-domain/Trash")
|
||||
;; (mu4e-compose-signature
|
||||
;; (concat
|
||||
;; "John Boy\n"
|
||||
;; "acc3@domain.com\n"))
|
||||
;; (user-mail-address "acc3@domain.com")
|
||||
;; (smtpmail-default-smtp-server "smtp.domain.com")
|
||||
;; (smtpmail-smtp-server "smtp.domain.com")
|
||||
;; (smtpmail-smtp-user "acc3@domain.com")
|
||||
;; (smtpmail-stream-type starttls)
|
||||
;; (smtpmail-smtp-service 587))))
|
||||
|
||||
(load "~/.doom.d/email")
|
||||
|
||||
(defun my-mu4e-set-account ()
|
||||
"Set the account for composing a message."
|
||||
(let* ((account
|
||||
(if mu4e-compose-parent-message
|
||||
(let ((maildir (mu4e-message-field mu4e-compose-parent-message :maildir)))
|
||||
(string-match "/\\(.*?\\)/" maildir)
|
||||
(match-string 1 maildir))
|
||||
(completing-read (format "Compose with account: (%s) "
|
||||
(mapconcat #'(lambda (var) (car var))
|
||||
my-mu4e-account-alist "/"))
|
||||
(mapcar #'(lambda (var) (car var)) my-mu4e-account-alist)
|
||||
nil t nil nil (caar my-mu4e-account-alist))))
|
||||
(account-vars (cdr (assoc account my-mu4e-account-alist))))
|
||||
(if account-vars
|
||||
(mapc #'(lambda (var)
|
||||
(set (car var) (cadr var)))
|
||||
account-vars)
|
||||
(error "No email account found"))))
|
||||
|
||||
(add-hook 'mu4e-compose-pre-hook 'my-mu4e-set-account)
|
||||
|
||||
(after! neotree
|
||||
(setq neo-smart-open t
|
||||
neo-window-fixed-size nil))
|
||||
(after! doom-themes
|
||||
(setq doom-neotree-enable-variable-pitch t))
|
||||
(map! :leader
|
||||
:desc "Toggle neotree file viewer"
|
||||
"t n" #'neotree-toggle
|
||||
:leader
|
||||
:desc "Open directory in neotree"
|
||||
"d n" #'neotree-dir)
|
||||
|
||||
(map! :leader
|
||||
:desc "Edit agenda file"
|
||||
"- a" #'(lambda () (interactive) (find-file "~/Org/agenda.org"))
|
||||
:leader
|
||||
:desc "Edit doom config.org"
|
||||
"- c" #'(lambda () (interactive) (find-file "~/.doom.d/config.org"))
|
||||
:leader
|
||||
:desc "Edit eshell aliases"
|
||||
"- e" #'(lambda () (interactive) (find-file "~/.doom.d/aliases"))
|
||||
:leader
|
||||
:desc "Edit doom init.el"
|
||||
"- i" #'(lambda () (interactive) (find-file "~/.doom.d/init.el"))
|
||||
:leader
|
||||
:desc "Edit doom packages.el"
|
||||
"- p" #'(lambda () (interactive) (find-file "~/.doom.d/packages.el")))
|
||||
|
||||
(after! org
|
||||
(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1)))
|
||||
(setq org-directory "~/Org/"
|
||||
org-agenda-files '("~/Org/agenda.org")
|
||||
org-default-notes-file (expand-file-name "notes.org" org-directory)
|
||||
org-ellipsis " ▼ "
|
||||
org-log-done 'time
|
||||
org-journal-dir "~/Org/journal/"
|
||||
org-journal-date-format "%B %d, %Y (%A) "
|
||||
org-journal-file-format "%Y-%m-%d.org"
|
||||
org-hide-emphasis-markers t
|
||||
;; ex. of org-link-abbrev-alist in action
|
||||
;; [[arch-wiki:Name_of_Page][Description]]
|
||||
org-link-abbrev-alist ; This overwrites the default Doom org-link-abbrev-list
|
||||
'(("google" . "http://www.google.com/search?q=")
|
||||
("arch-wiki" . "https://wiki.archlinux.org/index.php/")
|
||||
("ddg" . "https://duckduckgo.com/?q=")
|
||||
("wiki" . "https://en.wikipedia.org/wiki/"))
|
||||
org-todo-keywords ; This overwrites the default Doom org-todo-keywords
|
||||
'((sequence
|
||||
"TODO(t)" ; A task that is ready to be tackled
|
||||
"BLOG(b)" ; Blog writing assignments
|
||||
"GYM(g)" ; Things to accomplish at the gym
|
||||
"PROJ(p)" ; A project that contains other tasks
|
||||
"VIDEO(v)" ; Video assignments
|
||||
"WAIT(w)" ; Something is holding up this task
|
||||
"|" ; The pipe necessary to separate "active" states and "inactive" states
|
||||
"DONE(d)" ; Task has been completed
|
||||
"CANCELLED(c)" )))) ; Task has been cancelled
|
||||
|
||||
(defun dt/org-babel-tangle-async (file)
|
||||
"Invoke `org-babel-tangle-file' asynchronously."
|
||||
(message "Tangling %s..." (buffer-file-name))
|
||||
(async-start
|
||||
(let ((args (list file)))
|
||||
`(lambda ()
|
||||
(require 'org)
|
||||
;;(load "~/.emacs.d/init.el")
|
||||
(let ((start-time (current-time)))
|
||||
(apply #'org-babel-tangle-file ',args)
|
||||
(format "%.2f" (float-time (time-since start-time))))))
|
||||
(let ((message-string (format "Tangling %S completed after " file)))
|
||||
`(lambda (tangle-time)
|
||||
(message (concat ,message-string
|
||||
(format "%s seconds" tangle-time)))))))
|
||||
|
||||
(defun dt/org-babel-tangle-current-buffer-async ()
|
||||
"Tangle current buffer asynchronously."
|
||||
(dt/org-babel-tangle-async (buffer-file-name)))
|
||||
|
||||
(map! :leader
|
||||
:desc "Copy to register"
|
||||
"r c" #'copy-to-register
|
||||
:leader
|
||||
:desc "Frameset to register"
|
||||
"r f" #'frameset-to-register
|
||||
:leader
|
||||
:desc "Insert contents of register"
|
||||
"r i" #'insert-register
|
||||
:leader
|
||||
:desc "Jump to register"
|
||||
"r j" #'jump-to-register
|
||||
:leader
|
||||
:desc "List registers"
|
||||
"r l" #'list-registers
|
||||
:leader
|
||||
:desc "Number to register"
|
||||
"r n" #'number-to-register
|
||||
:leader
|
||||
:desc "Interactively choose a register"
|
||||
"r r" #'counsel-register
|
||||
:leader
|
||||
:desc "View a register"
|
||||
"r v" #'view-register
|
||||
:leader
|
||||
:desc "Window configuration to register"
|
||||
"r w" #'window-configuration-to-register
|
||||
:leader
|
||||
:desc "Increment register"
|
||||
"r +" #'increment-register
|
||||
:leader
|
||||
:desc "Point to register"
|
||||
"r SPC" #'point-to-register)
|
||||
|
||||
(map! :leader
|
||||
:desc "Ssh into distrotube.com"
|
||||
"\\ d" #'(lambda () (interactive) (find-file "/scp:derek@distrotube.com"))
|
||||
:leader
|
||||
:desc "Ssh into my nextcloud"
|
||||
"\\ n" #'(lambda () (interactive) (find-file "/scp:derek@distrotube.net")))
|
||||
|
||||
(setq shell-file-name "/bin/fish"
|
||||
eshell-aliases-file "~/.doom.d/aliases"
|
||||
eshell-history-size 5000
|
||||
eshell-buffer-maximum-lines 5000
|
||||
eshell-hist-ignoredups t
|
||||
eshell-scroll-to-bottom-on-input t
|
||||
eshell-destroy-buffer-when-process-dies t
|
||||
eshell-visual-commands'("bash" "fish" "htop" "ssh" "top" "zsh")
|
||||
vterm-max-scrollback 5000)
|
||||
(map! :leader
|
||||
:desc "Counsel eshell history"
|
||||
"e h" #'counsel-esh-history)
|
||||
|
||||
(defun prefer-horizontal-split ()
|
||||
(set-variable 'split-height-threshold nil t)
|
||||
(set-variable 'split-width-threshold 40 t)) ; make this as low as needed
|
||||
(add-hook 'markdown-mode-hook 'prefer-horizontal-split)
|
||||
(map! :leader
|
||||
:desc "Clone indirect buffer other window"
|
||||
"b c" #'clone-indirect-buffer-other-window)
|
||||
|
||||
(map! :leader
|
||||
:desc "Winner redo"
|
||||
"w <right>" #'winner-redo
|
||||
:leader
|
||||
:desc "Winner undo"
|
||||
"w <left>" #'winner-undo)
|
||||
597
.config/doom/config.org
Normal file
597
.config/doom/config.org
Normal file
@@ -0,0 +1,597 @@
|
||||
#+TITLE: DT's Doom Emacs Config
|
||||
#+AUTHOR: Derek Taylor (DT)
|
||||
#+DESCRIPTION: DT's personal Doom Emacs config.
|
||||
#+STARTUP: showeverything
|
||||
|
||||
* TABLE OF CONTENTS :toc:
|
||||
- [[#about-this-config][ABOUT THIS CONFIG]]
|
||||
- [[#bookmarks-and-buffers][BOOKMARKS AND BUFFERS]]
|
||||
- [[#centaur-tabs][CENTAUR-TABS]]
|
||||
- [[#dired][DIRED]]
|
||||
- [[#doom-theme][DOOM THEME]]
|
||||
- [[#elfeed][ELFEED]]
|
||||
- [[#emms][EMMS]]
|
||||
- [[#evaluate-elisp-expressions][EVALUATE ELISP EXPRESSIONS]]
|
||||
- [[#eww][EWW]]
|
||||
- [[#fonts][FONTS]]
|
||||
- [[#ivy][IVY]]
|
||||
- [[#ivy-posframe][IVY-POSFRAME]]
|
||||
- [[#ivy-keybindings][IVY KEYBINDINGS]]
|
||||
- [[#line-settings][LINE SETTINGS]]
|
||||
- [[#mastodon][MASTODON]]
|
||||
- [[#mu4e][MU4E]]
|
||||
- [[#setting-up-environment-with-main-account][Setting Up Environment With Main Account]]
|
||||
- [[#setting-up-multiple-accounts][Setting Up Multiple Accounts]]
|
||||
- [[#function-to-facilitate-switching-between-accounts][Function To Facilitate Switching Between Accounts]]
|
||||
- [[#neotree][NEOTREE]]
|
||||
- [[#open-specific-files][OPEN SPECIFIC FILES]]
|
||||
- [[#org-mode][ORG MODE]]
|
||||
- [[#registers][REGISTERS]]
|
||||
- [[#remote-connections][REMOTE CONNECTIONS]]
|
||||
- [[#shells][SHELLS]]
|
||||
- [[#splits][SPLITS]]
|
||||
- [[#winner-mode][WINNER MODE]]
|
||||
|
||||
* ABOUT THIS CONFIG
|
||||
This is my personal Doom Emacs config. Doom Emacs is a distribution of Emacs that uses the "evil" keybindings (Vim keybindings) and includes a number of nice extensions and a bit of configuration out of the box. I am maintaing this config not just for myself, but also for those that want to explore some of what is possible with Emacs. I will add a lot of examples of plugins and settings, some of them I may not even use personally. I do this because many people following me on YouTube look at my configs as "documentation".
|
||||
|
||||
* BOOKMARKS AND BUFFERS
|
||||
Doom Emacs uses 'SPC b' for keybindings related to bookmarks and buffers. Bookmarks are somewhat like registers in that they record positions you can jump to. Unlike registers, they have long names, and they persist automatically from one Emacs session to the next. The prototypical use of bookmarks is to record where you were reading in various files. Regarding /buffers/, the text you are editing in Emacs resides in an object called a /buffer/. Each time you visit a file, a buffer is used to hold the file’s text. Each time you invoke Dired, a buffer is used to hold the directory listing.
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(map! :leader
|
||||
(:prefix ("b". "buffer")
|
||||
:desc "List bookmarks" "L" #'list-bookmarks
|
||||
:desc "Save current bookmarks to bookmark file" "w" #'bookmark-save))
|
||||
#+END_SRC
|
||||
|
||||
* CENTAUR-TABS
|
||||
To use tabs in Doom Emacs, be sure to uncomment "tabs" in Doom's init.el. Displays tabs at the top of the window similar to tabbed web browsers such as Firefox. I don't actually use tabs in Emacs. I placed this in my config to help others who may want tabs. In the default configuration of Doom Emacs, 'SPC t' is used for "toggle" keybindings, so I choose 'SPC t c' to toggle centaur-tabs. The "g" prefix for keybindings is used for a bunch of evil keybindings in Doom, but "g" plus the arrow keys were not used, so I thought I would bind those for tab navigation. But I did leave the default "g t" and "g T" intact if you prefer to use those for centaur-tabs-forward/backward.
|
||||
|
||||
| COMMAND | DESCRIPTION | KEYBINDING |
|
||||
|-----------------------------+---------------------------+------------------|
|
||||
| centaur-tabs-mode | /Toggle tabs globally/ | SPC t c |
|
||||
| centaur-tabs-local-mode | /Toggle tabs local display/ | SPC t C |
|
||||
| centaur-tabs-forward | /Next tab/ | g <right> or g t |
|
||||
| centaur-tabs-backward | /Previous tab/ | g <left> or g T |
|
||||
| centaur-tabs-forward-group | /Next tab group/ | g <down> |
|
||||
| centaur-tabs-backward-group | /Previous tab group/ | g <up> |
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq centaur-tabs-set-bar 'over
|
||||
centaur-tabs-set-icons t
|
||||
centaur-tabs-gray-out-icons 'buffer
|
||||
centaur-tabs-height 24
|
||||
centaur-tabs-set-modified-marker t
|
||||
centaur-tabs-style "bar"
|
||||
centaur-tabs-modified-marker "•")
|
||||
(map! :leader
|
||||
:desc "Toggle tabs globally" "t c" #'centaur-tabs-mode
|
||||
:desc "Toggle tabs local display" "t C" #'centaur-tabs-local-mode)
|
||||
(evil-define-key 'normal centaur-tabs-mode-map (kbd "g <right>") 'centaur-tabs-forward ; default Doom binding is 'g t'
|
||||
(kbd "g <left>") 'centaur-tabs-backward ; default Doom binding is 'g T'
|
||||
(kbd "g <down>") 'centaur-tabs-forward-group
|
||||
(kbd "g <up>") 'centaur-tabs-backward-group)
|
||||
#+END_SRC
|
||||
|
||||
* DIRED
|
||||
Dired is the file manager within Emacs. Below, I setup keybindings for image previews (peep-dired). Doom Emacs does not use 'SPC d' for any of its keybindings, so I've chosen the format of 'SPC d' plus 'key'.
|
||||
|
||||
| COMMAND | DESCRIPTION | KEYBINDING |
|
||||
|-------------------------------------------+-------------------------------------------------+------------|
|
||||
| dired | /Open dired file manager/ | SPC d d |
|
||||
| dired-jump | /Jump to current directory in dired/ | SPC d j |
|
||||
| (in dired) peep-dired | /Toggle image previews within dired/ | SPC d p |
|
||||
| (in dired) dired-view-file | /View file in dired/ | SPC d v |
|
||||
| (in dired) dired-up-directory | /Go up in the directory tree/ | h |
|
||||
| (in dired) dired-find-file | /Go down in the directory tree (or open if file)/ | l |
|
||||
| (in peep-dired-mode) peep-dired-next-file | /Move to next file in peep-dired-mode/ | j |
|
||||
| (in peep-dired-mode) peep-dired-prev-file | /Move to previous file in peep-dired-mode/ | k |
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(map! :leader
|
||||
(:prefix ("d" . "dired")
|
||||
:desc "Open dired" "d" #'dired
|
||||
:desc "Dired jump to current" "j" #'dired-jump)
|
||||
(:after dired
|
||||
(:map dired-mode-map
|
||||
:desc "Peep-dired image previews" "d p" #'peep-dired
|
||||
:desc "Dired view file" "d v" #'dired-view-file)))
|
||||
;; Make 'h' and 'l' go back and forward in dired. Much faster to navigate the directory structure!
|
||||
(evil-define-key 'normal dired-mode-map
|
||||
(kbd "h") 'dired-up-directory
|
||||
(kbd "l") 'dired-open-file) ; use dired-find-file instead if not using dired-open package
|
||||
;; If peep-dired is enabled, you will get image previews as you go up/down with 'j' and 'k'
|
||||
(evil-define-key 'normal peep-dired-mode-map
|
||||
(kbd "j") 'peep-dired-next-file
|
||||
(kbd "k") 'peep-dired-prev-file)
|
||||
(add-hook 'peep-dired-hook 'evil-normalize-keymaps)
|
||||
;; Get file icons in dired
|
||||
(add-hook 'dired-mode-hook 'all-the-icons-dired-mode)
|
||||
;; With dired-open plugin, you can launch external programs for certain extensions
|
||||
;; For example, I set all .png files to open in 'sxiv' and all .mp4 files to open in 'mpv'
|
||||
(setq dired-open-extensions '(("gif" . "sxiv")
|
||||
("jpg" . "sxiv")
|
||||
("png" . "sxiv")
|
||||
("mkv" . "mpv")
|
||||
("mp4" . "mpv")))
|
||||
#+END_SRC
|
||||
|
||||
* DOOM THEME
|
||||
Setting the theme to doom-one. To try out new themes, I set a keybinding for counsel-load-theme with 'SPC h t'.
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq doom-theme 'doom-one)
|
||||
(map! :leader
|
||||
:desc "Load new theme" "h t" #'counsel-load-theme)
|
||||
#+END_SRC
|
||||
|
||||
* ELFEED
|
||||
An RSS newsfeed reader for Emacs.
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(custom-set-variables
|
||||
'(elfeed-feeds
|
||||
(quote
|
||||
(("https://www.reddit.com/r/linux.rss" reddit linux)
|
||||
("https://www.gamingonlinux.com/article_rss.php" gaming linux)
|
||||
("https://hackaday.com/blog/feed/" hackaday linux)
|
||||
("https://opensource.com/feed" opensource linux)
|
||||
("https://linux.softpedia.com/backend.xml" softpedia linux)
|
||||
("https://itsfoss.com/feed/" itsfoss linux)
|
||||
("https://www.zdnet.com/topic/linux/rss.xml" zdnet linux)
|
||||
("https://www.phoronix.com/rss.php" phoronix linux)
|
||||
("http://feeds.feedburner.com/d0od" omgubuntu linux)
|
||||
("https://www.computerworld.com/index.rss" computerworld linux)
|
||||
("https://www.networkworld.com/category/linux/index.rss" networkworld linux)
|
||||
("https://www.techrepublic.com/rssfeeds/topic/open-source/" techrepublic linux)
|
||||
("https://betanews.com/feed" betanews linux)
|
||||
("http://lxer.com/module/newswire/headlines.rss" lxer linux)
|
||||
("https://distrowatch.com/news/dwd.xml" distrowatch linux)))))
|
||||
#+END_SRC
|
||||
|
||||
* EMMS
|
||||
EMMS is now a default module in doom, so you only have to pass in your music folder.
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(emms-mode-line 1)
|
||||
(emms-playing-time 1)
|
||||
(setq emms-source-file-default-directory "~/Music/Non-Classical/70s-80s/"
|
||||
emms-playlist-buffer-name "*Music*"
|
||||
emms-info-asynchronously t
|
||||
emms-source-file-directory-tree-function 'emms-source-file-directory-tree-find)
|
||||
#+END_SRC
|
||||
|
||||
* EVALUATE ELISP EXPRESSIONS
|
||||
Changing some keybindings from their defaults to better fit with Doom Emacs, and to avoid conflicts with my window managers which sometimes use the control key in their keybindings. By default, Doom Emacs does not use 'SPC e' for anything, so I choose to use the format 'SPC e' plus 'key' for these (I also use 'SPC e' for 'eww' keybindings).
|
||||
|
||||
| COMMAND | DESCRIPTION | KEYBINDING |
|
||||
|-----------------+------------------------------------------------+------------|
|
||||
| eval-buffer | /Evaluate elisp in buffer/ | SPC e b |
|
||||
| eval-defun | /Evaluate the defun containing or after point/ | SPC e d |
|
||||
| eval-expression | /Evaluate an elisp expression/ | SPC e e |
|
||||
| eval-last-sexp | /Evaluate elisp expression before point/ | SPC e l |
|
||||
| eval-region | /Evaluate elisp in region/ | SPC e r |
|
||||
|
||||
#+Begin_src emacs-lisp
|
||||
(map! :leader
|
||||
(:prefix ("e". "evaluate/EWW")
|
||||
:desc "Evaluate elisp in buffer" "b" #'eval-buffer
|
||||
:desc "Evaluate defun" "d" #'eval-defun
|
||||
:desc "Evaluate elisp expression" "e" #'eval-expression
|
||||
:desc "Evaluate last sexpression" "l" #'eval-last-sexp
|
||||
:desc "Evaluate elisp in region" "r" #'eval-region))
|
||||
#+END_SRC
|
||||
|
||||
* EWW
|
||||
EWW is the Emacs Web Wowser, the builtin browser in Emacs. Below I set urls to open in a specific browser (eww) with browse-url-browser-function. By default, Doom Emacs does not use 'SPC e' for anything, so I choose to use the format 'SPC e' plus 'key' for these (I also use 'SPC e' for 'eval' keybindings). I chose to use 'SPC s w' for eww-search-words because Doom Emacs uses 'SPC s' for 'search' commands.
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq browse-url-browser-function 'eww-browse-url)
|
||||
(map! :leader
|
||||
(:prefix ("e" . "evaluate/EWW")
|
||||
:desc "Eww web browser" "e w" #'eww
|
||||
:desc "Eww reload page" "e R" #'eww-reload
|
||||
:desc "Search web for text between BEG/END" "s w" #'eww-search-words))
|
||||
#+END_SRC
|
||||
|
||||
* FONTS
|
||||
Settings related to fonts within Doom Emacs:
|
||||
+ 'doom-font' -- standard monospace font that is used for most things in Emacs.
|
||||
+ 'doom-variable-pitch-font' -- variable font which is useful in some Emacs plugins.
|
||||
+ 'doom-big-font' -- used in doom-big-font-mode; useful for presentations.
|
||||
+ 'font-lock-comment-face' -- for comments.
|
||||
+ 'font-lock-keyword-face' -- for keywords with special significance, like ‘for’ and ‘if’ in C.
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq doom-font (font-spec :family "Mononoki Nerd Font" :size 15)
|
||||
doom-variable-pitch-font (font-spec :family "Ubuntu" :size 15)
|
||||
doom-big-font (font-spec :family "Mononoki Nerd Font" :size 24))
|
||||
(after! doom-themes
|
||||
(setq doom-themes-enable-bold t
|
||||
doom-themes-enable-italic t))
|
||||
(custom-set-faces!
|
||||
'(font-lock-comment-face :slant italic)
|
||||
'(font-lock-keyword-face :slant italic))
|
||||
#+END_SRC
|
||||
|
||||
* IVY
|
||||
Ivy is a generic completion mechanism for Emacs.
|
||||
|
||||
** IVY-POSFRAME
|
||||
Ivy-posframe is an ivy extension, which lets ivy use posframe to show its candidate menu. Some of the settings below involve:
|
||||
+ ivy-posframe-display-functions-alist -- sets the display position for specific programs
|
||||
+ ivy-posframe-height-alist -- sets the height of the list displayed for specific programs
|
||||
|
||||
Available functions (positions) for 'ivy-posframe-display-functions-alist'
|
||||
+ ivy-posframe-display-at-frame-center
|
||||
+ ivy-posframe-display-at-window-center
|
||||
+ ivy-posframe-display-at-frame-bottom-left
|
||||
+ ivy-posframe-display-at-window-bottom-left
|
||||
+ ivy-posframe-display-at-frame-bottom-window-center
|
||||
+ ivy-posframe-display-at-point
|
||||
+ ivy-posframe-display-at-frame-top-center
|
||||
|
||||
=NOTE:= If the setting for 'ivy-posframe-display' is set to 'nil' (false), anything that is set to 'ivy-display-function-fallback' will just default to their normal position in Doom Emacs (usually a bottom split). However, if this is set to 't' (true), then the fallback position will be centered in the window.
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq ivy-posframe-display-functions-alist
|
||||
'((swiper . ivy-posframe-display-at-point)
|
||||
(complete-symbol . ivy-posframe-display-at-point)
|
||||
(counsel-M-x . ivy-display-function-fallback)
|
||||
(counsel-esh-history . ivy-posframe-display-at-window-center)
|
||||
(counsel-describe-function . ivy-display-function-fallback)
|
||||
(counsel-describe-variable . ivy-display-function-fallback)
|
||||
(counsel-find-file . ivy-display-function-fallback)
|
||||
(counsel-recentf . ivy-display-function-fallback)
|
||||
(counsel-register . ivy-posframe-display-at-frame-bottom-window-center)
|
||||
(dmenu . ivy-posframe-display-at-frame-top-center)
|
||||
(nil . ivy-posframe-display))
|
||||
ivy-posframe-height-alist
|
||||
'((swiper . 20)
|
||||
(dmenu . 20)
|
||||
(t . 10)))
|
||||
(ivy-posframe-mode 1) ; 1 enables posframe-mode, 0 disables it.
|
||||
#+END_SRC
|
||||
|
||||
** IVY KEYBINDINGS
|
||||
By default, Doom Emacs does not use 'SPC v', so the format I use for these bindings is 'SPC v' plus 'key'.
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(map! :leader
|
||||
:desc "Ivy push view" "v p" #'ivy-push-view
|
||||
:desc "Ivy switch view" "v s" #'ivy-switch-view)
|
||||
#+END_SRC
|
||||
|
||||
* LINE SETTINGS
|
||||
I set comment-line to 'SPC TAB TAB' which is a rather comfortable keybinding for me on my ErgoDox EZ keyboard. The standard Emacs keybinding for comment-line is 'C-x C-;'. The other keybindings are for commands that toggle on/off various line-related settings. Doom Emacs uses 'SPC t' for "toggle" commands, so I choose 'SPC t' plus 'key' for those bindings.
|
||||
|
||||
| COMMAND | DESCRIPTION | KEYBINDING |
|
||||
|--------------------------+-------------------------------------------+-------------|
|
||||
| comment-line | /Comment or uncomment lines/ | SPC TAB TAB |
|
||||
| hl-line-mode | /Toggle line highlighting in current frame/ | SPC t h |
|
||||
| global-hl-line-mode | /Toggle line highlighting globally/ | SPC t H |
|
||||
| doom/toggle-line-numbers | /Toggle line numbers/ | SPC t l |
|
||||
| toggle-truncate-lines | /Toggle truncate lines/ | SPC t t |
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq display-line-numbers-type t)
|
||||
(map! :leader
|
||||
:desc "Comment or uncomment lines" "TAB TAB" #'comment-line
|
||||
(:prefix ("t" . "toggle")
|
||||
:desc "Toggle line numbers" "l" #'doom/toggle-line-numbers
|
||||
:desc "Toggle line highlight in frame" "h" #'hl-line-mode
|
||||
:desc "Toggle line highlight globally" "H" #'global-hl-line-mode
|
||||
:desc "Toggle truncate lines" "t" #'toggle-truncate-lines))
|
||||
#+END_SRC
|
||||
|
||||
* MASTODON
|
||||
Mastodon.el is a mastodon client for Emacs. Note that I wrapped my settings with (after! mastodon). Without this, my settings for the mastodon instance that I use would be overwritten by the default settings for this module, which is "mastodon.social".
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(after! mastodon
|
||||
(setq mastodon-instance-url "https://mastodon.technology/"))
|
||||
#+END_SRC
|
||||
|
||||
* MU4E
|
||||
Setting up mu4e which is an email client that works within emacs. You must install mu4e and mbsync through your Linux distribution's package manager. Setting up smtp for sending mail. Make sure the gnutls command line utils are installed. Package 'gnutls-bin' in Debian/Ubuntu, and 'gnutls' in Arch.
|
||||
|
||||
** Setting Up Environment With Main Account
|
||||
I will be setting up mu4e to use three different email addresses. This source block contains default settings and fallback settings.
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(add-to-list 'load-path "/usr/local/share/emacs/site-lisp/mu4e")
|
||||
;;(require 'smtpmail)
|
||||
(setq user-mail-address "derek@distrotube.com"
|
||||
user-full-name "Derek Taylor"
|
||||
;; I have my mbsyncrc in a different folder on my system, to keep it separate from the
|
||||
;; mbsyncrc available publicly in my dotfiles. You MUST edit the following line.
|
||||
;; Be sure that the following command is: "mbsync -c ~/.config/mu4e/mbsyncrc -a"
|
||||
mu4e-get-mail-command "mbsync -c ~/.config/mu4e-dt/mbsyncrc -a"
|
||||
mu4e-update-interval 300
|
||||
mu4e-main-buffer-hide-personal-addresses t
|
||||
message-send-mail-function 'smtpmail-send-it
|
||||
starttls-use-gnutls t
|
||||
smtpmail-starttls-credentials '(("smtp.1and1.com" 587 nil nil))
|
||||
mu4e-sent-folder "/account-1/Sent"
|
||||
mu4e-drafts-folder "/account-1/Drafts"
|
||||
mu4e-trash-folder "/account-1/Trash"
|
||||
mu4e-maildir-shortcuts
|
||||
'(("/account-1/Inbox" . ?i)
|
||||
("/account-1/Sent Items" . ?s)
|
||||
("/account-1/Drafts" . ?d)
|
||||
("/account-1/Trash" . ?t)))
|
||||
|
||||
#+END_SRC
|
||||
|
||||
** Setting Up Multiple Accounts
|
||||
The settings below are specific to each of three different email accounts. These settings are fictional and are here for documentation purposes. Hence, I have this source block entirely commmented out. Now, I do use a source code block similar to the one below, but I don't want to share it publicly. Keep reading to see how I handle this.
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
;; (defvar my-mu4e-account-alist
|
||||
;; '(("acc1-domain"
|
||||
;; (mu4e-sent-folder "/acc1-domain/Sent")
|
||||
;; (mu4e-drafts-folder "/acc1-domain/Drafts")
|
||||
;; (mu4e-trash-folder "/acc1-domain/Trash")
|
||||
;; (mu4e-compose-signature
|
||||
;; (concat
|
||||
;; "Ricky Bobby\n"
|
||||
;; "acc1@domain.com\n"))
|
||||
;; (user-mail-address "acc1@domain.com")
|
||||
;; (smtpmail-default-smtp-server "smtp.domain.com")
|
||||
;; (smtpmail-smtp-server "smtp.domain.com")
|
||||
;; (smtpmail-smtp-user "acc1@domain.com")
|
||||
;; (smtpmail-stream-type starttls)
|
||||
;; (smtpmail-smtp-service 587))
|
||||
;; ("acc2-domain"
|
||||
;; (mu4e-sent-folder "/acc2-domain/Sent")
|
||||
;; (mu4e-drafts-folder "/acc2-domain/Drafts")
|
||||
;; (mu4e-trash-folder "/acc2-domain/Trash")
|
||||
;; (mu4e-compose-signature
|
||||
;; (concat
|
||||
;; "Suzy Q\n"
|
||||
;; "acc2@domain.com\n"))
|
||||
;; (user-mail-address "acc2@domain.com")
|
||||
;; (smtpmail-default-smtp-server "smtp.domain.com")
|
||||
;; (smtpmail-smtp-server "smtp.domain.com")
|
||||
;; (smtpmail-smtp-user "acc2@domain.com")
|
||||
;; (smtpmail-stream-type starttls)
|
||||
;; (smtpmail-smtp-service 587))
|
||||
;; ("acc3-domain"
|
||||
;; (mu4e-sent-folder "/acc3-domain/Sent")
|
||||
;; (mu4e-drafts-folder "/acc3-domain/Drafts")
|
||||
;; (mu4e-trash-folder "/acc3-domain/Trash")
|
||||
;; (mu4e-compose-signature
|
||||
;; (concat
|
||||
;; "John Boy\n"
|
||||
;; "acc3@domain.com\n"))
|
||||
;; (user-mail-address "acc3@domain.com")
|
||||
;; (smtpmail-default-smtp-server "smtp.domain.com")
|
||||
;; (smtpmail-smtp-server "smtp.domain.com")
|
||||
;; (smtpmail-smtp-user "acc3@domain.com")
|
||||
;; (smtpmail-stream-type starttls)
|
||||
;; (smtpmail-smtp-service 587))))
|
||||
#+END_SRC
|
||||
|
||||
I'm sourcing an elisp file (~/.doom.d/email.el) that contains the above source block but with my actual email settings. I do this so I don't have to share my email addresses (other than derek@distrotube.com) publicly. If you uncommented the above source block to use, then you should comment out or delete this block below.
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(load "~/.doom.d/email")
|
||||
|
||||
#+END_SRC
|
||||
|
||||
** Function To Facilitate Switching Between Accounts
|
||||
The following function can be used to select an account. This function then needs to be added to mu4e-compose-pre-hook,
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun my-mu4e-set-account ()
|
||||
"Set the account for composing a message."
|
||||
(let* ((account
|
||||
(if mu4e-compose-parent-message
|
||||
(let ((maildir (mu4e-message-field mu4e-compose-parent-message :maildir)))
|
||||
(string-match "/\\(.*?\\)/" maildir)
|
||||
(match-string 1 maildir))
|
||||
(completing-read (format "Compose with account: (%s) "
|
||||
(mapconcat #'(lambda (var) (car var))
|
||||
my-mu4e-account-alist "/"))
|
||||
(mapcar #'(lambda (var) (car var)) my-mu4e-account-alist)
|
||||
nil t nil nil (caar my-mu4e-account-alist))))
|
||||
(account-vars (cdr (assoc account my-mu4e-account-alist))))
|
||||
(if account-vars
|
||||
(mapc #'(lambda (var)
|
||||
(set (car var) (cadr var)))
|
||||
account-vars)
|
||||
(error "No email account found"))))
|
||||
|
||||
(add-hook 'mu4e-compose-pre-hook 'my-mu4e-set-account)
|
||||
#+END_SRC
|
||||
|
||||
* NEOTREE
|
||||
Neotree is a file tree viewer. When you open neotree, it jumps to the current file thanks to neo-smart-open. The neo-window-fixed-size setting makes the neotree width be adjustable. Doom Emacs had no keybindings set for neotree. Since Doom Emacs uses 'SPC t' for 'toggle' keybindings, I used 'SPC t n' for toggle-neotree.
|
||||
|
||||
| COMMAND | DESCRIPTION | KEYBINDING |
|
||||
|----------------+-----------------------------+------------|
|
||||
| neotree-toggle | /Toggle neotree/ | SPC t n |
|
||||
| neotree- dir | /Open directory in neotree/ | SPC t N |
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(after! neotree
|
||||
(setq neo-smart-open t
|
||||
neo-window-fixed-size nil))
|
||||
(after! doom-themes
|
||||
(setq doom-neotree-enable-variable-pitch t))
|
||||
(map! :leader
|
||||
(:prefix ("t" . "toggle")
|
||||
:desc "Toggle neotree file viewer" "n" #'neotree-toggle
|
||||
:desc "Open directory in neotree" "N" #'neotree-dir))
|
||||
#+END_SRC
|
||||
|
||||
* OPEN SPECIFIC FILES
|
||||
Keybindings to open files that I work with all the time using the find-file command, which is the interactive file search that opens with 'C-x C-f' in GNU Emacs or 'SPC f f' in Doom Emacs. These keybindings use find-file non-interactively since we specify exactly what file to open. The format I use for these bindings is 'SPC -' plus 'key' since Doom Emacs does not use these keybindings.
|
||||
|
||||
| PATH TO FILE | DESCRIPTION | KEYBINDING |
|
||||
|------------------------+-----------------------+------------|
|
||||
| ~/Org/agenda.org | /Edit agenda file/ | SPC - a |
|
||||
| ~/.doom.d/config.org" | /Edit doom config.org/ | SPC - c |
|
||||
| ~/.doom.d/aliases" | /Edit eshell aliases/ | SPC - e |
|
||||
| ~/.doom.d/init.el" | /Edit doom init.el/ | SPC - i |
|
||||
| ~/.doom.d/packages.el" | /Edit doom packages.el/ | SPC - p |
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(map! :leader
|
||||
(:prefix ("-" . "open file")
|
||||
:desc "Edit agenda file" "a" #'(lambda () (interactive) (find-file "~/Org/agenda.org"))
|
||||
:desc "Edit doom config.org" "c" #'(lambda () (interactive) (find-file "~/.doom.d/config.org"))
|
||||
:desc "Edit eshell aliases" "e" #'(lambda () (interactive) (find-file "~/.doom.d/aliases"))
|
||||
:desc "Edit doom init.el" "i" #'(lambda () (interactive) (find-file "~/.doom.d/init.el"))
|
||||
:desc "Edit doom packages.el" "p" #'(lambda () (interactive) (find-file "~/.doom.d/packages.el")))
|
||||
#+END_SRC
|
||||
|
||||
* ORG MODE
|
||||
Note that I wrapped most of this in (after! org). Without this, my settings might be evaluated too early, which will result in my settings being overwritten by Doom's defaults. I have also enabled org-journal by adding (+journal) to the org section of my Doom Emacs init.el.
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(after! org
|
||||
(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1)))
|
||||
(setq org-directory "~/Org/"
|
||||
org-agenda-files '("~/Org/agenda.org")
|
||||
org-default-notes-file (expand-file-name "notes.org" org-directory)
|
||||
org-ellipsis " ▼ "
|
||||
org-log-done 'time
|
||||
org-journal-dir "~/Org/journal/"
|
||||
org-journal-date-format "%B %d, %Y (%A) "
|
||||
org-journal-file-format "%Y-%m-%d.org"
|
||||
org-hide-emphasis-markers t
|
||||
;; ex. of org-link-abbrev-alist in action
|
||||
;; [[arch-wiki:Name_of_Page][Description]]
|
||||
org-link-abbrev-alist ; This overwrites the default Doom org-link-abbrev-list
|
||||
'(("google" . "http://www.google.com/search?q=")
|
||||
("arch-wiki" . "https://wiki.archlinux.org/index.php/")
|
||||
("ddg" . "https://duckduckgo.com/?q=")
|
||||
("wiki" . "https://en.wikipedia.org/wiki/"))
|
||||
org-todo-keywords ; This overwrites the default Doom org-todo-keywords
|
||||
'((sequence
|
||||
"TODO(t)" ; A task that is ready to be tackled
|
||||
"BLOG(b)" ; Blog writing assignments
|
||||
"GYM(g)" ; Things to accomplish at the gym
|
||||
"PROJ(p)" ; A project that contains other tasks
|
||||
"VIDEO(v)" ; Video assignments
|
||||
"WAIT(w)" ; Something is holding up this task
|
||||
"|" ; The pipe necessary to separate "active" states and "inactive" states
|
||||
"DONE(d)" ; Task has been completed
|
||||
"CANCELLED(c)" )))) ; Task has been cancelled
|
||||
|
||||
#+END_SRC
|
||||
|
||||
I was tired of having to run org-babel-tangle after saving my literate dotfiles. So the following function runs org-babel-tangle upon saving any org-mode buffer. This is asynchronous meaning that it dispatches the tangle function to a subprocess, so that the main Emacs is not blocked while it runs.
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun dt/org-babel-tangle-async (file)
|
||||
"Invoke `org-babel-tangle-file' asynchronously."
|
||||
(message "Tangling %s..." (buffer-file-name))
|
||||
(async-start
|
||||
(let ((args (list file)))
|
||||
`(lambda ()
|
||||
(require 'org)
|
||||
;;(load "~/.emacs.d/init.el")
|
||||
(let ((start-time (current-time)))
|
||||
(apply #'org-babel-tangle-file ',args)
|
||||
(format "%.2f" (float-time (time-since start-time))))))
|
||||
(let ((message-string (format "Tangling %S completed after " file)))
|
||||
`(lambda (tangle-time)
|
||||
(message (concat ,message-string
|
||||
(format "%s seconds" tangle-time)))))))
|
||||
|
||||
(defun dt/org-babel-tangle-current-buffer-async ()
|
||||
"Tangle current buffer asynchronously."
|
||||
(dt/org-babel-tangle-async (buffer-file-name)))
|
||||
#+END_SRC
|
||||
|
||||
* REGISTERS
|
||||
Emacs registers are compartments where you can save text, rectangles and positions for later use. Once you save text or a rectangle in a register, you can copy it into the buffer once or many times; once you save a position in a register, you can jump back to that position once or many times. The default GNU Emacs keybindings for these commands (with the exception of counsel-register) involves 'C-x r' followed by one or more other keys. I wanted to make this a little more user friendly, and since I am using Doom Emacs, I choose to replace the 'C-x r' part of the key chords with 'SPC r'.
|
||||
|
||||
| COMMAND | DESCRIPTION | KEYBINDING |
|
||||
|----------------------------------+----------------------------------+------------|
|
||||
| copy-to-register | /Copy to register/ | SPC r c |
|
||||
| frameset-to-register | /Frameset to register/ | SPC r f |
|
||||
| insert-register | /Insert contents of register/ | SPC r i |
|
||||
| jump-to-register | /Jump to register/ | SPC r j |
|
||||
| list-registers | /List registers/ | SPC r l |
|
||||
| number-to-register | /Number to register/ | SPC r n |
|
||||
| counsel-register | /Interactively choose a register/ | SPC r r |
|
||||
| view-register | /View a register/ | SPC r v |
|
||||
| window-configuration-to-register | /Window configuration to register/ | SPC r w |
|
||||
| increment-register | /Increment register/ | SPC r + |
|
||||
| point-to-register | /Point to register/ | SPC r SPC |
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(map! :leader
|
||||
(:prefix ("r" . "registers")
|
||||
:desc "Copy to register" "c" #'copy-to-register
|
||||
:desc "Frameset to register" "f" #'frameset-to-register
|
||||
:desc "Insert contents of register" "i" #'insert-register
|
||||
:desc "Jump to register" "j" #'jump-to-register
|
||||
:desc "List registers" "l" #'list-registers
|
||||
:desc "Number to register" "n" #'number-to-register
|
||||
:desc "Interactively choose a register" "r" #'counsel-register
|
||||
:desc "View a register" "v" #'view-register
|
||||
:desc "Window configuration to register" "w" #'window-configuration-to-register
|
||||
:desc "Increment register" "+" #'increment-register
|
||||
:desc "Point to register" "SPC" #'point-to-register))
|
||||
#+END_SRC
|
||||
|
||||
* REMOTE CONNECTIONS
|
||||
Keybindings for ssh'ing into remote machines. By default, Doom Emacs does not use 'SPC \', so the format I use for these bindings is 'SPC \' plus 'key'.
|
||||
|
||||
| DESCRIPTION | KEYBINDING |
|
||||
|-------------------------+------------|
|
||||
| Ssh into distrotube.com | SPC \ d |
|
||||
| Ssh into my nextcloud | SPC \ n |
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(map! :leader
|
||||
(:prefix ("\\" . "ssh")
|
||||
:desc "Ssh into distrotube.com"
|
||||
"d" #'(lambda () (interactive) (find-file "/scp:derek@distrotube.com"))
|
||||
:desc "Ssh into my nextcloud"
|
||||
"n" #'(lambda () (interactive) (find-file "/scp:derek@distrotube.net"))))
|
||||
#+END_SRC
|
||||
|
||||
* SHELLS
|
||||
Settings for the various shells and terminal emulators within Emacs.
|
||||
+ 'shell-file-name' -- sets the shell to be used in M-x shell, M-x term, M-x ansi-term and M-x vterm.
|
||||
+ 'eshell-aliases-file' -- sets an aliases file for the eshell.
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq shell-file-name "/bin/fish"
|
||||
eshell-aliases-file "~/.doom.d/aliases"
|
||||
eshell-history-size 5000
|
||||
eshell-buffer-maximum-lines 5000
|
||||
eshell-hist-ignoredups t
|
||||
eshell-scroll-to-bottom-on-input t
|
||||
eshell-destroy-buffer-when-process-dies t
|
||||
eshell-visual-commands'("bash" "fish" "htop" "ssh" "top" "zsh")
|
||||
vterm-max-scrollback 5000)
|
||||
(map! :leader
|
||||
:desc "Counsel eshell history" "e h" #'counsel-esh-history)
|
||||
#+END_SRC
|
||||
|
||||
* SPLITS
|
||||
I set splits to default to opening on the right using 'prefer-horizontal-split'. I set a keybinding for 'clone-indirect-buffer-other-window' for when I want to have the same document in two splits. The text of the indirect buffer is always identical to the text of its base buffer; changes made by editing either one are visible immediately in the other. But in all other respects, the indirect buffer and its base buffer are completely separate. For example, I can fold one split but other will be unfolded.
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun prefer-horizontal-split ()
|
||||
(set-variable 'split-height-threshold nil t)
|
||||
(set-variable 'split-width-threshold 40 t)) ; make this as low as needed
|
||||
(add-hook 'markdown-mode-hook 'prefer-horizontal-split)
|
||||
(map! :leader
|
||||
:desc "Clone indirect buffer other window" "b c" #'clone-indirect-buffer-other-window)
|
||||
#+END_SRC
|
||||
|
||||
* WINNER MODE
|
||||
Winner mode has been included with GNU Emacs since version 20. This is a global minor mode and, when activated, it allows you to “undo” (and “redo”) changes in the window configuration with the key commands 'SCP w <left>' and 'SPC w <right>'.
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(map! :leader
|
||||
(:prefix ("w" . "window")
|
||||
:desc "Winner redo" "<right>" #'winner-redo
|
||||
:desc "Winner undo" "<left>" #'winner-undo))
|
||||
#+END_SRC
|
||||
186
.config/doom/init.el
Normal file
186
.config/doom/init.el
Normal file
@@ -0,0 +1,186 @@
|
||||
;;; 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 +fonts +ivyposframe) ; a search engine for love and life
|
||||
|
||||
: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) ; 🙂
|
||||
;;fill-column ; a `fill-column' indicator
|
||||
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 ; 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 +aspell) ; 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
|
||||
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...
|
||||
;;cc ; C/C++/Obj-C madness
|
||||
;;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
|
||||
;;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
|
||||
;;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
|
||||
;;lean
|
||||
;;factor
|
||||
;;ledger ; an accounting system in Emacs
|
||||
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 +pretty) ; organize your plain life in plain text
|
||||
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 ; Fe2O3.unwrap().unwrap().unwrap().unwrap()
|
||||
;;scala ; java, but good
|
||||
;;scheme ; 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
|
||||
|
||||
:email
|
||||
mu4e
|
||||
;;notmuch
|
||||
;;(wanderlust +gmail)
|
||||
|
||||
:app
|
||||
;;calendar
|
||||
emms
|
||||
;;everywhere ; *leave* Emacs!? You must be joking
|
||||
;;irc ; how neckbeards socialize
|
||||
rss ; emacs as an RSS reader
|
||||
;;twitter ; twitter client https://twitter.com/vnought
|
||||
|
||||
:config
|
||||
literate
|
||||
(default +bindings +smartparens))
|
||||
64
.config/doom/packages.el
Normal file
64
.config/doom/packages.el
Normal file
@@ -0,0 +1,64 @@
|
||||
;; -*- 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! flycheck-aspell)
|
||||
(package! async)
|
||||
(package! dired-open)
|
||||
(package! dmenu)
|
||||
(package! elpher)
|
||||
(package! evil-tutor)
|
||||
(package! mastodon)
|
||||
(package! org-ql)
|
||||
(package! peep-dired)
|
||||
(package! pianobar)
|
||||
(package! rainbow-mode)
|
||||
(package! resize-window)
|
||||
(package! tldr)
|
||||
(package! wc-mode)
|
||||
Reference in New Issue
Block a user