Skip to content

Commit

Permalink
Add projectile-run-vterm
Browse files Browse the repository at this point in the history
  • Loading branch information
Silex authored and bbatsov committed Dec 3, 2019
1 parent 72814ed commit 7f4f293
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### New features

* New command `projectile-run-vterm` (<kbd>x v</kbd> in `projectile-command-map`).
* Add `related-files-fn` option to use custom function to find test/impl/other files.
* [#1019](https://github.com/bbatsov/projectile/issues/1019): Jump to a test named the same way but in a different directory.
* [#982](https://github.com/bbatsov/projectile/issues/982): Add heuristic for projectile-find-matching-test.
Expand Down
17 changes: 17 additions & 0 deletions projectile.el
Original file line number Diff line number Diff line change
Expand Up @@ -3410,6 +3410,22 @@ Switch to the project specific term buffer if it already exists."
(term-char-mode))))
(switch-to-buffer buffer)))

;;;###autoload
(defun projectile-run-vterm ()
"Invoke `vterm' in the project's root.
Switch to the project specific term buffer if it already exists."
(interactive)
(let* ((project (projectile-ensure-project (projectile-project-root)))
(buffer (format "*vterm %s*" (projectile-project-name project))))
(unless (buffer-live-p (get-buffer buffer))
(unless (require 'vterm nil 'noerror)
(error "Package 'vterm' is not available"))
(vterm buffer)
(vterm-send-string (concat "cd " project))
(vterm-send-return))
(switch-to-buffer buffer)))

(defun projectile-files-in-project-directory (directory)
"Return a list of files in DIRECTORY."
(let* ((project (projectile-ensure-project (projectile-project-root)))
Expand Down Expand Up @@ -4581,6 +4597,7 @@ thing shown in the mode line otherwise."
(define-key map (kbd "x i") #'projectile-run-ielm)
(define-key map (kbd "x t") #'projectile-run-term)
(define-key map (kbd "x s") #'projectile-run-shell)
(define-key map (kbd "x v") #'projectile-run-vterm)
(define-key map (kbd "z") #'projectile-cache-current-file)
(define-key map (kbd "<left>") #'projectile-previous-project-buffer)
(define-key map (kbd "<right>") #'projectile-next-project-buffer)
Expand Down

0 comments on commit 7f4f293

Please sign in to comment.