tools/tmux: fix +tmux:run & +tmux/run; add +tmux/send-region

This commit is contained in:
Henrik Lissner 2017-04-09 22:30:49 -04:00
parent 0c81402599
commit 335d9c27a9
2 changed files with 12 additions and 7 deletions

View file

@ -1,9 +1,11 @@
;;; tools/tmux/autoload/evil.el ;;; tools/tmux/autoload/evil.el
;;;###autoload (autoload '+tmux:run "tools/tmux/autoload/evil" nil t) ;;;###autoload (autoload '+tmux:run "tools/tmux/autoload/evil" nil t)
(evil-define-command +tmux:run (command bang) (evil-define-command +tmux:run (bang &optional command)
(interactive "<fsh><!>") (interactive "<!><fsh>")
(+tmux/run command bang)) (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) ;;;###autoload (autoload '+tmux:cd-here "tools/tmux/autoload/evil" nil t)
(evil-define-command +tmux:cd-here (bang) (evil-define-command +tmux:cd-here (bang)

View file

@ -46,13 +46,16 @@ but do not execute them."
(interactive (interactive
(list (read-string "tmux $ ") (list (read-string "tmux $ ")
current-prefix-arg)) 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 ;;;###autoload
(defun +tmux/send-region (beg end) (defun +tmux/send-region (beg end &optional noreturn)
"Send region to tmux." "Send region to tmux."
(interactive "r") (interactive "rP")
(error "Not implemented")) (+tmux/run (string-trim (buffer-substring-no-properties beg end))
noreturn))
;;;###autoload ;;;###autoload
(defun +tmux/rerun () (defun +tmux/rerun ()