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

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?



Solution 1:[1]

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.

Solution 2:[2]

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

Solution 3:[3]

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Feedforward
Solution 2 Andrey
Solution 3 Robin Bastiaan