Folder2Project
A sublime text plug-in that open the folder that contains current open file.
Details
Installs
- Total 4K
- Win 2K
- Mac 702
- Linux 640
Feb 20 | Feb 19 | Feb 18 | Feb 17 | Feb 16 | Feb 15 | Feb 14 | Feb 13 | Feb 12 | Feb 11 | Feb 10 | Feb 9 | Feb 8 | Feb 7 | Feb 6 | Feb 5 | Feb 4 | Feb 3 | Feb 2 | Feb 1 | Jan 31 | Jan 30 | Jan 29 | Jan 28 | Jan 27 | Jan 26 | Jan 25 | Jan 24 | Jan 23 | Jan 22 | Jan 21 | Jan 20 | Jan 19 | Jan 18 | Jan 17 | Jan 16 | Jan 15 | Jan 14 | Jan 13 | Jan 12 | Jan 11 | Jan 10 | Jan 9 | Jan 8 | Jan 7 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 1 | 1 | 1 | 0 | 0 |
Mac | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Linux | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Readme
- Source
- raw.githubusercontent.com
Open Folder From File As a Project
Introduction
Sublime Text has a bunch of useful API, However, given an opened file, there is no explicit way to open the folder that contains this file as a project, especially when a *.sublime-project inside that folder. That's why I develop this small plug-in. Basically, this plug-in does two things:
- Open the folder that contains the openned file as a project. If there is a sublime-project file in this folder, load it (This may change the interpreter, syntax theme, etc.)
- provide an API for futher developement:
window.run_command(“open_folder_as_project”, {“folder”: folder})
It is a bit tricky to implement this API. First, Sublime only has three project-related API:
- sublime.window.project_file_name()
- sublime.window.project_data()
- sublime.window.set_project_data()
Admittedly, if you have already opened a project file, the methods API are enough to retrive the project settings, but no method can directly open a sublime-project file, nor open a folder as a project.
Therefore, I designed a workaround: 1. Search the folder for *.sublime-project file 2. If exist, load this file. Otherwise create a temporary project configuration. 3. put folder's path in project settings, temporarily change all relative paths to absolute paths to correctly show relevant folders in side bar. 4. update project data.
Usage
“open_current_folder_as_project”: Add the folder that contains current file to the sidebar.
“remove_folder_from_project”: Remove the folder that contains current file from sidebar.
You can define your own keymaps, the default keymap is:
[
{ "keys": ["ctrl+shift+h"], "command": "open_current_folder_as_project"},
{ "keys": ["ctrl+shift+l"], "command": "remove_folder_from_project"}
]