Copy Path Line Numbers Flexible
Copy file paths with line numbers, your way. Flexible configuration for path style (absolute/relative/tilde/file name), separators, and multi-line output. Includes a default shortcut and editor context menu.
A lightweight VS Code extension to copy file paths with line numbers with flexible settings.
Features:
- Flexible path style: absolute, relative,
~, or file name only
- Configurable path/line separator
- Flexible multi-selection formats: range, list, per-line
- Default shortcut + editor context menu
Perfect for code review, sharing snippets, and remote workflows.
Quick Start
- Open any file.
- Select one or more lines.
- Right click and choose
Copy Path With Line Numbers, or press Shift+Alt+C.
- Paste anywhere.
Settings
Search for "copy path line number" in Settings UI, or edit settings.json:
{
"copyPath.lineNumber.pathStyle": "relative",
"copyPath.lineNumber.separatorBetweenPathAndLine": ":",
"copyPath.lineNumber.selectionMultiLineFormat": "range"
}
Options:
copyPath.lineNumber.pathStyle: absolute (full path) | relative | tilde (~) | fileName (name only)
copyPath.lineNumber.separatorBetweenPathAndLine: string
copyPath.lineNumber.selectionMultiLineFormat: range | list | perLine
GIFs (demos)
Single line copy - Select a single line and copy path with line number:

Copy multi line - Select multiple lines, copied as a range:

Settings - Configure path style, separator, and multi-line format in settings:

Multi selection - Select multiple separate lines and copy each with its line number:

Notes
- If no workspace is open,
relative falls back to absolute path.
tilde only applies when the path is under your home directory.
- Unsaved or non-file documents will show a message instead of copying.