Issue #118 (Copy File Path)07/24/24
A few keyboard shortcuts can help with copying and pasting if you're often needing to copy and paste file paths in your projects.
Firstly, in VS Code on Windows, using SHIFT-ALT-C you can copy the full file path of the currently active file in your editor. This shortcut works whether you're focused in the editor or not. On a Mac it's slightly different for focused and non-focused editor.
Below I've embedded a screenshot from the shortcuts document on both Mac and Windows. I should also point out that the shortcuts document you can find on the official VS Code website docs is actually out of date for this particular set of shortcuts. I'm guessing other shortcuts are also out of date, so you should always go by the reference inside your editor, accessible via your command palette.
And for those who need a text version, those shortcuts are:
- Windows Copy Active File Path: SHIFT-ALT-C
- Mac Copy Active File Path:
- With Editor not Focused: OPT-CMD-C
- With Editor Focused: CMD-K OPT-CMD-C
The Mac shortcut for copying the active file path when the editor is in focus is definitely one I'd never remember! But you can change that shortcut if you can find one that you like that doesn't conflict with something else.
Similarly, if you want to copy the current relative path rather than the full path, here's the shortcuts:
And again, the text version:
- Windows Copy Relative Path: CTRL-K CTRL-SHIFT-C
- Mac Copy Relative Path:
- With Editor Not Focused: SHIFT-OPT-CMD-C
- With Editor Focused: CMD-K SHIFT-OPT-CMD-C
Personally, in either case, I would definitely look into changing those shortcuts to something more memorable if you find yourself using these often.
Now on to this week's hand-picked links!