Issues with Terminal
Posted by ohsomacho@reddit | learnprogramming | View on Reddit | 5 comments
Is there any way to make editing commands - for example copy pasting sections of text - easier in macOS terminal?
I want it to behave more like a word editor
HashDefTrueFalse@reddit
Use a text editing program e.g. emacs, (n)vim, nano, etc, if you want to edit text within the terminal. You can also get shell plugins that allow you to work with shell input easier (e.g. have vim keys for editing command lines etc.) and if you configure $VISUAL or $EDITOR then you can use (C-x C-e) to edit a command line in your preferred editor program. Terminal emulators themselves are essentially just I/O devices that work with streams of bytes.
grantrules@reddit
Put em in a shell script and use vim
light_switchy@reddit
Press Ctrl-X Ctrl-E in bash to edit the current command with $EDITOR
Fluffy_Ad_9115@reddit
Yeah Terminal.app is bad for this. Try Warp — it's built around the idea
of commands as editable blocks instead of one long stream. Probably the
closest thing to what you're describing.
If you want to stick with something more traditional, iTerm2 + learning
a few readline shortcuts (Ctrl+A, Ctrl+E, Option+arrows) gets you most of
the way there. And `fc` in zsh opens your last command in $EDITOR if you
ever need to edit something long in a real editor.
doghouch@reddit
Either use macOS’
Fn+ arrow key shortcuts, or:Esc+mwithnano(text editor):set mouse […]withvi/vim (text editor)head/tail/grep(e.g.grep -oEc “expression”) to limit the lines returned[insert note on terminal multiplexers here]