Quickly Inserting File Paths in Sublime Text
Sublime Text is a notably minimalist code editor. It lacks a traditional GUI, with even the settings managed via text. This minimalist approach sharpens our focus on coding rather than navigating through the editor’s features. But a question arises: How do we efficiently insert a file path?
Unlike other code editors, such as Coda, which allows file paths to be inserted via a simple drag-and-drop, Sublime Text lacks this feature, usually requiring manual input. However, there’s a more efficient alternative.
For a more streamlined approach to inserting file paths in Sublime Text, read on.
18 Essential Plugins For Sublime Text
Even though SublimeText comes with a bunch of great features that help our work as web developers, like... Read more
Initial Plugin Solution
One useful plugin is SidebarEnhancement. It enhances the sidebar’s context menu to include a Copy Path option. Simply right-click on a file within your project and select Copy Path to grab the file path easily.
This method is more convenient than manually typing out the file path. Yet, there’s an even better plugin for this task.
Enhanced Solution with AutoFileName
The AutoFileName plugin extends the auto-completion feature of Sublime Text to file paths. Install this plugin via Package Control.
For instance, if your project includes an HTML file with folders for stylesheets and images, simply place your cursor within the <href>
tag. AutoFileName will display a list of files and folders at the same directory level.
Choosing css from this list displays the respective files and folders, streamlining the process of linking resources in your project.
Image Path Insertion Made Easy
AutoFileName particularly excels when inserting image paths. It automatically identifies and populates the image size, width, and height attributes, enhancing efficiency and accuracy.
Concluding Thoughts
While SidebarEnhancement is great for managing projects within the Sublime Text sidebar, for inserting file paths, AutoFileName proves indispensable. I hope you find these tips helpful in boosting your productivity.