How do I disable adding a matching open square bracket '[' character when typing a close square bracket ']'?
I've tried various combinations of the Smart Key options, and none of them do what I want. I am able to disable automatically adding a closing bracket ']' when I type an open bracket '[', but not the other way around.
Example:
I have the following line:
if ([myObject respondsToSelector:#selector(outline)])
and my cursor is between the ')' and ']' characters. When I type ']' this is what I get:
if ([myObject respondsToSelector:[#selector(outline) ]])
I expect that the existing ']' will be overwritten by the one I type, or at least that a new '[' will not be added.
I am using AppCode 1.6.2 and the IdeaVIM plugin.
Thank you!
In the XCode preferences under the 'Text Editing' tab there is a 'Automatically balance brackets in Objective-C method calls option'. Uncheck that box.
Related
The way we can use Cmd + Option + U to make text upper case or lower case; is there any shortcut to replace spaces with underscores with selected text in IntelliJ Idea?
Like: HELLO WORLD to HELLO_WORLD?
Use this unofficial plugin:
https://plugins.jetbrains.com/plugin/2162-string-manipulation
Installation:
Apple + Comma
Search for plugins
Browse Repo
Search for String Manipulation
Click install
I have recently learned about the FORMATMESSAGE (link below) and I have started using it.
https://msdn.microsoft.com/en-us/library/ms186788.aspx
I have aware that I have print/select a TAB character (link below) but I would like to learn how to you it inside the FROMATMESSAGE function
https://msdn.microsoft.com/en-us/library/ms187323.aspx
I have tried using CHAR(9) and the escape character \t but it looks like it does not like it.
I know there are workarounds and it will not be hard for me to think of an alternative way outside of using FORMATMESSAGE but I was really curious about it.
Many thanks
Apologies but I have actaully found out my own answer.
Altough the escape character does not work but CHAR(9) works fine.
To see the results to have to change your results output to "Results To Text" (Ctrl + t).
You cannot see such non printable characters inside a Grid (Ctrl + D).
If | is my cursor position
List<String> words = Arrays.asList(|"all cats are grey".split(" "));
Then I would like a shortcut to jump to the closing bracket
List<String> words = Arrays.asList("all cats are grey".split(" ")|);
Note, as per this question the shortcuts Ctrl+{ and Ctrl+} work for jumping between braces { } but not for brackets ( )
Note 2: with standard IntelliJ keymap
It looks like there isn't a specific action to move cursor to the matching bracket.
This does it in 2 keystrokes and is the best I've found: Ctrl+W which selects the block up to the matching bracket, then ▶
That's almost as quick, and better than switching to the mouse.
I don't think there exsists a shortcut for round parenthesis.
I am working with ItelliJ for years, never found one.
Ctrl +Key depends on your Keymap.
You can change it in Settings -> Keymap -> [Keymaps:].
I haven't found round parenthesis, but i could have overlooked it.
Edit:
A possible solution would be, to install the Plugin IdeaVim and use Shift + %
http://vim.rtorr.com/
In IntelliJ IDEA 11 or 12, with an HTML file open, typing
<img src=
causes automatic insertion of double quotes, resulting in
<img src=""
Since I type ahead of where I read, this usually means I end up with something like
<img src=""image.png" alt="Image"/>"
How do I prevent double-quotes from being inserted automatically after attribute names?
In Intellij IDEA 14 and 15 (see #Zook's comment for IDEA 13), the option is now
Windows:
Menu File→Settings→Editor→General→Smart Keys→Add quotes for attribute value on typing '=' and attribute completion (under XML/HTML section on the right side of the Settings dialog)
Mac:
Preferences→Editor→General→Smart Keys→Add quotes for attribute value on typing '='
I don't know if it was the same for previous versions, but what actually happens in IDEA 14 is it automatically inserts both quotes and puts the cursor inside them. That's fine, but then when you type what you expect to be your opening double-quote, the smart punctuation mechanism thinks you're closing the quotes and skips you over the automatically-inserted close quote (the same as it does in e.g. java code when you type a closing parenthesis when it has already auto-inserted one). So you wind up with the cursor after the pair of quotes, typing your attribute value. This seems consistent with the original observation.
I would actually consider this a bug in IDEA but I guess the fact that opening and closing punctuation are the same symbol in this case makes things complicated. The smart punctuation mechanism would need to know to ignore the first quote you typed, but if you actually wanted to type an empty attribute value like src="", it would need to ignore the first quote and then jump over the close quote for the second one. Fiddly, but not impossible.
I've tried it with IDEA 12 and double quotes are inserted only after you start completing src attribute and press Enter or type = to confirm the completion. It doesn't happen automatically, you invoke completion that inserts quotes.
There is no option to control it, so you will have to break your habit to insert quotes manually and use Enter instead.
It's also possible to use the template completion with:
imgTab to generate <img src="" alt=""> with the caret inside first pair quotes.
Then just enter the image file name, Tab, enter alt text.
You can always submit a feature request to disable adding quotes on attributes completion.
Just change Input Language from "US - International" to "US". Switching to just "US" fixed the problem.
Read IntelliJ thread
What is the keymap for navigating to the matching brace in IntelliJ IDEA?
public void blah() {|
...
}
If | is my cursor, I would like to jump to the closing brace with this keymap.
I've only verified this with IntelliJ 9 but:
On Windows:
Ctrl+} will move to the close
bracket.
Ctrl+{ will move to the open bracket.
On Mac:
Use cmd instead of Ctrl.
As an alternative to Ctrl+} and Ctrl+{ you can by default use Ctrl+Alt+Shift+9 and Ctrl+Alt+Shift+8 respectively. I haven't even tried to remember that yet. ;)
Also in Settings -> (IDE Settings ->) Keymap -> Editor Actions there's an entry called "Move Caret to Matched Brace" that doesn't have a default key mapping. I mapped it to Ctrl+< because the key combination was unmapped and the keys are close to each other on a german keyboard.
This applies to IDEA 12.
Its ^M (control + M) on my Mac using IDEA v15 and keeping the default keymap for MacOSX 10.5+
If you are not sure go to prefs and search for "Move Caret to Matching Brace". That's the name of the command and you can set your own shortcut!
On some keyboards, including Swedish ones, it's not practical to use Ctrl-} or Ctrl-{. The best approach I've found under those circumstances is to double-click the bracket in view, which highlights everything between the brackets, then use left-arrow or right-arrow to move to the appropriate end of the highlighted region.
Ctrl+} and Ctrl+{ only moves the cursor to the closes corresponding brace that embraces ( with its counterpart) the place where you called the shortcut.
Ctrl+Shift+} and Ctrl+Shift+{ moves the cursor to the same brace as the first mentioned shortcut and highlights all the area between start point and the result brace.
Ctrl+Shift+M moves the cursor to the opposite or nearest embracing brace or bracket of any sort ( ), { }, < >, [ ].
The last one can be changed in the settings.
#dhable is also right but you can also do this mouse
place the cursor with braces and double click so this will select or
highlight the code bw braces