dwt1--dotfiles/.doom.d/config.org

310 lines
12 KiB
Org Mode
Raw Normal View History

2020-07-11 16:37:20 +00:00
#+TITLE: DT's Doom Emacs Config
#+AUTHOR: Derek Taylor (DT)
#+STARTUP: showeverything
2020-07-17 17:49:20 +00:00
2020-10-14 00:35:02 +00:00
* FONTS
2020-07-11 16:37:20 +00:00
Doom exposes five (optional) variables for controlling fonts in Doom. Here
are the three important ones:
2020-10-14 00:35:02 +00:00
+ `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.
2020-07-11 16:37:20 +00:00
#+BEGIN_SRC emacs-lisp
2020-09-29 21:28:27 +00:00
(setq doom-font (font-spec :family "SauceCodePro Nerd Font" :size 15)
2020-10-17 02:43:49 +00:00
doom-variable-pitch-font (font-spec :family "Ubuntu" :size 15)
2020-10-14 00:35:02 +00:00
doom-big-font (font-spec :family "SauceCodePro Nerd Font" :size 24))
2020-10-17 02:43:49 +00:00
(after! doom-themes
(setq
doom-themes-enable-bold t
doom-themes-enable-italic t))
2020-07-11 16:37:20 +00:00
#+END_SRC
2020-10-14 00:35:02 +00:00
* DOOM THEME
2020-10-17 02:43:49 +00:00
Setting the theme to doom-one. To try out new themes, I set a keybinding for counsel-load-theme with SPC-h-t.
2020-07-11 16:37:20 +00:00
#+BEGIN_SRC emacs-lisp
2020-09-29 21:28:27 +00:00
(setq doom-theme 'doom-one)
2020-10-14 00:35:02 +00:00
(map! :leader
:desc "Load new theme"
"h t" #'counsel-load-theme)
2020-07-11 16:37:20 +00:00
#+END_SRC
2020-10-17 02:43:49 +00:00
* LINE SETTINGS
I have toggled display-line-numbers-type so I have line numbers displayed. I also set a keybinding to be able to toggle-truncate-lines with SPC-l-t.
#+BEGIN_SRC emacs-lisp
(setq display-line-numbers-type t)
(map! :leader
:desc "Toggle truncate lines"
"l t" #'toggle-truncate-lines)
#+END_SRC
2020-10-14 00:35:02 +00:00
* ORG MODE
2020-10-17 02:43:49 +00:00
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.
2020-07-11 16:37:20 +00:00
#+BEGIN_SRC emacs-lisp
2020-09-29 21:28:27 +00:00
(after! org
2020-10-14 00:35:02 +00:00
(setq org-directory "~/Org/"
org-agenda-files '("~/Org/agenda.org")
2020-10-17 02:43:49 +00:00
org-default-notes-file (expand-file-name "notes.org" org-directory)
org-ellipsis " ▼ "
2020-10-14 00:35:02 +00:00
org-log-done 'time
;; ex. of org-link-abbrev-alist in action
;; [[arch-wiki:Name_of_Page][Description]]
org-link-abbrev-alist
'(("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 '((sequence "TODO(t)" "PROJ(p)" "VIDEO(v)" "WAIT(w)" "|" "DONE(d)" "CANCELLED(c)" )))
;; Nicer bullets in org-mode
2020-09-29 21:28:27 +00:00
(require 'org-bullets)
2020-10-14 00:35:02 +00:00
(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))))
2020-07-11 16:37:20 +00:00
#+END_SRC
2020-10-15 23:30:56 +00:00
* SHELLS
The =inferior shell= is what you get when you run M-x shell. It is a wrapper around your default shell. It is governed by explicit-shell-file-name, the ESHELL environment variable or shell-file-name, in that order. Below, I demonstrate how to change shell to use fish even though the default shell may be something else. This will also make M-x term and M-x ansi-term default to fish, though it asks you to confirm before it launches.
2020-10-17 02:43:49 +00:00
2020-10-15 23:30:56 +00:00
#+BEGIN_SRC emacs-lisp
(setq shell-file-name "/bin/fish")
#+END_SRC
Sets the file for where I place my eshell aliases.
2020-10-17 02:43:49 +00:00
2020-10-15 23:30:56 +00:00
#+BEGIN_SRC emacs-lisp
(setq eshell-aliases-file "~/.doom.d/aliases")
#+END_SRC
2020-10-14 00:35:02 +00:00
* SPLITS
2020-07-11 16:37:20 +00:00
Force splits to open on the right
2020-10-17 02:43:49 +00:00
2020-07-11 16:37:20 +00:00
#+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)
#+END_SRC
2020-10-14 00:35:02 +00:00
* TABS (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, there are just a few keybindings that use SPC-t, so it wasn't too difficult to find appropriate keybindings using that prefix for "tabs".
2020-10-17 02:43:49 +00:00
| COMMAND | DESCRIPTION | KEYBINDING |
|-----------------------------------------------+---------------------------+------------|
| centaur-tabs-local-mode | Toggle tabs on/off | SPC-t-o |
| centaur-tabs-counsel-switch-group | Switch tab groups | SPC-t-s |
| centaur-tabs-toggle-groups | Toggle tab groups | SPC-t-t |
| centaur-tabs-kill-all-buffer-in-current-group | Kill all buffers in group | SPC-t-k |
| centaur-tabs-forward | Next tab | SPC-t-n |
| centaur-tabs-backward | Previous tab | SPC-t-k |
2020-10-14 00:35:02 +00:00
#+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 on/off"
"t o" #'centaur-tabs-local-mode
:leader
:desc "Switch tab groups"
"t s" #'centaur-tabs-counsel-switch-group
:leader
:desc "Toggle tab groups"
"t t" #'centaur-tabs-toggle-groups
:leader
:desc "Kill all buffers in group"
"t k" #'centaur-tabs-kill-all-buffer-in-current-group
:leader
:desc "Next tab"
"t n" #'centaur-tabs-forward
:leader
:desc "Previous tab"
"t p" #'centaur-tabs-backward)
#+END_SRC
2020-10-17 02:43:49 +00:00
* NEOTREE
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.
#+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))
#+END_SRC
* MANPAGES
#+BEGIN_SRC emacs-lisp
(require 'ox-groff)
#+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 you see using C-x C-f in vanilla Emacs or SPC-f-f in Doom Emacs. These keybindings use find-file non-interactively since we specify exactly what file to open. By default, Doom Emacs does not use SPC-/, so the format I use for these bindings is SPC-/ plus "key".
| 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
:desc "Edit agenda file"
"/ a" #'(lambda () (interactive) (find-file "~/Org/agenda.org")))
(map! :leader
:desc "Edit doom config.org"
"/ c" #'(lambda () (interactive) (find-file "~/.doom.d/config.org")))
(map! :leader
:desc "Edit eshell aliases"
"/ e" #'(lambda () (interactive) (find-file "~/.doom.d/aliases")))
(map! :leader
:desc "Edit doom init.el"
"/ i" #'(lambda () (interactive) (find-file "~/.doom.d/init.el")))
(map! :leader
:desc "Edit doom packages.el"
"/ p" #'(lambda () (interactive) (find-file "~/.doom.d/packages.el")))
(map! :leader
:desc "Ssh into distrotube.com"
"/ s" #'(lambda () (interactive) (find-file "/scp:derek@distrotube.com")))
#+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
:desc "Ssh into distrotube.com"
"\\ d" #'(lambda () (interactive) (find-file "/scp:derek@distrotube.com")))
(map! :leader
:desc "Ssh into my nextcloud"
"\\ n" #'(lambda () (interactive) (find-file "/scp:derek@distrotube.net")))
#+END_SRC
2020-10-14 00:35:02 +00:00
* FILE MANAGER (dired)
2020-07-11 16:37:20 +00:00
Image previews in dired
2020-10-17 02:43:49 +00:00
2020-07-11 16:37:20 +00:00
#+BEGIN_SRC emacs-lisp
(map!
(:after dired
(:map dired-mode-map
2020-10-14 00:35:02 +00:00
:leader
"l i" #'peep-dired
2020-07-11 16:37:20 +00:00
)))
(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)
#+END_SRC
2020-10-17 02:43:49 +00:00
* BROWSER (eww)
Set urls to open in a specific browser. I set this to use Emacs' own browser (eww).
#+BEGIN_SRC emacs-lisp
(setq browse-url-browser-function 'eww-browse-url)
#+END_SRC
2020-10-14 00:35:02 +00:00
* AUDIO PLAYER (emms)
2020-10-17 02:43:49 +00:00
One of the media players available for Emacs is emms, which stands for Emacs Multimedia System.
2020-07-11 16:37:20 +00:00
#+BEGIN_SRC emacs-lisp
(use-package emms
:ensure t
:config
(require 'emms-setup)
(require 'emms-info)
(require 'emms-cue)
(require 'emms-mode-line)
(require 'emms-playing-time)
(setq emms-source-file-default-directory "~/Music/Non-Classical/70s-80s/")
(setq emms-playlist-buffer-name "*Music*")
(setq emms-info-asynchronously t)
(unless (eq system-type 'windows-nt)
(setq emms-source-file-directory-tree-function
'emms-source-file-directory-tree-find))
(emms-all)
(emms-default-players)
(emms-mode-line 1)
(emms-playing-time 1))
#+END_SRC
2020-10-14 00:35:02 +00:00
* EMAIL CLIENT (mu4e)
2020-10-17 02:43:49 +00:00
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.
#+BEGIN_SRC emacs-lisp
2020-07-11 16:37:20 +00:00
(add-to-list 'load-path "/usr/local/share/emacs/site-lisp/mu4e")
(require 'mu4e)
(require 'smtpmail)
2020-10-17 02:43:49 +00:00
(setq mu4e-get-mail-command "mbsync -c ~/.emacs.d/mu4e/.mbsyncrc -a"
mu4e-update-interval 300
user-mail-address "derek@distrotube.com"
user-full-name "Derek Taylor"
mu4e-compose-signature
(concat
"Derek Taylor\n"
"http://www.youtube.com/DistroTube\n")
message-send-mail-function 'smtpmail-send-it
starttls-use-gnutls t
smtpmail-starttls-credentials '(("smtp.1and1.com" 587 nil nil))
smtpmail-auth-credentials '(("smtp.1and1.com" 587 "derek@distrotube.com" nil))
smtpmail-default-smtp-server "smtp.1and1.com"
smtpmail-smtp-server "smtp.1and1.com"
smtpmail-smtp-service 587)
(setq mu4e-sent-folder "/Sent"
mu4e-drafts-folder "/Drafts"
mu4e-trash-folder "/Trash"
mu4e-refile-folder "/All Mail")
(setq mu4e-maildir-shortcuts
'(("/derek-distrotube/Inbox" . ?i)
("/derek-distrotube/Sent" . ?s)
("/derek-distrotube/All Mail" . ?a)
("/derek-distrotube/Trash" . ?t)))
2020-07-11 16:37:20 +00:00
#+END_SRC
2020-10-14 00:35:02 +00:00
* MASTODON CLIENT (mastodon)
2020-09-29 21:28:27 +00:00
Note that I wrapped my settings with (after! mastodon). Without this, my settings will be overwritten by the default settings for this module, which is "mastodon.social".
2020-10-17 02:43:49 +00:00
2020-07-11 16:37:20 +00:00
#+BEGIN_SRC emacs-lisp
2020-09-29 21:28:27 +00:00
(after! mastodon
2020-10-14 00:35:02 +00:00
(setq mastodon-instance-url "https://mastodon.technology/"))
2020-07-11 16:37:20 +00:00
#+END_SRC
2020-10-14 00:35:02 +00:00
* REDDIT CLIENT (md4rd)
2020-10-17 02:43:49 +00:00
An Emacs reddit client.
2020-07-14 16:54:54 +00:00
#+BEGIN_SRC emacs-lisp
(setq md4rd-subs-active '(archlinux commandline DistroTube DoomEmacs emacs freesoftware lbry linux linux4noobs linuxmasterrace linnuxquestions orgmode qutebrowser suckless Ubuntu unixporn UsabilityPorn vim xmonad))
#+END_SRC
2020-10-14 00:35:02 +00:00
* RSS READER (elfeed)
2020-10-17 02:43:49 +00:00
An RSS newsfeed reader for Emacs.
2020-07-11 16:37:20 +00:00
#+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)
2020-10-14 00:35:02 +00:00
("https://distrowatch.com/news/dwd.xml" distrowatch linux)))))
2020-07-11 16:37:20 +00:00
#+END_SRC