54 lines
1.6 KiB
EmacsLisp
54 lines
1.6 KiB
EmacsLisp
;;; terminal.el --- Userland terminal with vterm -*- lexical-binding: t -*-
|
|
|
|
;; This file is not part of GNU Emacs
|
|
|
|
;; This program is free software: you can redistribute it and/or modify
|
|
;; it under the terms of the GNU General Public License as published by
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
;; (at your option) any later version.
|
|
|
|
;; This program is distributed in the hope that it will be useful,
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
;; GNU General Public License for more details.
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
|
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
;; commentary
|
|
|
|
;;; Code:
|
|
|
|
(when (not (equal system-type 'windows-nt))
|
|
(use-package vterm
|
|
:ensure t))
|
|
|
|
(defun theurgy-shell ()
|
|
(interactive)
|
|
(if (fboundp 'vterm)
|
|
'vterm
|
|
'shell))
|
|
|
|
(defun theurgy-bottom-shell ()
|
|
(interactive)
|
|
(let ((win (car (window-at-side-list nil 'bottom))))
|
|
(if (and win (equal 'bottom (window-parameter win 'window-side)))
|
|
(delete-window win)
|
|
(funcall (theurgy-shell)))))
|
|
|
|
(global-set-key (kbd "M-RET") 'theurgy-bottom-shell)
|
|
(define-key vterm-mode-map (kbd "M-RET") 'theurgy-bottom-shell)
|
|
|
|
(add-to-list 'display-buffer-alist
|
|
'("\\*vterm\\*\\|\\*shell\\*"
|
|
(display-buffer-in-side-window)
|
|
(side . bottom)
|
|
(slot . 0)
|
|
(window-height . 0.2)))
|
|
|
|
(provide 'terminal)
|
|
|
|
;;; terminal.el ends here
|