In Xcode, if the cursor is on one brace (or bracket or parenthesis) of a matched pair, what keyboard shortcut will jump to the matching brace? Or how can I create such a shortcut?
An example of the feature I'm after is the "goto brace" shortcut in Visual Studio.
There is a Balance Delimiters menu command. So simply assign it any keyboard shortcut you prefer (all commands have customizable key bindings). You can also double-click the first delimiter to perform the same action.
A partial solution is to use code folding. For example, to jump from the opening brace to the closing brace:
Put the cursor just after the opening brace.
Fold with ⌥⌘←.
Arrow the cursor right to just before the closing brace.
Unfold with ⌥⌘←.
Since Xcode now has Vim mode you can use that and just hit %.
(Adding this answer for completeness - I understand it kind of amounts to "just use Vim".)
Related
In Visual Studio
while i am typing a string inside braces
what is the hotkey to go to ending bracket ] without pressing end
item["i am typing here..."] //i want an hotkey to jump here
if it's not possible
how can i jump out of current box which i am typing in?
namespace{
class{
method(){
lambda->({(jump out of this box)});
}
}
}
according to this https://www.dofactory.com/reference/visual-studio-shortcuts you should use end button to go to ending bracket and you can see all of hotkeys in this link.
You are looking for Ctrl-]. From the documentation:
Moves the cursor to the matching brace in the document. If the cursor is on an opening brace, this will move to the corresponding closing
brace and vice versa
At the bottom line - it will bring you to the end of your current braces-scope (or to the beginning of it if you are on the closing brace )
I did this trick after starting to type inside quotes ("")
press tab then press ]
It's much better than pressing end
Sometimes this won't work and will print /t character
I don't know how to deal with that
Still, there should be a better answer to this!
Given the following code example
someMethod(②someArgument①);③
I know moving the cursor from position ①->② shortcut is CTRL+], is there a ①->③ shortcut.
Is there a keyboard shortcut that escapes the brace when cursor is just left of brace (Not with End key).
In Eclipse, It can easily work with Tab key.
(In Visual Studio) - Try Ctrl+Shift+] - That seems to select text to where you might need to be, but if you press the ] again, by itself, it deselects, but leaves the cursor where you appear to want it.
Is that what you're looking for?
Say you have a large amount of C# code in an if statement. If you place your carat next to the opening bracket, is there a hotkey or something in ReSharper that will automatically take you to the closing bracket?
VS offers this shortcut, regardless of whether you have R# installed.
Ctrl + ] will take you to the opening brace. Subsequent presses will jump between the RHS/LHS of the scope.
See Go to Matching Brace in Visual Studio? (now as an answer as requested!)
ReSharper assigns the shortcut (Control + ´ - I have german keyboard) to a different command. In order to restore it go to Tools - Options - Environment - Keyboard, search for Edit.GotoBrace and enter the desired shortcut key.
See to what command it is currently assigned and then remove it for this command first by searching this command and clicking Remove. Then again search for Edit.GotoBrace and assign the shortcut.
Directly assigning without Removing it first didn´t work.
Visual Studio's shortcut is (under the IntelliJ shortcut set): Control + ] when your cursor is on the opening brace goes to the ending brace. The inverse is also true.
now i am using vs2010 trail version.
i want to see the matching braces if there are multiple braces. the opening brace and the closing brace must be highlight.. how to achieve this?
Thank you,
Mihir
The link above should give you all default key mappings.
Another useful link is: Pre-defined keyboard shortcuts
I'd just like to mention a couple that I find very useful:
To jump back and forth between matching braces, you can put your cursor on either brace, and then push Ctrl-]
And also Ctrl-M Ctrl-L toggles all outlining in the current file, and Ctrl-M Ctrl-M toggles the current region
from msdn: http://msdn.microsoft.com/en-us/library/be94e8aw%28v=vs.80%29.aspx
outlines all the options and how to set them up
for javascript: Brace highlighting in Visual Studio for Javascript?
With Eclipse/Java one of the shortcuts I used a lot was selecting expressions. alt+shift+up would increase selection to the next parent/enclosing expression, alt+shift+down would bring it back down.
Is there anything like this for XCode/Objective-C. What about when using vi?
I don't know about any keyboard shortcuts, but in XCode double-clicking a parentheses, curly bracket, square bracket, or quote will select the corresponding expression/block.
Doesn't seem to be any way to do this, even in XC4. Sad.