Configure ‘emacs-vterm’ through Guix
This commit is contained in:
parent
079078c7eb
commit
7f691ec18e
2 changed files with 103 additions and 7 deletions
|
@ -22,7 +22,6 @@
|
|||
#:select (emacs-next-tree-sitter))
|
||||
#:use-module ((gnu packages emacs-xyz)
|
||||
#:select (emacs-org-roam
|
||||
emacs-vterm
|
||||
emacs-guix
|
||||
emacs-org-contacts))
|
||||
#:use-module ((gnu packages file-systems)
|
||||
|
@ -90,7 +89,9 @@
|
|||
home-emacs-ace-link-service-type
|
||||
home-emacs-ace-link-configuration
|
||||
home-emacs-golden-ratio-service-type
|
||||
home-emacs-pinentry-service-type))
|
||||
home-emacs-pinentry-service-type
|
||||
home-emacs-vterm-service-type
|
||||
home-emacs-vterm-configuration))
|
||||
#:use-module ((oni home services environment)
|
||||
#:select (home-environment-service))
|
||||
#:use-module ((oni home services flameshot)
|
||||
|
@ -140,7 +141,6 @@
|
|||
emacs-syncthing-status))
|
||||
#:use-module ((oni packages emacs-config)
|
||||
#:select (emacs-oni-org-roam
|
||||
emacs-oni-vterm
|
||||
emacs-oni-elfeed
|
||||
emacs-oni-elisp
|
||||
emacs-oni-eshell
|
||||
|
@ -277,7 +277,6 @@
|
|||
shutdown-rofi
|
||||
emacs-org-roam
|
||||
emacs-org-roam-ui
|
||||
emacs-vterm
|
||||
emacs-org-contacts
|
||||
fakeroot ; Needed for build arch packages
|
||||
tmsu
|
||||
|
@ -289,7 +288,6 @@
|
|||
emacs-guix
|
||||
|
||||
(emacs-oni-org-roam my-emacs)
|
||||
emacs-oni-vterm
|
||||
emacs-oni-elisp
|
||||
emacs-oni-core
|
||||
emacs-oni-elfeed
|
||||
|
@ -449,6 +447,9 @@
|
|||
(org-mode-key "C-S-e")))
|
||||
(service home-emacs-golden-ratio-service-type)
|
||||
(service home-emacs-pinentry-service-type)
|
||||
(service home-emacs-vterm-service-type
|
||||
(home-emacs-vterm-configuration
|
||||
(buffer-name-string "*vterm* %s")))
|
||||
|
||||
(service home-flameshot-service-type)
|
||||
|
||||
|
|
|
@ -14,12 +14,16 @@
|
|||
emacs-dashboard
|
||||
emacs-eros
|
||||
emacs-ace-link
|
||||
emacs-pinentry))
|
||||
emacs-pinentry
|
||||
emacs-vterm))
|
||||
#:use-module ((gnu home services)
|
||||
#:select (service-type
|
||||
service-extension
|
||||
home-profile-service-type
|
||||
home-files-service-type))
|
||||
#:use-module ((gnu home services shells)
|
||||
#:select (home-zsh-extension
|
||||
home-zsh-service-type))
|
||||
#:use-module ((gnu home services shepherd)
|
||||
#:select (shepherd-service
|
||||
home-shepherd-service-type))
|
||||
|
@ -56,7 +60,10 @@
|
|||
home-emacs-golden-ratio-configuration
|
||||
|
||||
home-emacs-pinentry-service-type
|
||||
home-emacs-pinentry-configuration))
|
||||
home-emacs-pinentry-configuration
|
||||
|
||||
home-emacs-vterm-service-type
|
||||
home-emacs-vterm-configuration))
|
||||
|
||||
(define-maybe string)
|
||||
|
||||
|
@ -398,3 +405,91 @@
|
|||
(compose identity)
|
||||
(default-value (home-emacs-pinentry-configuration))
|
||||
(description "Install and configure emacs-pinentry.")))
|
||||
|
||||
;;; Emacs Vterm
|
||||
|
||||
(define-configuration/no-serialization home-emacs-vterm-configuration
|
||||
(package
|
||||
(package emacs-vterm)
|
||||
"Package to use for setting emacs-vterm.")
|
||||
(buffer-name-string
|
||||
maybe-string
|
||||
"Format string for the title of vterm buffers.")
|
||||
(extra-content
|
||||
(text-config '())
|
||||
"Extra content for emacs-pinentry configuration."))
|
||||
|
||||
(define (add-emacs-vterm-configuration config)
|
||||
(home-emacs-extension
|
||||
(configurations
|
||||
(append
|
||||
(list (mixed-text-file "vterm-config"
|
||||
";;;;; vterm-config starts here.\n"
|
||||
(let ((buffer-name-string (home-emacs-vterm-configuration-buffer-name-string config)))
|
||||
(if (maybe-value-set? buffer-name-string)
|
||||
(format #f "(setq vterm-buffer-name-string ~s)\n" buffer-name-string)
|
||||
""))
|
||||
";;;;; vterm-config ends here.\n"))
|
||||
(home-emacs-vterm-configuration-extra-content config)))))
|
||||
|
||||
(define (add-emacs-vterm-zsh-configuration config)
|
||||
(home-zsh-extension
|
||||
(zshrc
|
||||
(list
|
||||
(mixed-text-file
|
||||
"vterm-config"
|
||||
"##### vterm-config starts here.\n"
|
||||
"vterm_printf() {\n"
|
||||
" if [ -n \"$TMUX\" ] && ([ \"${TERM%%-*}\" = \"tmux\" || [ \"${TERM%%-*}\" = \"screen\" ]); then\n"
|
||||
" # Tell tmux to pass the escape sequence through\n"
|
||||
" printf \"\\ePtmux;\\e\\e]%s\\007\\e\\\\\" \"$1\"\n"
|
||||
" elif [ \"${TERM%%-*}\" = \"screen\" ]; then\n"
|
||||
" # GNU screen (screen, screen-256color, screen-256color-bce)\n"
|
||||
" printf \"\\eP\\e]%s\\007\\e\\\\\" \"$1\"\n"
|
||||
" else\n"
|
||||
" printf \"\\e]%s\\e\\\\\" \"$1\"\n"
|
||||
" fi\n"
|
||||
"}\n"
|
||||
"if [[ \"$INSIDE_EMACS\" = 'vterm' ]]; then\n"
|
||||
" alias clear='vterm_printf \"51;Evterm-clear-scrollback\";tput clear'\n"
|
||||
"fi\n"
|
||||
(if (maybe-value-set? (home-emacs-vterm-configuration-buffer-name-string config))
|
||||
(string-append
|
||||
"autoload -U add-zsh-hook\n"
|
||||
"add-zsh-hook -Uz chpwd (){ print -Pn \"\\e]2;%m:%2~\\a\" }\n")
|
||||
"")
|
||||
"vterm_prompt_end() {\n"
|
||||
" vterm_printf \"51;A$(whoami)@$(hostname):$(pwd)\"\n"
|
||||
"}\n"
|
||||
"setopt PROMPT_SUBST\n"
|
||||
"PROMPT=$PROMPT'%{$(vterm_prompt_end)%}'\n"
|
||||
"vterm_cmd() {\n"
|
||||
" local vterm_elisp\n"
|
||||
" vterm_elisp=\"\"\n"
|
||||
" while [ $# -gt 0]; do\n"
|
||||
" vterm_elisp=\"vterm_elisp\"\"$(printf '\"%s\" ' \"$(printf \"%s\" \"$1\" | sed -e 's|\\\\|\\\\\\\\|g' -e 's|\"|\\\\\"|g')\")\"\n"
|
||||
" shift\n"
|
||||
" done\n"
|
||||
" vterm_printf \"51;E$vterm_elisp\"\n"
|
||||
"}\n"
|
||||
"##### vterm-config ends here.\n")))))
|
||||
|
||||
(define (add-emacs-vterm-packages config)
|
||||
(list (home-emacs-vterm-configuration-package config)))
|
||||
|
||||
(define home-emacs-vterm-service-type
|
||||
(service-type
|
||||
(name 'home-emacs-vterm)
|
||||
(extensions
|
||||
(list (service-extension
|
||||
home-emacs-service-type
|
||||
add-emacs-vterm-configuration)
|
||||
(service-extension
|
||||
home-zsh-service-type
|
||||
add-emacs-vterm-zsh-configuration)
|
||||
(service-extension
|
||||
home-profile-service-type
|
||||
add-emacs-vterm-packages)))
|
||||
(compose identity)
|
||||
(default-value (home-emacs-vterm-configuration))
|
||||
(description "Install and configure emacs-vterm.")))
|
||||
|
|
Loading…
Reference in a new issue