diff --git a/modules/tools/tmux/autoload/evil.el b/modules/tools/tmux/autoload/evil.el index 540b5d25f..a9b9ce828 100644 --- a/modules/tools/tmux/autoload/evil.el +++ b/modules/tools/tmux/autoload/evil.el @@ -1,9 +1,11 @@ ;;; tools/tmux/autoload/evil.el ;;;###autoload (autoload '+tmux:run "tools/tmux/autoload/evil" nil t) -(evil-define-command +tmux:run (command bang) - (interactive "") - (+tmux/run command bang)) +(evil-define-command +tmux:run (bang &optional command) + (interactive "") + (if (evil-visual-state-p) + (+tmux/send-region evil-visual-beginning evil-visual-end bang) + (+tmux/run command bang))) ;;;###autoload (autoload '+tmux:cd-here "tools/tmux/autoload/evil" nil t) (evil-define-command +tmux:cd-here (bang) diff --git a/modules/tools/tmux/autoload/tmux.el b/modules/tools/tmux/autoload/tmux.el index 696ab25fe..3bd362481 100644 --- a/modules/tools/tmux/autoload/tmux.el +++ b/modules/tools/tmux/autoload/tmux.el @@ -46,13 +46,16 @@ but do not execute them." (interactive (list (read-string "tmux $ ") current-prefix-arg)) - (+tmux (concat "send-keys C-u " command (unless noreturn " Enter")))) + (+tmux (concat "send-keys C-u " + (shell-quote-argument command) + (unless noreturn " Enter")))) ;;;###autoload -(defun +tmux/send-region (beg end) +(defun +tmux/send-region (beg end &optional noreturn) "Send region to tmux." - (interactive "r") - (error "Not implemented")) + (interactive "rP") + (+tmux/run (string-trim (buffer-substring-no-properties beg end)) + noreturn)) ;;;###autoload (defun +tmux/rerun ()