How to change the key binding of "Go to File" of textmate? - textmate

I want to change the key binding of "Go to File" of textmate from it's default one Cmd + T to option + cmd + n. How to do that?

Head into System Preferences → Keyboard → Shortcuts → App Shortcuts.
Add a new Application (Textmate) and the Menu Title should be 'Go to File..."
I tried just using 'Go to File' but found out the actual title requires the additional '...'

Go to System Preferences → Keyboard → Shortcuts.
Click App Shortcuts and then the plus button to create a new entry.
Select TextMate as application, set menu title to Go to File… (including the ellipsis) and then pick your desired key equivalent.

Related

Xcode 12 won't allow ⌘⌥← / ⌘⌥→ shortcuts for "Show Previous Tab" / "Show Next Tab"

I am trying to customize the Xcode 12.2 keyboard shortcuts for "Show Previous Tab" and "Show Next Tab". These are the new document tabs that were introduced in Xcode 12, as opposed to the old window tabs. (The document tab bar is below the window tab bar.)
When I go to Preferences > Key Bindings, and try to record shortcuts for "Show Previous Tab" and "Show Next Tab", the settings panel records ⌘⌥← as ⌘← and ⌘⌥→ as ⌘→. Basically, the option key disappears.
This is a problem only for those two shortcuts. If I try to customize "Show Previous Window Tab" and "Show Next Window Tab", I can record ⌘⌥← / ⌘⌥→ just fine.
Previously, I used System Preferences > Keyboard > Shortcuts > App Shortcuts to customize "Show Previous Tab" / "Show Next Tab" for "All Applications". I removed this, and it still didn't fix this issue in Xcode.
What you want is to change Navigation Style to "Open in Place" in the Xcode preferences. Then the whole silly tabs in tabs thing will go away and you can go back to just using App shortcuts like you used to.
For the record, I previously used shortcuts defined in Xcode, where it actually was possible to define option as a part of a shortcut for Show next and show previous tab, but had to go with App shortcuts now due to the behaviour you describe.
This is the article where I found the above info: https://www.jessesquires.com/blog/2020/07/24/how-to-fix-the-incomprehensible-tabs-in-xcode-12/
TL;DR: I had to use the system preferences -> keyboard -> shortcuts and set all four of these shortcuts. Which had a weird lag when it was setting them.
Show Previous Tab
Show Next Tab
Previous Window Tab
Next Window Tab
Long version: I tried the below first which should be the correct answer but it didn't work for me. Please let me know if it works for you.
I wish this worked because it looks like it would be awesome.
XCode -> Preferences -> Key Bindings
Use the the search Filter on the right side to search for:
Show Previous Tab
Show Next Tab
Previous Window Tab
Next Window Tab

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

How to disable keyboard shortcuts in Mac OS X?

I would like to disable keyboard shortcuts Command-W and Command-Q in Mac OS X 10.8 Mountain Lion.
This is because they interfere with emacs commands which I run from inside a terminal running from xQuartz. How can I disable the keyboard shortcuts?
BetterTouchTool is no longer free.
I reached this page because I wanted to disable command-h (hide application) which is not shown in System Preferences. This is my solution.
BetterTouchTool is a utility which can disable keyboard shortcuts (and has many other uses). http://www.boastr.de/
To disable command-w globally
Install BetterTouchTool
Click on the BetterTouchTool menubar item and choose "Preferences"
Click "Gestures"
Click "Keyboard"
Click "Global"
Click "Add New Shortcut"
Click "Keyboard Shortcut"
Type the shortcut you want to disable (for example, command-w)
Set Trigger Predefined Action to "No Action" (which is the default)
Note that you can also set a keyboard shortcut for a specific application.
To disable command-w only for Terminal
Install BetterTouchTool
Click on the BetterTouchTool menubar item and choose "Preferences"
Click "Gestures"
Click "Keyboard"
Click the plus sign at the bottom of the "Select Application" pane
Choose Terminal (in Applications/Utilities folder)
Click "Add New Shortcut"
Click "Keyboard Shortcut"
Type the shortcut you want to disable (for example, command-w)
Set Trigger Predefined Action to "No Action" (which is the default)
BetterTouch wasn't able to change or disable the key that was causing me grief: ctrl-cmd-d.
Here is how I was able to delete it:
Edit open ~/Library/Preferences/com.apple.symbolichotkeys.plist
Find the code for kCGHotKeyLookUpWordInDictionary (70), and set 'enabled' to OFF
(if it's not there just create an entry '70' with 'enabled' = OFF).
Restart your system
From this site I learned about symbolic hot keys and found a list of them:
http://www.theregister.co.uk/2009/02/24/hotkeys_framework2/
These sites have lists of the codes used in the plist file, so one can actually change the shortcuts instead of only deleting them:
http://krypted.com/mac-os-x/defaults-symbolichotkeys/ and
Documenting com.apple.symbolichotkeys.plist.
To view or change Keyboard shortcuts:
Open the System Preferences->Keyboard
Click on the Keyboard Shortcuts tab
To change a shortcut, double click on the existing shortcut, and
press the keys that make up your new shortcut.
If you make a mistake, click '"Restore Defaults to return the
keyboard shortcuts to the factory defaults
A solution that may work for factory hotkeys in individual apps which conflict with your desired assignment:
Use the built-in hotkey management:
System Preferences | Keyboard | Shortcuts | App Shortcuts
...to map the pre-existing to some hard-to-hit keyboard combination (like Cmd-Opt-Shift-backslash). This will free-up the old key combination for assignment.
Which highly recommend is hammerspoon, who defined GOD LIKE!
install hammerspoon
vim ~/.hammerspoon/init.lua
paste this hs.hotkey.bind("cmd", 'H', function()end) in
:wq and then StatusBar -> Hammerspoon -> ReloadConfig
done!
Happy Hack!
A solution is to configure XQuartz to enable "Option keys send Alt_L and Alt_R" under Preferences/Input.
Then add this to your ~/.emacs:
(setq x-alt-keysym 'meta)
It is not perfect, as you might still slip on Cmd-W instead of Option-W sometimes, but at least it is functional.
Following an article on how to script shortcuts I tried setting a shortcut to '' to no avail, but setting it to NULL worked fine. Here's an example:
TAB_KEY_SYMBOL="\\U21e5"
COMMAND_KEY_SYMBOL="#"
SHIFT_KEY_SYMBOL="$"
defaults write com.apple.finder NSUserKeyEquivalents "{ 'Show Package Contents' = '${COMMAND_KEY_SYMBOL}${SHIFT_KEY_SYMBOL}O'; }"
defaults write com.apple.finder NSUserKeyEquivalents -dict-add 'Add to Sidebar' '\U0000'
defaults write com.apple.finder NSUserKeyEquivalents -dict-add 'Add to Dock' '\U0000'
# kill finder and prefs daemon
killall Finder
killall cfprefsd
# *only* if absent, add bundle id to make it show up in keyboard prefs pane
defaults read com.apple.universalaccess "com.apple.custommenu.apps"
defaults write com.apple.universalaccess "com.apple.custommenu.apps" -array-add "com.apple.finder"
$ defaults read com.apple.finder NSUserKeyEquivalents
{
"Add to Dock" = "";
"Add to Sidebar" = "";
"Show Package Contents" = "#$O";
}

What key shortcuts are to comment and uncomment code?

There were Ctrl+E+C (comment) and Ctrl+E+U (uncomment) in older versions, or Ctrl+K+C and Ctrl+K+U.
But in VS 2012, I can't see key shortcuts:
How to enable those shortcuts?
Keyboard accelerators are configurable. You can find out which keyboard accelerators are bound to a command in Tools -> Options on the Environment -> Keyboard page.
These commands are named Edit.CommentSelection and Edit.UncommentSelection.
(With my settings, these are bound to Ctrl+K, Ctrl+C and Ctrl+K, Ctrl+U. I would guess that these are the defaults, at least in the C++ defaults, but I don't know for sure. The best way to find out is to check your settings.)
You can also add the toolbar in Visual Studio to have the buttons available.
View > Toolbars > Text Editor
Use the keys CtrlK,C to comment out the line and CtrlK,U to uncomment the line.
From your screenshot it appears you have ReSharper installed.
Depending on the key binding options you chose when you installed it, some of your standard shortcuts may now be redirected to ReSharper commands. It's worth checking, for example Ctrl+E, C is used by R# for the code cleanup dialog.
This is how I did it,
Menu Tools → Options on the Environment → Keyboard window
One can alter the default shortcuts following the below steps
Select Edit.CommentSelection in the listbox
Click on "Remove" button
Select "Text Editor" option in the dropdown under "Use new shortcut in:"
Press your own shortcut in the textbox under "Press shortcut keys:"
Example: Pressing Ctrl+E and then C will give you Ctrl+E, C
Click on "Assign" button
Repeat the same for Edit.UnCommentSelection (Ctrl+E, U)
I went to menu: Tools → Options.
Environment → Keyboard.
Show command containing and searched: comment
I changed Edit.CommentSelection and assigned Ctrl+/ for commenting.
And I left Ctrl+K then U for the Edit.UncommentSelection.
These could be tweaked to the user's preference as to what key they would prefer for commenting/uncommenting.
"commentLine" is the name of function you are looking for. This function coment and uncoment with the same keybinding
Shift + alt + a
the command palette is great for finding shortcut keys.

interface/implementation files shows up in new windows

I`m using "All in one" layout.
When I press cmd + opt + up arrow interface/implementation files are switched in new window. How to do in current window ?
Open Preferences (Xcode > Preferences from the menu) and on the General pane, under Editing, check off Open counterparts in same editor.

Resources