Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You can edit text, at the prompt. Afterwards output is readonly and copyable. Doesn’t make much sense another way.


Yeah? Like in a normal text editor?

Please write:

  echo "12345789"
and insert the missing number without deleting the already existing numbers in a vanilla (non-emacs, non-vim) terminal. In nearly every other editable text field people know well in their lived (including the one you typed in for this comment) you can move your cursor to the middle of a sentence and insert text with a mouse click or the left/right arrow key.

And before someone suggest some option to enable this: my comment was about changing the defaults.


Using the arrow keys to navigate the current input is well supported on most modern terminals, and has been for most of my adult life. If this isn't working properly in your terminal, then I'd recommend experimenting with the various settings available to you.

Some terminals also support mouse navigation, so keep an eye out for that as well.

I'm sorry that you've been dealing with this frustration for so long and under the impression that it was just supposed to be that way and not fixable. The good news is that it's NOT supposed to be that frustrating and you CAN fix it

Edit: you edited your comment somewhere between my first seeing it and my reply posting. I haven't had to modify the default settings on my terminal to fix things like this in about 20 years. I've changed them to tweak various preferences like scrollback, cursor shape/size, etc. But arrow navigation has worked out of the box for me for so long that I literally can't remember when I last had to fix it. I don't know why our experiences have been so different, but I'm sorry that a tool that has been so useful for me has been so frustrating for you.


I see this in situations when terminal relies on readline() to do this stuff, but that isn't installed.


The terminal model is just to display the text that the currently running software provides and send input to it. It’s not a text editor. The prompt is a feature of the shell and other REPL programs, not the terminal. Bash and Zsh and others use readline which allows text editing like navigation [0]. And there’s rlwrap for programs that lack these.

[0]: https://readline.kablamo.org/emacs.html


I've not had luck with selecting a position with my mouse in a terminal shell, but arrow keys is rarely a problem.

Old enough terminal or old enough host, sure, there can be some fighting involved. Of course, working in those conditions, sometimes backspace doesn't work either and you have to hit ctrl-H like an animal.

But I haven't had issues with that lately.


Press left arrow four time and type “6”.


No option is needed, it’s worked this way since the 90s at least. Mouse is not commonly enabled but would be inefficient to use as hands are already on the keyboard. I haven’t missed it, but it could be set up with a script, no?

If arrow keys not working for you, install a new distro.


You can do this in the default windows Terminal. Which is also how I interface with WSL, so it's also my Linux terminal.


just use fc (fix command)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: