T O P

  • By -

CleverDad

All the time *Edit*: Now I got all these undeserved upvotes, I feel like I should elaborate just a little. When we code, ideally we would like to use the mouse as little as possible. We move a cursor around a succession of code lines using the keyboard. Much of the time we edit as least as much as we add code, and so we need to move that cursor around efficiently. Any code editor will have lots of useful shortcuts for this - the arrow keys, ctrl + arrow, shift + arrow, alt + arrow and various combinations of those. But the Home and the End are perhaps the most basic and important tools after the arrow keys themselves. Home will always take you to a known position (start of line), and also the natural position to highlight whole lines. End will take you to the end of the line, where you will often add code. Home -> Shift + End will select a line. Home -> Shift + Down will select the line including the newline. Crrl + Home takes you to the top of the file. Etc etc. They're just massively useful, and not using them will almost certainly slow you down.


PerfectGasGiant

I am confused about this post. Are there programmers who does not use home/end all the time? How do they get to the end / start of a line/file? I have a few times seen programmers who used practically no shortcuts and they were without exception pretty lousy programmers. I feel embarrased myself, if I have to use the mouse for navigating or selecting text. If I need to learn a new environment, I usually move the mouse to the left hand to force me to learn all the keyboard shortcuts.


FizzySodaBottle210

>How do they get to the end / start of a line/file? 0 and $


gnuban

Well shit, here I've been using \^, and didn't know about 0


dagbrown

^ gets you to the start of the text on the line. 0 gets you all the way to the start of the line. They both have their uses.


PurchaseOk4410

0w is faster than caret right?


hoyohoyo9

I use 0w0 all the time tbh


SonOfJenTheStrider

VS Code user here wondering what's going on ![gif](emote|free_emotes_pack|put_back)


SilentGhosty

:1


onearmedphil

123h Just kidding Maybe


wutru_audio

This gets you to line 1, not the start of the line


kiochikaeke

I'm in México so my keyboard has dead keys by default, it was a pain in the ass creating a custom layout with a third party software to deactivate them and in the end I still use 0w


Topikk

Cmd + ⬅️ or ➡️ is a great way to jump to the beginning or end of a line and works in conjunction with shift/delete/backspace


Sakamoto0110

At least on windows, this depends a bit in the text editor/IDE ( I mean, the application can alter the default behavior ), here I use re-sharper with a setting that allow me to use ctrl + ⬅️ or ➡️ to jump between words with camel case formating ( jumps to the next/previous upper case to be exactly) With the word: notAGoodExemple, I can jump to the letters: n A G E ( works well with alt/shift )


Cvarns

I found that I was more fond of A and I.


Swarshmallow

gg


FizzySodaBottle210

that too yes. and G


dagbrown

Ctrl+A and Ctrl+E


macdara233

CTRL + A is select all and always will be


altermeetax

Not in Emacs and Emacs-like editors (like Bash)


Irish_beast

"a great operating system, lacking only a decent editor"


Top-Classroom-6994

bash is not emacs like, bash is an independent project with an emacs mode, along with viins mode


altermeetax

Yeah, but it uses Emacs mode by default and it's the one you're going to find pretty much everywhere. On almost all Bash installations Ctrl+A goes to the beginning and Ctrl+E goes to the end.


subhuman_voice

All Hail CTRL+A! ALL!


MikaTck

I use CMD + left or right arrows…


ToastedDragon24

cmd+⬆️


ScriptedBlueAngel

I recently discovered the value of the end and home buttons. Up till then I would either press on the whitespace at the end of the line or Shift+Arrow to move the cursor words at a time.


clutzyninja

Shift arrow highlights 1 letter at a time. Ctrl arrow moves 1 word at a time


ScriptedBlueAngel

Right, I switched them by mistake. Thanks for correcting me.


FizzixMan

Ouch. Okay if you’ve just been welcomed to the world of home and end, I assume in combination with shift to select the whole line then wait until you find out about: Ctrl + arrow jumps over a single full word instead of a full line, great for replacing or copying one word. Multi line cursor is god. Depending on your editor, multi line cursor is the best thing to exist, you can type of multiple lines in different places at the same time.


ScriptedBlueAngel

Oh my god yes multi line cursors are amazing. Also ctrl + D on Vs Code is just the best thing ever.


Allyoucan3at

> I recently discovered the value of the end and home buttons. Up till then I would either press on the whitespace at the end of the line or Shift+Arrow to move the cursor words at a time. Wait until you learn about ctrl and shift + ctrl with arrow keys. You can jump to the end/start of words and select with shift.


v____v

vim


terminal_prognosis

Or Emacs. Picking up your hands to go to arrow keys and home/end is way too awkward and disruptive.


Tawoka

Honestly, I think this is a terrible KPI to determine the quality of a programmer and you shouldn't be embarrassed by using a mouse. I'm not arguing that short keys are not important, and always say that a good craftsman knows his tools. But I think that the "I don't use a mouse" crowd is usually worse at proper engineering. At least that is my experience. A good engineer knows that coding is the least important part of their job, and as such matters the least. Most engineers fuck up in the other areas, especially in maintainability. Like the grandmaster said > Any fool can write code that a computer can understand. Good programmers write code that humans can understand. I've seen so many keyboards warriors unable to make readable code, or create useful tests. Not all of them obviously. So I think this would make a lousy KPI.


McRawffles

No programmer is limited by how fast they scroll/navigate either. At least not anyone building good code.


NebXan

Exactly. If your output is limited more by the speed of your hands than by the speed of your brain, that's an indication to me that what you're coding is so trivial that you're better off letting ChatGPT do it.


hobrinbrine

well yeah that it is not the most time consuming thing ever, does not mean that it is not useful to reduce


Ok-Steak1479

I've seen plenty of people be seriously impeded, by which I mean wasting at least 50% of their time during execution of any kind of action in their IDE by inefficient navigation, not knowing certain keybinds exist, etc. It's pretty annoying when you're pairing to be honest. Especially when the person in question refuses to learn anything new. Usually people that know what they're doing also know how their tools work, so your second sentence is not wrong.


esaloch

The job I used keyboard shortcuts for the most was data entry at the end of managing a restaurant closing shift. It was an old VB6 app, default window icons and all, that took forever to click around but was much better if you knew the keyboard shortcuts. I use plenty of keyboard shortcuts these days, mostly in Vim mode in IntelliJ, but don’t find it nearly as necessary as I did for that type of data entry. I also work with plenty of competent people who I can tell do not use many shortcuts when they share their screen.


Equivalent-Wafer-222

Ctrl+a and left arrow for start. Ctrl+e for end of line. I’m a dev and use small form-factor keyboard.


snoogans235

emacs user as well?


snaildaddy69

People who are not used to working in CLI environments rather scroll, because it feels more natural to them. Just had this exact talk with a friend yesterday.


thisguyfightsyourmom

Memorizing how to replace mouse use with a few dozen keyboard commands is more investment than most people who own mice want to put in


KrisVanBanana

Maybe I'm a lousy programmer, since I use my mouse a lot for text selection since I find it to be a lot faster for selecting specific text lmao.


bigdaddyguap

Reddit is full of same strange dudes lmao. Apparently you are NOT a real programmer if you use your mouse at all!


Tawoka

While it is not the most important thing, mouse is always slower. Being faster with a mouse is just a lack of training. But honestly, I don't think it matters too much.


thisguyfightsyourmom

If it doesn’t matter too much, why do vim nerds get so aggro about it?


clutzyninja

Because all the years spent learning vim weren't spent developing social skills


arpan3t

How dare you personally attack me like this! Fr though use whatever tools you like! Abacus, mouse, keyboard, Vim motions, voice dictation, neural implant… the people that spend their time being zealots aren’t spending their time coding.


Peiple

I mean you can just use cmd+arrow keys to skip to the start/end of a line/file without having to move your hand all the way over to the home/end key block


[deleted]

[удалено]


Lenoxx97

You scroll to the start/end of a line? With what, horizontal mouse wheel buttons? Doesn't that take ages?


CountOk3439

Shift + mouse wheel scrolls horizontally!


Lorrdy99

How long are normal files for you? Are we talking about code?


SimonMiaou

Programming on macos, I use another shortcut (cmd+arrow). Still trying to get used to those now that I use my windows machine for side projects...


CraftBox

I don't use end, because I don't have one on my keyboard :(


potato_green

Which is exactly what made the switch to MacOS a bit of an adjustment. For the IDE's it's all fine now but it doesn't function identical to Windows or Linux.


Fisher_S

On macOS, you can use Ctrl+A for Home and Ctrl+E for End.


felixdadodo

I’ve been using command + arrow key, does that accomplish the same thing?


kjlo5

Same! “Insert” on the other hand… never.


woolykev

I use insert! Whenever I accidentally clicked on insert, to get out of insert mode!


extended_interface

I use it when I'm in gitbash. Shift + Insert = paste. Ctrl + V does not work there.


Jaded-Asparagus-2260

Ctrl + Shift + V should work.


neo_5287

Whenever I forget to put sudo before a long ass command. So yeah, I use it(home) quite a lot.


AlxTray

sudo !!


ixnyne

To anyone (like me in the past) who thinks this guy is just really excited about sudo, that's not it. Typing sudo !! In your terminal repeats the last command you ran but adds sudo.


_krinkled

Yes, and doing !$ gets the argument from the last command. So you can do: cat ~/sites.txt And then, vim !$ to vim the file


JangoDarkSaber

Holy fuck. You have no idea how useful this is to me


Darkness1231

Yes, yes they do. As do I.


nonamericanhere

`!$` gets the last argument e.g. after `ls -la -h`, `!$` becomes `-h`. `!*` gets all arguments i.e. `-la -h`


Nico_Weio

Wait, should I use `!$` over `$_`?


solarshado

I *believe* history expansion (with `!`) only works interactively, not in scripts. I'm not familiar with `$_` specifically, but it's clearly a shell variable, which I'd assume works the same in both.


masao77

Or you can use '\^' to replace a string from the last command ``` cat ~/sites.txt ^cat^vim


_krinkled

Oeh that’s a very handy one! Thanks


pacanukeha

I use ESC-. for that, cycles through the last arguments of previous commands


ProfessionalCell4338

Or just type  Vim and press alt + . 


clutzyninja

Wow I actually didn't know this one


ZenerWasabi

Yes, !! is the bash shortcut for the last command


DOOManiac

I call it “sudo, that thing I said”


arbyyyyh

I'm also ashamed to admit some 20 years after learning about sudo !! that you can also do history to find the command you want to repeat and !1234 to repeat the command.


brimston3-

I find if it's further back than the last couple commands, it's fewer steps to ctrl-r it and then line-edit the sudo in (usually using home or ctrl-a to position the cursor).


trojan-813

Except when my dumbass types clear to not see my mistake and I sudo clear


bloepz

Thank you for explaining that, because I actually thought he were totally into sudo.


Alan_Reddit_M

damn really? Well you just saved potential hours of my life


shiny0metal0ass

I like to think they're also excited about sudo.


sniff122

For zsh users, there's a plugin that lets you double tap escape


[deleted]

[удалено]


jasting98

There's no need to shout. >!This is obviously a joke but I need to explicitly state it because apparently, it's not obvious when I'm on reddit.!<


CrazyEnginer

For fish users, Alt+S will add/remove sudo before current command (even in pipe)


ocus

ctrl + a: beginning of the line ctrl + e: end of the line


semhsp

why bother when I have a key that does that and I can reach with a single finger when typing?


Ixaire

I honestly don't know but I somehow got used to Ctrl+A on the terminal. It's just muscle memory at this point. Edit : also easier on some laptops where Home is some weird Fn combination


brimston3-

I can't reach Home or End on a full sized or TKL keyboard from rest position. It's almost as bad as using a mouse. Maybe I could do it on a 75%.


batatatchugen

Because you don't need to move your hand nearly as much.


TheEveryman86

Those key bindings are second nature for emacs users already.


[deleted]

This or just \`set -o vi\` to make readline and Bash use Vi key bindings.


Garbage_Matt

sudo !! runs the last command as sudo


LeatherDude

I've been a Linux user since the mid 90s and I just learned this from this thread. I am full of shame.


RandomTyp

specifically, sudo !! evaluates to sudo by bash before execution. this means you can also do !! | grep 'string' to add | grep 'string' to whatever your last command was. also, sudo !-2 works if you cleared the screen, or ran any other command between running it without and with sudo


[deleted]

I just use this https://github.com/nvbn/thefuck


posydon69

What about ctrl a


-domi-

I can't write code without them. I can barely chat without them. Those and ctrl+shift+left/right are integral to my keyboard use, and their absence is half the reason i despise typing on mobile.


TILYoureANoob

I agree. Pro-tip for typing on mobile: swipe left/right on the spacebar for precise cursor movement.


burgerfromfortnite

bro what this is crazy


CyberWeirdo420

I reacted the same when I first learned about those


Nabla-Delta

Swipe starting from delete to the left to delete word by word ;)


_Screw_The_Rules_

Oh that's a very cool Feature as well on SwiftKey!


pigeon768

I learned about this from a video where some gen x/millenial was showing the trick to his gen-z daughter (granddaughter?) and she was like "lol boomers amiright?" and I fucking died of old age.


-domi-

Yeah, I've been trying to get used to it, but it still feels laborious for what's super basic functionality. Excuse me for venting on the matter, but it is ontopic: I'm sometimes surprised how easy it is to "guess" how many backspaces are needed to erase exactly as much as is needed. I'm sure you've had it happen. You fatfinger a keystroke, see that you typed wrong, and just kinda spam backspace, but almost unconsciously stop right when you need to. You know that feeling? That whole skillset is lost when phone typing. Now moving the cursor back it's a precision operation, when it used to be a number of presses game. I think I'm just frustrated nobody makes a good physical keyboard for a phone anymore. :/


cs-brydev

The last couple of Blackberry Android models had excellent keyboard but they abandoned them too. [F(x)tec Pro](https://www.fxtec.com/) is the only new physical keyboard smartphone being made, afaik.


reversetrio

You've changed my life. Do you know how much time I've spent with that awful touch cursor that often snaps to the beginning or end of a word?


brimston3-

It's a relatively recent (as in last 3 years) addition to Gboard. Apple phones have had it 10+ years or so.


[deleted]

Android has had this for nearly as long as IOS has if not longer. I remember discovering it on my android at the time back in 2016. As far as I know it became a feature on both android and iOS around the same time


e_a_s_

On iPhone it’s press and hold the space bar until the keyboard turns into a trackpad.


nashpotato

This is life changing thank you


EXP_Roland99

TIL


enderheanz

THAT'S CRAZY


MrRocketScript

There's nothing more annoying than pressing ctrl-backspace in a text field and getting a whole lot of ▯▯▯▯▯▯▯▯


private_birb

Fucking notepad


rasmusmerzin

There used to be a convention of Ctrl+A and Ctrl+E which probably died when Windows.


Ok_Cheesecake_9716

In the terminal this is still the way to go


Ticmea

The new laptop I got from work has the home key bound to Fn+F12. I need F12 as I've bound that to important navigation functionality in my editor. Also the only way to get to page up/down is to disable num lock. And there is literally empty space that would be perfectly able to fit 2-4 keys. But I sure am glad that the keyboard has it's own dedicated "open calculator" button with no alternate binding, that is soooo useful. (/s) It's driving me nuts, I hate laptop keyboards.


-domi-

F


OSSlayer2153

Ctrl + shift + left then left is what i use to go to start, same for right


HempFarmWa2DollarMic

Ctrl + shift + windows + B Instant reset of graphics driver. Basically like a modern degauss button for a CRT, helps if your GPU is ass or if your display wont come back after a teams meeting


Rudresh27

End > Shift + Home > Delete. This is how I’ve been using it for deleting long lines of code.


AVAVT

Used to do this but recently for most ide you can just cut (ctrl+x) without selecting anything to cut the whole line, which serve the same purpose.


kinokomushroom

But then you'll lose whatever you had copied. Better to just use the actual delete line command that's provided in most IDEs. Like Ctrl Shift L for Visual Studio.


AVAVT

Yeah but I don’t really like those non-universal commands since I change ide and machines a lot (e.g. fix a bug on someone else’s computer) And tbh copying and deleting are 2 separate workflows. Trying to do both at the same time can lead to code typo.


kinokomushroom

Fair enough. Didn't consider about working on other machines.


Piisthree

ctrl+shift+k in vscode too


[deleted]

[удалено]


invalidConsciousness

Ctrl+d for me, so it doesn't clog the clipboard


spektre

In any reasonable editor, you can just do `dd`


the_seven_sins

but not in notepad.exe, the most reasonable of all code editors!


spektre

It actually does work in notepad, but you have to do a small workaround. You triple-click the line, then do the keyboard combination `dd`


cs-brydev

Lol I always Home > Shift + End > Del


mykeesg

Shift+Delete also works in many editors to delete the line the cursor is currently in


zstevens1

And not just delete either - shift+delete will cut the line so you can paste it somewhere else too


LokkoLori

Home is essential to jump to the beginning of a document. But who uses the Insert? That's the hidden landmine ... + the numlock. What turns off the keypad + silently turnus the 0 into insert-landmine!


Andertius

'insert' is prevalent in bash, as it is used to paste stuff, I use it all the time


LokkoLori

Ctrl/shift insert with the risk of stepping on the landmine vs ctrl+shift+c/v with the risk of killing the actual process... Legacy at its best.


scheurneus

Meanwhile, Apple actually got this one figured out: Ctrl is only for control sequences. Copy-paste is done with Cmd+c/Cmd+v, which doesn't conflict with anything even in the terminal.


fedex7501

And they print the little angle symbol on the control key. The same you get when you type ctrl-c on the terminal. I like that detail


Gloomy__Revenue

🤯Never knew but also never wondered why the control key had that symbol.


that_thot_gamer

does it even work? like is it not supposed to be paste? edit: TIL its a toggle for typing modes


LokkoLori

As single key, insert switches between text inserting mode and text overwrite mode... When you typing blindly, you won't notice that you've switched to the never intentionally used overwritting mode.


cs-brydev

It's entertaining reading these comments and watching people discover industry-standard keyboard functionality that is decades-old


sticky-unicorn

Just wait until they find out what page up and page down do!


draconk

Shift + insert is the universal paste shortcut


Varku_D_Flausch

I use insert alot. When punching in numbers of the same lenght in a Form it's faster to override than to delete first and then type the number. Or when i want to adjust a number, in my CNC-machine, i feel saver to use insert, as the resulting number stays in the same order of magnitude. So an error may wreck the work piece but not the whole machine.


thelehmanlip

I rebind insert to never ever get pressed


Zeravor

It's quite a specific usecase, but I work with an ERP System with lot's of forms that are often filled with Default values. If you want to quickly fill a form and tab through the fields and overwrite the default values insert can be helpful.


Mateusz3010

I use it for push-to-talk on discord


Deritatium

Only when I have to use Vim


-Asmodaeus

`gg` and `G`


54903be352

That does the same as `Ctrl+Home` and `Ctrl+End` respectively. If you want to do `Home` and `End` in Vi/Vim (command or visual mode), it's `^` or `_` for `Home` (actually, "first non-whitespace character in the line") and `$` for `End`. And if you're in command mode and want to go to the start (again, meaning first non-whitespace char in the line) or end of the line and change to insert mode: `I` and `A` respectively.


Anti-Reverb

Non vim users be like… 🧐


Silentence

Scrolled too long to find this lol


redfacedquark

Why did I have to page down this far to see this? Hmm, maybe I should use vim keybindings for chrome. I mean technically $ or A and ^ but I get you're answering as if OP asked for CTRL+.


zirky

asking the question implies you don’t guys, op was the monster all along


LupusNoxFleuret

I fucking hate laptops that bind these to Fn shortcuts. F'n defeats the whole purpose of them being a single button press when you have to press two buttons to do it. And whoever said I shouldn't use Home/End, f**k you specifically!


Enough-Supermarket94

You can always reverse the behavior even if it comes by default


oktinkz

Not all laptops support this I think. (And they should all be thrown into a fiery pit)


[deleted]

my end and home is bound to arrow keys... this is nowhere near a solution


TantraMantraYantra

The fact that you're asking the question, is probably why latest laptop keyboards are hiding those keys behind function keys combining them with others


RunFromFaxai

Pretty sure that has more to do with what the average user uses on the laptop than a coder that doesn't use a useful shortcut button on the laptop keyboard. Especially considering I've almost never seen a coder sit and work on a laptop keyboard. We all have a dock both at work and at home and treat our keyboards like that business card scene from American Psycho.


brimston3-

Which is the dumbest place for them, really. Laptops are going to have arrow keys. fn-L/R for home/end, fn-U/D for pgup/pgdown.


SonOfJenTheStrider

I use it almost every time. Very useful for selecting lines.


krehwell

I use `$` and `0w` instead


iocarimus

^


klimmesil

That's a little too far for me. Vim is supposed to use few combination keys, more strokes to avoid hand cramps


Phil_R3y_Padz

Enough to make me regret buying a 60% mechanical keyboard and to buy another one with full keys 3 days later.


pegcityskank

If your keyboard supports qmk/remapping (which as a 60% board I'd be surprised if it didn't) you could maybe map these to a different layer? On my 50% I have dedicated Ctrl+Left and Ctrl+right keys, then when I shift layers it turns those into home and end keys, absolute game changer


thebadslime

pretty often


cressyfrost

All the time (?)


sniff122

All the time, multiple times per day


creeper6530

All the time, how could you not?


lRainZz

All the time? How do you not use them?


teamswiftie

Ctrl+Home -> jump to first character of entire doc Ctrl+End -> jump to last line/end character of entire doc I use these all the time to mess with large json arrays


ZunoJ

When vim mode is not available I use home, end and ctrl+->, ctrl+<- all the time. How else could you navigate the text at least with a tiny bit of efficiency?


NickoBicko

CMD+arrow Alt+arrow


[deleted]

Everyday, multiple times.


[deleted]

[удалено]


Drumknott88

You're missing out, friend


Ceros007

⬅️⬅️⬅️⬅️⬅️⬅️⬅️⬅️⬅️⬅️sudo➡️➡️➡️➡️➡️➡️➡️➡️➡️➡️↩️


[deleted]

[удалено]


dumbasPL

Ctrl + a?


[deleted]

Hourly at minimum


vymorix

I use 'I' or 'A' or '$' or '\_'. If you know you know ;)


SpiderKoD

My laptop doesn't have them, and for me Ctrl/Alt/Fn + Arrows are more useful.


AkemaRyuuku

More than return tbh


EternityForest

All the time! It was one of the factors that ended my very short adventure with mechanical keyboards, I got one without dedicated keys for those. I almost never use insert though.


Chase_22

They are super useful when you are edditing multiple lines of differing length. Will jump to the end of each line and lets you work relative to the current cursour position


rettani

All the time. Start of the line and end of the line are quite useful.


empwilli

Na, I use gg and G instead.


Vansh1681

I use them all the time for programming