How to use autoclose brackets in Jupyter notebook? - jupyter

This may sound like a silly question, but how do I make use of the autoclose brackets in Jupyter notebook? For example, when I type
print(
Jupyter notebook auto-closes the brakets
print()
and places the cursor inside. Then I could type the argument, say
print(1 + 1)
now my cursor is between the second 1 and the right bracket ). What is the key to navigate to the right of )?
Of course I can press End or → or even ) to achieve this, but it does not seem to save time, which is the purpose of the brackets autoclose I suppose?
Thanks in advance.

We can do that from the jupyter console, try it.

Related

How to select whole line in VSCode

I am using VSCode on a Mac.
Does anyone know how to select the entire line that the cursor is on? I know about Command+I, but that only selects what appears to be the whole line, which is not always the whole line if I have word wrap enabled.
I am looking for something like Sublime Text's "Expand Selection to Line" command.
All you need to do is put the cursor anywhere on the line, do not make any selection at all and then do the desired command (Cut, copy, or paste).
When no text selected, VS Code will automatically select the entire line.
just triple click the end of the line it will select the entire line
Triple click at any point on the line
Click once on number of the line
Press Command + L
An alternative to what people have posted is, when your cursor is at the start/end of the line, you can hit shift + end/home respectively.
I find this useful for wrapping a line in curly braces/quotes/etc. whereas the other answers include spaces in the select so whatever you're wrapping it in will be wrapped around that whitespace.
Install the MetaGo extension and use the "metaGo: selectLineDown" command, which will come installed already overriding the "expandLineSelection" command.
This extension has many additional commands that you'll likely find useful as well, including moving up/down over code blocks, centering the active line, and going to any character on the screen.
Now, when I press Command+I, the whole line is selected. I am guessing this was caused by an update to VS Code, but I am not sure.
Ctrl + L on Windows or Command + L on Mac to select the whole line in VS Code.
You can use your mouse to select the whole line by triple-clicking on the line but the better way is to click on the line number to select the whole line or multiple lines.
Tripple click at any point on the line
In case you're wondering why Cmd+L is not working, there might be a chance that there are duplicate shortcuts. You can find out by opening Keyboard Shortcuts in VSC and remove the one that's not needed.
I know its old but for anyone seeking, you can press Alt + arrow up/down to duplicate your cursor to other lines and then without selecting anything copy and paste multiple lines.

iPython update interfers with Alt-Gr combinations

I just updated Python to 2.7.13 and Anaconda 4.4.0. Since the update, I cannot type the open square bracket ("[") into Jupyter. However, I can type the closed square bracket and copy paste the open square bracket without problem. I am using a French Canadian keyboard and to type these square brackets I do need to press a combination with "Alt-Gr". "Alt-Gr" seems to trigger something in Jupyter notebook and I'm guessing the exact combinations for open square bracket is used as a shortcut for something else. I cannot find it in the list of shortcuts as "Alt-Gr" doesn't seem to be a valid key when trying to edit keyboard shortcuts. Any clue of what's causing the issue?

How do I select text inside of braces in Visual Studio Code?

In Atom I can select inside of brackets with CMD+CTRL+M. How can I do this in Visual Studio Code? I've checked the keyboard bindings, but didn't find anything.
There are 2 even better alternative commands in the keybinding file you might want to check out:
editor.action.smartSelect.grow
and
editor.action.smartSelect.shrink
They select everything in between the next boundary (quotes, brackets, curly braces...) and the selection grows to the next boundary when you hit the shortcut again.
Default shortcut is ctrl+shift+cmd+right / ctrl+shift+cmd+left, which is a bit too "finger heavy" for my taste, so you might want to rebind it (I use ctrl+up / ctrl+down).
Shift+Alt+Right for selecting all text inside the braces.
CTRL+Shift+\ for jumping between opening/closing braces (or) parentheses.

Shortcut to get out of bracket or parenthesis in iPython

Is there a shortcut to moving the cursor from
my_variable = (entry|)
to
my_variable = (entry)
|
in iPython notebook? Where "|" is the cursor
That is, is there some shortcut you can use in place of (right arrow) followed by (return) in iPython to get out of the automatic parentheses/brackets? I feel like it would be useful to have this when coding really fast.
I found pressing 'End' & 'Enter' does the work.

How to move out of auto-completed brackets in IntelliJ IDEA (without using the arrow keys)?

I recently switched from Eclipse to IntelliJ IDEA, and found myself wondering how to move the cursor out of a pair of auto-completed brackets.
In Eclipse after I finished typing in a pair of brackets, pressing tab brings me out of the brackets. How can I do the same thing without using the arrow keys?
Many thanks for your help!
IDEA doesn't have such feature yet. The closest equivalent is the Complete Current Statement editor action (Ctrl+Shift+Enter).
UPDATE
Initial implementation for this feature is available in 2018.2 EAP version - press Tab to jump out.
It works more like in MS Visual Studio - without visual indication of tab 'exit' position. For now, it should work in Java, SQL, Python and some other files. It will take some time for other languages to catch up - some language-specific code changes are required.
The feature is disabled by default, you can enable it in
Settings -> Editor -> General -> Smart Keys -> Jump outside closing
bracket/quote with Tab
Ctrl + Shift + Enter does not seem to work for me in IDEA 12.1.4, but I found the closest feature to what I was looking for was Shift + Enter. This completes the line, creates a new line below the current line and moves the cursor to it.
You can do this by pressing the closing symbol that you would've pressed otherwise, but was auto completed. For example, if you have just typed the f below, you would press shift and 0 (or closing parenthesis), and it will move your cursor outside of the parenthesis.
String asdf = "hello world";
System.out.println(asdf);
I went to preferences->Keymap and set a shortcut for "Move Caret to Line End" to Shift-Space. It takes me to the end of the current line I am on without adding anything, if that's what you want.
Not currently supported by Intellij. There is an open feature request on this at http://youtrack.jetbrains.com/issue/IDEA-74666. Extra votes would be nice.
Intellij supports the ctrl+shift+m shortcut that jumps to the end of the block:
https://www.jetbrains.com/help/idea/2016.2/navigating-to-braces.html
It's not quite what you're looking for, but you can type the character you are trying to move outside of (a closing paren, for example) and that should pop you outside of the auto-completed character.
Not ideal, but functional as far as I've tested it.
I set these setting:
1) I added Semicolon shortcut to Complete Current Statement:
Instead of using for loop command, I using fori command (because for command needs semicolon character):
2) I added Alt+Semicolon shortcut to Move Caret to Code Block End:
So when I inside the loop, by pressing Alt+Semicolon jumping end of the bracket, by pressing Semicolon I jumping out the bracket subsequently.
by adding these shortcuts, the speed of coding will be faster.
Such key is called "End".
You can assign any unused shortcut to "Move Caret to Line End" action in "Settings/Preferences | Keymap".
P.S. You can use Ctrl+Shift+Enter to complete your statement (in your case it will place caret at the end of line and will add ";" there) -- action called "Complete Current Statement" and shortcut can be checked/changed in a same way as described earlier.
If you decide to move back to Eclipse and use PyDev this feature by default is disabled, First Switch to PyDev Perspective and you can enable it by going under Preferences>PyDev>Editor>Typing>Enable link on Automatic parenthesis or literals closing