Why does continuation line break right after if block on ipython? - ipython

UPDATE: This is/was a known bug on v7.
Runs after if block - unable to use elif or else.
Why does my ipython interpreter's continuation line break right after if block while only pressing RET once?

Related

When selecting line in VS Code with the shortcut Ctr+i, cursor jumps to the line below. How to avoid it?

When selecting line in VS Code with the shortcut Ctr+i, the cursor jumps to the line below.
Meaning if i press copy, it actually copies two lines...
Is there a way to force the cursor to stay at the end of the selected line?
editor.action.smartSelect.grow
seems to do what you want with some number of keypresses unfortunately. It is already bound to Shift-Alt-RightArrow but you ca rebind that command to something else less cumbersome.

In Scala REPL, how to discard partly written multi-line command?

On Unix Shell terminal, you can discard a typed command just by typing ctrl-c.
Is there a way to discard a typed command on Scala REPL?
Ctrl-C still works but it would exit the Scala REPL, which is probably not what you prefer.
A couple of cases:
If you're in the middle of a single-line command, you can hit Up button then Down to an empty command line.
If you're in the middle of a multi-line command and the command is incomplete, you can simply hit return a couple of times to let the REPL interpret the consecutive blank lines as intention to start a new command. But, in case you worry about whatever you've typed might get executed, safest way would still be to hit Ctrl-C.
When you're writing an unfinished block you can enter two blank lines and the REPL will then skip your command and start a new one.
You may then still use up buttons to retrieve the lines you want to continue with in the new command.

Change RET behavior in IPython shell

In IPython (5.3 in this case) pressing the RET has double meaning:
send current input to the interpreter
insert line break to the current input and let the user to modify it further
Looks like the first one is implemented only if the the cursor is in the beginning or end of the line. How can I change this behavior? For example have a separate keystroke for this purpose.
P.S. Any link to keybindings configuration in IPython would also be much appreciated.

How to clear the command line in Octave?

In Octave, when typing command in the command line, sometimes I need to erase the whole line and restart a new command. In Matlab, erasing the text would be done with the ESC key. In Octave this does not work. The only way I found to discard the input text is using Ctrl-C. This works, but it is ugly, as it leaves remains on the screen.
Is there a key combination to clear the line in Octave?
to clear the command window type:
clc
There are several clearing shortcuts defined:
Meta-D: clear the next word1
Ctrl-K: clear to the end of the line
Ctrl-U: clear the whole line
Ctrl-L: clear the line and the screen
See more examples in the octave command-line-editing section of the manual.
For historical reasons Ctrl-U is usually controlled by your terminal rather than octave, although octave also supports it. You can test this with stty kill undef (restore with stty kill '^U').
1 Meta is often bound to the Win key or the Alt key. If not hit the Esc key first and then the character that needs to be "metaified".
Ctrl-A: go to beginning of line.
Ctrl-K: kill all characters starting at the cursor.

debug the last sentence of a program

I have used Eclipse and VS. When I insert a breakpoint and debug the program, it will stop before the breakpoint.
But what if I want to debug the effect of the last sentence of the program? Inserting a meaningless sentence(say print 'pause' in Python) is OK but seems awkward. Is there any alternatives?
In Visual Studio you can put break point on closing bracket in main (or any) method of Program (or any) class (default naming, may vary), then debugger stops just before closing application.
Is there any reason not to use a breakpoint on the last statement, like you said, then manually proceed one step? Depending on the debugger, this can also be automated. In GDB, one can use commands N, where N is the breakpoint number, to set a list of (debugger) commands to be executed immediately after a breakpoint is hit.