Doom: All the updates...
This commit is contained in:
parent
a58854bae0
commit
a4d7456048
|
@ -1,176 +1,421 @@
|
|||
;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-
|
||||
;; No need to run doom sync after modifying this file
|
||||
(setq user-full-name "hedy"
|
||||
user-mail-address "hedy@tilde.cafe")
|
||||
;; 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:
|
||||
;; (setq doom-font (font-spec :family "monospace" :size 12 :weight 'semi-light)
|
||||
;; doom-variable-pitch-font (font-spec :family "sans" :size 13))
|
||||
|
||||
(setq diplay-line-numbers-type t)
|
||||
|
||||
(setq confirm-kill-emacs nil)
|
||||
|
||||
(setq scroll-margin 6)
|
||||
|
||||
(global-visual-line-mode t)
|
||||
|
||||
(setq evil-shift-width 2)
|
||||
(setq tab-width 4)
|
||||
|
||||
(defun set-exec-path-from-shell-PATH ()
|
||||
"Set up Emacs' `exec-path' and PATH environment variable to match that used by the user's shell.
|
||||
|
||||
This is particularly useful under Mac OS X and macOS, where GUI apps are not started from a shell."
|
||||
(interactive)
|
||||
(let ((path-from-shell
|
||||
(replace-regexp-in-string "[ \t\n]*$" ""
|
||||
(shell-command-to-string ;;SHELL = fish
|
||||
"$SHELL --login -c 'string join : $PATH'"))))
|
||||
(setenv "PATH" path-from-shell)
|
||||
(setq exec-path (split-string path-from-shell path-separator))))
|
||||
|
||||
(set-exec-path-from-shell-PATH)
|
||||
|
||||
;; https://www.emacswiki.org/emacs/ToggleWindowSplit
|
||||
(defun toggle-window-split ()
|
||||
(interactive)
|
||||
(if (= (count-windows) 2)
|
||||
(let* ((this-win-buffer (window-buffer))
|
||||
(next-win-buffer (window-buffer (next-window)))
|
||||
(this-win-edges (window-edges (selected-window)))
|
||||
(next-win-edges (window-edges (next-window)))
|
||||
(this-win-2nd (not (and (<= (car this-win-edges)
|
||||
(car next-win-edges))
|
||||
(<= (cadr this-win-edges)
|
||||
(cadr next-win-edges)))))
|
||||
(splitter
|
||||
(if (= (car this-win-edges)
|
||||
(car (window-edges (next-window))))
|
||||
'split-window-horizontally
|
||||
'split-window-vertically)))
|
||||
(delete-other-windows)
|
||||
(let ((first-win (selected-window)))
|
||||
(funcall splitter)
|
||||
(if this-win-2nd (other-window 1))
|
||||
(set-window-buffer (selected-window) this-win-buffer)
|
||||
(set-window-buffer (next-window) next-win-buffer)
|
||||
(select-window first-win)
|
||||
(if this-win-2nd (other-window 1))))))
|
||||
|
||||
(define-key ctl-x-4-map "t" 'toggle-window-split)
|
||||
|
||||
(setq doom-font (font-spec :family "Fira Code" :size 16 :weight 'normal)
|
||||
doom-variable-pitch-font (font-spec :family "Open Sans" :size 18 :weight 'light))
|
||||
|
||||
;; Elfeed: Use sans for articles
|
||||
(add-hook 'elfeed-show-mode-hook
|
||||
(lambda () (buffer-face-set 'variable-pitch)))
|
||||
|
||||
;; 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-vibrant) ;; Doom's dracula is a bit funny
|
||||
;; 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 "~/org/")
|
||||
;; Can set to relative or nil
|
||||
(setq display-line-numbers-type t)
|
||||
|
||||
;; Here are some additional functions/macros that could help you configure Doom:
|
||||
;;
|
||||
;; - `load!' for loading external *.el files relative to this one
|
||||
;; - `use-package!' for configuring packages
|
||||
;; - `after!' for running code after a package has loaded
|
||||
;; - `add-load-path!' for adding directories to the `load-path', relative to
|
||||
;; this file. Emacs searches the `load-path' when you load packages with
|
||||
;; `require' or `use-package'.
|
||||
;; - `map!' for binding new keys
|
||||
|
||||
(setq evil-split-window-below t
|
||||
evil-vsplit-window-right t)
|
||||
|
||||
;; FIXING EVIL DON"T USE CLIPBOARD::
|
||||
;;(fset 'evil-visual-update-x-selection 'ignore)
|
||||
;; FIXME DOES NOT WORK!
|
||||
(setq evil-visual-update-x-selection-p nil)
|
||||
;;(setq evil-kill-on-visual-paste nil)
|
||||
;;
|
||||
;; XXX: Workaround from: https://discourse.doomemacs.org/t/how-to-set-up-clipboard/3742
|
||||
;; don't put deleted strings to X11 clipboard
|
||||
(setq select-enable-clipboard nil)
|
||||
;; copying and pasting selected blocks in visual mode to and from X11 clipboard
|
||||
(map! "S-C-c" #'clipboard-kill-ring-save)
|
||||
(map! "S-C-v" #'clipboard-yank)
|
||||
;; How to use yank/paste and system clipboard:
|
||||
;; - Anything copied outside of emacs, paste in emacs with S-C-v
|
||||
;; - Yank within emacs, will not override clipboard outside emacs
|
||||
;; - To paste yanks within emacs, use default paste bind or use p
|
||||
;; - Copy sth to clipboard from emacs: Use S-C-c, paste outside with normal
|
||||
;; system bind
|
||||
|
||||
;; Seriously? I just want to quit. Damn. Why confirm lol
|
||||
(setq confirm-kill-emacs nil)
|
||||
(setq org-directory "~/org/")
|
||||
|
||||
(org-babel-do-load-languages
|
||||
'org-babel-load-languages
|
||||
'((emacs-lisp . t)
|
||||
(python . t))) ;; Why jupyter when you have this JK
|
||||
|
||||
(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1)))
|
||||
|
||||
(after! treemacs
|
||||
(setq treemacs-width 20
|
||||
treemacs-project-follow-cleanup t)
|
||||
(treemacs-load-theme "Default"))
|
||||
|
||||
(after! magit
|
||||
(custom-set-faces
|
||||
'(magit-diff-added-highlight ((((type tty)) (:background nil))))
|
||||
'(magit-diff-context-highlight ((((type tty)) (:background nil))))
|
||||
'(magit-diff-file-heading ((((type tty)) nil)))
|
||||
'(magit-diff-removed ((((type tty)) (:foreground "red"))))
|
||||
'(magit-diff-removed-highlight ((((type tty)) (:background nil))))
|
||||
'(magit-section-highlight ((((type tty)) nil)))
|
||||
'(magit-diff-highlight-hunk-body ((((type tty)) (:background nil))))
|
||||
'(magit-diff-base-highlight ((((type tty)) (:background nil))))
|
||||
))
|
||||
;; Elfeed: Use sans for articles
|
||||
(add-hook 'elfeed-show-mode-hook
|
||||
(lambda () (buffer-face-set 'variable-pitch)))
|
||||
|
||||
;; Scroll margin like scrolloff in vim
|
||||
(setq scroll-margin 6)
|
||||
;;(setq doom-themes-treemacs-variable-pitch-face nil)
|
||||
(add-hook! 'vterm-mode-hook 'evil-insert)
|
||||
|
||||
;; Horizontal scrolling is pain
|
||||
(global-visual-line-mode t)
|
||||
(after! company
|
||||
(setq company-idle-delay nil))
|
||||
|
||||
;; Give it the IDE vibes
|
||||
; (run-with-timer 1 nil (lambda () (save-selected-window (treemacs))))
|
||||
(require 'math-symbol-lists)
|
||||
;; This is actually for C-\, then select input "math",
|
||||
;; then the Ω will show in the status bar.
|
||||
(quail-define-package "math" "UTF-8" "Ω" t)
|
||||
;; (quail-define-rules ; add whatever extra rules you want to define here...
|
||||
;; ("\\from" #X2190)
|
||||
;; ("\\to" #X2192)
|
||||
;; ("\\lhd" #X22B2)
|
||||
;; ("\\rhd" #X22B3)
|
||||
;; ("\\unlhd" #X22B4)
|
||||
;; ("\\unrhd" #X22B5))
|
||||
(mapc (lambda (x)
|
||||
(if (cddr x)
|
||||
(quail-defrule (cadr x) (car (cddr x)))))
|
||||
(append math-symbol-list-basic math-symbol-list-extended))
|
||||
|
||||
;;org-todo
|
||||
(setq org-todo-keyword-faces
|
||||
'(("NOW" . "labelColor") ("CANCELED" . "systemRedColor") ("DONE" . "selectedControlColor") ("FINISH" . "selectedControlColor") ("PAST" . "controlTextColor")
|
||||
("RECUR" . "systemYellowColor") ("MARK" . "systemOrangeColor") ("PLAN" . "systemBrownColor")
|
||||
("OVERDUE". "systemRedColor") ("DUE" . "systemYellowColor") ("STARTED" . "labelColor")))
|
||||
(setq diary-file "~/Documents/diary/diary")
|
||||
(add-to-list 'company-backends 'company-math-symbols-unicode)
|
||||
|
||||
(org-babel-do-load-languages
|
||||
'org-babel-load-languages
|
||||
'((emacs-lisp . t)
|
||||
(python . t)
|
||||
(jupyter . t)))
|
||||
;; Emoji completion
|
||||
(defun --set-emoji-font (frame)
|
||||
"Adjust the font settings of FRAME so Emacs can display emoji properly."
|
||||
(if (eq system-type 'darwin)
|
||||
;; For NS/Cocoa
|
||||
(set-fontset-font t 'symbol (font-spec :family "Apple Color Emoji") frame 'prepend)
|
||||
;; For Linux
|
||||
(set-fontset-font t 'symbol (font-spec :family "Symbola") frame 'prepend)))
|
||||
|
||||
;; centaur tabs
|
||||
(defun centaur-tabs-buffer-groups ()
|
||||
"`centaur-tabs-buffer-groups' control buffers' group rules.
|
||||
;; For when Emacs is started in GUI mode:
|
||||
(--set-emoji-font nil)
|
||||
;; Hook for when a frame is created with emacsclient
|
||||
;; see https://www.gnu.org/software/emacs/manual/html_node/elisp/Creating-Frames.html
|
||||
(add-hook 'after-make-frame-functions '--set-emoji-font)
|
||||
(require 'company-emoji)
|
||||
(add-to-list 'company-backends 'company-emoji)
|
||||
|
||||
Group centaur-tabs with mode if buffer is derived from `eshell-mode'
|
||||
`emacs-lisp-mode' `dired-mode' `org-mode' `magit-mode'. All buffer name start
|
||||
with * will group to \"Emacs\". Other buffer group by
|
||||
`centaur-tabs-get-group-name' with project name."
|
||||
(list
|
||||
(cond
|
||||
;; ((not (eq (file-remote-p (buffer-file-name)) nil))
|
||||
;; "Remote")
|
||||
;; Put org mode first since some of these begin with "*"
|
||||
;; elisp seems to short-circuit "or"
|
||||
((memq major-mode '(org-mode
|
||||
org-agenda-clockreport-mode
|
||||
org-src-mode
|
||||
org-agenda-mode
|
||||
org-beamer-mode
|
||||
org-indent-mode
|
||||
org-bullets-mode
|
||||
org-cdlatex-mode
|
||||
org-agenda-log-mode
|
||||
diary-mode))
|
||||
"OrgMode") ;; Org Agenda next to org files is useful
|
||||
((derived-mode-p 'vterm-mode)
|
||||
"VTerm")
|
||||
((or (derived-mode-p 'prog-mode) ;; Put magit along with program files
|
||||
(memq major-mode '(magit-process-mode
|
||||
magit-status-mode
|
||||
magit-diff-mode
|
||||
magit-log-mode
|
||||
magit-file-mode
|
||||
magit-blob-mode
|
||||
magit-blame-mode))
|
||||
(derived-mode-p 'dired-mode))
|
||||
"Dev")
|
||||
((memq major-mode '(helpful-mode
|
||||
help-mode))
|
||||
"Help")
|
||||
((or (string-equal "elfeed" (substring (buffer-name) 1 7))
|
||||
(string-equal "eww" (substring (buffer-name) 1 4))
|
||||
(string-equal "elpher" (substring (buffer-name) 1 7)))
|
||||
"E-apps")
|
||||
((string-equal "*" (substring (buffer-name) 0 1))
|
||||
"Emacs") ;; This should be at the very end to match ones where none of the
|
||||
;; previous mode matches failed
|
||||
(t
|
||||
(centaur-tabs-get-group-name (current-buffer))))))
|
||||
(use-package! wrap-region
|
||||
:config
|
||||
(wrap-region-add-wrappers
|
||||
'(("/* " " */" "#" (java-mode javascript-mode css-mode))
|
||||
("`" "`" nil (markdown-mode org-mode))
|
||||
("=" "=" nil (org-mode))
|
||||
("~" "~" nil (org-mode))
|
||||
("*" "*" nil (markdown-mode org-mode)))))
|
||||
|
||||
(defun set-exec-path-from-shell-PATH ()
|
||||
"Set up Emacs' `exec-path' and PATH environment variable to match
|
||||
that used by the user's shell.
|
||||
(add-hook! ('org-mode 'markdown-mode) 'wrap-region-mode)
|
||||
|
||||
This is particularly useful under Mac OS X and macOS, where GUI
|
||||
apps are not started from a shell."
|
||||
(use-package! org-roam
|
||||
:ensure t
|
||||
:custom
|
||||
(org-roam-directory (file-truename "~/org/orgroam"))
|
||||
:bind (("C-c n l" . org-roam-buffer-toggle)
|
||||
("C-c n f" . org-roam-node-find)
|
||||
("C-c n g" . org-roam-graph)
|
||||
("C-c n i" . org-roam-node-insert)
|
||||
("C-c n c" . org-roam-capture)
|
||||
;; Dailies
|
||||
("C-c n j" . org-roam-dailies-capture-today))
|
||||
:config
|
||||
;; If you're using a vertical completion framework, you might want a more informative completion interface
|
||||
(setq org-roam-node-display-template (concat "${title:*} " (propertize "${tags:10}" 'face 'org-tag)))
|
||||
(org-roam-db-autosync-mode)
|
||||
;; If using org-roam-protocol
|
||||
(require 'org-roam-protocol))
|
||||
|
||||
(use-package! websocket
|
||||
:after org-roam)
|
||||
|
||||
(use-package! org-roam-ui
|
||||
:after org-roam ;; or :after org
|
||||
;; normally we'd recommend hooking orui after org-roam, but since org-roam does not have
|
||||
;; a hookable mode anymore, you're advised to pick something yourself
|
||||
;; if you don't care about startup time, use
|
||||
;; :hook (after-init . org-roam-ui-mode)
|
||||
:config
|
||||
(setq org-roam-ui-sync-theme t
|
||||
org-roam-ui-follow t
|
||||
org-roam-ui-update-on-save t
|
||||
org-roam-ui-open-on-start nil))
|
||||
|
||||
(customize-set-variable 'org-anki-default-deck "Doom")
|
||||
|
||||
(defun my/org-anki-sync-fix-refs ()
|
||||
"Fix 'Unable to resolve link: XXX'"
|
||||
(interactive)
|
||||
(let ((path-from-shell (replace-regexp-in-string
|
||||
"[ \t\n]*$" "" (shell-command-to-string ;;SHELL = fish
|
||||
"$SHELL --login -c 'string join : $PATH'"
|
||||
))))
|
||||
(setenv "PATH" path-from-shell)
|
||||
(setq exec-path (split-string path-from-shell path-separator))))
|
||||
(org-id-update-id-locations
|
||||
(directory-files-recursively org-roam-directory "\\.org$")))
|
||||
|
||||
(set-exec-path-from-shell-PATH)
|
||||
(customize-set-variable 'org-anki-field-templates
|
||||
'(("Basic"
|
||||
("Front" . (lambda (it) ;; strip text-properties
|
||||
(let ((breadcrumb (substring-no-properties
|
||||
;; arguments:
|
||||
;; - prepend file name?
|
||||
;; - incl current heading?
|
||||
;; - SEPARATOR
|
||||
;; - return as string?
|
||||
(org-display-outline-path nil nil " > " t)))
|
||||
(path (buffer-file-name)))
|
||||
;; "File Title: Heading > SubHeading > Sub-subheading"
|
||||
(setq breadcrumb (concat (org-get-title) ": " breadcrumb))
|
||||
(concat
|
||||
(format
|
||||
(concat "<div id=\"meta\">"
|
||||
"<p id=\"breadcrumb\">%s</p>"
|
||||
"<p id=\"open-file\">"
|
||||
"<a href='emacs:///%s'>Open file</a>"
|
||||
"</p>"
|
||||
"</div>"
|
||||
"<h3>%s</h3>")
|
||||
breadcrumb path it (org-get-heading)))))))))
|
||||
|
||||
(add-hook 'vterm-mode-hook
|
||||
(lambda () (visual-line-mode) (centaur-tabs-local-mode) (turn-off-evil-mode)))
|
||||
(setq org-latex-create-formula-image-program 'dvisvgm)
|
||||
(plist-put org-format-latex-options :scale 4.0)
|
||||
(plist-put org-format-latex-options :background nil)
|
||||
|
||||
(defun my/scale-current-overlay ()
|
||||
(interactive)
|
||||
(pcase major-mode
|
||||
('latex-mode
|
||||
(dolist (ov (overlays-in (point-min) (point-max)))
|
||||
(if (eq (overlay-get ov 'category)
|
||||
'preview-overlay)
|
||||
(my/text-scale--resize-fragment ov))))
|
||||
('org-mode
|
||||
(dolist (ov (overlays-in (- (point) 10) (+ (point) 5) ))
|
||||
(if (eq (overlay-get ov 'org-overlay-type)
|
||||
'org-latex-overlay)
|
||||
(my/text-scale--resize-fragment ov))))))
|
||||
|
||||
(defun my/text-scale--resize-fragment (ov)
|
||||
(overlay-put
|
||||
ov 'display
|
||||
(cons 'image
|
||||
(plist-put
|
||||
(cdr (overlay-get ov 'display))
|
||||
'margin 'right-margin)))
|
||||
(overlay-put
|
||||
ov 'display
|
||||
(cons 'image
|
||||
(plist-put
|
||||
(cdr (overlay-get ov 'display))
|
||||
:scale 7.0))))
|
||||
|
||||
(defun list-overlays-at (&optional pos)
|
||||
"Describe overlays at POS or point."
|
||||
(interactive)
|
||||
(setq pos (or pos (point)))
|
||||
(let ((overlays (overlays-at pos))
|
||||
(obuf (current-buffer))
|
||||
(buf (get-buffer-create "*Overlays*"))
|
||||
(props '(priority window category face mouse-face display
|
||||
help-echo modification-hooks insert-in-front-hooks
|
||||
insert-behind-hooks invisible intangible
|
||||
isearch-open-invisible isearch-open-invisible-temporary
|
||||
before-string after-string evaporate local-map keymap
|
||||
field))
|
||||
start end text)
|
||||
(if (not overlays)
|
||||
(message "None.")
|
||||
(set-buffer buf)
|
||||
(erase-buffer)
|
||||
(dolist (o overlays)
|
||||
(setq start (overlay-start o)
|
||||
end (overlay-end o)
|
||||
text (with-current-buffer obuf
|
||||
(buffer-substring start end)))
|
||||
(when (> (- end start) 13)
|
||||
(setq text (concat (substring text 1 10) "...")))
|
||||
(insert (format "From %d to %d: \"%s\":\n" start end text))
|
||||
(dolist (p props)
|
||||
(when (overlay-get o p)
|
||||
(insert (format " %15S: %S\n" p (overlay-get o p))))))
|
||||
(pop-to-buffer buf))))
|
||||
|
||||
(defun eshell-fn-on-files (fun1 fun2 args)
|
||||
"Call FUN1 on the first element in list, ARGS.
|
||||
Call FUN2 on all the rest of the elements in ARGS."
|
||||
(unless (null args)
|
||||
(let ((filenames (flatten-list args)))
|
||||
(funcall fun1 (car filenames))
|
||||
(when (cdr filenames)
|
||||
(mapcar fun2 (cdr filenames))))
|
||||
;; Return an empty string, as the return value from `fun1'
|
||||
;; probably isn't helpful to display in the `eshell' window.
|
||||
""))
|
||||
|
||||
(defun eshell/ff (&rest files)
|
||||
"find-file on first arg, find-file-other-window on rest"
|
||||
(eshell-fn-on-files 'find-file 'find-file-other-window files))
|
||||
|
||||
(defun eshell/f (&rest files)
|
||||
"Edit one or more files in another window."
|
||||
(eshell-fn-on-files 'find-file-other-window 'find-file-other-window files))
|
||||
|
||||
(defalias 'eshell/emacs 'eshell/ff)
|
||||
(defalias 'eshell/vi 'eshell/ff)
|
||||
(defalias 'eshell/vim 'eshell/ff)
|
||||
(defalias 'eshell/nv 'eshell/ff)
|
||||
(defalias 'eshell/nvim 'eshell/ff)
|
||||
|
||||
(defun eshell/less (&rest files)
|
||||
"view-file-other-window"
|
||||
(view-file-other-window files))
|
||||
|
||||
(defalias 'eshell/more 'eshell/less)
|
||||
|
||||
(defun my/eshell-exit-with-window ()
|
||||
(when (not (one-window-p))
|
||||
(delete-window)))
|
||||
|
||||
(advice-add 'eshell-life-is-too-much :after 'my/eshell-exit-with-window)
|
||||
|
||||
(defun eshell/do (&rest args)
|
||||
"Execute a command sequence over a collection of file elements.
|
||||
Separate the sequence and the elements with a `::' string.
|
||||
For instance:
|
||||
|
||||
do chown _ angela :: *.org(u'oscar')
|
||||
|
||||
The function substitutes the `_' sequence to a single filename
|
||||
element, and if not specified, it appends the file name to the
|
||||
command. So the following works as expected:
|
||||
|
||||
do chmod a+x :: *.org"
|
||||
(seq-let (forms elements) (-split-on "::" args)
|
||||
(dolist (element (-flatten (-concat elements)))
|
||||
(message "Working on %s ... %s" element forms)
|
||||
(let* ((form (if (-contains? forms "_")
|
||||
(-replace "_" element forms)
|
||||
(-snoc forms element)))
|
||||
(cmd (car form))
|
||||
(args (cdr form)))
|
||||
(eshell-named-command cmd args)))))
|
||||
|
||||
(defun eshell--buffer-from-dir (dir)
|
||||
"Return buffer name of an Eshell based on DIR."
|
||||
(format "*eshell: %s*"
|
||||
(thread-first dir
|
||||
(split-string "/" t)
|
||||
(last)
|
||||
(car))))
|
||||
|
||||
(defun eshell-there (parent)
|
||||
"Open an eshell session in a PARENT directory.
|
||||
The window is smaller and named after this directory.
|
||||
If an Eshell is already present that has been named
|
||||
after PARENT, pop to that buffer instead."
|
||||
(if-let* ((term-name (eshell--buffer-from-dir parent))
|
||||
(buf-name (seq-contains (buffer-list) term-name
|
||||
(lambda (a b) (string-equal (buffer-name b) a)))))
|
||||
(pop-to-buffer buf-name)
|
||||
|
||||
(let* ((default-directory parent)
|
||||
(height (/ (window-total-height) 3)))
|
||||
(split-window-vertically (- height))
|
||||
(other-window 1)
|
||||
(setq eshell-buffer-name term-name)
|
||||
(eshell))))
|
||||
|
||||
(defun eshell-here ()
|
||||
"Opens a new shell in the directory of the current buffer.
|
||||
Renames the eshell buffer to match that directory to allow more
|
||||
than one eshell window."
|
||||
(interactive)
|
||||
(eshell-there (if (buffer-file-name)
|
||||
(file-name-directory (buffer-file-name))
|
||||
default-directory)))
|
||||
|
||||
(bind-key "C-`" 'eshell-here)
|
||||
|
||||
(defun ha-eshell-send (command &optional dir)
|
||||
"Send COMMAND to the Eshell buffer named with DIR.
|
||||
The Eshell may have moved away from the directory originally
|
||||
opened with DIR, but it should have the name of the buffer.
|
||||
See `eshell--buffer-from-dir'."
|
||||
(interactive "sCommand to Send: ")
|
||||
(unless dir
|
||||
(setq dir (projectile-project-root)))
|
||||
(save-window-excursion
|
||||
(eshell-there dir)
|
||||
(goto-char (point-max))
|
||||
(insert command)
|
||||
(eshell-send-input)))
|
||||
|
||||
(defun execute-command-on-file-buffer (cmd)
|
||||
"Executes a shell command, CMD, on the current buffer's file.
|
||||
Appends the filename to the command if not specified, so:
|
||||
|
||||
chmod a+x
|
||||
|
||||
Works as expected. We replace the special variable `$$' with the
|
||||
filename of the buffer. Note that `eshell-command' executes this
|
||||
command, so eshell modifiers are available, for instance:
|
||||
|
||||
mv $$ $$(:r).txt
|
||||
|
||||
Will rename the current file to now have a .txt extension.
|
||||
See `eshell-display-modifier-help' for details on that."
|
||||
(interactive "sExecute command on File Buffer: ")
|
||||
(let* ((file-name (buffer-file-name))
|
||||
(full-cmd (cond ((string-match (rx "$$") cmd)
|
||||
(replace-regexp-in-string (rx "$$") file-name cmd))
|
||||
((and file-name (string-match (rx (literal file-name)) cmd))
|
||||
cmd)
|
||||
(t
|
||||
(concat cmd " " file-name)))))
|
||||
(message "Executing: %s" full-cmd)
|
||||
(eshell-command full-cmd)))
|
||||
|
||||
(use-package! eshell
|
||||
;;:type built-in
|
||||
;;:custom (eshell-banner-message '(ha-eshell-banner))
|
||||
|
||||
:init
|
||||
(setq eshell-error-if-no-glob t
|
||||
;; This jumps back to the prompt:
|
||||
eshell-scroll-to-bottom-on-input 'all
|
||||
eshell-hist-ignoredups t
|
||||
eshell-save-history-on-exit t
|
||||
|
||||
;; Since eshell starts fast, let's dismiss it on exit:
|
||||
eshell-kill-on-exit t
|
||||
eshell-destroy-buffer-when-process-dies t
|
||||
|
||||
;; Can you remember the parameter differences between the
|
||||
;; executables `chmod' and `find' and their Emacs counterpart?
|
||||
;; Me neither, so this makes it act a bit more shell-like:
|
||||
eshell-prefer-lisp-functions nil))
|
||||
|
|
|
@ -25,15 +25,15 @@
|
|||
;;helm ; the *other* search engine for love and life
|
||||
;;ido ; the other *other* search engine...
|
||||
;;ivy ; a search engine for love and life
|
||||
vertico ; the search engine of the future
|
||||
(vertico +icons) ; the search engine of the future
|
||||
|
||||
: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) ; 🙂
|
||||
hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW
|
||||
(emoji +unicode) ; 🙂
|
||||
;;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
|
||||
|
@ -43,27 +43,27 @@
|
|||
;;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
|
||||
;;tabs ; a tab bar for Emacs
|
||||
treemacs ; a project drawer, like neotree but cooler
|
||||
;;unicode ; extended unicode support for various languages
|
||||
(vc-gutter +pretty) ; 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
|
||||
zen ; distraction-free coding or writing
|
||||
|
||||
:editor
|
||||
;; (evil +everywhere)
|
||||
(evil); come to the dark side, we have cookies
|
||||
;; (evil +everywhere) ; come to the dark side, we have cookies
|
||||
evil
|
||||
file-templates ; auto-snippets for empty files
|
||||
fold ; (nigh) universal code folding
|
||||
;;(format +onsave) ; automated prettiness
|
||||
format ; automated prettiness
|
||||
format
|
||||
;;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
|
||||
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
|
||||
|
@ -83,23 +83,24 @@
|
|||
|
||||
:checkers
|
||||
syntax ; tasing you for every semicolon you forget
|
||||
(spell +flyspell) ; tasing you for misspelling mispelling
|
||||
;; (spell +flyspell) ; tasing you for misspelling mispelling
|
||||
spell ; tasing you for misspelling mispelling
|
||||
;;grammar ; tasing grammar mistake every you make
|
||||
|
||||
:tools
|
||||
;;ansible
|
||||
;;biblio ; Writes a PhD for you (citation needed)
|
||||
;;debugger ; FIXME stepping through code, to help you add bugs
|
||||
;;(debugger +lsp) ; 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
|
||||
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 +dictionary +offline) ; navigate your code and its documentation
|
||||
lsp ; M-x vscode
|
||||
magit ; a git porcelain for Emacs
|
||||
;;make ; run make tasks from Emacs
|
||||
make ; run make tasks from Emacs
|
||||
;;pass ; password manager for nerds
|
||||
;;pdf ; pdf enhancements
|
||||
;;prodigy ; FIXME managing external services & code builders
|
||||
|
@ -147,7 +148,7 @@
|
|||
;;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
|
||||
latex ; writing papers in Emacs has never been so fun
|
||||
;;lean ; for folks with too much to prove
|
||||
;;ledger ; be audit you can be
|
||||
;;lua ; one-based indices? one-based indices
|
||||
|
@ -174,7 +175,7 @@
|
|||
;;solidity ; do you need a blockchain? No.
|
||||
;;swift ; who asked for emoji variables?
|
||||
;;terra ; Earth and Moon in alignment for performance.
|
||||
;;web ; the tubes
|
||||
(web +lsp) ; the tubes
|
||||
yaml ; JSON, but readable
|
||||
;;zig ; C, but simpler
|
||||
|
||||
|
@ -184,13 +185,13 @@
|
|||
;;(wanderlust +gmail)
|
||||
|
||||
:app
|
||||
;;calendar
|
||||
calendar
|
||||
;;emms
|
||||
;;everywhere ; *leave* Emacs!? You must be joking
|
||||
irc ; how neckbeards socialize
|
||||
(rss +org) ; emacs as an RSS reader
|
||||
;;irc ; how neckbeards socialize
|
||||
;;(rss +org) ; emacs as an RSS reader
|
||||
;;twitter ; twitter client https://twitter.com/vnought
|
||||
|
||||
:config
|
||||
;;literate
|
||||
literate
|
||||
(default +bindings +smartparens))
|
||||
|
|
|
@ -37,3 +37,18 @@
|
|||
|
||||
(package! elpher)
|
||||
(package! eww)
|
||||
(package! math-symbol-lists)
|
||||
(package! company-emoji)
|
||||
|
||||
(if (>= emacs-major-version 27)
|
||||
(progn
|
||||
(unpin! org-roam)
|
||||
(package! org-roam-ui)
|
||||
(package! simple-httpd)
|
||||
(package! websocket)))
|
||||
|
||||
(package! org-bullets
|
||||
:recipe (:host github :repo "sabof/org-bullets"))
|
||||
|
||||
(package! org-anki)
|
||||
(package! wrap-region)
|
||||
|
|
Loading…
Reference in New Issue