xcode: select expressions shortcut - xcode

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.

Related

Jump to matching brace in Xcode

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".)

Brakets keyboard shortcut to move focus to treeview

This should have been relatively easy to fine out , turns out its not, so actually all i really want is a shortcut with which i can toggle between the text editor and the treeview on the left.
The brackets documentation really don't mention any such shortcut see here.
In Atom text editor for example there is a shortcut ctrl+0 which shifts focus to the tree view , i can't seem to find such a shortcut in brackets though. I love all the features of brackets, but i just seem to be short of this one last shortcut to make my work flow awesome !!
Thank you.
Alex-z.

Xcode Matching Pairs of Braces, Parentheses, and Brackets

If you are a notepad++ user you will understand what I want Xcode to do for me , it's very simple I want when i place the cursor before or after a Braces, Parentheses, and Brackets , it highlight for me its pair to know the matching ones juste try to place the cursor in notepad++ and tell me how to do that in Xcode i know already the trick of the right arrow of the keyboard and the double click but the trick of notepad++ is faster , thanks in advance
The only thing I can add (and I have looked a fair bit) is to train your eyes on the vertical grey bar on the left edge of the editor, called the "code folding ribbon" in preferences. It will visually hint at matching braces (not parenthesis) at all nested levels, and mousing over it hints quite strongly and gives the interface for folding.
See here for a snapshot and brief description from Apple.

.vimrc to behave like Textmate?

I am making the switch to VIM from Textmate and I wanted to know what should be included in my .vimrc to get the similar behavior for:
auto-close on brackets, paranthesis, etc.
auto tabbing after a bracket
when i open a bracket and select enter, the open bracket is on 1st line, the cursor on the 2nd line indented, and the closing bracket on the 3rd line
pressing <tab> on for will generate a common 'for' use
Thanks.
The first thing to be aware is that you can't turn Vim into TextMate. The second, is that you shouldn't even try.
Instead, focus your efforts on learning Vim, progressively, and grow/shrink your collection of settings and plugins as you need. Using Janus or some other "distro" will only occult Vim behind other people's arbitrary choices.
That said,
"auto-close on brackets, paranthesis, etc."
can be done in a "dumb" way by adding this line to your ~/.vimrc:
inoremap ( ()<Left>
inoremap is for mapping in insert mode (note the i)
( is the key you want to press, that's your trigger
()<Left> means input a pair of parenthesis then go back one character, between the parenthesis
If you need a "smarter" way, there are a many plugins to choose from.
You might want to try surround which was in and of itself a very compelling reason for me to switch from TextMate.
"when i open a bracket and select enter, the open bracket is on 1st line, the cursor on the 2nd line indented, and the closing bracket on the 3rd line"
can be done in many ways as well, for example:
inoremap <C-Return> <CR><CR><C-o>k<Tab>
inoremap, again
<C-Return> means Ctrl+Return, that's your trigger
<CR><CR> means 2 carriage returns to push the closing bracket 2 lines below
<C-o> to leave insert mode only for one command
k to go up one line
<Tab> to put the insertion cursor at the right place
Mappings in Vim can be just that: shortcuts for sequences of keypresses or more serious scripts.
"pressing <Tab> on for will generate a common 'for' use"
can be done with a dedicated plugin like SnipMate. There are others.
auto-close on brackets, paranthesis, etc.
There are a number of plugins for this functionality: autoclose, closepairs, simplepairs
auto tabbing after a bracket
By this, I believe you mean automatic indentation. This is a default Vim behavior when you're working on a supported filetype. If you're just starting on a file and haven't saved it, you can manually set the filetype with :set ft=<whatever filetype you want> and you'll get indentation and syntax highlighting.
when i open a bracket and select enter, the open bracket is on 1st line, the cursor on the 2nd line indented, and the closing bracket on the 3rd line
This will be taken care of with the above auto-close plugins.
pressing tab on for will generate a common 'for' use
These are called "snippets" in TextMate. Snipmate is a commonly used Vim plugin for snippets. Other people prefer xptemplate.
If you're moving from TextMate to Vim, I would try installing Janus and thoroughly reading the documentation.
Janus is a great starter distribution of plugins and mappings for Vim, gVim, and MacVim. It features sane defaults and aims to provide a minimal working environment using the most popular plug-ins and the most common mappings. It was developed and is maintained by Carl Lerche and former TextMate user Yehuda Katz.
My own personal experience/advice is that you can really drive yourself crazy trying to mimic every feature of your favorite editor exactly as it was. Each feature you're trying to replicate is probably just a quirk you became used to through muscle memory. You'll be much more productive if you just start "accepting" Vim, learning it, and re-train your muscle memory for it.

What is the best practice to Jump out of closing bracket in Resharper?

Its good when resharper inserts closing bracket automatically.
But assume condition that the method didn't have any parameter
in this situation it takes more time to jump out of the brackets is there a work around ?
now I use mouse to jump out from closing bracket.
Assuming you haven't typed anywhere else, you should also be able to just type the closing brace and ReSharper should automagically skip over it as though it hadn't added it in the first place. (same thing works with closing quotes and semicolons, btw)
You can turn this off by going to Resharper options/Editor and unchecking "Auto-insert pair brackets, parentheses, and quotes". I personally just use the right arrow key.

Resources