jixiuf / vterm-toggle

toggles between the vterm buffer and whatever buffer you are editing.
GNU General Public License v3.0
188 stars 12 forks source link

vterm-toggle-insert-cd does not work first time vterm opens #38

Open fast-90 opened 2 years ago

fast-90 commented 2 years ago

Hello,

Thanks for creating this awesome package! It has been really useful for my workflow. I just have one feature request (unfortunately my elisp skills are not sufficient to make a PR...):

When I try to invoke vterm-toggle-insert-cd the first time a vterm terminal is created via vterm-toggle, it doesn't do anything. If my understanding of the code is correct, it is because vterm-toggle-cd--cmd has not been set yet at this point. I can only use vterm-toggle-insert-cd if I do vterm-toggle (creates new vterm) -> vterm-toggle (hides vterm) -> vterm-toggle (show vterm again) -> vterm-toggle-insert-cd.

I guess for most people this is trivial, as the first time a vterm terminal is created will already be in the folder of the previous buffer. However, I am using vterm-toggle with vterm-toggle-scope set to project, hence my created vterms will be in the project root (which is what I generally want). I just want to be able to jump to the subfolder containing the file of the previous buffer via vterm-toggle-insert-cd.

Many thanks for your time and effort!