I need to use the path to the current active file in my VS Code editor all. The. Time!
Eventually I figured there must be a shortcut but there is none that's built-in. However, you can quickly add it yourself.
- Open the command palette (Windows: Ctrl+Shift+P, Mac: Command+Shift+P)
- Search for "Preferences: Open Keyboard Shortcuts (JSON)"
- In the opened
keybindings.json
file, add a new item to the array
{
"key": "ctrl+shift+t",
"command": "workbench.action.terminal.sendSequence",
"args": { "text": "${relativeFile}" },
"when": "terminalFocus"
}
Now open any file, then open a terminal within VS Code, and press Ctrl+Shift+T
and it will paste the full path to that file where your cursor is in the terminal.
Top comments (0)