272 lines
8.7 KiB
EmacsLisp
272 lines
8.7 KiB
EmacsLisp
;;; .doom.d/config.el -*- lexical-binding: t; -*-
|
|
|
|
;; Place your private configuration here
|
|
|
|
(setq user-full-name "KahrKunne"
|
|
user-mail-address "kahr.kunne@gmail.com"
|
|
backup-directory-alist '(("~/.emacs.d/backups"))
|
|
delete-old-versions nil
|
|
version-control t
|
|
vc-make-backup-files nil
|
|
auto-save-file-name-transforms '((".*" "~/.emacs.d/auto-save-list" t))
|
|
savehist-file "~/.emacs.d/savehist"
|
|
require-final-newline t
|
|
global-auto-revert-mode t
|
|
global-auto-revert-non-file-buffers t
|
|
auto-revert-verbose nil
|
|
custom-safe-themes t)
|
|
|
|
(add-hook 'term-mode-hook 'toggle-truncate-lines)
|
|
(fset 'yes-or-no-p 'y-or-n-p)
|
|
|
|
(defadvice projectile-project-root (around ignore-remote first activate)
|
|
(unless (file-remote-p default-directory) ad-do-it))
|
|
|
|
(setq web-mode-script-padding 0
|
|
js-indent-level 2
|
|
js2-strict-missing-semi-warning nil)
|
|
|
|
(setq avy-all-windows nil)
|
|
(setq avy-timeout-seconds 0.2)
|
|
(setq avy-keys '(?a ?s ?d ?f ?k ?l ?; ?g ?h
|
|
?q ?w ?e ?r ?t ?y ?i ?p
|
|
?A ?S ?D ?F ?J ?K ?L))
|
|
(define-key evil-normal-state-map (kbd "C-.") #'avy-goto-char-timer)
|
|
(setq aw-keys '(?a ?s ?d ?f ?k ?l ?; ?g ?h
|
|
?q ?w ?e ?r ?t ?y ?i ?p
|
|
?A ?S ?D ?F ?J ?K ?L))
|
|
|
|
(define-key evil-normal-state-map (kbd ";") 'evil-ex)
|
|
(define-key evil-normal-state-map (kbd "g a") 'paste-above)
|
|
(define-key evil-normal-state-map (kbd "g p") 'paste-below)
|
|
|
|
|
|
(setq ivy-height 10
|
|
ivy-count-format "(%d/%d) "
|
|
ivy-use-virtual-buffers t
|
|
ivy-re-builders-alist '((t . ivy--regex-ignore-order))
|
|
ivy-initial-inputs-alist '((org-refile . "")
|
|
(org-capture-refile . "")
|
|
(counsel-M-x . "")
|
|
(counsel-describe-function . "")
|
|
(counsel-describe-variable . "")
|
|
(man . "")
|
|
(woman . "")))
|
|
|
|
(defun my-web-mode-hook ()
|
|
(setq web-mode-markup-indent-offset 2)
|
|
(setq web-mode-code-indent-offset 2)
|
|
(setq web-mode-css-indent-offset 2))
|
|
(add-hook 'web-mode-hook 'my-web-mode-hook)
|
|
|
|
(require 'key-chord)
|
|
(key-chord-mode t)
|
|
(key-chord-define evil-insert-state-map "jj" 'evil-normal-state)
|
|
|
|
|
|
(set-frame-font "Mononoki 22" nil t)
|
|
|
|
(global-set-key (kbd "C-s") #'swiper)
|
|
|
|
(which-key-mode 1)
|
|
(setq which-key-idle-delay 0.25)
|
|
|
|
(setq treemacs--width-is-locked nil)
|
|
|
|
;(centaur-tabs-mode 0)
|
|
;(setq centaur-tabs-style "bar")
|
|
;(setq centaur-tabs-modified-marker "*")
|
|
;(setq centaur-tabs-set-bar 'left)
|
|
;
|
|
;(centaur-tabs-change-fonts "Mononoki" 120)
|
|
;(centaur-tabs-group-by-projectile-project)
|
|
|
|
(setq doom-theme 'doom-old-hope)
|
|
|
|
(display-time-mode 1)
|
|
|
|
|
|
(global-set-key (kbd "C-x C-f") #'counsel-find-file)
|
|
(map! :leader
|
|
"." #'counsel-find-file)
|
|
|
|
(after! evil (evil-escape-mode nil))
|
|
|
|
(setq ivy-read-action-function #'ivy-hydra-read-action)
|
|
|
|
(defun my:is-end-of-line ()
|
|
"Compare point with end of line."
|
|
(let* ((pos (current-column))
|
|
(end-pos (save-excursion
|
|
(evil-end-of-line)
|
|
(current-column))))
|
|
(eq pos end-pos)))
|
|
|
|
(defun my:compare-with-end-of-word ()
|
|
"Compare point with end of word."
|
|
(let* ((pos (current-column))
|
|
(end-pos (save-excursion
|
|
(evil-backward-word-begin)
|
|
(evil-forward-word-end)
|
|
(current-column))))
|
|
(- pos end-pos)))
|
|
|
|
(defun my:point-is-space ()
|
|
"Check if point is whitespace."
|
|
(char-equal ?\s (char-after)))
|
|
|
|
(defun my:insert-after (func)
|
|
"Run FUNC after the end of word, ignoring whitespace."
|
|
(interactive)
|
|
(let ((relative-loc (my:compare-with-end-of-word)))
|
|
(cond ((my:is-end-of-line)
|
|
(end-of-line)
|
|
(call-interactively func))
|
|
((eq 0 relative-loc)
|
|
(evil-forward-char)
|
|
(call-interactively func))
|
|
((and (> 0 relative-loc) (not (my:point-is-space)))
|
|
(evil-forward-word-end)
|
|
(if (my:is-end-of-line)
|
|
(end-of-line)
|
|
(evil-forward-char))
|
|
(call-interactively func))
|
|
(t
|
|
(call-interactively func)))))
|
|
|
|
(setq mouse-autoselect-window t
|
|
focus-follows-mouse t)
|
|
|
|
(add-to-list 'auto-mode-alist '("\\.tsx\\'" . typescript-mode))
|
|
|
|
(setq lsp-enable-links nil)
|
|
|
|
|
|
(require 'ox-publish)
|
|
|
|
(defun blog/get-util (x)
|
|
(with-temp-buffer
|
|
(insert-file-contents (concat "~/Blog/util/"
|
|
x))
|
|
(buffer-string)))
|
|
|
|
(setq org-html-metadata-timestamp-format "%Y-%m-%d")
|
|
;; Get project settings
|
|
(defun akko/blog-spec ()
|
|
"Return project settings for use with `org-publish-project-alist'."
|
|
(let* ((html-head (blog/get-util "head.html"))
|
|
(html-preamble (blog/get-util "preamble.html"))
|
|
(html-postamble (blog/get-util "postamble.html")))
|
|
|
|
|
|
`(
|
|
("pages"
|
|
:base-directory "~/Blog/org"
|
|
:base-extension "org"
|
|
:recursive t
|
|
:publishing-directory "~/Blog/html"
|
|
:publishing-function org-html-publish-to-html
|
|
|
|
:html-doctype "html5"
|
|
:html-html5-fancy t
|
|
|
|
:html-viewport ((width "100%")
|
|
(initial-scale "0.7")
|
|
(minimum-scale "")
|
|
(maximum-scale "")
|
|
(user-scalable ""))
|
|
|
|
:language "en"
|
|
:section-numbers nil
|
|
|
|
:with-toc nil
|
|
:with-date t
|
|
:with-title nil
|
|
:with-author nil
|
|
|
|
:auto-sitemap t
|
|
|
|
:sitemap-sort-files anti-chronologically
|
|
:sitemap-format-entry
|
|
(lambda (entry style project)
|
|
(cond ((not (directory-name-p entry))
|
|
(format
|
|
"[[file:%s][%s]]\n"
|
|
entry
|
|
(org-publish-find-title entry project)))
|
|
((eq style 'tree)
|
|
(capitalize (file-name-nondirectory (directory-file-name entry))))
|
|
(t entry)))
|
|
|
|
:headline-levels 4
|
|
:html-head ,html-head
|
|
|
|
:html-preamble ,html-preamble
|
|
:html-postamble (lambda (p)
|
|
(let* ((timestamp-format (plist-get p :html-metadata-timestamp-format))
|
|
(date (org-export-data (org-export-get-date p timestamp-format)
|
|
p))
|
|
(file (plist-get p :input-file))
|
|
(modified (format-time-string
|
|
timestamp-format
|
|
(and file (file-attribute-modification-time
|
|
(file-attributes file))))))
|
|
(concat
|
|
"<div id='footer'>"
|
|
(when (not (string-blank-p (format "%s" date)))
|
|
(format "<div id='publish-date'>Published: %s</div>" date))
|
|
(format "<div id='modified-date'>Last modified: %s</div>" modified)
|
|
,html-postamble
|
|
"</div>"))))
|
|
|
|
("static"
|
|
:base-directory "~/Blog/static"
|
|
:base-extension "css\\|txt\\|jpg\\|gif\\|png\\|ttf"
|
|
:recursive t
|
|
:publishing-directory "~/Blog/html/static"
|
|
:publishing-function org-publish-attachment)
|
|
|
|
("blog" :components ("pages" "static")))))
|
|
|
|
(setq org-publish-project-alist (akko/blog-spec))
|
|
|
|
(defun akko/publish-blog ()
|
|
(interactive)
|
|
(setq org-publish-project-alist (akko/blog-spec))
|
|
(org-publish-all))
|
|
|
|
(defun akko/force-publish-blog ()
|
|
(interactive)
|
|
(setq org-publish-project-alist (akko/blog-spec))
|
|
(org-publish-remove-all-timestamps)
|
|
(org-publish-all))
|
|
|
|
(map! :leader
|
|
(:prefix ("a" . "akko")
|
|
:desc "Publish Blog"
|
|
"b" #'akko/publish-blog
|
|
"f" #'akko/force-publish-blog))
|
|
|
|
(setq org-html-htmlize-output-type 'css)
|
|
(setq org-html-htmlize-font-prefix "org-")
|
|
|
|
(set-file-template! "/Blog/org/posts/.+\\.org"
|
|
:trigger "__blog")
|
|
|
|
(defun akko/org-current-time-string ()
|
|
(with-temp-buffer
|
|
(org-mode)
|
|
(org-time-stamp '(16))
|
|
(buffer-substring (point-min) (point-max))))
|
|
|
|
(add-to-list 'auto-mode-alist '("\\.tsx\\'" . typescript-tsx-mode))
|
|
|
|
(setq auto-mode-alist
|
|
(append '(("\\.tsx\\'" . typescript-tsx-mode))
|
|
auto-mode-alist))
|
|
|
|
; XXX this will make doom create new files with ipython shebang - bad!
|
|
(setq python-shell-interpreter "ipython"
|
|
python-shell-interpreter-args "-i --simple-prompt")
|
|
(setq python-shell-completion-native-disabled-interpreters '("ipython"))
|