Get Terminal current directory for a specific window

8 views
Skip to first unread message

Chainsaw

unread,
Dec 29, 2021, 2:51:42 PM12/29/21
to vim...@googlegroups.com
Hello,

I am using GVIM in Windows.
In a terminal window via ':terminal' (shell is cmd.exe), is there a way to return a string that is the actual dynamic current directory?
getcwd() and expand() always return the current working directory, which for ':terminal' is the path of cmd.exe, not the actual current directory in the terminal buffer/window.
Cmd.exe with command extensions enabled has access to the dynamic environment variable %CD%, but Vim does not appear to see the dynamic environment variables (unless there is a way).
What would be perfect is something like getenv('CD'), but somehow also target the buffer/window of a specific active terminal.
One use I have in mind is titlestring, so it needs to be efficient/fast.

Thanks,
Chainsaw
Reply all
Reply to author
Forward
0 new messages