0

Quick Question: Is there a shortcut key or an add-on for VS Code that updates the path in the integrated terminal to the path of the file that is currently open??

For example: Powershell in the integrated terminal always opens in my C:\Users\andy folder, but if I have a script in say c:\scripts\powershell\superdooperhacks\andysscript\ I need to cd through a lot of folders to get there (or prepend the command with the entire path).

The only quick way I found so far is to right click on the file and Reveal in Explorer and then open another Powershell session by right-clicking and... you get the idea. That means, I now have three windows open and it defeats the purpose of having an integrated shell.

4ndy
  • 550
  • 1
  • 9
  • 23
  • 2
    See https://stackoverflow.com/questions/56218958/how-to-quickly-change-shell-folder-to-match-the-currently-open-file/56222855#56222855 No need for an extension anymore. Use the `sendSequence` version. – Mark Sep 25 '19 at 03:36

1 Answers1

2

Try Terminal Here add-on. Exposes the command terminalHere.create that creates a terminal at the current file's directory. This can be accessed through the command palette (ctrl/cmd+shift+p) or by attaching a custom keybinding to it.

Konstantin Baklaev
  • 323
  • 1
  • 3
  • 7
  • 2
    While this extension is handy, note that it always creates a _new_ shell in the integrated terminal, which won't be an integrated _PowerShell_ terminal (even if your default shell is PowerShell, a regularly launched instance will behave differently). – mklement0 Sep 25 '19 at 05:59
  • 2
    That's right, if we start some operation in the old terminal window and open a new terminal with this add-on, the old terminal will still perform the operation. Thanks for the addition. – Konstantin Baklaev Sep 25 '19 at 09:53