this post was submitted on 26 Oct 2024
648 points (97.0% liked)
Programmer Humor
32475 readers
1455 users here now
Post funny things about programming here! (Or just rant about your favourite programming language.)
Rules:
- Posts must be relevant to programming, programmers, or computer science.
- No NSFW content.
- Jokes must be in good taste. No hate speech, bigotry, etc.
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Recently had to edit the hosts-file on a remote host, and I don't know if using two proxy jumps to SSH into it broke it, but it just wouldn't let me select text with the mouse.
I had to duplicate seven lines and edit the IP addresses, and without being able to copy-paste, I already saw myself manually typing it out.
Then I remembered that in Vim, you can do
d5↓
to delete 5 lines. Surely that would also work with copying/yanking. And yep, ay7↓
and ap
aste later and I had duplicated the lines.Then use the multi-line cursor like I routinely do for changing all 7 IP addresses...
...and now I feel like I've crossed the line where people will think I'm just a wizard.
Ctrl-K and Ctrl-U in nano, a sane editor that does not hate you
Doesn't that just cut one line at a time? Or is this Emacs-like, where it buffers the lines?
That host doesn't have internet access, though, so installing a different editor wasn't really an option to begin with...
Move the cursor to the start of what you want to cut, press ALT+A, then move the cursor with arrow keys (you'll see text be highlighted from where the cursor was to where you move your cursor), then once you've moved the cursor to where you want, press CTRL+K to cut.