As developers, we create, update, and delete files all day long. Managing files from the command-line is one of the first skills we learned. However, constantly switching from your editor to the command-line to execute a simple file command, a command you’ve probably executed thousands of times before, is tedious and slow. Instead, stay in your editor, and let it take care of the boring stuff. In this post, we’ll look at RubyMine’s file commands on OS X.
Creating Files
To create a new file or directory, press control + alt/option + N
within the editor or Project tool window.
Copying Files
Use F5
within the editor or Project tool window to copy the current file.
F5
can also be used in the Project tool window to copy directories.
Cloning Files
To create a copy of a file or directory in the current directory, press shift + F5
.
Moving Files
Move files and directories with F6
.
Like the previous file commands, this command works both within the editor and Project tool window.
Renaming Files
Files and directories can be renamed in the Project tool window with shift + F6
.
Deleting Files
Delete files and directories in the Project tool window with delete
.
Locating Files
To locate a file in the Project tool window, press alt/option + F1
in the editor, and then select the Project View option, the default option, from the Select Target dialog.
Select Reveal in Finder to open the file in a new OS X Finder window.
Working with File Paths
Use command + alt/option + F12
to view the complete file path.
Selecting a directory will open the directory in a new OS X Finder window.
Copy the current file path to the clipboard with command + shift + C
. Copy a reference, the current relative file path and line with command + alt/option + shift + C
.
These commands are useful for when you need to work with a file on the command-line.
Relying on Abstractions
A common developer fear is that overreliance on a particular IDE’s features will cause you to forget, or maybe never learn, the underlying commands. I agree that in some cases, e.g., version control, it’s important to know what’s going on under the hood. However, these situations are rare. And when it comes to everyday commands, I’d much rather use higher-level abstractions to free me from the mundane.