In this video tutorial, I’ll be showing you how to perform file operations super fast with Sublime Text. I’m sure a lot of us uses the mouse to create files and folders by going to our IDE or editor’s sidebar and using the New File or Folder option. For me, that is a very daunting operation as I personally don’t like to touch the mouse when I’m coding.
Luckily, AdvancedNewFile, a package of Sublime Text comes to rescue. So let’s go ahead and install this great package. Fire up Sublime Text, open up Command Palette and use Package Control to install AdvancedNewFile package.
Once the package is installed, you can open up the Command Palette. You will see a couple of commands with the prefix ANF short for AdvancedNewFile.
Creating New Files
You can create new files by either selecting ANF: New File from the Command Palette or by pressing the shortcut Command+Option+P on Mac. It’ll open up a textbox at the bottom, you can type in the entire path to the file and it’ll create the entire path if it doesn’t exist. If you want to create a new file in the current path of an open file, you can type in the filename prefixed with a colon (:).
You should be able to rename the file by selecting the ANF: Rename File option from the Command Palette. Just one catch in this is to prefix the new filename with colon (:). Otherwise, it’s going to rename/move the file over to the project root.
Similarly, you can select the ANF: Delete File to delete a specific file or ANF: Delete Current File to delete the currently open file.
There are a couple of more operations which you can filter by going over to the Command Palette and typing ANF to filter the results and then using the right operation of what you need to do.
That’s it for this quick tutorial, in the next one, I’ll show you a couple of more Sublime Text packages.
Till next time, Good Bye.