💥 Move dired, electric-indent, eshell, imenu, term modules to :emacs
This commit is contained in:
parent
0c0276378f
commit
e2d055a40b
12 changed files with 21 additions and 19 deletions
|
@ -1,61 +0,0 @@
|
|||
;;; tools/dired/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(def-package! dired
|
||||
:defer t
|
||||
:init
|
||||
(setq ;; Always copy/delete recursively
|
||||
dired-recursive-copies 'always
|
||||
dired-recursive-deletes 'top
|
||||
;; Auto refresh dired, but be quiet about it
|
||||
global-auto-revert-non-file-buffers t
|
||||
auto-revert-verbose nil
|
||||
;; files
|
||||
image-dired-dir (concat doom-cache-dir "image-dired/")
|
||||
image-dired-db-file (concat image-dired-dir "db.el")
|
||||
image-dired-gallery-dir (concat image-dired-dir "gallery/")
|
||||
image-dired-temp-image-file (concat image-dired-dir "temp-image")
|
||||
image-dired-temp-rotate-image-file (concat image-dired-dir "temp-rotate-image"))
|
||||
:config
|
||||
(defun +dired|sort-directories-first ()
|
||||
"List directories first in dired buffers."
|
||||
(save-excursion
|
||||
(let (buffer-read-only)
|
||||
(forward-line 2) ;; beyond dir. header
|
||||
(sort-regexp-fields t "^.*$" "[ ]*." (point) (point-max))))
|
||||
(and (featurep 'xemacs)
|
||||
(fboundp 'dired-insert-set-properties)
|
||||
(dired-insert-set-properties (point-min) (point-max)))
|
||||
(set-buffer-modified-p nil))
|
||||
(add-hook 'dired-after-readin-hook #'+dired|sort-directories-first)
|
||||
|
||||
;; Automatically create missing directories when creating new files
|
||||
(defun +dired|create-non-existent-directory ()
|
||||
(let ((parent-directory (file-name-directory buffer-file-name)))
|
||||
(when (and (not (file-exists-p parent-directory))
|
||||
(y-or-n-p (format "Directory `%s' does not exist! Create it?" parent-directory)))
|
||||
(make-directory parent-directory t))))
|
||||
(push #'+dired|create-non-existent-directory find-file-not-found-functions)
|
||||
|
||||
;; Kill buffer when quitting dired buffers
|
||||
(define-key dired-mode-map [remap quit-window] (λ! (quit-window t))))
|
||||
|
||||
|
||||
(def-package! dired-k
|
||||
:after dired
|
||||
:config
|
||||
(add-hook 'dired-initial-position-hook #'dired-k)
|
||||
(add-hook 'dired-after-readin-hook #'dired-k-no-revert)
|
||||
|
||||
(defun +dired*interrupt-process (orig-fn &rest args)
|
||||
"Fixes dired-k killing git processes too abruptly, leaving behind disruptive
|
||||
.git/index.lock files."
|
||||
(cl-letf (((symbol-function #'kill-process)
|
||||
(symbol-function #'interrupt-process)))
|
||||
(apply orig-fn args)))
|
||||
(advice-add #'dired-k--start-git-status :around #'+dired*interrupt-process)
|
||||
|
||||
(defun +dired*dired-k-highlight (orig-fn &rest args)
|
||||
"Butt out if the requested directory is remote (i.e. through tramp)."
|
||||
(unless (file-remote-p default-directory)
|
||||
(apply orig-fn args)))
|
||||
(advice-add #'dired-k--highlight :around #'+dired*dired-k-highlight))
|
|
@ -1,5 +0,0 @@
|
|||
;; -*- no-byte-compile: t; -*-
|
||||
;;; emacs/dired/packages.el
|
||||
|
||||
(package! dired-k)
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
;;; tools/electric-indent/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
;; Smarter, keyword-based electric-indent
|
||||
|
||||
(defvar doom-electric-indent-p nil
|
||||
"TODO")
|
||||
|
||||
(defvar-local doom-electric-indent-words '()
|
||||
"TODO")
|
||||
|
||||
(def-setting! :electric (modes &rest plist)
|
||||
"Declare :words (list of strings) or :chars (lists of chars) in MODES that
|
||||
trigger electric indentation."
|
||||
(declare (indent 1))
|
||||
(let ((modes (doom-enlist (doom-unquote modes)))
|
||||
(chars (doom-unquote (plist-get plist :chars)))
|
||||
(words (doom-unquote (plist-get plist :words))))
|
||||
(when (or chars words)
|
||||
(let ((fn-name (intern (format "doom--init-electric-%s" (mapconcat #'symbol-name modes "-")))))
|
||||
`(progn
|
||||
(defun ,fn-name ()
|
||||
(electric-indent-local-mode +1)
|
||||
,@(if chars `((setq electric-indent-chars ',chars)))
|
||||
,@(if words `((setq doom-electric-indent-words ',words))))
|
||||
(add-hook! ,modes #',fn-name))))))
|
||||
|
||||
;;
|
||||
(after! electric
|
||||
(setq-default electric-indent-chars '(?\n ?\^?))
|
||||
|
||||
(defun +electric-indent|char (_c)
|
||||
(when (and (eolp) doom-electric-indent-words)
|
||||
(save-excursion
|
||||
(backward-word)
|
||||
(looking-at-p
|
||||
(concat "\\<" (regexp-opt doom-electric-indent-words))))))
|
||||
(add-to-list 'electric-indent-functions #'+electric-indent|char))
|
||||
|
|
@ -1,238 +0,0 @@
|
|||
;;; tools/eshell/autoload/eshell.el -*- lexical-binding: t; -*-
|
||||
|
||||
;;;###autoload
|
||||
(defface +eshell-prompt-pwd '((t :inherit eshell-prompt))
|
||||
"TODO"
|
||||
:group 'eshell)
|
||||
|
||||
;;;###autoload
|
||||
(defface +eshell-prompt-git-branch '((t :inherit font-lock-function-name-face))
|
||||
"TODO"
|
||||
:group 'eshell)
|
||||
|
||||
;;;###autoload
|
||||
(defface +eshell-prompt-char '((t :inherit font-lock-constant-face))
|
||||
"TODO"
|
||||
:group 'eshell)
|
||||
|
||||
|
||||
(defvar +eshell-buffers (make-ring 25)
|
||||
"List of open eshell buffers.")
|
||||
|
||||
(defvar +eshell-buffer-name "*doom eshell*"
|
||||
"The name to use for custom eshell buffers. This only affects `+eshell/open',
|
||||
`+eshell/open-popup' and `+eshell/open-workspace'.")
|
||||
|
||||
(defvar +eshell-last-buffer nil
|
||||
"TODO")
|
||||
|
||||
|
||||
;;
|
||||
;; Library
|
||||
;;
|
||||
|
||||
(defun +eshell--add-buffer (buf)
|
||||
(ring-remove+insert+extend +eshell-buffers buf))
|
||||
|
||||
(defun +eshell--remove-buffer (buf)
|
||||
(when-let* ((idx (ring-member +eshell-buffers buf)))
|
||||
(ring-remove +eshell-buffers idx)
|
||||
t))
|
||||
|
||||
(defun +eshell--current-git-branch ()
|
||||
(let ((branch (car (cl-loop for match in (split-string (shell-command-to-string "git branch") "\n")
|
||||
if (string-match-p "^\*" match)
|
||||
collect match))))
|
||||
(if (not (eq branch nil))
|
||||
(format " [%s]" (substring branch 2))
|
||||
"")))
|
||||
|
||||
(defun +eshell--buffer (&optional new-p)
|
||||
(or (unless new-p
|
||||
(cl-loop for buf in (ring-elements +eshell-buffers)
|
||||
if (and (buffer-live-p buf)
|
||||
(not (get-buffer-window buf)))
|
||||
return buf))
|
||||
(generate-new-buffer +eshell-buffer-name)))
|
||||
|
||||
(defun +eshell--set-window (window &optional flag)
|
||||
(when window
|
||||
(set-window-parameter window 'no-other-window flag)
|
||||
(set-window-parameter window 'visible flag)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +eshell-prompt ()
|
||||
"Generate the prompt string for eshell. Use for `eshell-prompt-function'."
|
||||
(concat (propertize (abbreviate-file-name (eshell/pwd)) 'face '+eshell-prompt-pwd)
|
||||
(propertize (+eshell--current-git-branch) 'face '+eshell-prompt-git-branch)
|
||||
(propertize " λ " 'face '+eshell-prompt-char)))
|
||||
|
||||
|
||||
;;
|
||||
;; Commands
|
||||
;;
|
||||
|
||||
;;;###autoload
|
||||
(defun +eshell/open (&optional command)
|
||||
"Open eshell in the current buffer."
|
||||
(interactive)
|
||||
(let ((buf (+eshell--buffer (eq major-mode 'eshell-mode))))
|
||||
(switch-to-buffer buf)
|
||||
(+eshell--set-window (get-buffer-window buf) t)
|
||||
(with-current-buffer buf
|
||||
(unless (eq major-mode 'eshell-mode) (eshell-mode)))
|
||||
(when command
|
||||
(+eshell-run-command command))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +eshell/open-popup (&optional command)
|
||||
"Open eshell in a popup window."
|
||||
(interactive)
|
||||
(let ((buf (+eshell--buffer)))
|
||||
(with-current-buffer buf
|
||||
(unless (eq major-mode 'eshell-mode) (eshell-mode)))
|
||||
(pop-to-buffer buf)
|
||||
(+eshell--set-window (get-buffer-window buf) t)
|
||||
(when command
|
||||
(+eshell-run-command command))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +eshell/open-workspace (&optional command)
|
||||
"Open eshell in a separate workspace. Requires the (:feature workspaces)
|
||||
module to be loaded."
|
||||
(interactive)
|
||||
(unless (featurep! :feature workspaces)
|
||||
(user-error ":feature workspaces is required, but disabled"))
|
||||
(unless (+workspace-get "eshell" t)
|
||||
(+workspace/new "eshell"))
|
||||
(if-let* ((buf (cl-find-if (lambda (buf) (eq 'eshell-mode (buffer-local-value 'major-mode buf)))
|
||||
(doom-visible-windows)
|
||||
:key #'window-buffer)))
|
||||
(select-window (get-buffer-window buf))
|
||||
(+eshell/open))
|
||||
(when command
|
||||
(+eshell-run-command command))
|
||||
(+eshell--set-window (selected-window) t)
|
||||
(doom/workspace-display))
|
||||
|
||||
(defun +eshell-run-command (command)
|
||||
(unless (cl-remove-if-not #'buffer-live-p +eshell-buffers)
|
||||
(user-error "No living eshell buffers available"))
|
||||
(with-current-buffer (car +eshell-buffers)
|
||||
(goto-char eshell-last-output-end)
|
||||
(when (bound-and-true-p evil-mode)
|
||||
(call-interactively #'evil-append-line))
|
||||
(insert command)
|
||||
(eshell-send-input nil t)))
|
||||
|
||||
|
||||
;;
|
||||
;; Hooks
|
||||
;;
|
||||
|
||||
;;;###autoload
|
||||
(defun +eshell|init ()
|
||||
"Keep track of eshell buffers."
|
||||
(let ((buf (current-buffer)))
|
||||
(dolist (buf (ring-elements +eshell-buffers))
|
||||
(unless (buffer-live-p buf)
|
||||
(+eshell--remove-buffer buf)))
|
||||
(+eshell--add-buffer buf)
|
||||
(setq +eshell-last-buffer buf)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +eshell|cleanup ()
|
||||
"Close window (or workspace) on quit."
|
||||
(let ((buf (current-buffer)))
|
||||
(when (+eshell--remove-buffer buf)
|
||||
(+eshell--set-window (get-buffer-window buf) nil)
|
||||
(cond ((and (featurep! :feature workspaces)
|
||||
(string= "eshell" (+workspace-current-name)))
|
||||
(+workspace/delete "eshell"))
|
||||
((one-window-p)
|
||||
(unless (doom-real-buffer-p (progn (previous-buffer) (current-buffer)))
|
||||
(switch-to-buffer (doom-fallback-buffer))))
|
||||
((and (fboundp '+popup-window-p) (+popup-window-p))
|
||||
(delete-window))))))
|
||||
|
||||
|
||||
;;
|
||||
;; Keybinds
|
||||
;;
|
||||
|
||||
;;;###autoload
|
||||
(defun +eshell/quit-or-delete-char (arg)
|
||||
"Delete a character (ahead of the cursor) or quit eshell if there's nothing to
|
||||
delete."
|
||||
(interactive "p")
|
||||
(if (and (eolp) (looking-back eshell-prompt-regexp nil))
|
||||
(eshell-life-is-too-much)
|
||||
(delete-char arg)))
|
||||
|
||||
(defsubst +eshell--bury-buffer ()
|
||||
(unless (switch-to-prev-buffer nil 'bury)
|
||||
(switch-to-buffer (doom-fallback-buffer))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +eshell/split-below ()
|
||||
"Create a new eshell window below the current one."
|
||||
(interactive)
|
||||
(select-window (split-window-vertically))
|
||||
(+eshell--bury-buffer))
|
||||
|
||||
;;;###autoload
|
||||
(defun +eshell/split-right ()
|
||||
"Create a new eshell window to the right of the current one."
|
||||
(interactive)
|
||||
(select-window (split-window-horizontally))
|
||||
(+eshell--bury-buffer))
|
||||
|
||||
;; `make-ring'
|
||||
;; `ring-ref'
|
||||
;; `ring-empty-p'
|
||||
;; `ring-remove'
|
||||
|
||||
;;;###autoload
|
||||
(defun +eshell/next ()
|
||||
"Switch to the next eshell buffer."
|
||||
(interactive)
|
||||
(when (ring-empty-p +eshell-buffers)
|
||||
(user-error "No eshell buffers are available"))
|
||||
(switch-to-buffer (ring-next +eshell-buffers (current-buffer))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +eshell/previous ()
|
||||
"Switch to the previous eshell buffer."
|
||||
(interactive)
|
||||
(when (ring-empty-p +eshell-buffers)
|
||||
(user-error "No eshell buffers are available"))
|
||||
(switch-to-buffer (ring-previous +eshell-buffers (current-buffer))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +eshell/open-last ()
|
||||
"Switch to the last eshell buffer that was open (and is still alive)."
|
||||
(interactive)
|
||||
(unless (buffer-live-p +eshell-last-buffer)
|
||||
(setq +eshell-last-buffer nil)
|
||||
(user-error "No last eshell buffer to jump to"))
|
||||
(switch-to-buffer +eshell-last-buffer))
|
||||
|
||||
;;;###autoload
|
||||
(defun +eshell/switch (buffer)
|
||||
"Interactively switch to another eshell buffer."
|
||||
(interactive
|
||||
(let ((buffers (cl-remove-if-not (lambda (buf) (eq (buffer-local-value 'major-mode buf) 'eshell-mode))
|
||||
(delete (current-buffer) (ring-elements +eshell-buffers)))))
|
||||
(if (not buffers)
|
||||
(user-error "No eshell buffers are available")
|
||||
(list (completing-read
|
||||
"Eshell buffers"
|
||||
(mapcar #'buffer-name buffers)
|
||||
#'get-buffer
|
||||
'require-match
|
||||
nil nil
|
||||
(when (eq major-mode 'eshell-mode)
|
||||
(buffer-name (current-buffer))))))))
|
||||
(if-let* ((window (get-buffer-window buffer)))
|
||||
(select-window window)
|
||||
(switch-to-buffer buffer)))
|
|
@ -1,63 +0,0 @@
|
|||
;;; tools/eshell/autoload/evil.el -*- lexical-binding: t; -*-
|
||||
;;;###if (featurep! :feature evil)
|
||||
|
||||
;;;###autoload
|
||||
(defun +eshell|goto-prompt-on-insert ()
|
||||
"Move cursor to the prompt when switching to insert mode (if point isn't
|
||||
already there)."
|
||||
(when (< (point) eshell-last-output-end)
|
||||
(goto-char
|
||||
(if (memq this-command '(evil-append evil-append-line))
|
||||
(point-max)
|
||||
eshell-last-output-end))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +eshell/goto-end-of-prompt ()
|
||||
"Move cursor to the prompt when switching to insert mode (if point isn't
|
||||
already there)."
|
||||
(interactive)
|
||||
(goto-char (point-max))
|
||||
(evil-append 1))
|
||||
|
||||
;;;###autoload (autoload '+eshell:run "tools/eshell/autoload/evil" nil t)
|
||||
(evil-define-command +eshell:run (command bang)
|
||||
;; TODO Add COMMAND support
|
||||
(interactive "<fsh><!>")
|
||||
(if bang
|
||||
(+eshell/open command)
|
||||
(+eshell/open-popup command)))
|
||||
|
||||
;;;###autoload (autoload '+eshell/evil-change "tools/eshell/autoload/evil" nil t)
|
||||
(evil-define-operator +eshell/evil-change (beg end type register yank-handler delete-func)
|
||||
"Like `evil-change' but will not delete/copy the prompt."
|
||||
(interactive "<R><x><y>")
|
||||
(save-restriction
|
||||
(narrow-to-region eshell-last-output-end (point-max))
|
||||
(evil-change (max beg (point-min))
|
||||
(if (eq type 'line) (point-max) (min (or end (point-max)) (point-max)))
|
||||
type register yank-handler delete-func)))
|
||||
|
||||
;;;###autoload (autoload '+eshell/evil-change-line "tools/eshell/autoload/evil" nil t)
|
||||
(evil-define-operator +eshell/evil-change-line (beg end type register yank-handler)
|
||||
"Change to end of line."
|
||||
:motion evil-end-of-line
|
||||
(interactive "<R><x><y>")
|
||||
(+eshell/evil-change beg end type register yank-handler #'evil-delete-line))
|
||||
|
||||
;;;###autoload (autoload '+eshell/evil-delete "tools/eshell/autoload/evil" nil t)
|
||||
(evil-define-operator +eshell/evil-delete (beg end type register yank-handler)
|
||||
"Like `evil-delete' but will not delete/copy the prompt."
|
||||
(interactive "<R><x><y>")
|
||||
(save-restriction
|
||||
(narrow-to-region eshell-last-output-end (point-max))
|
||||
(evil-delete (if beg (max beg (point-min)) (point-min))
|
||||
(if (eq type 'line) (point-max) (min (or end (point-max)) (point-max)))
|
||||
type register yank-handler)))
|
||||
|
||||
;;;###autoload (autoload '+eshell/evil-delete-line "tools/eshell/autoload/evil" nil t)
|
||||
(evil-define-operator +eshell/evil-delete-line (_beg end type register yank-handler)
|
||||
"Change to end of line."
|
||||
:motion nil
|
||||
:keep-visual t
|
||||
(interactive "<R><x>")
|
||||
(+eshell/evil-delete (point) end type register yank-handler))
|
|
@ -1,74 +0,0 @@
|
|||
;;; tools/eshell/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
;; see:
|
||||
;; + `+eshell/open': open in current buffer
|
||||
;; + `+eshell/open-popup': open in a popup
|
||||
;; + `+eshell/open-workspace': open in separate tab (requires :feature
|
||||
;; workspaces)
|
||||
|
||||
(def-package! eshell ; built-in
|
||||
:defer t
|
||||
:init
|
||||
(setq eshell-directory-name
|
||||
(let ((dir (expand-file-name "eshell" doom-private-dir)))
|
||||
(if (file-directory-p dir)
|
||||
dir
|
||||
"~/.eshell"))
|
||||
eshell-scroll-to-bottom-on-input 'all
|
||||
eshell-scroll-to-bottom-on-output 'all
|
||||
eshell-buffer-shorthand t
|
||||
eshell-kill-processes-on-exit t
|
||||
eshell-error-if-no-glob t
|
||||
eshell-hist-ignoredups t
|
||||
;; em-prompt
|
||||
eshell-prompt-regexp "^.* λ "
|
||||
eshell-prompt-function #'+eshell-prompt
|
||||
;; em-glob
|
||||
eshell-glob-case-insensitive t
|
||||
eshell-error-if-no-glob t)
|
||||
|
||||
:config
|
||||
;; Consider eshell buffers real
|
||||
(defun +eshell-p (buf)
|
||||
(eq (buffer-local-value 'major-mode buf) 'eshell-mode))
|
||||
(add-to-list 'doom-real-buffer-functions #'+eshell-p #'eq)
|
||||
|
||||
;; Keep track of open eshell buffers
|
||||
(add-hook 'eshell-mode-hook #'+eshell|init)
|
||||
(add-hook 'eshell-exit-hook #'+eshell|cleanup)
|
||||
|
||||
(after! em-term
|
||||
;; Visual commands require a proper terminal. Eshell can't handle that, so
|
||||
;; it delegates these commands to a term buffer.
|
||||
(setq eshell-visual-commands
|
||||
(append eshell-visual-commands '("tmux" "htop" "bash" "zsh" "fish" "vim" "nvim"))
|
||||
eshell-visual-subcommands '(("git" "log" "l" "diff" "show"))))
|
||||
|
||||
(defun +eshell|init-evil ()
|
||||
"Replace `evil-collection-eshell-next-prompt-on-insert' with
|
||||
`+eshell|goto-prompt-on-insert'."
|
||||
(dolist (hook '(evil-replace-state-entry-hook evil-insert-state-entry-hook))
|
||||
(remove-hook hook 'evil-collection-eshell-next-prompt-on-insert t)
|
||||
(add-hook hook '+eshell|goto-prompt-on-insert nil t)))
|
||||
(add-hook 'eshell-mode-hook #'+eshell|init-evil)
|
||||
|
||||
(defun +eshell|init-keymap ()
|
||||
"Setup eshell keybindings. This must be done in a hook because eshell-mode
|
||||
redefines its keys every time `eshell-mode' is enabled."
|
||||
(map! :map eshell-mode-map
|
||||
:n [return] #'+eshell/goto-end-of-prompt
|
||||
:n "c" #'+eshell/evil-change
|
||||
:n "C" #'+eshell/evil-change-line
|
||||
:n "d" #'+eshell/evil-delete
|
||||
:n "D" #'+eshell/evil-delete-line
|
||||
:i "C-d" #'+eshell/quit-or-delete-char
|
||||
:i "C-p" #'eshell-previous-input
|
||||
:i "C-n" #'eshell-next-input
|
||||
[remap doom/backward-to-bol-or-indent] #'eshell-bol
|
||||
[remap doom/backward-kill-to-bol-and-indent] #'eshell-kill-input
|
||||
[remap split-window-below] #'+eshell/split-below
|
||||
[remap split-window-right] #'+eshell/split-right
|
||||
[remap evil-window-split] #'+eshell/split-below
|
||||
[remap evil-window-vsplit] #'+eshell/split-right))
|
||||
(add-hook 'eshell-first-time-mode-hook #'+eshell|init-keymap))
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
;;; tools/imenu/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
;; `imenu-anywhere'
|
||||
(setq imenu-anywhere-delimiter ": ")
|
||||
|
||||
|
||||
(after! imenu-list
|
||||
(setq imenu-list-idle-update-delay 0.5)
|
||||
|
||||
(set! :popup "^\\*Ilist"
|
||||
'((side . right) (size . 35))
|
||||
'((quit . current) (select) (transient . 0)))
|
||||
|
||||
(defun +imenu|cleanup-on-popup-close ()
|
||||
"Clean up after `imenu-list-minor-mode' when killing the list window."
|
||||
(unless +popup-buffer-mode
|
||||
(when imenu-list--displayed-buffer
|
||||
(with-current-buffer imenu-list--displayed-buffer
|
||||
(imenu-list-minor-mode -1)))
|
||||
(when (equal (buffer-name) imenu-list-buffer-name)
|
||||
(kill-buffer (get-buffer imenu-list-buffer-name)))))
|
||||
(add-hook '+popup-buffer-mode-hook #'+imenu|cleanup-on-popup-close))
|
|
@ -1,5 +0,0 @@
|
|||
;; -*- no-byte-compile: t; -*-
|
||||
;;; tools/imenu/packages.el
|
||||
|
||||
(package! imenu-anywhere)
|
||||
(package! imenu-list)
|
|
@ -1,29 +0,0 @@
|
|||
;;; tools/term/autoload.el -*- lexical-binding: t; -*-
|
||||
|
||||
;;;###autoload
|
||||
(defun +term/open (&optional project-root)
|
||||
"Open a terminal buffer in the current window. If PROJECT-ROOT (C-u) is
|
||||
non-nil, cd into the current project's root."
|
||||
(interactive "P")
|
||||
(let ((default-directory (if project-root (doom-project-root 'nocache) default-directory)))
|
||||
(call-interactively #'multi-term)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +term/open-popup (arg)
|
||||
"Open a terminal popup window. If ARG (universal argument) is
|
||||
non-nil, cd into the current project's root."
|
||||
(interactive "P")
|
||||
(require 'multi-term)
|
||||
(let ((default-directory (if arg (doom-project-root 'nocache) default-directory))
|
||||
(buffer (multi-term-get-buffer current-prefix-arg)))
|
||||
(pop-to-buffer buffer)
|
||||
(setq multi-term-buffer-list (nconc multi-term-buffer-list (list buffer)))
|
||||
(multi-term-internal)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +term/open-popup-in-project (arg)
|
||||
"Open a terminal popup window in the root of the current project.
|
||||
|
||||
If ARG (universal argument) is non-nil, open it in `default-directory' instead."
|
||||
(interactive "P")
|
||||
(+term/open-popup (not arg)))
|
|
@ -1,14 +0,0 @@
|
|||
;;; tools/term/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
;; `multi-term'
|
||||
(setq multi-term-dedicated-window-height 20
|
||||
multi-term-switch-after-close 'PREVIOUS)
|
||||
|
||||
;; `term' (built-in)
|
||||
(after! term
|
||||
(set! :env "SHELL")
|
||||
|
||||
;; Consider term buffers real
|
||||
(defun +term-p (buf)
|
||||
(eq (buffer-local-value 'major-mode buf) 'term-mode))
|
||||
(add-to-list 'doom-real-buffer-functions #'+term-p #'eq))
|
|
@ -1,4 +0,0 @@
|
|||
;; -*- no-byte-compile: t; -*-
|
||||
;;; tools/term/packages.el
|
||||
|
||||
(package! multi-term)
|
Loading…
Add table
Add a link
Reference in a new issue