Files
dotfiles/doom/config.el

131 lines
4.3 KiB
EmacsLisp

;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-
(setq shell-file-name "/bin/bash")
;; Place your private configuration here! Remember, you do not need to run 'doom
;; sync' after modifying this file!
(setq doom-localleader-key ",")
;; Some functionality uses this to identify you, e.g. GPG configuration, email
;; clients, file templates and snippets.
(setq user-full-name "Tim McCarthy"
user-mail-address "tim.mccarthy@sri.com")
;; Doom exposes five (optional) variables for controlling fonts in Doom. Here
;; are the three important ones:
;;
;; + `doom-font'
;; + `doom-variable-pitch-font'
;; + `doom-big-font' -- used for `doom-big-font-mode'; use this for
;; presentations or streaming.
;;
;; They all accept either a font-spec, font string ("Input Mono-12"), or xlfd
;; font string. You generally only need these two:
(require 'cl-lib)
(setq font-candidates
(list
(font-spec :family "Fira Code Regular Nerd Font Complete Mono")
(font-spec :family "monospace" :size 14)))
(setq doom-font (cl-find-if #'find-font font-candidates))
;; There are two ways to load a theme. Both assume the theme is installed and
;; available. You can either set `doom-theme' or manually load a theme with the
;; `load-theme' function. This is the default:
(setq doom-theme 'doom-one)
;; Initial frame size
;; (add-to-list 'default-frame-alist '(width . 125))
;; (add-to-list 'default-frame-alist '(height . 70))
;; Transparency
(set-frame-parameter (selected-frame) 'alpha '(99 98))
(add-to-list 'default-frame-alist '(alpha 99 98))
;; If you use `org' and don't want your org files in the default location below,
;; change `org-directory'. It must be set before org loads!
(setq org-directory "~/Seafile/Notes/")
;; Enable full 3-cycle tabbing in Org-mode
(after! evil-org
(remove-hook 'org-tab-first-hook #'+org-cycle-only-current-subtree-h))
;; This determines the style of line numbers in effect. If set to `nil', line
;; numbers are disabled. For relative line numbers, set this to `relative'.
(setq display-line-numbers-type t)
;; Spacemacs-like SPC SPC -> M-x behavior
(map! :leader
:desc "M-x"
"SPC" #'execute-extended-command)
(defun first-executable (candidates)
(seq-find #'executable-find candidates))
;; Reveal in finder/nautilus/whatever
(defun reveal-in-file-browser ()
(interactive)
(call-process
(first-executable '("xdg-open" "open"))
nil nil nil "."))
(map! :leader
:desc "Reveal"
"o o" #'reveal-in-file-browser)
(map! :leader
:desc "Show in dired"
"f j" #'dired-jump)
;; Make C-h kill a word in Ivy, for symmetry with C-j/k/l bindings.
(map! :map ivy-mode-map "C-h" #'ivy-backward-kill-word)
;; C-h/C-l bindings in vertico
(map! :map vertico-map "C-h" #'vertico-directory-delete-word)
(map! :map vertico-map "C-l" #'vertico-directory-enter)
(map! :map smartparens-mode-map
:n "SPC k s" #'sp-forward-slurp-sexp
:n "SPC k b" #'sp-forward-barf-sexp)
;; Clear all todo statuses in org-mode. For Grocery list.
(defun ttm-org-clear-all ()
(interactive)
(goto-char 0)
(org-map-entries
(lambda ()
(org-todo "")))
(flush-lines "CLOSED")
(message "Entries cleared."))
(map! :mode org-mode :localleader "C" :desc "Clear all todos" #'ttm-org-clear-all)
(setq-default eshell-cmpl-ignore-case t)
;; Show colors in log files
(add-load-path! ".")
(require 'tty-format)
(defun display-ansi-colors ()
(interactive)
(format-decode-buffer 'ansi-colors))
(add-hook 'find-file-hook 'tty-format-guess)
(add-to-list 'auto-mode-alist '("\\.log\\'" . display-ansi-colors))
(add-to-list 'auto-mode-alist '("\\.log\\.out\\'" . display-ansi-colors))
;; Disable smartparens' insistence on inserting extraneous colons in Python
(setq sp-python-insert-colon-in-function-definitions nil)
;; Disable "Enter" as a company-mode completion trigger and replace with C-SPC
(with-eval-after-load 'company
(define-key company-active-map (kbd "<return>") nil)
(define-key company-active-map (kbd "RET") nil)
(define-key company-active-map (kbd "C-SPC") #'company-complete-selection))
;; "g u" in normal mode finds references, using LSP if available
(map! :n "g u" #'xref-find-references)
(map! :mode lsp-mode :n "g u" #'lsp-ui-peek-find-references)
;; Insist on using regular "ls", to override Doom's insistence on "gls" on Mac+Nix
(setq insert-directory-program "ls")