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.
Related
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.
IPython 5 is a big release. One of its features is real multi-line editing with prompt_toolkit. The up arrow key now moves to the previous input line instead of the previous input command (block of lines).
This is awesome, but when my previous command spans many lines, and I need to reach the command before that, I find myself wishing I could go up one command at a time. Is there a way to do that? The shortcut ctrlp has the exact same behaviour as the up arrow key, so it does not provide a solution.
On my own Belgian Mac keyboard, fnshift↑ does the job. But I cannot tell whether this also works for other locales.
The PageUp and PageDown keys do exactly what you want without any chorded hotkeys involved; they work on an entry-oriented basis, rather than the arrow keys' line oriented approach.
In Matlab or GNU Octave, this command input("") allows to break the input process by pressing CTRL+C or CTRL+Z. Is there a way to block this, so that only a valid input is accepted?
Note: Pressing CTRL+Z on an input command even exits the Octave shell in a Linux terminal, so I understand that the control must be established at a different layer.
So you want input to ignore when Ctrl + C is pushed? I don't think that's possible simply because this could potentially be dangerous. Ignoring listening to Ctrl + C could open the possibility of your code running endlessly and you not being able to break out of the code unless you manually kill MATLAB. I'm not saying that what you desire with input will be dangerous, but if MATLAB allowed you to ignore this keystroke in any capacity, then you'd have that dangerous situation that I talked about if used improperly.
FWIW, check out this link on MATLAB Central: http://www.mathworks.com/matlabcentral/answers/25213-disabling-ctrl-c-in-a-gui . Here, someone is trying to ignore Ctrl + C so that their GUI doesn't needlessly crash, but MathWorks confirms that it is not possible to do so.
For example, place point at the beginning of a line with the text "foo bar". Then M-d C- C-e M-C-w C-w C-y produces " barfoo". This behaviour causes problems when I try to switch the order of text and when I combine a real kill with save-as-kill. No doubt prepending is often useful, but all the documentation I have found says that append-next-kill appends. How do I control emacs's choice between appending and prepending?
See the Emacs manual, node Appending Kills. It gives explicit examples, in particular an example that shows clearly what C-M-w is for and what it does. Here is part of that text:
If a kill command is separated from the last kill command by other
commands (not just numeric arguments), it starts a new entry on the kill
ring. But you can force it to append by first typing the command
`C-M-w' (`append-next-kill') right before it. The `C-M-w' tells the
following command, if it is a kill command, to append the text it kills
to the last killed text, instead of starting a new entry. With
`C-M-w', you can kill several separated pieces of text and accumulate
them to be yanked back in one place.
For C-M-w to append the next kill, that kill must immediately follow C-M-w. If you do something else in between then there is no appending. The command name might better have been append-next-kill-if-it-follows-immediately. ;-)
In vimtutor Lesson 2.1: DELETION COMMANDS, there is a note after the #4 item:
The letter d will appear on the last line of the screen as you type it. Vim is waiting for you to type w. If you see another character than d you typed something wrong; press <ESC> and start over.
However, I do not see intermediate commands in the last line as the note says. How do I enable this? What option should I set in my .vimrc?
You can use
:set showcmd
That will display the commands as you type it in Vim.
The same can also be put into .vimrc
This 'last line' is the line at bottom of screen.
If you don't see this you may have trouble with (Linux?) terminal setting.
If you use terminal on Linux system, try to invoke command export TERM=Linux before running Vim.