I am a heavy macOS user but my current work requires the use of Windows and its Terminal for WSL2. Working with Windows Terminal was very frustrating until I changed a couple of settings:
- Set the word delimiters setting to match the one of iTerm2.
table of contents
Selecting text automatically copies it to the clipboard. No need to hit CTRL+C to copy. This is a massive time saver. To enable copy-on-select:
- Open Windows Terminal Settings.
- Go to the Interaction tab.
- Enable Automatically copy selection to clipboard.
There are two main text selection methods in Windows Terminal:
- Click-and-drag to select desired text portion.
- Double-click on text to select.
The double-click with copy-on-select speeds up working in terminal.
However, double-click must select the right thing. The default Windows Terminal word delimiters setting isn’t very well suited to working with Linux-based systems.
As a—primarily—macOS user, I work with iTerm2 which comes with the best word delimiter setting out there, in my humble opinion. It correctly selects strings representing complex variable names and paths. Consider the following example:
With the default Windows Terminal setting, double-clicking on:
- hello selects hello only.
- world selects world_example only.
- any part of the path selects only that part of the path, for example clicking on file selects file only.
To make it better, change the Word delimiters setting in Settings / Interaction to:
There’s a space as the first character. In settings.json, this would be:
If you’re having trouble updating the setting to the proposed value due to the ", use the Open JSON file button in the bottom left corner to modify the settings.json file directly.
After that change, double-clicking on:
- hello selects hello-world_example.
- any part of the path selects the complete /path/to/a/file.md.
This is a productivity boost when working with:
- Tools like find, grep, tree, and so on.
- Various outputs. For example textual, JSON and YAML kubectl outputs.
- Editing bash programs or any other files directly in the terminal.
Don’t dismiss this advice based on the fact that it originates from macOS. At least give it a try, if you don’t like it, you can always change it back.
§bonus: trim whitespace on paste
Two more settings I always make sure are enabled:
- Remove trailing white-space in rectangular selection.
- Remove trailing white-space when pasting.
Both available under the same Interaction section.