term/*: conform to new conventions
This commit is contained in:
parent
d5646d2b88
commit
703b58f325
5 changed files with 34 additions and 31 deletions
|
@ -10,7 +10,7 @@
|
|||
|
||||
|
||||
;;
|
||||
;; Helpers
|
||||
;;; Helpers
|
||||
|
||||
(defun +eshell--add-buffer (buf)
|
||||
(ring-remove+insert+extend +eshell-buffers buf 'grow))
|
||||
|
@ -75,7 +75,7 @@
|
|||
|
||||
|
||||
;;
|
||||
;; Commands
|
||||
;;; Commands
|
||||
|
||||
;;;###autoload
|
||||
(defun +eshell/toggle (arg &optional command)
|
||||
|
@ -146,7 +146,7 @@ Once the eshell process is killed, the previous frame layout is restored."
|
|||
|
||||
|
||||
;;
|
||||
;; Keybinds
|
||||
;;; Keybinds
|
||||
|
||||
;;;###autoload
|
||||
(defun +eshell/search-history ()
|
||||
|
@ -266,10 +266,10 @@ delete."
|
|||
|
||||
|
||||
;;
|
||||
;; Hooks
|
||||
;;; Hooks
|
||||
|
||||
;;;###autoload
|
||||
(defun +eshell|init ()
|
||||
(defun +eshell-init-h ()
|
||||
"Initialize and track this eshell buffer in `+eshell-buffers'."
|
||||
(let ((current-buffer (current-buffer)))
|
||||
(dolist (buf (+eshell-buffers))
|
||||
|
@ -280,7 +280,7 @@ delete."
|
|||
(setq +eshell--last-buffer current-buffer)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +eshell|cleanup ()
|
||||
(defun +eshell-cleanup-h ()
|
||||
"Close window (or workspace) on quit."
|
||||
(let ((buf (current-buffer)))
|
||||
(when (+eshell--remove-buffer buf)
|
||||
|
@ -307,13 +307,13 @@ delete."
|
|||
return (select-window win))))))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +eshell|switch-workspace (type)
|
||||
(defun +eshell-switch-workspace-fn (type)
|
||||
(when (eq type 'frame)
|
||||
(setq +eshell-buffers
|
||||
(or (persp-parameter 'eshell-buffers)
|
||||
(make-ring 25)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +eshell|save-workspace (_workspace target)
|
||||
(defun +eshell-save-workspace-fn (_workspace target)
|
||||
(when (framep target)
|
||||
(set-persp-parameter 'eshell-buffers +eshell-buffers)))
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
((+eshell/open-popup nil command)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +eshell*goto-prompt-on-insert ()
|
||||
(defun +eshell-goto-prompt-on-insert-a ()
|
||||
"Move cursor to the prompt when switching to insert mode (if point isn't
|
||||
already there).
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
"")))
|
||||
|
||||
;;;###autoload
|
||||
(defun +eshell-default-prompt ()
|
||||
(defun +eshell-default-prompt-fn ()
|
||||
"Generate the prompt string for eshell. Use for `eshell-prompt-function'."
|
||||
(concat (if (bobp) "" "\n")
|
||||
(let ((pwd (eshell/pwd)))
|
||||
|
|
|
@ -67,7 +67,7 @@ You should use `set-eshell-alias!' to change this.")
|
|||
eshell-input-filter (lambda (input) (not (string-match-p "\\`\\s-+" input)))
|
||||
;; em-prompt
|
||||
eshell-prompt-regexp "^.* λ "
|
||||
eshell-prompt-function #'+eshell-default-prompt
|
||||
eshell-prompt-function #'+eshell-default-prompt-fn
|
||||
;; em-glob
|
||||
eshell-glob-case-insensitive t
|
||||
eshell-error-if-no-glob t)
|
||||
|
@ -76,27 +76,27 @@ You should use `set-eshell-alias!' to change this.")
|
|||
(add-hook 'eshell-mode-hook #'doom-mark-buffer-as-real-h)
|
||||
|
||||
;; Keep track of open eshell buffers
|
||||
(add-hook 'eshell-mode-hook #'+eshell|init)
|
||||
(add-hook 'eshell-exit-hook #'+eshell|cleanup)
|
||||
(add-hook 'eshell-mode-hook #'+eshell-init-h)
|
||||
(add-hook 'eshell-exit-hook #'+eshell-cleanup-h)
|
||||
|
||||
;; Enable autopairing in eshell
|
||||
(add-hook 'eshell-mode-hook #'smartparens-mode)
|
||||
|
||||
;; Persp-mode/workspaces integration
|
||||
(when (featurep! :ui workspaces)
|
||||
(add-hook 'persp-activated-functions #'+eshell|switch-workspace)
|
||||
(add-hook 'persp-before-switch-functions #'+eshell|save-workspace))
|
||||
(add-hook 'persp-activated-functions #'+eshell-switch-workspace-fn)
|
||||
(add-hook 'persp-before-switch-functions #'+eshell-save-workspace-fn))
|
||||
|
||||
;; UI enhancements
|
||||
(defun +eshell|remove-fringes ()
|
||||
(add-hook 'eshell-mode-hook
|
||||
(defun +eshell-remove-fringes-h ()
|
||||
(set-window-fringes nil 0 0)
|
||||
(set-window-margins nil 1 nil))
|
||||
(add-hook 'eshell-mode-hook #'+eshell|remove-fringes)
|
||||
(set-window-margins nil 1 nil)))
|
||||
|
||||
(defun +eshell|enable-text-wrapping ()
|
||||
(add-hook 'eshell-mode-hook
|
||||
(defun +eshell-enable-text-wrapping-h ()
|
||||
(visual-line-mode +1)
|
||||
(set-display-table-slot standard-display-table 0 ?\ ))
|
||||
(add-hook 'eshell-mode-hook #'+eshell|enable-text-wrapping)
|
||||
(set-display-table-slot standard-display-table 0 ?\ )))
|
||||
|
||||
(add-hook 'eshell-mode-hook #'hide-mode-line-mode)
|
||||
|
||||
|
@ -109,15 +109,16 @@ You should use `set-eshell-alias!' to change this.")
|
|||
(after! em-term
|
||||
(pushnew! eshell-visual-commands "tmux" "htop" "vim" "nvim" "ncmpcpp"))
|
||||
|
||||
(defun +eshell|init-aliases ()
|
||||
(add-hook 'eshell-alias-load-hook
|
||||
(defun +eshell-init-aliases-h ()
|
||||
(setq +eshell--default-aliases eshell-command-aliases-list
|
||||
eshell-command-aliases-list
|
||||
(append eshell-command-aliases-list
|
||||
+eshell-aliases)))
|
||||
(add-hook 'eshell-alias-load-hook #'+eshell|init-aliases)
|
||||
+eshell-aliases))))
|
||||
|
||||
(when (featurep! :editor evil +everywhere)
|
||||
(advice-add #'evil-collection-eshell-next-prompt-on-insert :override #'+eshell*goto-prompt-on-insert))
|
||||
(advice-add #'evil-collection-eshell-next-prompt-on-insert
|
||||
:override #'+eshell-goto-prompt-on-insert-a))
|
||||
|
||||
(add-hook 'eshell-first-time-mode-hook
|
||||
(defun +eshell-init-keymap-h ()
|
||||
|
|
|
@ -9,7 +9,9 @@
|
|||
|
||||
(add-hook 'vterm-mode-hook #'doom-mark-buffer-as-real-h)
|
||||
;; Automatically kill buffer when vterm exits.
|
||||
(add-to-list 'vterm-exit-functions (lambda (buffer) (if buffer (kill-buffer buffer))))
|
||||
(add-hook 'vterm-exit-functions
|
||||
(defun +vterm-kill-buffer-on-quit-fn (buffer)
|
||||
(if buffer (kill-buffer buffer))))
|
||||
;; Modeline serves no purpose in vterm
|
||||
(add-hook 'vterm-mode-hook #'hide-mode-line-mode)
|
||||
;; Don't prompt about processes when killing vterm
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue