19

Is there any Shortcut Key or Option to Copy the full file path on which you are working?

Like: /var/www/html/code/info.php or /code/info.php

Thanks

Ryu S.
  • 1,538
  • 2
  • 22
  • 41
Surya
  • 454
  • 6
  • 15

2 Answers2

32

Right click on editor tab or on entry in Project View and choose "Copy path" action.

Alternatively: Edit | Copy Path (Ctrl + Shift + C here on Windows keymap). You can adjust the shortcuts in the Settings/Preferences | Keymap as needed.

If you need it to be relative to the project root -- use Copy Relative Path action instead.

Please note that this action is context dependant: when focus is on file (e.g. in Project View or some popup with files) it will be "Copy Relative Path" ... but when invoked inside the editor .. it will become "Copy Reference" (and will copy Class/Variable name etc).

UPDATE 2022-08-19:

Modern IDE versions have these commands under a single popup menu:

enter image description here

Invoked in the Project View context:

enter image description here

Invoked in the Editor context:

enter image description here


Another option is to use custom plugin that provides such actions. There are few that can do that and more (even if invoked right from the Editor).

LazyOne
  • 158,824
  • 45
  • 388
  • 391
3

It is strange, but in the latest version, JetBrains removed this option from the context menu (right-click on the file name tab) + removed from the Edit top menu.

So the alternative is to use triple-click on the shift + type copy path there.

Andron
  • 6,413
  • 4
  • 43
  • 56
  • 1
    **Copy Reference** gives you more options, including **Absolute Path** – Felipe Alameda A Sep 24 '19 at 20:41
  • I ended up adjusting the context menu described here: https://www.jetbrains.com/help/phpstorm/customize-actions-menus-and-toolbars.html so I only need 2 clicks to copy a relative path – chickenchilli Jun 17 '20 at 05:42