Is there any way to sort the "Open Files" section in the sidebar by alphabetical order?
The open files section of the sidebar is listed in the same order as the open tabs in the editor, so you can alphabetize the list by alphabetizing the tabs.
There is a plugin called SortTabs that will do this automatically. It also has a couple of other sorting options, including sorting by file type and last modified date.
sortTabs is the way to go as pointed out by Derrick. I would like to add, opening more than one instance of the same file, will not let the linter to work properly. sortTabs helps identify those duplicate instances. Although, written for Sublime Text 2, sortTabs also works well in ST3. Ctrl+Shift+P > sortTabs Menu > choose your sorting criteria.
Related
I am newbie with Applescript and Automator. I am trying to build a Quick Actions which will be able to propose different functions according to the type of file for example.
If the file is test.sh quick action will be a and b
If the file is document.pdf action will be c and d
I succeed in creating my actions but not to make them specific to file type. I don't know where to start as I don't see any possibility to make input conditional like if input = .sh do a and b.
Any help on how to proceed will be really appreciated.
Thank you,
After looking at the image of your QuickAction, it is not at all useful for anything other then a selected PDF document in Finder.
The first action should be a Set Value of Variable action so its contents can be retrieved multiple times using Get Value of Variable with however many Filter Finder Items actions needed to process the different file types, followed by the appropriate actions for each file type.
You would also use Ignore this action's input checkbox under Options for this action to detach it from the previous set of actions.
The image below shows a rough outline example of what I'm referring to:
Quick Actions are meant to be type-specific, so in general the best practice is to write one Quick Action for each file type. These quick actions will only appear in the Finder when files of that type are selected.
In many cases you can specify the file type when you create or edit the Quick Action in Automator. For instance, to create a Quick Action that appears only when PDF files are selected, set the pulldown menus at the top of the workflow to say "Workflow receives current PDF files in Finder":
then complete and save the Quick Action.
If you want more fine-tuned control over what types of files the Quick Action 'sees', you can edit its info.plist file and change its file types. After you've saved the Quick Action, navigate to ~/Library/Services in the Finder (that's the Services folder in the Library folder of your Home folder). Find the package with the name of the Quick Action (e.g., "Open in Preview"), control-click on it to get the contextual menu, choose Show Package Contents, and then open the Contents folder. You'll see the following:
Open that info.plist file in a plain-text text editor — I prefer BBEdit, but TextEdit will work fine if you make sure 'rich text' is turned off — and look for the NSSendFileTypes key. It will look something like the following:
<key>NSSendFileTypes</key>
<array>
<string>com.adobe.pdf</string>
</array>
com.adobe.pdf is a Uniform Type Identifier (UTI), and you can add or substitute in any system-recognized UTI. Here is the list of system-declared UTIs, but applications can declare their own UTIs and register them with the system, so this list is not necessarily exhaustive. For instance, if you want your Quick Action to send both PDFs and image files to Preview, you would search on the system-declared UTIs page and find that the base UTI for images is public.image, and then edit the info.plist to read:
<key>NSSendFileTypes</key>
<array>
<string>com.adobe.pdf</string>
<string>public.image</string>
</array>
Save this, and the Quick Action will now appear whenever you selected PDFs or images. Note that if you manually edit the info.plist file it might get overwritten if you edit and save the Quick Action in Automator.
Only the first two relevant Quick Actions will appear in the Finder window; any extras will be collapsed under the more button. To change the ordering so that the Quick Actions you use most are up first, open System Preferences, click the Extensions item, open the Finder section, and drag the items in the right-hand list into the order you prefer.
I'm trying to implement 'Next File' and 'Previous File' shortcuts in Sublime Text 3 following this answer, Change "Next File" and "Previous File" shortcut in Sublime Text 2.
However, I'm unable to find the "Key Bindings - User" file mentioned in that answer. I can find some .sublime-keymap files in ~/Library/Application Support/Sublime Text 3/Packages, but they seem to be specific to certain installed packages:
~/L/A/S/Packages> find . -name '*keymap*'
./pymdownx/st3/pymdownx/keymap_db.py
./Pretty JSON/Default (Windows).sublime-keymap
./Pretty JSON/Default (OSX).sublime-keymap
./Pretty JSON/Default (Linux).sublime-keymap
./Babel/Default.sublime-keymap
Where would be the right place to add these commands?
[
{ "keys": ["ctrl+]"], "command": "next_view" },
{ "keys": ["ctrl+["], "command": "prev_view" }
]
Incidentally, the next_view and prev_view commands are described at https://docs.sublimetext.io/reference/commands.html.
See the answer I added in your other question regarding why you can't find the files that the documentation is pointing to.
Regarding how many of the resource files in Sublime Text work, when Sublime loads them it gathers all of the files with the same name across all of the packages you have installed and combines them together. This merging happens in a very specific order related to the name of the package that the files are in to ensure consistent results. Generally speaking, the package list is sorted lexically by name and files are merged in that order, except that Default always comes first and User always comes last.
This allows Sublime to provide the default bindings in the Default package, any package can include their own bindings that augment the list, and the User package (where all of your user specific customizations go) is the "final arbiter".
In this case, the default key bindings for your platform are stored in the Default (<platform>).sublime-keymap file in the Default package, and your user customized key bindings are in a file of the same name in your User package.
The Preferences > Key Bindings menu item opens the appropriate files in a split window, with the platform defaults on the left and your user customizations (if any) on the right.
It's also worth noting that in previous versions of Sublime Text, the menu items for editing things such as key bindings existed as multiple items, so you would see things like Preferences > Key Bindings - Default and Preferences > Key Bindings - User. In this case, one menu item opens the defaults for your platform and the other opens your user file.
Some packages still present their settings in this manner and some have switched to the new format, so this is still something that you see from time to time. In cases like this, you can pick the single menu item to refer to either of the older style menu items. It's essentially doing both of them for you at the same time.
Is it possible to exclude commented lines (either individual, or groups) from searches in Xcode?
If so, how can this be done?
No, you cannot exclude comment lines from Xcode search.
You can use "search scopes" to search more efficiently in Xcode:
Reference by Apple docs:
The refined search navigator allows all current search options and settings to be seen at a glance. The options are easily manipulated by clicking directly on them in the search navigator. You can set search scopes, including selecting multiple folders in a project, and save them by name for easy re-use. The search results display wraps to allow you to see ore results easily and quickly.
In Xcode 5, can you sort the list of code snippets?
I've made one of my own and it's down at the bottom. I'd rather have it be up at the top.
One cannot automatically sort the snippets. One can go into the snippet file and reorder the snippets. System snippets are always presented first so to move a user snippet to the top one would copy the data for the snippet between the dictionary tags (....) to the top of the system snippets.
How to do it
Be advised that it is likely one would lose the ordered snippets when Xcode is upgraded so this should be considered but here is the way to force the issue:
Backup the affected system snippet file
(/Applications/Xcode.app/Contents/PlugIns/IDECodeSnippetLibrary.ideplugin/Contents/Resources/SystemCodeSnippets.codesnippets)
for safety
User snippets are stored as a series of xml files located in the
following directory ~/Library/Developer/Xcode/UserData/CodeSnippets/
Create a user snippet
Go to the user snippets folder and open the file just created with a
text editor (these are just xml files so TextEdit, TextMate, et al
will do)
Copy the user snippet between the ... tags
Paste the user snippet data into the system snippet data at the top
Why you should avoid doing it
Changes will likely be lost when Xcode is updated
You can and should create a shortcut that will allow you to type the
entire snippet into code easily
Your title of the snippet is also searchable (making the snippets easy to find)
What is the alternative
I suggest you open an enhancement request at http://bugreport.apple.com to ask Apple to make a sort option available.
In VS2010 is it possible to search within a certain file type only?
I want to search just my cs code and exclude .aspx files and VS generated code from datasets and edmx files.
Go to Find in Files and fill out your search string in Find What: and expand Find options and fill out Look at these file types: with *.cs.
Under Find and Replace/Find in Files (Ctrl+Shift+F), expand "Find options", then you'll notice a box called "look at these file types". Enter "*.cs" in there, and it'll only look at files with the .cs extension.
For more information, you may refer to http://msdn.microsoft.com/en-us/library/dechx2tz.aspx.
Use the Find in Files search.
You can specify the extensions of the files you want to search.
On the "Find in Files" dialog, there is a 'Look in these file types' option, under 'Find Options'