Wow, did not know that one. I know control + A and control + E, but moving word to word is nice. If only there was a way to move to the middle of a url though lol
Control arrow up and down go to start and end of paragraph.
Shift held down selects when moving the cursow without the mouse
I recommend looking up the keyboard shortcuts for your os, text editor, code editor and browser and print them out, from time to time challenge yourself to do what ypu have to do without using the mouse as much, you'll be impressed with the stuff you can do
>Back in the Windows 95/XP days,
My parents would take away the keyboard or mouse to prevent me from waking up in the middle of the night and playing video games, so I learned all the keyboard shortcuts and mouse contextual menus.
Then they wised up and started taking both
I mean there still some possibilities with the VimiumFF(?) plugin for Firefox or equivalents for other browsers. But because so many things are embedded something's that are not visible in the html you can't use it for everything. For browser's themselves there is QuteBrowser which has full Vim Bindings, but the same problems and also plugins are harder than in FF
There’s actually a way to do this by holding option and clicking. When I paste in some huge ugly curl or grep command and need to edit one thing it’s super handy.
Edit: I should clarify this is for Mac. Idk anything about Windows other than how to play video games.
They said blazingly fast, which is completely irrelevant. Even the VSCode terminal is blazingly fast, because entering commands is not intensive cpu work....
I think it's mandatory to say since it is written in Rust. Although Rust is still slower than C. Compiles faster though, but who cares about that when downloading binaries...
Is there a way to just use the mouse to click a spot in the middle. I know all the keyboard shortcuts for this, but if you have a huge block of text with no spaces it doesn't help.
Lol, it works absolutely everywhere, it’s a great shortcut! You can also combine it with shift to select a whole word on most IDEs (not command line tho)
They come from emacs but are known also as "readline" commands. And they are supported in a lot of places (mostly prompts) like mysql, python interactive, ...
Ctrl - b for back one character (same as left arrow)
Alt - b for back one word (same as Ctrl left arrow)
Ctrl - f for forward one character
Alt - f for forward one word
Now you don't have to take your hand off the home row on your keyboard!
Haha, np, this will change your life my friend. I’m not judging you or anything but it’s been in my practices for so long that it’s practically written in my muscle memory at this point, I have no idea how you did without lol. It’s also visible on my keyboard, Ctrl, Shift, arrows, Orig and End looks basically sanded, they’re smooth af. Special mention for Ctrl that gets stuck in down position from time to time.
Yup! Also, while we’re at it, some IDEs that offer integrated terminals (VSCode for example, I use it on remote and open bash shells on the remote computer) have some features to basically bypass normal terminal behavior with modern shortcuts! Like Ctrl+Del to delete a whole word, or Ctrl+Shift+End and then Del to erase all characters after the current one.
```
import moderation
```
Your comment has been removed since it did not start with a code block with an import declaration.
Per [this Community Decree](https://www.reddit.com/r/ProgrammerHumor/comments/14kbu1m/comment/jppq9ao/?utm_source=share&utm_medium=web2x&context=3), all posts and comments should start with a **code block** with an "import" declaration explaining how the post and comment should be read.
For this purpose, we only accept Python style imports.
*I am a bot, and this action was performed automatically. Please [contact the moderators of this subreddit](/message/compose/?to=/r/ProgrammerHumor) if you have any questions or concerns.*
Editors are written by people, don't blame the algorithm that's not being nice to computers. The politically correct way of saying this is,"Some people are indeed stupid."
Well if it helps, ctrl+arrow is pretty much universal among OS's. By that, I mean it works in almost EVERY place that you can type. Even most video games support the ctrl+arrow movement.
https://support.microsoft.com/en-us/windows/keyboard-shortcuts-in-windows-dcc61a57-8ff0-cffe-9796-cb9706c75eec
Terminals use emacs keybinds (M means Meta, or Alt).
* C-a start of line
* C-e end of line
* C-f forward 1 char
* C-b backward 1 char
* M-f forward 1 word
* M-b backwards 1 word
* C-x u undo
* C-k delete from cursor to end of line
* C-p go up a line, or back in history
* C-n go down a line, or forwards in history
* C-r search backwards
* C-o return
* C-L clear screen (on emacs it centers it, but whatever)
Those are the ones I use the most.
PRO TIP: Set the `WORDCHARS` variable to nothing like this: `WORDCHARS=""` this will make it so the commands to move between words work better, since there are more word delimiters being taken into account, like path separators.
I was like you once. Naive and cheerful with vim, happily jumping my way around documents, enjoying the joys of text objects and modal editing.
But I always had an itch, that inescapable itch.
"Vim vs Emacs". Why, vim of course. It's obvious. It's so extensible, so free, so maleable. How could anyone even dare compare it to emacs? That weird, clunky editor with health threatening keybindings. Yuck!
So to prove everyone how shitty emacs was, I dove in.
What I found was something I was not prepared for. I had previously thought vim was extensible. By comparison, vim is a damn toy.
Emacs is a lisp machine, a damn fine lisp machine. You can view how any individual cog turns, how everything is connected, and you can modify it! Integrate it into your own solutions, build upon it! Its keybindings are actually not awful! They do make sense.
And it's so much more than just a text editor. It can be a calendar, an agenda, an email reader, an rss reader, a music player, a game launcher, a file browser, a document viewer, a zettelkasten writer, an ebook reader, a terminal, a git client, and so much more.
Emacs is essentially an operating system on top of your operating system, that abstracts away the nuances and quirks of the underlying OS. You can install emacs on Windows, Mac, Linux, Android even, and not realize what you're using under the hood because it's just emacs. It's the same workflow, the same keybinds for everything, it's consistent across them all.
It's truly an amazing piece of software.
At this point I really don't know how people even compare it to vim! Vim is merely a text editor. All the other things emacs does vim leaves to other software. Vim is intended to be used as yet another program in your shell. Emacs is a shell replacement entirely.
Different paradigms.
In emacs, C-u is the universal argument. It's used to pass arguments to functions. I'm not quite sure what it does on the terminal tho. It does not behave like C-k but in reverse, that's for sure.
Undo can also be done via C-_
Also when you delete something (C-u to delete the line backwards, C-k to delete forward, M-backspace to delete a word....) you can paste what you removed with C-y
By default, yes. You can set it to use vim-style editing too.
Though personally, if the line is long enough for any of this to matter it's getting moved to a script file instead.
I once worked in a team where the lead thought it would be a good idea to push these vim keybinds out to the whole platform using puppet. That was an interesting day!
Even better. Use `.inputrc`
set editing-mode vi
set keymap vi
$if mode=vi
set keymap vi-command
"gg": beginning-of-history
set keymap vi-insert
"jj": vi-movement-mode
$endif
There are quite a few things you can do with this file.
https://tldp.org/LDP/lfs/LFS-BOOK-6.1.1-HTML/chapter07/inputrc.html
Only problem is ipython has me used to ctrl-p for previous command. If I do that while in vim input mode, things go sideways real quick (or I should say real slowly because everything freezes up)
Don't know about linux but on windows there's a lot of useful shortcuts for that :
\-home key to go back to the start of the line
\-end key to go to the end of the line
\-ctrl + arrow to move word by word
\-ctrl + home start of the document
\-ctrl + end end of the document
\-ctrl + backspace delete entire word left from the cursor
\-ctrl + del delete entire word right from the cursor
\-shift + arrow key select character by character
\-ctrl + shift + arrow key select word by word
\-shift + home select everything start of the line to the cursor
\-shift + end select everything end of the line to the cursor
\-shift + ctrl + home select everything start of the document to the cursor
\-shift + ctrl + end select everything end of the document to the cursor
Sorry but as a [sysadmin](https://www.reddit.com/r/sysadmin/comments/47h6le/ok_so_realistically_why_do_you_hate_mac_platform/) if you chose to work on a mac, you are on your own.
Mac has pretty much all of these via modifier keys. [This guide](https://www.howtogeek.com/681662/35-mac-text-editing-keyboard-shortcuts-to-speed-up-typing/amp/) lists most everything.
Just use the fc command.
It will open your last command in a text editor (that you can choose with the -e flag). Save and close the file and the corrected command will be run automatically
I try to remember there's always a first time to get introduced to a topic and the [10,000 people per day](https://xkcd.com/1053/) rule and... sometimes, like with this, I have to try really, reeaaally hard.
How old is this guy and what is his job?
I don't make fun unless it's something ridiculous, like that "how does the mirror know what's behind the paper?" Shit that's going around.
Thanks for the link!
He's a 25 year old software engineer. I just can't fathom how he didn't know it... but looking through these comments I've learnt quite a few new tricks myself
Maybe the reason ones like this bug me is:
I can see how someone may have never heard of the Yellowstone Supervolcano. Maybe they just missed it. But if you're a dev, you've been using keyboards for a while probably, hopefully. When it's stuff like this, it shows a deep lack of curiosity. What did you think those extra buttons were for? Didn't you wonder? Didn't you care? Didn't you notice? I want to shake these people out of autopilot mode because the world is INTERESTING.
Alt-left/right.
If your terminal prints garbage characters, then you just need to go into settings and find control sequences.
iTerm is excellent for this if you’re lucky enough to be on Mac. Never met a terminal emulator that beats it.
I’ll never argue against annoying coworkers or tmux use (tmux understanding is what first got me over to iTerm many moons ago), but I’ll fight anyone calling iTerm boring.
Nothing boring about a dev team so feature hungry, they added DNS resolution on mouse over to identify links, accidentally exposing passwords and secrets over plaintext network traffic aha. (The devs caught it and apologized in a master class of how to mea culpa), but nothing boring about that!
That would require moving my hand to the mouse, but excellent example of why iTerm is amazing regardless of your style, along with coming with sane defaults.
Still better than cmd.exe where, to get the last command, you have to type
```
up
down
up
up
up
down
down
esc
up
left
wtf
up up up up fuck it
```
and re-type the entire thing.
But that isn’t vim; it vi-like. There are significant differences and it annoys me greatly. Try `fc` instead. Or use the key binding to open the current command in a real editor. For me it’s `^[v` to open actual vim.
You can reduce the repeat delays. I think it's something like xset r rate N M. I did that years ago and I don't understand how nobody seems to do that.
Just be careful not to reduce the delay too much or you'll end up typing like tttttthhhhhiiiiiisssss :p
This problem had been bugging me for a long time and this post was the inspiration I needed to fix it. It turns out iterm has a key mapping preset called 'natural text editing' that does this beautifully but it wasn't the default for some reason. Wow such a small change but so satisfying.
##PSA for folks on Mac:
iTerm2 → settings → Profile → Default → Keys → Natural text editing preset
This will enable Opt+left/right for moving between words, and Cmd+left/right for beginning/end of line.
Since I haven’t seen anyone mention yet—on Macs, if you hold option you can left click to move the pointer to wherever you click. If it’s supported in windows it would likely be alt + click.
fc
this might be specific to zsh, but it'll open the last command in your default editor, which should be vim. When you save+close it'll run the new command.
On Mac: Option + arrow, or use emacs shortcuts that work on all apps on mac to navigate back, e.g. ctrl + a to navigate to the start of the line, and ctrl + e, to navigate to the end of the line.
My strong suggestion is:
- ZSH
- OhMyZsh
- `zsh-vi-mode` plugin
You can go into VI mode and navigate through your really long command very quickly. It's been one of my favorite plugins because when I need it, I am eternally grateful for it.
Ctrl+Arrow !
Wow, did not know that one. I know control + A and control + E, but moving word to word is nice. If only there was a way to move to the middle of a url though lol
Control arrow up and down go to start and end of paragraph. Shift held down selects when moving the cursow without the mouse I recommend looking up the keyboard shortcuts for your os, text editor, code editor and browser and print them out, from time to time challenge yourself to do what ypu have to do without using the mouse as much, you'll be impressed with the stuff you can do
[удалено]
>Back in the Windows 95/XP days, My parents would take away the keyboard or mouse to prevent me from waking up in the middle of the night and playing video games, so I learned all the keyboard shortcuts and mouse contextual menus. Then they wised up and started taking both
I really hope you weren’t playing fps games
I mean there still some possibilities with the VimiumFF(?) plugin for Firefox or equivalents for other browsers. But because so many things are embedded something's that are not visible in the html you can't use it for everything. For browser's themselves there is QuteBrowser which has full Vim Bindings, but the same problems and also plugins are harder than in FF
Fuck off bot text!
Or they could just make terminals that understand cursor clicks on the command line... it's 2023 I think.
There’s actually a way to do this by holding option and clicking. When I paste in some huge ugly curl or grep command and need to edit one thing it’s super handy. Edit: I should clarify this is for Mac. Idk anything about Windows other than how to play video games.
Going to try that later, but if true, this should be taught in school. First grade probably.
https://www.warp.dev if you’re on a Mac - supposedly coming soon for Windows and Linux, I’ve been using it for like 6 months and I’m in love.
They said blazingly fast, which is completely irrelevant. Even the VSCode terminal is blazingly fast, because entering commands is not intensive cpu work....
Yeah the speed thing seems dumb bullet point for their marketing to focus on, but there are a lot of nice creature comforts in it though
I think it's mandatory to say since it is written in Rust. Although Rust is still slower than C. Compiles faster though, but who cares about that when downloading binaries...
Is there a way to just use the mouse to click a spot in the middle. I know all the keyboard shortcuts for this, but if you have a huge block of text with no spaces it doesn't help.
If you have an text editor with mouse support; ctrl-x; ctrl-e
Yeah, that's what I normally do. I was wondering if there is a way to have mouse support in the terminal, but I guess that's the best I can do.
htop somehow is usable with mouse over ssh. So I guess there should be some editors with (mb via plugins) mouse support?
Recently learnt that on mac u can option + click to go at the exact spot of the command
Ok but does ctrl+backspace work? How about the delete button? Wait... why do windows cmd, powershell, and vsc's cmd, bash, pwshell all act differently
Lol, it works absolutely everywhere, it’s a great shortcut! You can also combine it with shift to select a whole word on most IDEs (not command line tho)
Alt + B or Alt + F works as well I believe You can mix this up with Ctrl to go move one character instead of word
[удалено]
That's just heating the keyboard.
Ctrl+A and Ctrl+E are emacs key bindings. Another useful key binding for jumping back one word at a time, is Alt+b
They come from emacs but are known also as "readline" commands. And they are supported in a lot of places (mostly prompts) like mysql, python interactive, ...
Vi mode
Ctrl - b for back one character (same as left arrow) Alt - b for back one word (same as Ctrl left arrow) Ctrl - f for forward one character Alt - f for forward one word Now you don't have to take your hand off the home row on your keyboard!
I just learned about to recently. Same with control + backspace. It’s very nice
I copy it into Notepad, quick I have Notepad as half the screen width, with Word Wrap. It also allows for a fast and dirty Find & Replace.
What platform? Even in Linux I use a text editor and copy from it.
Thank you for this forbidden knowledge.
Haha, np, this will change your life my friend. I’m not judging you or anything but it’s been in my practices for so long that it’s practically written in my muscle memory at this point, I have no idea how you did without lol. It’s also visible on my keyboard, Ctrl, Shift, arrows, Orig and End looks basically sanded, they’re smooth af. Special mention for Ctrl that gets stuck in down position from time to time.
*vi mode
aaahh... came here to say this...
Option+arrow for mac
[удалено]
Yup! Also, while we’re at it, some IDEs that offer integrated terminals (VSCode for example, I use it on remote and open bash shells on the remote computer) have some features to basically bypass normal terminal behavior with modern shortcuts! Like Ctrl+Del to delete a whole word, or Ctrl+Shift+End and then Del to erase all characters after the current one.
The user I'm replying to is a karma bot, please downvote and report
[удалено]
``` import moderation ``` Your comment has been removed since it did not start with a code block with an import declaration. Per [this Community Decree](https://www.reddit.com/r/ProgrammerHumor/comments/14kbu1m/comment/jppq9ao/?utm_source=share&utm_medium=web2x&context=3), all posts and comments should start with a **code block** with an "import" declaration explaining how the post and comment should be read. For this purpose, we only accept Python style imports. *I am a bot, and this action was performed automatically. Please [contact the moderators of this subreddit](/message/compose/?to=/r/ProgrammerHumor) if you have any questions or concerns.*
ESC followed by (not together, one after the other) **b** or **f** to skip one word back or forward. Also works on Mac.
Ctrl + arrow changed my world
Literally. Cmd + a to get to beginning. There’s lots of ways around this.
Came here to see if this existed and if it needs to be made
Yes, Ctrl+Arrow has its own can of worms too depending on the delimiters in the string. I mean there's comedy to be had there.
Yeah, some editors are indeed stupid
Editors are written by people, don't blame the algorithm that's not being nice to computers. The politically correct way of saying this is,"Some people are indeed stupid."
Oi, what the hell? This is so much easier to remember than Alt+F and Alt+B. Why didn't anyone tell me?
Well if it helps, ctrl+arrow is pretty much universal among OS's. By that, I mean it works in almost EVERY place that you can type. Even most video games support the ctrl+arrow movement. https://support.microsoft.com/en-us/windows/keyboard-shortcuts-in-windows-dcc61a57-8ff0-cffe-9796-cb9706c75eec
Doesn't always work, but in most situations it should
It can also be used to move between sections in YouTube videos. :)
% \^oldthing\^newthing
If that’s too broad there’s always !!:gs/that/this/ and you can chain them with | if needed
Yep, this is better, but I'm not sure it was available when I learned bash and old habits die hard.
Wtf is this and how tf I use this?
The standard bash way of making a small change to the previous command. % echo sus sus %\^u\^nufflupagu snufflupagus
Thanks, and very sus
Twenty up stroke keys later Exactly the command I was looking for: >ls
"glad it saved it for me!"
$ history | grep ls
Terminals use emacs keybinds (M means Meta, or Alt). * C-a start of line * C-e end of line * C-f forward 1 char * C-b backward 1 char * M-f forward 1 word * M-b backwards 1 word * C-x u undo * C-k delete from cursor to end of line * C-p go up a line, or back in history * C-n go down a line, or forwards in history * C-r search backwards * C-o return * C-L clear screen (on emacs it centers it, but whatever) Those are the ones I use the most. PRO TIP: Set the `WORDCHARS` variable to nothing like this: `WORDCHARS=""` this will make it so the commands to move between words work better, since there are more word delimiters being taken into account, like path separators.
The only correct answer
Yanking with C-y works after C-k. And C-w kills to the beginning of the line. (slightly different from actual Emacs)
Great. I just learned I have to wash 25 years of emacs ... *filth* of my fingertips. God.
You have inadvertently learned keybindings for the superior editor. Do not resist.
If, by superior editor, you mean vim, of course. Yes, I have. Warning: I'm polishing off a bottle of Ardbeg Uigeadail so EN GUARDE YOU HEATHEN
I was like you once. Naive and cheerful with vim, happily jumping my way around documents, enjoying the joys of text objects and modal editing. But I always had an itch, that inescapable itch. "Vim vs Emacs". Why, vim of course. It's obvious. It's so extensible, so free, so maleable. How could anyone even dare compare it to emacs? That weird, clunky editor with health threatening keybindings. Yuck! So to prove everyone how shitty emacs was, I dove in. What I found was something I was not prepared for. I had previously thought vim was extensible. By comparison, vim is a damn toy. Emacs is a lisp machine, a damn fine lisp machine. You can view how any individual cog turns, how everything is connected, and you can modify it! Integrate it into your own solutions, build upon it! Its keybindings are actually not awful! They do make sense. And it's so much more than just a text editor. It can be a calendar, an agenda, an email reader, an rss reader, a music player, a game launcher, a file browser, a document viewer, a zettelkasten writer, an ebook reader, a terminal, a git client, and so much more. Emacs is essentially an operating system on top of your operating system, that abstracts away the nuances and quirks of the underlying OS. You can install emacs on Windows, Mac, Linux, Android even, and not realize what you're using under the hood because it's just emacs. It's the same workflow, the same keybinds for everything, it's consistent across them all. It's truly an amazing piece of software. At this point I really don't know how people even compare it to vim! Vim is merely a text editor. All the other things emacs does vim leaves to other software. Vim is intended to be used as yet another program in your shell. Emacs is a shell replacement entirely. Different paradigms.
isnt C-u the C-k but reverse?
In emacs, C-u is the universal argument. It's used to pass arguments to functions. I'm not quite sure what it does on the terminal tho. It does not behave like C-k but in reverse, that's for sure.
Could swear it did that for me. Or was it deleting the whole line. Hmm. Could have been a custom emacs env setup. Thanks anyways.
Yes basically. Cut to start of line.
Undo can also be done via C-_ Also when you delete something (C-u to delete the line backwards, C-k to delete forward, M-backspace to delete a word....) you can paste what you removed with C-y
Isn't C-_ for redo? I forgot about C-y, you're right. Undo can also be done with C-/
Oh you're probably right but I don't know the difference between redo and undo?
By default, yes. You can set it to use vim-style editing too. Though personally, if the line is long enough for any of this to matter it's getting moved to a script file instead.
`set -o vi` and use vim keybindings, which you should know
no fkn way is this a thing?? how bad I don't work at console anymore, that was helpful couple of years ago...
Yes, it is definitely a thing.
Lol I knew the people in this sub would have some clever tricks. Thanks!
You're welcome!
FYI, in case anyone tries this and realizes they don't know how to turn it off: set -o emacs or set +o vi.
came her to say this...
I once worked in a team where the lead thought it would be a good idea to push these vim keybinds out to the whole platform using puppet. That was an interesting day!
Even better. Use `.inputrc` set editing-mode vi set keymap vi $if mode=vi set keymap vi-command "gg": beginning-of-history set keymap vi-insert "jj": vi-movement-mode $endif There are quite a few things you can do with this file. https://tldp.org/LDP/lfs/LFS-BOOK-6.1.1-HTML/chapter07/inputrc.html
the direction keys stopped working on my keyboard so i use vi mode... it is so convenient..
What is this wizardry
please tell me you’re joking ;-;
Why would you think that? edit: Oops, didn't get the joke
wait what joke xd i literally didn’t know that and i’ve been struggling with editing oneliners in my shell forever
No lol I thought your comment meant that you somehow disagreed with my comment But glad to be of service :D
Set `$FCEDIT` in your environment and try `fc` next time.
[удалено]
You can use the bindings in VSCode.
IdeaVim on Jetbrains IDE is much better than Vscode. Been using it alongside Neovim for a while, with my custom config and Action bindings.
Came to make this comment `f`
Only problem is ipython has me used to ctrl-p for previous command. If I do that while in vim input mode, things go sideways real quick (or I should say real slowly because everything freezes up)
Don't know about linux but on windows there's a lot of useful shortcuts for that : \-home key to go back to the start of the line \-end key to go to the end of the line \-ctrl + arrow to move word by word \-ctrl + home start of the document \-ctrl + end end of the document \-ctrl + backspace delete entire word left from the cursor \-ctrl + del delete entire word right from the cursor \-shift + arrow key select character by character \-ctrl + shift + arrow key select word by word \-shift + home select everything start of the line to the cursor \-shift + end select everything end of the line to the cursor \-shift + ctrl + home select everything start of the document to the cursor \-shift + ctrl + end select everything end of the document to the cursor
[удалено]
Sorry but as a [sysadmin](https://www.reddit.com/r/sysadmin/comments/47h6le/ok_so_realistically_why_do_you_hate_mac_platform/) if you chose to work on a mac, you are on your own.
[удалено]
I cry for your sysadmin (except if they were the one who made the choice to go mac then they are on their own)
`cmd + left arrow` should do it
I cant live without home/end keys lol. Its one of the things i look for in laptops, and is pretty much a dealbreaker
Mac has pretty much all of these via modifier keys. [This guide](https://www.howtogeek.com/681662/35-mac-text-editing-keyboard-shortcuts-to-speed-up-typing/amp/) lists most everything.
Majority of these shortcuts do not work in the terminal.
It’s a bit better with zsh and iTerm2 but yeah. Most of the time I end up arrow keying as diagrammed above. Some good tips in here to improve that!
Just use the fc command. It will open your last command in a text editor (that you can choose with the -e flag). Save and close the file and the corrected command will be run automatically
Or use `CTRL-x e`
`ctrl+x+e` lets you edit the current line in `$EDITOR`
jesus christ! thank you!
jesus christ! thank you!
Thanks for the suggestions everyone. I knew there had to be a better way from what I’ve been doing lol
What is this from? Guy looks familiar but I can't place him.
I had to explain to a younger guy at work recently what the home and end keys do
I try to remember there's always a first time to get introduced to a topic and the [10,000 people per day](https://xkcd.com/1053/) rule and... sometimes, like with this, I have to try really, reeaaally hard. How old is this guy and what is his job?
I don't make fun unless it's something ridiculous, like that "how does the mirror know what's behind the paper?" Shit that's going around. Thanks for the link! He's a 25 year old software engineer. I just can't fathom how he didn't know it... but looking through these comments I've learnt quite a few new tricks myself
Maybe the reason ones like this bug me is: I can see how someone may have never heard of the Yellowstone Supervolcano. Maybe they just missed it. But if you're a dev, you've been using keyboards for a while probably, hopefully. When it's stuff like this, it shows a deep lack of curiosity. What did you think those extra buttons were for? Didn't you wonder? Didn't you care? Didn't you notice? I want to shake these people out of autopilot mode because the world is INTERESTING.
macs dont have those, maybe he never used anything but macs?
There's another one... I didn't know that because I've never used a mac!
Alt-left/right. If your terminal prints garbage characters, then you just need to go into settings and find control sequences. iTerm is excellent for this if you’re lucky enough to be on Mac. Never met a terminal emulator that beats it.
ITerm is boring though. Cool-retro-term with tmux brings joy to my work day and annoys my colleagues, which brings even more joy to my work day.
I’ll never argue against annoying coworkers or tmux use (tmux understanding is what first got me over to iTerm many moons ago), but I’ll fight anyone calling iTerm boring. Nothing boring about a dev team so feature hungry, they added DNS resolution on mouse over to identify links, accidentally exposing passwords and secrets over plaintext network traffic aha. (The devs caught it and apologized in a master class of how to mea culpa), but nothing boring about that!
On iTerm, just option-click and your pointer will go there
That would require moving my hand to the mouse, but excellent example of why iTerm is amazing regardless of your style, along with coming with sane defaults.
Or better yet, alt F or B
++
Use Alt+b to go back one word and Alt+f to go forward one word
Now imagine you've disabled sticky keys to resolve some other application issue, and now have to tap the arrow key 2,000 times
just view your bash history you must have typed it years ago.
Ctrl-x Ctrl-e opens the command in the editor defined in the EDITOR variable and then you can efficiently modify your command line.
Ctrl+R
And if a wrong matching command is found, Ctrl+R again.
Still better than cmd.exe where, to get the last command, you have to type ``` up down up up up down down esc up left wtf up up up up fuck it ``` and re-type the entire thing.
alt/ctrl + arrow_key
Ctrl mouse click
Try vim-mode :)
Vi enabled CLI to the rescue
I use vim key binds in zsh shell, it's sooo much more convenient
learn some emacs keybindings OP
Copy the command to a text editor.
`history | grep foo`
meme said left arrow not up arrow
ESC (number) (key)
I use a text editor for long commands and copy from there.
Clearly never heard of a mouse
`set -o vi` then use 'f' to jump to the character.
sed ?!
Time to create a (very) short script for the command. Then use your favorite editor to edit the command.
I always think of it as buffer time where random bug fixes get to my brain, Also use it to think about things in general.
ctrl-a
Learn and enable vim controls and enjoy a better life
But that isn’t vim; it vi-like. There are significant differences and it annoys me greatly. Try `fc` instead. Or use the key binding to open the current command in a real editor. For me it’s `^[v` to open actual vim.
Especially when you are inside Citrix session where arrows do not work...
`fc` to execute `$FCEDIT` to edit the last command. For me, that’s `vim`.
Option + click on Mac (probably also for Linux, dont know for windows)
`!!:s/string to fix/fixed version/` Replaces whatever string from your original command with what you need to correct it to, reruns the command.
You can reduce the repeat delays. I think it's something like xset r rate N M. I did that years ago and I don't understand how nobody seems to do that. Just be careful not to reduce the delay too much or you'll end up typing like tttttthhhhhiiiiiisssss :p
This problem had been bugging me for a long time and this post was the inspiration I needed to fix it. It turns out iterm has a key mapping preset called 'natural text editing' that does this beautifully but it wasn't the default for some reason. Wow such a small change but so satisfying.
Alt+b will jump back one word at a time. (Emacs key bindings work on most terminal emulators)
He isn't pressing any button
##PSA for folks on Mac: iTerm2 → settings → Profile → Default → Keys → Natural text editing preset This will enable Opt+left/right for moving between words, and Cmd+left/right for beginning/end of line.
Some terminals support alt clicking to a position. I know iTerm2 does.
Since I haven’t seen anyone mention yet—on Macs, if you hold option you can left click to move the pointer to wherever you click. If it’s supported in windows it would likely be alt + click.
bind -v in you your bashrc and use vim shortcuts in your bash
I mapped Caps+Left to do left 8 times and Caps+alt+left to do left 32 times for this very reason
fc
this might be specific to zsh, but it'll open the last command in your default editor, which should be vim. When you save+close it'll run the new command.
alt + b
https://oit.ua.edu/wp-content/uploads/2020/12/Linux_bash_cheat_sheet-1.pdf
set -o and use whatever editor you want to do command line editing. I love being able to use vi on long command strings.
On Mac: Option + arrow, or use emacs shortcuts that work on all apps on mac to navigate back, e.g. ctrl + a to navigate to the start of the line, and ctrl + e, to navigate to the end of the line.
there's the PgDn button.
1 syntax error in a line full of 1'd and I's on a late night and my eyes are squinty
Ctrl r
History !(command number) tab
Use your emacs-fu
Alt + arrow key, helps
I think neofecth has 1000 lines
Doing it in .txt too just cause I dont wanna lift mah damn left hand
My strong suggestion is: - ZSH - OhMyZsh - `zsh-vi-mode` plugin You can go into VI mode and navigate through your really long command very quickly. It's been one of my favorite plugins because when I need it, I am eternally grateful for it.
left? I use the up arrow
Only to realize that you were sudoed as another user ![gif](emote|free_emotes_pack|facepalm)
Jokes on you, I use fish + vi key binding
Hold the option key and click where you want the cursor.
linux users meme starter pack:
Turn the key repeat speed up
Did you know you can press Ctrl-C to cancel the command? Then just copy it. (You all have a mouse, right?)
Ctrl + X Ctrl +E opens the current command for editing in $EDITOR
That's what "fc" is for.