Textmate, how to find out which theme I am using? - textmate

I am using TextMate version 2.0-alpha.9387, I don't see any options in Preferences.

The answer is select View->Theme from menu bar. But I think textmate 2 has bug on that menu item, the menu item is grey and not selectable, I have to make selection of text that I am editing to enable the menu item.

Start with an open document
Keyboard:
Ctrl + Command + t, begin typing variable, when "Show TextMate Variables - Bundle Development" is selected, press return.
Mouse:
Bundles → Bundle Development → Show TextMate Variables
Results:
This displays a large tooltip listing all the environment variables available to the TM, you're looking for "TM_CURRENT_THEME_PATH". The theme name is the same as filename in this path.
Bonus:
You could create a snippet for this as well:
Snippet/Command:
${TM_CURRENT_THEME_PATH}
in a snippet with a tab trigger of theme would cause the path to replace theme with the path.

Related

What is the hotkey in Xcode to open the function list & MARKs list in the current file editor

Instead of mouse clicking the section in Red box here, is there a hotkey for it in XCode?
control-6.
Everything in that bar is found in the View➡️Editor menu.
"Hotkey" is a Microsoft term. They are called "keyboard shortcuts" in the Apple ecosystem.

Show Assistant Editor missing in Xcode 11?

In Xcode 10, the toolbar had an inter-locking ring icon which showed the assistant editor, it's missing in Xcode 11.
In Xcode 10, the toolbar had an inter-locking ring icon which showed the assistant editor, it's missing in Xcode 11.
The interface has changed a little, but the functionality is still there. The top right corner of the editor pane has two buttons:
Clicking the left button, which looks like lines of text, displays the popup menu, where you can choose various editor configuration options. Clicking the right button just narrows the existing editor and adds another one next to it.
Some of the same options are also available in the Editor menu in the main menu bar.
Update: This is from the Xcode 11 beta release notes, and perhaps more fully explains why the UI was changed:
Editors can be added to any window without needing the Assistant Editor. Editors are added using the “Add Editor” button in the jump bar or the File > New > Editor command. Each editor can now be in one of three modes: “Editor Only”, “Editor and Assistant” or “Editor and Canvas”. The latter two modes automatically show relevant content when available. When using multiple editors, the View > Editor > Focus command can be used to temporarily expand the active editor to fill the entire window, hiding other editors. For source control support, the Code Review button in the Toolbar replaces the Comparison Editor. The “Show Authors” command is now available from the Source Editor’s Editor menu. The SCM Log is now in the Inspector Area. (43806898)
With multiple editors possible in a window, you need editor-specific controls for showing the ancillary views like the assistant editor, author view, etc.
From SMGreenfield's comment:
Sometimes I want to look at a different part of the same darn document. There has always been a way to do this, but it involved jumping through hoops.
Just add another editor: click the Add Editor button in the upper right corner of the editor, or choose File > New > Editor. The new editor will default to showing the same file you were working on in the existing editor.
If new editors show up on the right of the existing editor and you'd prefer them to stack vertically, you can choose View > Change Editor Orientation. If you want them to stack horizontally most of the time (the default) but just want one to show up below, choose File > New > Editor Below.
Shortcuts :
control + option + command + return : Show Assistant Editor
command + return : Show Editor only (hide Assistant Editor)
Using Editor on the Toolbar
It has moved, to show it click on icon with horizontal lines and select Assistant.
In Xcode 11 we now have multiple editor panes. You can summon a second pane, a third pane, as many as you like.
When you have a second pane, it does not have to be an automatic assistant. In other words, the editor pane itself either is an assistant or it is not. So if it is not, it is manual. And if it is, it is automatic.
To toggle between being an assistant and being an ordinary pane, choose Assistant from the Editor menu:
If Assistant is checked, this is an assistant and is automatic. What it displays depends automatically on some other pane.
If Assistant is unchecked, this is an ordinary editor pane and is manual. You can display anything you like in this editor.
In case you can't use Add Editor button just use shortcut:
Cmd + Ctrl + Shift + Enter
Turn Assistant on by navigating to the following in Xcode 11:-
Xcode > Editor > Assistant
For Xcode 11.2.1
command + option + return
or
Main Menu -> Editor -> Line View
it is worth noting, that you can also open the assistant editor by alt-clicking the file

Xcode: Is it possible to 'Open Quickly' the right pane of the Assistant Editor?

Is it possible to 'Open Quickly' in the right pane of the Assistant Editor? This would increase productivity by like 20x
Yes it's possible, but depending on your Xcode version you may need to adjust the default behavior in Xcode's preferences.
Use ⌘ command+⇧ shift+O to open the "Open Quicky" input box, and then:
Use ⌥ option+Enter to open the file in the right editor.
Use ⌥ option+Shift+Enter to select where you want to open the file using the arrow keys.
On Xcode 12, the default action of ⌥ option+Enter is to open the file in a new "Tab" (which are new in this release, and different from a "Window Tab"). This is still configurable in the preferences.
On Xcode 11, you can split the editor as much as you want. This means ⌥ option+Enter by default will open the file in the editor next to where your cursor currently is.
This behavior is configurable in Xcode's Preferences, under Navigation:
To have ⌥ option+Enter open the selected file in the editor on the right of the Xcode window, select "Optional Navigation: Uses Second Editor".
Make sure that Uses Focused Editor is selected in Preferences > Navigation:
This way, you can open it by focusing the Assistant Editor, pressing ⌘ command+⇧ shift+O to open the Open Quicky input box, and just press Enter to open the selected file, instead of ⌥ alt+Enter.
An even easier way is to hold down the Option key and then click on the file. That will bring open the chosen file in the Assistant Editor. This works great when you TDD your Swift :) You can have your tests on the left and option click on the implementation to open on the right.
Cool thing!
Just to extend the answer you can switch between more then two Tabs or open it new editor tab cool isn't it?
• Open multiple assistant editor .
• ⌘ command+⇧ shift+O.
• Hold ⌥ option and press Enter on the selected item.(Used to open any file in Assistant Editor)
• You can also use ⌥ option+⇧ shift+Enter to toggle more and
open new tab if you're not on stacked editor.
• The multiple selection window will appear
Note: Make sure you have all editor stacked selected
In addition to Guillaume's answer, be mindful that the editor is not in the single editor mode (I don't know what it should be called officially though) that you can disable by selecting this button, otherwise all navigations become "Uses Focused Editor":
EDIT: misread your question above answer is good, just make sure you click into that pane before trying those commands
Sounds like your looking for some hotkeys, check here for a full list
http://spin.atomicobject.com/2014/03/23/xcode-keyboard-shortcuts/
http://iphonedev.tv/blog/2014/9/15/14-xcode-time-saving-shortcuts-memorize-and-improve-your-productivity
http://nshipster.com/xcode-key-bindings-and-gestures/
but to open assistant editor use ⌘ command + ⌥ option + ↵ return

Track down a textmate snippet by keybinding

I'm trying to use a snippet from an installed bundle that has the keybinding command+shift+a. The problem is that it's being overridden by some other snippet. How do I track down that snippet and remove it's keybinding so I can use the one I want.
Press ⌘⌃T to show the Select Bundle Item window, then click on the magnifying glass and switch the field to "Key equivalent". Now type the keyboard shortcut.

Fix code indentation in Xcode

Once I start editing my code and adding for loops or if then statements my code indentation is whacked because the previous code maintains its former indentation instead of adjusting automatically.
In Visual Studio you can highlight code and select 'format selection' to fix these issues - is there anything similar in Xcode?
Before Xcode 9 (for Xcode 9 see default shortcut below)
select text
right-click
there's a "Re-indent selection" item in popup menu
In XCode 4 there is one more step:
select text
right-click
Click on "Structure"
there's a "Re-indent selection" and other options in popup menu
Or using the default shortcut:
select text
press ctrl + i
select text
press Control-I (the default keyboard shortcut)
You can do this automatically in Xcode 11
In Xcode 4.6.3, choose Editor > Structure > Re-Indent.
Shortcut: Control + I
(that's 'i', for 'indent')
This works on current selection. If no text selected, choose Edit > Select All (⌘+A) and then perform the re-indent.
(I'm more clearly restating the other answers)
These solutions re-indent text to the default xCode behaviors. To change these behaviors, go to xCode (v.4) > Preferences > Text Editing. Then to Indentation Tab.
Xcode 9.2:
You can select text and press ctrl + i to re-indent code.
You can do it in different ways, but these two are the easiest
select text ( ⌘ +a) :
Using shortcut -> (control)^ + i
Click on "Editor" -> Click on "Structure" -> Click on "Re-indent"
Sometimes setting Xcode global preferences is not enough for ^ + i to do its job accordingly. The reason is that project settings override global ones. You can set indentations for a concrete project or even a file.
Select project (or file) in the Navigation Pane. Then in File Inspector go to Text Settings section and set desired number of tabs or spaces for indents.
To quickly re-indent the whole file:
⌘+a
⌘+x
⌘+v
Edit: No longer working in Xcode 11
You can try my extension Swimat
https://github.com/Jintin/Swimat
It support format on selection.
Simple install by brew cask install swimat

Resources