reddit / emacs

Tramp + Project.el + Vterm integration help

Agreeable-Solid7212 · 2022-08-21 17:56
I'm trying to create a workflow where I use project.el, tramp, and vterm together to simulate editing local files in a remote environment. Firstly, how can I open a remote project.el project through ssh? So far, I've been using C-x C-f. How can I terminals through vterm once I am in the server? This part should be working, but when I toggle vterm, it just says, "Tramp: Opening connection vterm for ... using ssh... done", and then nothing shows up.
akirakom · 2022-08-21 18:15
Add a function to project-find-functions and implement methods of the generic functions defined in project.el. Call project-remember-project on your remote project. An alternative way is to bookmark your file/directory.
super-linux-nerd · 2022-08-22 06:23
For opening a remote project I use `project-switch-project` (`C-x p p`) I added a vterm entry to the menu so I can switch to a project then open vterm in the project root. Or from a project buffer I can `C-x p t` and open (or pop to) a project-unique vterm instance. Here's my config. On mobile so sorry if I messed up the formatting (use-package vterm :ensure t :bind (:map project-prefix-map ("t" . project-vterm)) :preface (defun project-vterm () (interactive) (defvar vterm-buffer-name) (let* ((default-directory (project-root (project-current t))) (vterm-buffer-name (project-prefixed-buffer-name "vterm")) (vterm-buffer (get-buffer vterm-buffer-name))) (if (and vterm-buffer (not current-prefix-arg)) (pop-to-buffer vterm-buffer (bound-and-true-p display-comint-buffer-action)) (vterm)))) :init (add-to-list 'project-switch-commands '(project-vterm "Vterm") t) (add-to-list 'project-kill-buffer-conditions '(major-mode . vterm-mode)) :config (setq vterm-copy-exclude-prompt t) (setq vterm-max-scrollback 100000) (setq vterm-tramp-shells '(("ssh" "/bin/bash") ("podman" "/bin/bash")))) Works well for me.
404cn · 2022-08-23 09:37
I use vterm-toggle and it will auto change dir to remote host.