Projectile: Vterm integration

Created on 24 Nov 2019  路  7Comments  路  Source: bbatsov/projectile

There is a (projectile-run-term PROGRAM) (accessible using C-c p x t) which opens term in project root. Would be great if there was such integration with vterm (emacs-libvterm).

Most helpful comment

@elnawe: made a PR based on your code

All 7 comments

@Compro-Prasad: not related to this issue, but can you explain in a few words what vterm's advantages are? Its homepage contains very little information.

Vterm is a terminal emulator available only when Emacs is built with modules support. It is a far better terminal emulator than the builtin term. Its faster and there are relatively lower number of lags(slowdowns) when interacting with it.

Thanks for the information :+1:

I noticed there are multiple projectile-run- functions and they are specific to different term emulators inside Emacs (the defaults, at least).

I also use vterm but I would suggest to make a custom function in your configuration for this, since vterm is not a default Emacs term emulator.

Something like this should work: (Note: switches to vterm buffer if exists and has the default name. If not, it will create a new vterm. Also, I hadn't test this heavily)

(defun projectile-run-vterm ()
  (interactive)
  (let* ((project (projectile-ensure-project (projectile-project-root)))
        (buffer "vterm"))
    (require 'vterm)
    (if (buffer-live-p (get-buffer buffer))
        (switch-to-buffer buffer)
      (vterm))
    (vterm-send-string (concat "cd " project))
    (vterm-send-return)))

@elnawe's suggestion works well, all you need to to bind it to a keymap. Also, vterm is awesome, I might start using the terminal inside emacs.

I agree, vterm is great. It works like any X Term emulator but has some great Emacs keybindings like C-c C-t to select and copy text. I use EXWM so vterm for me is the best term emulator since I don't need to emulate keybindings.

@elnawe: made a PR based on your code

Was this page helpful?
0 / 5 - 0 ratings

Related issues

breadncup picture breadncup  路  3Comments

JSmith-BitFlipper picture JSmith-BitFlipper  路  4Comments

novakboskov picture novakboskov  路  4Comments

andrematheus picture andrematheus  路  3Comments

sweord picture sweord  路  3Comments