i hate when this happens

3 years ago by Tibor to c/programmerhumor

coldhotman 96 points 3 years ago
path: 0 1275062, hotness: undefined, score: 96, children: 7
baseless_discourse 32 points 3 years ago

Actually, most linux terminal allows you to change shortcut in terminal to just use ctrl-c and ctrl-v.

path: 0 1275062 1275161, hotness: undefined, score: 32, children: 5
entropicdrift 60 points 3 years ago

The one I use just wants me to do ctrl+shift+v

path: 0 1275062 1275161 1275560, hotness: undefined, score: 60, children: 2
baseless_discourse 6 points 3 years ago

By default, yes, but most terminal allow you to just open the setting and change the keybinding. And even Ctrl-c will work as you expect, it will copy when text is selected, and terminate command otherwise.

path: 0 1275062 1275161 1275560 1285673, hotness: undefined, score: 6, children: 1
whyNotSquirrel 6 points 3 years ago

Ctrl+shift+v is paste without formatting in most apps though, so kind of a good habit

path: 0 1275062 1275161 1275560 1285673 1306691, hotness: undefined, score: 6, children: 0
drew_belloc 16 points 3 years ago

If i knew it before, now my brain just knows that it need to press shift on the terminal

path: 0 1275062 1275161 1276157, hotness: undefined, score: 16, children: 0
coldhotman 4 points 3 years ago
path: 0 1275062 1275161 1275276, hotness: undefined, score: 4, children: 0
i_am_hiding 8 points 3 years ago

We have the middle-mouse-button clipboard for this.

path: 0 1275062 1294778, hotness: undefined, score: 8, children: 0
MrMonkey 89 points 3 years ago

Works the same as M-b for me (backwards-word)

Make sure your /etc/inputrc or ~/.inputrc contains

# mappings for Ctrl-left-arrow and Ctrl-right-arrow for word moving

"\e[1;5C": forward-word

"\e[1;5D": backward-word

"\e[5C": forward-word

"\e[5D": backward-word

"\e\e[C": forward-word

"\e\e[D": backward-word`
path: 0 1277040, hotness: undefined, score: 89, children: 5
lemann 23 points 3 years ago

Lemmy:

> meme with problem

> SolutionCommentMemeCommentCommentMemeQuestion

Others:

> meme with problem

> BotCommentCommentAwardsAwardsBotShitpostAwardsShitpost

I hope the formatting shows properly... And thanks for this 😁 now to update the .inputrc on my laptop and VPSes

Edit: fix typo and formatting

path: 0 1277040 1280811, hotness: undefined, score: 23, children: 1
4am 6 points 3 years ago

It would have been funnier if you put in “\e;D5c1-7” or whatever the fuck VT-100 gobbledegook

path: 0 1277040 1280811 1282552, hotness: undefined, score: 6, children: 0
bisq 7 points 3 years ago

Commenting to save. Thank you!

path: 0 1277040 1277952, hotness: undefined, score: 7, children: 2
angrymouse 18 points 3 years ago

Idk if you know but you van actually save a post or comment pressing the button "save" under it. It will appear in your profile in a section of saved stuff.

path: 0 1277040 1277952 1279203, hotness: undefined, score: 18, children: 1
bisq 3 points 3 years ago

Didn’t know that. My lemmy app doesn’t have a comment save button.

path: 0 1277040 1277952 1279203 1286843, hotness: undefined, score: 3, children: 0
abraham_linksys 83 points 3 years ago

Ctrl+a - go to beginning of line (alpha? I dunno)

ctrl+e - go to (e)nd of the line

alt+f - (f)orward one word

alt+b - (b)ack one word

You might already know these but no one else has posted them on this thread yet. I work in both Linux and Mac a lot and this works for them. No idea about Windows I'm no longer forced to use it at work 🙂

path: 0 1282204, hotness: undefined, score: 83, children: 6
NaiveBayesian 15 points 3 years ago

Also Ctrl + w to delete one word backwards (which is what OP wants to do).

Edit: Nvm I misread the post, deleting is not what OP wants to do. Still gonna keep this because Ctrl + w is easily the readline shortcut I use the most.

path: 0 1282204 1292116, hotness: undefined, score: 15, children: 1
FUsername 5 points 3 years ago

While we're at it: Alt+d deletes the next word.

path: 0 1282204 1292116 1328959, hotness: undefined, score: 5, children: 0
dot20 11 points 3 years ago

If you use WSL (which you should), you have a normal Bash, so it works

path: 0 1282204 1284012, hotness: undefined, score: 11, children: 2
abraham_linksys 22 points 3 years ago

The best part of Windows is the part that isn't Windows lmao lawd I'm glad I don't work for the federal government (exclusively Microsoft) anymore

path: 0 1282204 1284012 1284489, hotness: undefined, score: 22, children: 1
darcy 3 points 3 years ago

fed detected

path: 0 1282204 1284012 1284489 1287803, hotness: undefined, score: 3, children: 0
somedaysoon 6 points 3 years ago
path: 0 1282204 1286628, hotness: undefined, score: 6, children: 0
debil 37 points 3 years ago

In a sane editor just press b.

path: 0 1291968, hotness: undefined, score: 37, children: 3
nailbar 7 points 3 years ago

Is Ctrl + ⬅️ for typing 'b' then?

path: 0 1291968 1293600, hotness: undefined, score: 7, children: 2
debil 5 points 3 years ago

No (although you can easily create such a key mapping if so inclined). To type b character one must first enter the so called Insert mode. Depending on where exactly you wish to type the character, you can enter the Insert mode by typing for example i, a, I, A, o or O.

path: 0 1291968 1293600 1295602, hotness: undefined, score: 5, children: 1
nailbar 5 points 3 years ago

It wasn't a serious question 🙂

Sounds like you're talking about good old vi or vim.

path: 0 1291968 1293600 1295602 1296699, hotness: undefined, score: 5, children: 0
maeries 27 points 3 years ago

Why is that actually?

path: 0 1276684, hotness: undefined, score: 27, children: 3
Anticorp 29 points 3 years ago

Because fuck you! That's why!

Edit: serious answer, I'm pretty sure it's outputting the key events to the terminal line.

path: 0 1276684 1277113, hotness: undefined, score: 29, children: 0
gornius 26 points 3 years ago

Because terminal emulators are literally the old terminal emulators (ye oldy screens + keyboard combos that looked like a computer but were just IO) and everything modern they do is just a hack.

path: 0 1276684 1279315, hotness: undefined, score: 26, children: 1
grue 17 points 3 years ago

Terminals with screens? What's all that newfangled shit?

Nah, whippersnapper, this tech goes all the way back to teletypes. You didn't get a fancy-shmancy "screen;" instead, it printed out the results of your commands. On actual paper!


Seriously though, that's why the device files for terminals in Linux are named tty[$NUM] -- "tty" is shorthand for "TeleTYpe."

I believe it's also why really primitive programs can't scroll up and do things like writing an entire screen worth of content in order to emulate interactivity (as opposed to seeking the cursor backwards and replacing only the parts the program wants to replace): they're using a version of the control protocol so primitive that it didn't have a function to go backwards because teletypes didn't need it due to physical impossibility. (That's my theory, anyway -- I haven't dug deep enough into the guts of TERMCAP etc. to be sure. I'm also not actually old enough to have experienced that stuff, despite my joke above.)


Edit: look at this excerpt from man terminfo(5), for instance:

Basic Capabilities
The number of columns on each line for the terminal is given by
the cols numeric capability.  If the terminal is a CRT, then the
number of lines on the screen is given by the lines capability.
If the terminal wraps around to the beginning of the next line
when it reaches the right margin, then it should have the am
capability.  If the terminal can clear its screen, leaving the
cursor in the home position, then this is given by the clear
string capability.  If the terminal overstrikes (rather than
clearing a position when a character is struck over) then it
should have the os capability.  If the terminal is a printing
terminal, with no soft copy unit, give it both hc and os.

To this day, the info database entry for your virtual terminal has to specify that it's capable of deleting a line of text instead of merely striking it out, because some terminals back in the day actually couldn't!

path: 0 1276684 1279315 1286176, hotness: undefined, score: 17, children: 0
mawkler 25 points 3 years ago

b

path: 0 1293926, hotness: undefined, score: 25, children: 0
TimeIntegrated 23 points 3 years ago
path: 0 1277017, hotness: undefined, score: 23, children: 3
stratoscaster 14 points 3 years ago

It also works with Shift so you can highlight and select words at a time.

path: 0 1277017 1278136, hotness: undefined, score: 14, children: 1
Enpeze 7 points 3 years ago

Hey, I actually knew that shortcut! But it never occurred to me that ctrl+arrow just moves the cursor without selecting anything.

wild stuff.

path: 0 1277017 1278136 1278285, hotness: undefined, score: 7, children: 0
towerful 13 points 3 years ago

Ctrl+backspace to delete previous word.
Ctrl+delete to delete next work.

path: 0 1277017 1281645, hotness: undefined, score: 13, children: 0
nayminlwin 22 points 3 years ago

What happens to me is the opposite. I got used to Ctrl+w to delete a word in terminal and accidentally closed browser tabs many times while typing in them.

path: 0 1331109, hotness: undefined, score: 22, children: 0
feifei 16 points 3 years ago

Also in some Windows programs. Infuriating

path: 0 1275154, hotness: undefined, score: 16, children: 6
TWeaK 15 points 3 years ago

More often it's Ctrl + backspace that doesn't work. Ctrl + <- works nearly everywhere.

path: 0 1275154 1275434, hotness: undefined, score: 15, children: 5
ralC 13 points 3 years ago

Getting the little boxes when renaming files. Uuuuuuuuggghhh

path: 0 1275154 1275434 1277753, hotness: undefined, score: 13, children: 0
playxdestroy 7 points 3 years ago

i’ve noticed ctrl + backspace works in windows 11 where it didn’t work in 10

path: 0 1275154 1275434 1276897, hotness: undefined, score: 7, children: 3
TWeaK 5 points 3 years ago

I hope you don't expect that to convince me to upgrade. That doesn't even make up for what they did to the taskbar.

path: 0 1275154 1275434 1276897 1279507, hotness: undefined, score: 5, children: 2
Kryomaani 2 points 3 years ago

They've since updated it to allow you to display labels & not condense multiple windows into one button so it's better than ever. I can't believe it took until 11 to center the items, left aligning was a literal pain in the neck especially on ultrawide screens.

path: 0 1275154 1275434 1276897 1279507 1315448, hotness: undefined, score: 2, children: 1
jordanlund 16 points 3 years ago

In any sane editor:

Save a file - CRTL-S

In VI:

  1. Switch to command mode by pressing the Esc key.

  2. Type : (colon). This will open the prompt bar in the bottom left corner of the window.

  3. Type w after the colon and hit Enter.

In Emacs:

https://www.gnu.org/...

C-x C-s Save the current buffer to its file (save-buffer).

C-x s Save any or all buffers to their files (save-some-buffers).

M-~ Forget that the current buffer has been changed (not-modified). With prefix argument (C-u), mark the current buffer as changed.

C-x C-w Save the current buffer with a specified file name (write-file).

M-x set-visited-file-name Change the file name under which the current buffer will be saved.

When you wish to save the file and make your changes permanent, type C-x C-s (save-buffer). After saving is finished, C-x C-s displays a message like this:

Wrote /u/rms/gnu/gnu.tasks

If the current buffer is not modified (no changes have been made in it since the buffer was created or last saved), saving is not really done, because it would have no effect. Instead, C-x C-s displays a message like this in the echo area:

(No changes need to be saved) With a prefix argument, C-u C-x C-s, Emacs also marks the buffer to be backed up when the next save is done. See Backup Files.

The command C-x s (save-some-buffers) offers to save any or all modified buffers. It asks you what to do with each buffer. The possible responses are analogous to those of query-replace:

y SPC Save this buffer and ask about the rest of the buffers.

n DEL Don’t save this buffer, but ask about the rest of the buffers.

! Save this buffer and all the rest with no more questions.

q RET Terminate save-some-buffers without any more saving.

. Save this buffer, then exit save-some-buffers without even asking about other buffers.

C-r View the buffer that you are currently being asked about. When you exit View mode, you get back to save-some-buffers, which asks the question again.

C-f Exit save-some-buffers and visit the buffer that you are currently being asked about.

d Diff the buffer against its corresponding file, so you can see what changes you would be saving. This calls the command diff-buffer-with-file (see Comparing Files).

C-h Display a help message about these options.

path: 0 1308853, hotness: undefined, score: 16, children: 1
RocksForBrains 3 points 3 years ago

wtf m8

path: 0 1308853 1316647, hotness: undefined, score: 3, children: 0
james 13 points 3 years ago

set -o vi

path: 0 1277050, hotness: undefined, score: 13, children: 0
Dohnakun 11 points 3 years ago

Depends on the terminal. xfce4-terminal it works.

path: 0 1294128, hotness: undefined, score: 11, children: 2
WhiskyTangoFoxtrot 3 points 3 years ago

Works in the Cinnamon terminal, too.

path: 0 1294128 1309614, hotness: undefined, score: 3, children: 1
Nemoder 1 point 3 years ago

And it works in QTerminal.

path: 0 1294128 1309614 1334469, hotness: undefined, score: 1, children: 0
s0phia 11 points 3 years ago

Idk about bash but at least in fish I can do alt + arrows to move the cursor by word, also alt + backspace works to delete whole words.

path: 0 1287979, hotness: undefined, score: 11, children: 0
chaorace 9 points 3 years ago

That's why my terminal is emacs

path: 0 1282013, hotness: undefined, score: 9, children: 6
SanndyTheManndy 10 points 3 years ago

I think you mean OS

path: 0 1282013 1282404, hotness: undefined, score: 10, children: 1
Rootiest 13 points 3 years ago

That's why my terminal is OS

path: 0 1282013 1282404 1283034, hotness: undefined, score: 13, children: 0
grue 6 points 3 years ago

Emacs and bash use the same navigation shortcuts though, LOL.

path: 0 1282013 1285495, hotness: undefined, score: 6, children: 3
chaorace 16 points 3 years ago

Bold of you to assume that an Emacs user will have anything remotely resembling the default keymap by the time they're proud enough to brag about it

path: 0 1282013 1285495 1287603, hotness: undefined, score: 16, children: 0
Vegoon 2 points 3 years ago

set -o vi

path: 0 1282013 1285495 1290373, hotness: undefined, score: 2, children: 1
sLLiK 1 point 3 years ago

This. Esc, then b. Or if you're a stickler for keeping you hands on home row, Ctrl [ does the trick as well. Bonus points for making that more comfortable via a remapping of Caps Lock to control (or swapping the two).

path: 0 1282013 1285495 1290373 1308712, hotness: undefined, score: 1, children: 0
priapus 6 points 3 years ago

I've never used a distro that didn't come with a sane default shell config to avoid this

path: 0 1279712, hotness: undefined, score: 6, children: 0
korthrun 5 points 3 years ago

✨🌈 R E A D L I N E 🌈✨

path: 0 1308859, hotness: undefined, score: 5, children: 0
AnActualFossil 5 points 3 years ago

Alt-B usually works fairly reliably

path: 0 1276009, hotness: undefined, score: 5, children: 0
Ascend910 3 points 3 years ago

Does anyone know how to fix it in bash?

path: 0 1283538, hotness: undefined, score: 3, children: 10
Raphael 9 points 3 years ago path: 0 1283538 1284734, hotness: undefined, score: 9, children: 5
Ascend910 6 points 3 years ago

You didn't read my comment properly :(

path: 0 1283538 1284734 1286866, hotness: undefined, score: 6, children: 0
maess 2 points 3 years ago

so this is why I can't relate to the meme

path: 0 1283538 1284734 1285670, hotness: undefined, score: 2, children: 0
iusearchbtw 2 points 3 years ago

fish is nice but the nonstandard syntax gets really annoying after a while. I use ble.sh these days.

path: 0 1283538 1284734 1291769, hotness: undefined, score: 2, children: 1
Raphael 0 points 3 years ago

I have no such weakness because I never learned bash syntax anyway.

path: 0 1283538 1284734 1291769 1308131, hotness: undefined, score: 0, children: 0
Ascend910 1 point 3 years ago
path: 0 1283538 1284734 1286862, hotness: undefined, score: 1, children: 0
xthexder 4 points 3 years ago

Why is your user flagged as a bot account? You certainly aren't behaving like a bot.

path: 0 1283538 1287187, hotness: undefined, score: 4, children: 2
Ascend910 1 point 3 years ago

Maybe it's because I join and in a few day I create several communities and commented into too much. I am just trying to replace Reddit lol

path: 0 1283538 1287187 1291238, hotness: undefined, score: 1, children: 1
xthexder 1 point 3 years ago

There's a "Bot Account" checkbox in your user profile settings. You should be able to just deselect it, and you'll be a normal user.

path: 0 1283538 1287187 1291238 1305749, hotness: undefined, score: 1, children: 0
iusearchbtw 1 point 3 years ago

It works for me, which terminal are you using?

path: 0 1283538 1291660, hotness: undefined, score: 1, children: 0
binwiederhier 3 points 3 years ago

You can type reset to fix your terminal if it gets messed up like that.

path: 0 1278031, hotness: undefined, score: 3, children: 0
AlexWIWA 3 points 3 years ago

Mind bogglingly infuriating

path: 0 1276631, hotness: undefined, score: 3, children: 0
thurstylark 2 points 3 years ago

readline vim mode would like to have a word...

path: 0 1276761, hotness: undefined, score: 2, children: 0
nayminlwin 2 points 3 years ago

What happens to me is the opposite. I got used to Ctrl+w to delete a word in terminal and accidentally closed browser tabs many times while typing in them.

path: 0 1331099, hotness: undefined, score: 2, children: 0
jbrains 1 point 3 years ago

Train yourself to use edit-and-execute and this problem disappears forever. Now I'm annoyed when I type "esc v v" and nothing happens.

path: 0 1281895, hotness: undefined, score: 1, children: 0
programmerhumor
programmerhumor

@lemmy.ml

login for more options
43787
1628
1567

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.

go to feed...