From 8d695f3998290552dc304bc212d4c2beadef4148 Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Tue, 26 Sep 2023 10:21:35 -0400 Subject: [PATCH] Add ability to edit vterm command in buffer --- emacs/.emacs.d/config/init-vterm.el | 6 ++++++ zsh/.zshrc | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/emacs/.emacs.d/config/init-vterm.el b/emacs/.emacs.d/config/init-vterm.el index 2f8e3a6..0bd9c72 100644 --- a/emacs/.emacs.d/config/init-vterm.el +++ b/emacs/.emacs.d/config/init-vterm.el @@ -41,8 +41,14 @@ (comint-send-invisible "Enter password: ") (vterm-send-string "\n") (clear-this-command-keys)) + (defun vterm-edit-zsh-command-line () + "Edit the current command line in a temp buffer." + (interactive) + (vterm-send-C-x) + (vterm-send-C-e)) :general (leader-map "v" #'project-vterm) + (vterm-mode-map "C-x C-e" #'vterm-edit-zsh-command-line) :custom (vterm-max-scrollback 10000) (vterm-environment '("TYPEWRITTEN_CURSOR=terminal")) diff --git a/zsh/.zshrc b/zsh/.zshrc index ad75547..2d38f96 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -128,6 +128,11 @@ fi # kubectl completion [[ $commands[kubectl] ]] && source <(kubectl completion zsh) +# edit the current command line in $EDITOR +autoload -U edit-command-line +zle -N edit-command-line +bindkey '\C-x\C-e' edit-command-line + # VTerm integration # Some of the most useful features in emacs-libvterm require shell-side # configurations. The main goal of these additional functions is to enable the