When I’m writing posts in 11ty, I often need to create new posts by copying and pasting files into the same folder. While this isn't difficult, the repetitive nature of the task started to irritate me. I wanted to find a faster way.
I discovered that while ⌘ + D
works for duplicating files in macOS, but it doesn't work in VSCode. Than I found a way to streamline the process using the "File Utils" extension.
Here’s how to set it up:
-
Install the "File Utils extension;
-
Open Keyboard Shortcuts settings: go to Code > Preferences > Keyboard Shortcuts;
-
Find the Duplicate File Command: in the Keyboard Shortcuts window, type "Duplicate file" in the search bar;
-
Assign a Keybinding for Duplication.
I wanted to create the shortest keyboard shortcut to duplicate a file: "D" key. However, that didn’t work, as I couldn’t finish any word containing the letter D 😁 Every time I pressed "D", the file duplication command triggered. As a result, I had to resort to using the key combination Shift + D
.
Now, when you want to duplicate a file, just select the file in the file explorer, press your newly assigned keybinding, and the file will be duplicated in the same folder. You will only need to enter a new file name.