automatically open a group of files in Sublime Text 2 - sublimetext2

Is there a way to open a group of files automatically in Sublime Text 2? These files are stored in different folders. From online posts and videos it looks like Projects within Sublime Text are for specifying which folders to include/exclude in a project, which is different than wanting to open a group of specific files.

Related

display message if two users are using same file in sublime text 2?

The problem is when I am editing one file on my pc and that same file is also being edited by next developer in next pc but when i upload the file next developers changes were lost. Is there any way to display the message that same file is being used by many users and save the changes of both?

HTML/CSS Editor with Multi-Computer Code Folding

I'm looking for a code editor that saves folded/collapsed code. I want to be able to open the file on a 2nd computer and have the same folded/collapsed code structure. I understand that HTML/CSS cannot have this preference built in. If the editor needs to save the file in some propriety file type, I'm fine with that. I just need to be able to export it as plain HTML/CSS files once it's ready for publishing.
(Windows 7)
UltraEdit supports code folding for text files of any type and it supports also saving/restoring of folds on close/open.
In menu Advanced there is the menu item Configuration. In the settings tree navigate to Editor Display - Code Folding and enable at least the settings Save folded lines and Enable show/hide lines and code folding.
By default UltraEdit remembers which file are open with which lines hidden/folded on exit in file uedit32.ini stored on Windows computers by default in directory %APPDATA%\IDMComp\UltraEdit\. But this file contains also all other user configurations like the 2 settings I wrote above.
Therefore it is better to use a project or at least a workspace for editing the HTML/CSS files for your website(s). A project/workspace can be created in menu Project with New Project/Workspace. Using a project/workspace results in remembering which files are open on closing the project in a separate project related workspace file instead of uedit32.ini. The workspace file remembers not only the open files on closing the project, it remebers also which lines are folded, where the caret is positioned in each file, which file was the active file on close, and some other information to restore the workspace on next opening of the project/workspace.
But before creating the project/workspace, you need to enable the setting Save project information for use on multiple systems at Advanced - Configuration - File Handling - Advanced. As you can read on help page opened by clicking on button Help of this configuration dialog, this setting results in storing the workspace file of a project in same directory as the project file.
The location of the project file is defined by you on creating the project/workspace and is quite often in root directory or a subdirectory of a local copy of a website. With *.prj (the project file) and *.pui (the project user interface file = workspace file) somewhere in directory tree of the website, you have those 2 files also shared between multiple systems together with the HTML and CSS files.
See the user forum topics Create project from an existing directory tree? and Why save files to a Project? in the user-to-user forums of UltraEdit and take also a look on Tutorials/Power Tips page of IDM Computer Solutions, Inc.
SynWrite (Windows) supports it. Make some folding, then save a session file (*.syn). This file contains folded states and more. Anytime later, just open session file (menu File - Sessions) and folding (and more) restored.
You have a CSSMENU editor where you can create menu bars. This editor saves a file in such a way that it can be moved to any other pc as you mentioned . Html file will be saved and the related Css files are stored in another folder where you can move those files as your wish. No need of changing any code.

Sublime Text plugin API: how to get list of files in project?

I'm writing a plugin for Sublime Text 2/3 that should open multiple files which names contain a certain string.
How could I get a list of the files in the project? I can't find any related API function in the docs. I can do it with Python's os.walk but it's kinda slow. On the other hand, Sublime's Ctrl+P menu is blazingly fast, but I don't know how to access its contents from my plugin.
In Sublime Text 3 API fot exists function for get files in project, but exists function project_data() which returns project related information. for files you can code like this:
project_data = sublime.active_window().project_data()
project_folder = project_data['folders'][0]['path']
# and here os.walk(project_folder )

Sublime Text 3 plugin development: access own files

The porting guide states that:
Packages in Sublime Text 3 are able to be run from .sublime-package
(i.e., renamed .zip files) files directly, in contrast to Sublime Text 2, which
unzipped them prior to running.
While in most changes this should lead to no differences, it is
important to keep this in mind if you are accessing files in your
package.
So how do I access files in my own package? My plugin comes with some static files that it must use.
You can use sublime.load_resource(name) where name is (from the API docs)
Loads the given resource. The name should be in the format Packages/Default/Main.sublime-menu.

Sublime text 2 find in folder with file extension

How do I search in a folder in sublime text 2 with file extension?
My where when I use:
*.js
searches globally for all js files.
If I try to restrict it to a folder:
/project/*.js
it matches nothing.
Instead of this:
/project/*.js
Try using this:
project .js
This should match files which have project in the path and have a .js extension
EDIT: The above assumes you're trying to find all the files with .js extension using the Goto Anything feature in Sublime Text.
In case you'd like to search within .js files located within a directory, you can add an Include Filter in the search path:
/project,*.js
This will search for the text you've entered, limiting the scope to files within /project and it's sub-directories having the extension .js.
Reference: Sublime Text Docs - Search Scope
EDIT 2: For Sublime Text 3, refer Simons answer below.
godfrzero's answer does not work in Sublime 3 as it actually includes ALL JS files plus ALL files in the project folder.
Instead, you need to specify it similar to how you had it originally...
project/*.js
Note that there's no leading slash, as that will treat it as an absolute path which you won't want in most cases. To include multiple file types within the folder, I think you need to specify it like this:
folder/*.ctp,folder/*.php
This will match any of the following files:
/app/folder/example.ctp
/app/folder/example.php
/app/folder/subfolder/example.ctp
/app/long/path/folder/subfolder/example.php
I know you asked about Sublime 2, but hopefully this helps others (like myself) who are Googling for such advice.
Simon.
My Sublime ver: 3.2.2
Adding to above answers, I was trying to find in all python files starting with test_ . so this is how I did it.
After pressing Ctrl+Shift+F, in the window.
Where : /home/WorkDir/test, test_*.py