Add send-to-iterm defuns
This commit is contained in:
parent
15f977c3ad
commit
97cc61c9c8
4 changed files with 53 additions and 40 deletions
30
core/lib/defuns-term.el
Normal file
30
core/lib/defuns-term.el
Normal file
|
@ -0,0 +1,30 @@
|
|||
;;; defuns-tmux.el
|
||||
|
||||
(defun narf--send-to-tmux (command)
|
||||
(shell-command (format "tmux send-keys %s" command)))
|
||||
|
||||
(evil-define-interactive-code "<term>"
|
||||
"Ex tmux argument (a mix between <sh> <f> and <fsh>)"
|
||||
:ex-arg shell
|
||||
(list (when (evil-ex-p) (evil-ex-file-arg))))
|
||||
|
||||
;;;###autoload (autoload 'narf:send-to-tmux "defuns-term" nil t)
|
||||
(evil-define-command narf:send-to-tmux (command &optional bang)
|
||||
"Sends input to tmux. Use `bang' to append to tmux"
|
||||
(interactive "<term><!>")
|
||||
(narf--send-to-tmux (format (if bang "C-u %s Enter" "%s")
|
||||
(shell-quote-argument command)))
|
||||
(when (evil-ex-p)
|
||||
(message "[Tmux] %s" command)))
|
||||
|
||||
;;;###autoload (autoload 'narf:send-to-iterm "defuns-term" nil t)
|
||||
(when IS-MAC
|
||||
(evil-define-command narf:send-to-iterm (command &optional bang)
|
||||
"Sends input to tmux. Use `bang' to append to tmux"
|
||||
(interactive "<term><!>")
|
||||
(narf-send-to-iterm command bang)
|
||||
(when (evil-ex-p)
|
||||
(message "[iTerm] %s" command))))
|
||||
|
||||
(provide 'defuns-tmux)
|
||||
;;; defuns-tmux.el ends here
|
|
@ -1,35 +0,0 @@
|
|||
;;; defuns-tmux.el
|
||||
|
||||
(defun narf--tmux-send (command)
|
||||
(shell-command (format "tmux send-keys %s" command)))
|
||||
|
||||
(evil-define-interactive-code "<tmux>"
|
||||
"Ex tmux argument (a mix between <sh> <f> and <fsh>)"
|
||||
:ex-arg shell
|
||||
(list (when (evil-ex-p) (evil-ex-file-arg))))
|
||||
|
||||
;;;###autoload (autoload 'narf:tmux-run "defuns-tmux" nil t)
|
||||
(evil-define-command narf:tmux-run (&optional command bang)
|
||||
"Sends input to tmux. Use `bang' to append to tmux"
|
||||
(interactive "<tmux><!>")
|
||||
(narf--tmux-send (format (if bang "C-u %s Enter" "%s")
|
||||
(shell-quote-argument command)))
|
||||
(when (evil-ex-p)
|
||||
(message "[Tmux] %s" command)))
|
||||
|
||||
;;;###autoload (autoload 'narf:tmux-chdir "defuns-tmux" nil t)
|
||||
(evil-define-command narf:tmux-chdir (&optional path bang)
|
||||
"CDs in tmux using `narf/project-root'"
|
||||
(interactive "<f><!>")
|
||||
(let ((dir (shell-quote-argument
|
||||
(if (and path (not (s-blank? path)))
|
||||
(if (file-directory-p path)
|
||||
(file-truename path)
|
||||
(error "Directory doesn't exist %s" path))
|
||||
(if bang default-directory (narf/project-root))))))
|
||||
(narf--tmux-send (format "C-u cd Space %s Enter" (shell-quote-argument dir)))
|
||||
(when (evil-ex-p)
|
||||
(message "[Tmux] cd %s" dir))))
|
||||
|
||||
(provide 'defuns-tmux)
|
||||
;;; defuns-tmux.el ends here
|
Loading…
Add table
Add a link
Reference in a new issue