Shell Path Copy

by Charles Kelsoe (ckelsoe)
5
4
3
2
1
Score: 54/100

Description

The Shell Path Copy plugin makes it easier to copy file and folder paths in formats that match your target system, whether you're working on Windows, macOS, Linux, or even a mobile device connected to a remote server. It integrates directly into the right-click menu and command palette, offering relative paths, absolute paths, and file:// URLs, all formatted appropriately for the platform. You can configure which options appear, choose how paths are wrapped to handle spaces, and get visual confirmation when a path is copied. This helps avoid manual edits when pasting into terminals, scripts, or AI assistants like Claude Code or Gemini CLI.

Reviews

No reviews yet.

Stats

10
stars
3,163
downloads
0
forks
280
days
1
days
1
days
8
total PRs
0
open PRs
2
closed PRs
6
merged PRs
8
total issues
0
open issues
8
closed issues
0
commits

Latest Version

2 days ago

Changelog

Added

  • New <absolute-folder> token: the containing folder as a full filesystem path (desktop only). For a file it resolves to the folder the file sits in; for a folder, to its parent, like dirname. Requested in discussion #17.

Changed

  • The unresolved-token notice now reads "Desktop-only tokens (absolute path, folder, file URL) are unavailable here and were left blank." so it covers the new token.

VirusTotal scan

README file from

Github

Shell Path Copy for Obsidian

CI Release GitHub Downloads GitHub Stars Obsidian License Latest Release

Copy a file or folder path out of your Obsidian vault. Right-click, pick a format, paste.

What it does

Right-click a file or folder, pick a format, and the result is on your clipboard. The command palette does the same for the note you have open.

It comes with formats for relative and absolute paths, file:// and Obsidian URLs, Markdown and wiki links, filenames, and links that point at a heading or a block. Four are turned on out of the box; the rest take one toggle in settings.

If none of them fit, you can build your own. A format is a template such as <filename> -> <obsidian-url>, and the plugin fills in the tokens when you copy. This is optional. If the built-in formats cover you, you never have to touch a template.

Works on desktop and mobile.

Why this plugin?

Obsidian often sits next to a terminal or an AI assistant like Claude Code or Gemini CLI. You might run Obsidian on Windows with a WSL terminal, or on an iPad connected to a remote Linux server. Either way, you need a path out of your vault and into a shell command, a prompt, or a document, in the format that target expects.

Obsidian's own "Copy file path" command is buried in the command palette and gives one format. Shell Path Copy puts copy actions in the right-click menu and the command palette, and lets each format be what you want.

Installation

  1. Open Obsidian settings.
  2. Go to Community plugins.
  3. Click Browse.
  4. Search for Shell Path Copy.
  5. Click Install, then Enable.

Manual installation

  1. Download main.js, manifest.json, and styles.css from the latest release.
  2. Create a folder named shell-path-copy in your vault's .obsidian/plugins/ directory.
  3. Copy the three files into it.
  4. Reload Obsidian.
  5. Enable Shell Path Copy in Settings → Community plugins.

BRAT (optional, for pre-release testing)

BRAT installs pre-release builds before they reach the Community Plugins marketplace. Regular users should install from Community Plugins instead.

  1. Install the BRAT plugin from Community Plugins.
  2. Open BRAT settings and click Add Beta Plugin.
  3. Enter https://github.com/ckelsoe/obsidian-shell-path-copy.
  4. Click Add Plugin.
  5. Enable Shell Path Copy in Settings → Community plugins.

Quick start

You can copy from four places:

  • Right-click a file or folder in the file explorer.
  • Right-click inside an open note. The formats act on that note, and the heading-aware formats link to the heading your cursor is in.
  • Command palette (Ctrl/Cmd+P): type Copy: and pick a format. It acts on the active file.
  • Ribbon (optional): turn on Show in ribbon for a format to add a left-ribbon icon that copies it from the active note in one click. Off by default, so the ribbon stays uncluttered until you opt a format in.

In the right-click menu, the enabled formats sit inside a Copy path as submenu to keep the menu tidy. Pick the format you want and the result lands on your clipboard. You can pin individual formats to the root menu, or turn the submenu off entirely, in settings. There is also an option to fold every format into Obsidian's native Copy path submenu instead, so all path-copy choices (the built-in ones and yours) live in one place.

Out of the box four formats are enabled: Relative Linux/macOS path, Relative Windows path, Obsidian URL, and Markdown link. Open the settings to enable the others or add your own.

Built-in formats

These formats are seeded into every vault. Enable, edit, or delete any of them in settings.

Format Template Example result
Relative Linux/macOS path <relative-path-unix> `./folder/file.md`
Relative Windows path <relative-path-windows> `.\folder\file.md`
Absolute path <absolute-path> `C:\Users\you\vault\folder\file.md`
file:// URL <file-url> file:///C:/Users/you/vault/folder/file.md
Obsidian URL <obsidian-url> obsidian://open?vault=MyVault&file=folder%2Ffile
Markdown link <markdown-link> [[file]]
Filename <filename> file
Filename with extension <filename-ext> file.md

Seven more formats ship disabled, ready to enable or copy from:

Format Template Example result
Example: name and Obsidian URL <filename> -> <obsidian-url> file -> obsidian://open?vault=MyVault&file=folder%2Ffile
Example: line reference <filename-ext>#L<line-number> file.md#L42
Example: name and line number <filename-ext> Line <line-number> file.md Line 42
Obsidian URL (to heading) <obsidian-url-heading> obsidian://open?vault=MyVault&file=folder%2Ffile%23Notes
Wiki link (to heading) <wikilink-heading> [[file#Notes]]
Obsidian URL (to block) <obsidian-url-block> obsidian://open?vault=MyVault&file=folder%2Ffile%23%5Ea1b2c3
Wiki link (to block) <wikilink-block> [[file#^a1b2c3]]

The "to heading" and "to block" formats link to the heading or block your cursor is in when a note is open, and to the file otherwise. They are the way to get an Obsidian link that jumps to a section. Block links need a ^id marker in the note; if the block has none, the plugin creates one (see Block links below). Absolute path and file:// URL are desktop-only; on mobile they produce nothing.

Custom formats

A custom format is a token template. Build one in settings:

  1. Open Settings → Community plugins → Shell Path Copy → Options.
  2. In Custom formats, click + to add a format, or click any existing format to open its settings page.
  3. Set the fields:
    • Enabled: turn the format on or off everywhere (menu, command palette, ribbon).
    • Name: shown in the menu, command palette, and ribbon.
    • Icon: the icon shown next to the format in the menu, command palette, and ribbon. Pick a common one from the dropdown, or click Browse all icons to search the full set of Obsidian icons and choose any of them.
    • Template: the token template. The token palette below the field inserts a token at the cursor. A live preview shows the rendered result, and a Desktop / Mobile row shows where the template works.
    • Wrapping: none, double quotes, single quotes, or backticks, applied around the whole result.
    • Show in menu, Show in command palette, and Show in ribbon: where the format appears. The ribbon adds a left-rail icon that copies the format in one click; it is off by default.
    • Pin to root menu: also show this format at the top of the right-click menu, not only inside the Copy path as submenu. Useful for the one or two formats you reach for most.
    • Show on: limit the format to files, folders, or both. Formats that use file-specific tokens (like <obsidian-url>, wiki links, or line/heading tokens) are files-only automatically, since those do not resolve for folders.
  4. Reload Obsidian so the command and ribbon icon register.

The format list is drag-to-reorder; list order is the menu order, and ribbon icons register in the same order. To place the ribbon group relative to other ribbon icons, drag it within Obsidian's ribbon. Each global option is searchable from Obsidian's settings search, and each format opens its own settings page.

Tokens

A token is a name in angle brackets. Unknown tokens are left as typed. Escape a literal bracket with a backslash (\<).

Token Resolves to Availability
<filename> Name without the final extension All
<filename-ext> Full name with extension All
<extension> Extension without the dot All
<relative-path> Vault-relative path, host OS style All
<relative-path-unix> Vault-relative path, Linux/macOS style All
<relative-path-windows> Vault-relative path, Windows style All
<absolute-path> Full filesystem path Desktop only
<file-url> file:// URL Desktop only
<obsidian-url> obsidian://open deep link All
<vault-name> Vault name, raw All
<vault-name-encoded> Vault name, URL-encoded All
<markdown-link> Markdown link in the configured format All
<wikilink> Wiki-style link All
<date> Current date, YYYY-MM-DD All
<time> Current time, HH:mm All
<line-number> Active editor cursor line Editor only
<line-start> First line of the editor selection Editor only
<line-end> Last line of the editor selection Editor only
<line-range> Selected line range like 42-58, or a single line when nothing is selected Editor only
<heading> Heading the cursor sits under Editor only
<obsidian-url-heading> Obsidian URL to the cursor heading, or the file when there is none All
<wikilink-heading> Wiki link to the cursor heading, or the file when there is none All
<block-id> Block id at the cursor, created if needed Editor only
<obsidian-url-block> Obsidian URL to the cursor block, or the file when there is none All
<wikilink-block> Wiki link to the cursor block, or the file when there is none All
<nl> A literal newline All

"Desktop only" tokens are blank on mobile. "Editor only" tokens fill in only when the file you copy is the file open in the editor. The settings preview flags both cases as you build a template.

The full token reference, with worked examples and fallback behavior, is in token-usage.md.

The block tokens (<block-id>, <obsidian-url-block>, <wikilink-block>) link to a specific block, the paragraph or list item your cursor is in.

A block link needs a ^id marker in the note. Obsidian works this way for all block links. If the block at your cursor does not already have one, Shell Path Copy generates a short id and writes it into the note, exactly as Obsidian does when you create a block link yourself. This is the one case where the plugin modifies a note; every other format is read-only.

Block links support paragraphs and list items. If you copy a block format with no note open, or with the cursor on a heading, table, code block, or other multi-line construct, the block link falls back to a plain file link and nothing is written.

Settings

Open Settings → Community plugins → Shell Path Copy → Options.

Global options:

  • Show notifications: show a notice when something is copied.
  • Markdown link format: wiki-style ([[filename]]) or standard Markdown ([filename](path)). Used by the <markdown-link> token.
  • Notify when a token could not be resolved: show a notice when a desktop-only or editor-only token is left blank.
  • Group formats under a submenu: nest every format inside one Copy path as right-click submenu (on by default). Turn it off to put every enabled format directly at the root menu, the way 2.1.x worked.
  • Group with Obsidian's copy path: instead of the plugin's own submenu, append every format inside Obsidian's native Copy path submenu, alongside the built-in entries like as Obsidian URL and from vault folder. When this is on, the Group formats under a submenu option above is ignored.

Everything else is per format, in the Custom formats list.

Using a custom file explorer

Shell Path Copy's right-click items appear in Obsidian's native file explorer. If you use a plugin that replaces the file explorer, such as Notebook Navigator, those menu items will not show there. Every format is still available through the command palette (Ctrl/Cmd+P), which works on the active file regardless of which explorer you use.

Example workflows

Remote terminal. You are viewing My-Project-Plan.md in Obsidian on an iPad, connected to a Linux server over SSH. Right-click the file, choose Relative Linux/macOS path, and paste `/My-Project-Plan.md` straight into your terminal session.

AI assistant line reference. Enable the Line reference example format. With a note open at the line you care about, run it to copy My-Project-Plan.md#L42, ready to drop into a prompt for Claude Code or Gemini CLI.

Cross-app links. Use the Obsidian URL format to create links that open a note directly in Obsidian from a task manager, a wiki, or an automation tool.

Contributing

Bug reports and feature requests are welcome via GitHub Issues. For local build, test, and pull request guidelines, see CONTRIBUTING.md.

Privacy

Shell Path Copy collects no data, stores nothing outside your own vault, and contains no network code. It reads a path you select and places it on your clipboard. The one exception is the block link formats: when you use one, the plugin may add a ^id marker to a note so the block can be linked to, exactly as Obsidian does for its own block links. See PRIVACY.md for the full privacy policy and liability disclaimer, and SECURITY.md for the security policy.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgments

  • Thanks to @craziedde for feature requests and feedback that shaped the plugin.
  • Inspired by the need for better file path handling when working with AI coding assistants.
  • Built for Obsidian using the Obsidian API.
  • Thanks to the Obsidian developers and community.

Support

If you find this plugin helpful, consider:

  • Starring the repository on GitHub.
  • Reporting bugs or suggesting features via GitHub Issues.

Similar Plugins

info
• Similar plugins are suggested based on the common tags between the plugins.
Metadata Menu
4 years ago by mdelobelle
For data management enthusiasts : type and manage the metadata of your notes.
Root Folder Context Menu
2 years ago by mnaoumov
Obsidian Plugin that enables context menu for vault root folder
Show Current File Path
5 years ago by Ravi Mashru
Obsidian plugin to show the file path of the current file in the status bar
Enhanced Image
2 years ago by situ2001
Enhance the experience of image in Obsidian, seamlessly.
External File Embed and Link
a year ago by oylbin
Embed and link local files outside your obsidian vault with relative paths for cross-device and multi-platform compatibility.
Context Command Hider
a year ago by Mara-Li
This plugin allows you to hide every command from the Obsidian's right-click context menu.
Pixel Perfect Image
a year ago by Johan Sanneblad
Pixel perfect 100% image resizing, copy to clipboard, show image in Finder/Explorer, edit image in external editor, and much more.
Sync Vault CE
a year ago by Camus Qiu
The missing bridge between your 10+ TB cloud drive and your AI brain.
Copy Local Graph Paths
a year ago by Amy Z
copy-local-graph-paths is a simple Obsidian plugin that copies the paths of notes linked to your current page.
Hyperlink Remover
a year ago by Daniel Agafonov
Easily remove hyperlinks and wikilinks from selected text or the entire note.
Copy Path
a year ago by shumadrid
An Obsidian plugin that adds context menu actions for copying the full and vault relative path of a file/folder.
Open in Cursor
9 months ago by awaken233
An Obsidian plugin to open files in Cursor IDE or other VSCode-based editors (VSCode, Kiro, etc.) with automatic cursor position jumping. 一个可以在 Cursor IDE 或其他类 VSCode 编辑器中打开文件并自动跳转光标位置的 Obsidian 插件。
Tab File Path
9 months ago by John Burnett
HTTP Link Maker
9 months ago by Kenneth Christensen
Create HTTP links for Obsidian notes that work on all your devices
DOCX Exporter
6 months ago by Kanshurichard
An Obsidian plug-in, aiming to help users easily export note content into DOCX format.
Double-Click Image Opener
3 months ago by atman
Open images with your system's default application by double-clicking.
Lskypro Upload V2
3 months ago by 3kk0
Auto upload local images to LskyPro.