What is the fastest way to copy the filename to the clipboard in IntelliJ?

Viewed 1313

I currently place my cursor in the file, click the Scroll from Source icon in the Project window, then use the keyboard shortcut to refactor the filename, select all in the prompt and copy.

Is there a less clunky way to do this?

4 Answers

You can just select file in project view and press ctrl+c. File name will be copied.

Or you can use File Name Grabber plugin.

Ctrl/Cmd+F5 (Refactor | Copy action) then Ctrl/Cmd+C.

For future reference: In current versions you can setup this yourself by adding a keyboard shortcut. Settings -> Keymap -> Main menu -> Edit -> Copy Path/Reference -> File name

You can also use CTRL + SHIFT + C. This will copy your full path to the file.

Credits to @Robin Bastiaan he posted a short comment on the issue he created.

Out of the box, Intellij does not provide a quick shortcut for this feature. However, you can configure this via the keymap config nowadays. No plugin is needed.

Follow these steps:

  • Open your configuration via the menu File | Settings or use the shortcut: ⌘, (macOS), or Ctrl+Alt+S (Windows/Linux).
  • Go to the keymap page.
  • Search for the setting by searching for file name.
  • Add your preferred keyboard shortcut, for example Alt+C. (I like this key binding because it is similar to the other copy shortcuts, and is pressed easily too)
  • Click on Apply.
Related