;;; +vterm.el --- Vterm extras -*- lexical-binding: t; -*-

;;; Commentary:

;;; Code:

(require 'vterm)

(defun +vterm-counsel-yank-pop-action (orig-fun &rest args)
  (if (equal major-mode 'vterm-mode)
      (let ((inhibit-read-only t)
            (yank-undo-function (lambda (_start _end) (vterm-undo))))
        (cl-letf (((symbol-function 'insert-for-yank)
                   (lambda (str) (vterm-send-string str t))))
          (apply orig-fun args)))
    (apply orig-fun args)))

(provide '+vterm)
;;; +vterm.el ends here
