r/learnprogramming • u/CockGoblinReturns • Mar 10 '20
After a year and a half of programming, I just learned about double clicking to highlight a whole word and triple clicking to select a whole line and quadtruple clicking to select all. NEVER AGAIN. What are some must have tricks and shortcuts for programming.
Oh god, knowing these shortcuts would have saved me so much time.
On the other hand, this is a real life powerup.
264
u/firstlevelwizard Mar 10 '20
On windows machines, The windows button plus an arrow key auto snaps your current window to the side of the screen.
63
u/haos_ Mar 11 '20
On multi-monitor setup: Windows key + shift + left/right arrow key to move the window between the screens.
→ More replies (2)14
28
u/0101010001001011 Mar 10 '20
What's more, once you are snapped to a side of the screen, if you then press the windows button plus an up or down arrow key, it snaps the window into a corner of the screen.
11
u/SelfTaughtDeveloper Mar 11 '20
This works on some Linux environments, too. I have used it on cinnamon, gnome and KDE
→ More replies (1)16
u/tenfourthereover Mar 10 '20
There are several apps you can download with similar functionality for iOS if youre using that (I use one called Magnet)
11
3
u/Casual_py Mar 11 '20
And ctrl+win+arrows let's you shift it all around - really useful for multiple monitors.
5
u/monsto Mar 11 '20
also . . .
if you're on L/R edge, you can Win + Up/Down to quarter-size the window. If it wasn't on the edge, it will min-to-taskbar... just hit Up again.
→ More replies (9)2
u/RyleZor Mar 11 '20
For some reason it only works with some windows. Still prefer using Linux with a tiling WM for that feature.
403
u/Inspurration Mar 10 '20
To change code into comment, highlight the code and press Ctrl + /
120
u/NormalDefinition Mar 10 '20
Depends on the editor / IDE
38
6
u/monsto Mar 11 '20
It probably does, but I've not used an editor in the last however long that didn't have this key.
→ More replies (2)3
133
u/CalbertCorpse Mar 10 '20
You son of a bitch!! I’m 50 years old and you never fucking told me this!!?? I’ve been a poser all this time.....
→ More replies (3)15
19
u/aplawson7707 Mar 11 '20
I'm on day 2 of programming and I'm really proud to understand what "commenting out" means lol. Thank you for this tip, too!
4
35
u/shatteredglassbox Mar 10 '20
In Visual Studio, Ctrl + K will comment out all lines selected. Ctrl + U will uncomment those lines
47
u/HereSoIDontGtSpoilrs Mar 10 '20
You're either forgetting some steps or you don't have default settings.
By default, Visual Studio sets comment lines to CTRL+K, CTRL+C and uncomment to CTRL+K, CTRL+U.
It means you hold CTRL and press K, then while still holding CTRL press C (or U).
12
u/DJ_Gamedev Mar 11 '20
Even though I've gotten very used to these over the last 15 years, it's always irked me that the comment shortcut involves two keys on opposite sides of the keyboard, necessitating a concert piano-like exchange between the hands to pull off efficiently.
→ More replies (5)6
u/gunnnnii Mar 11 '20
Really? I've never messed with the shortcuts in VS code and ctrl + / has always toggled between commenting/uncommenting. This has been the case for Mac, Ubuntu and Windows machines.
→ More replies (1)33
→ More replies (1)11
10
u/RheingoldRiver Mar 10 '20
In notepad++ it's Ctrl+Q -> comment each line; Ctrl+Shift+Q -> block comment. Redo to undo. It's the same in Sublime for me but honestly idk if that's default or if I did it when I switched...
→ More replies (4)6
→ More replies (5)2
58
u/Baiiko Mar 10 '20
Ctrl+d to duplicate a line and alt+shift+ arrow keys to move selection up or down
10
u/anoppinionatedbunny Mar 11 '20
that's not so standard. in Atom ctrl D deletes the line. in eclipse it hides the line. but when it works it helps a lot.
4
→ More replies (4)4
u/MomijiMatt1 Mar 11 '20
One of my students showed me the Alt + Arrow Key thing and my whole world was shaken.
46
u/Korzag Mar 10 '20
Now wait until you master keyboard-only shortcuts. I can't speak for Linux and Mac editors, but on Windows:
Learn to make use of the home and end keys. For instance, you can hit home or end, then hold shift and use the other (home, shift+end) to highlight an entire line without the indentation)
Ctrl+arrow keys to select entire words; ctrl+up will select everything before the cursor up to the next line to the same position, same works for ctrl+down.
If you use Visual Studio or VSCode, alt+up/down will move the entire line up or down seamlessly. Ctrl+D will duplicate the current line. Shift+Delete will delete the current line
→ More replies (8)
134
u/NormalDefinition Mar 10 '20
Tab to indent & shift-tab to unindent
33
u/Drayviz Mar 10 '20
I learned this through programming in text editors then was flabbergasted upon finding out it works in word processors (and essentially everywhere) as well!
14
0
8
u/Fbhwnashfan Mar 11 '20
Wanted to add this also work with highlighted lines so that you can indent blocks
6
u/trip16661 Mar 10 '20
command+[to unindentcommand+]to indentOn vs code (English keyboard, fuck you ñ...)
→ More replies (1)→ More replies (3)3
Mar 10 '20
for some reason My brain does not want to remember the shift-tab.
16
u/blackerbird Mar 10 '20
This is my approach to learning new commands: Put a sticky note or similar by your monitor with a few new commands you want to remember. Every time you find yourself doing it the old way, stop, look at the sticky note, and do it with the new key combo. Soon enough it will become muscle memory.
→ More replies (1)
113
u/Tangy_Tortoise Mar 10 '20
CTRL + Backspace.
Works pretty much everywhere.
You're welcome.
87
u/Sande24 Mar 10 '20
To expand on that:
CTRL can be combined with arrow keys, home, end, backspace, delete to skip words, lines etc.
SHIFT can be used in the same way to SELECT stuff.
Combine CTRL and SHIFT to get both. Very easy to copy sections of code etc.
Also, some interesting ways to work around (filled) tables in excel.
→ More replies (1)13
Mar 11 '20 edited Mar 11 '20
On a mac it's similar:
Hold option to skip words
Hold command to skip to start/end of current line
Hold shift to select along the way
In my decades of using a computer, I have to say I think this has been my most useful keyboard revelation (or maybe it's a tie with multiple cursors). The "word-wise" movement is aware of special characters too, so its even more useful for jumping around in code. Once you internalize the system it becomes second nature and you'll use it everywhere. It's almost frustrating watching my coworkers clicking around and navigating 1 char at a time.
21
u/SECsMan Mar 10 '20
Here I am sitting at work (not at all programming-related) in disbelief wondering why I didn’t know this. Thank you
20
u/semi_88 Mar 10 '20
Ctrl is pretty much shortcut for skipping through words/statements Ctrl home/end to go to top/bottom of page Ctrl left and right skips words Ctrl shift left/right to highlight words Ctrl backspace/delete to delete words
9
u/hkbertoson Mar 10 '20
I showed this my coworker the other day and he flipped shit. I was typing out some emails and I use CTRL+Backspace a million times a day. He didn’t know how I was deleting whole words.
→ More replies (4)2
u/abcteryx Mar 11 '20
Except for in the PowerShell Integrated Terminal on VSCode on Windows 10, for some reason. Has something to do with PsReadLine not playing nicely with the VSCode keybinds. And yet it works fine in Windows 7. Annoying little bug!
Ctrl+LeftArrow, then Ctrl+Delete is a workaround.
112
u/Kingslayer1337 Mar 10 '20
Just wait til you try VIM...
72
u/vBubbaa Mar 10 '20
<esc> :wq <enter>
50
20
→ More replies (2)14
u/Cyber_Samurai Mar 11 '20
Woah there, you don't know what you might've messed up on accident. Better to just <esc><esc><esc><esc><esc><esc><esc><esc><esc><esc> :q! <enter>
19
u/jpritcha3-14 Mar 11 '20
I was going to say.... most of these tips are all one or two keystrokes in VIM normal mode. I'm still not a master, but I love not having to use a mouse when editing.
16
8
u/acepukas Mar 11 '20
Vim is dangerous because once you get half decent with it, it's hard to go back to anything else. The one thing I wish would get better in Vim is debugging though. It's still pretty tricky to get working and when you do it's still not as slick as most IDEs.
→ More replies (5)4
u/0xAAA Mar 11 '20
And most people don’t understand that learning vim actually makes you a better programmer. When you can write/edit code at the same speed that you think you are much more productive.
The cognitive load of using your mouse and arrow keys adds up to a lot when you are coding for multiple hours.
Oh I’m at the middle of a line and need to append code to the end of the line. Oh I need to add “this.” to the beginning of the next 10 lines. Oh I need to jump to the top of the file to check what I imported. All of these take 0 cognitive load in vim once you use it for a little bit.
→ More replies (2)→ More replies (7)2
68
u/sparky135 Mar 10 '20
This is not programming, but I'm amazed how few people use CTRL + C ( or X or V), definitely the best shortcuts.
63
u/Virtual-Lawfulness Mar 10 '20
My skin crawls when I watch people click and drag to highlight a word, then move the mouse up to the Edit dropdown, and select copy.
→ More replies (3)36
u/cmaronchick Mar 10 '20
My skin crawled just reading that. The mouse drag was bad enough, the going to the Edit menu is plain sado-masochistic.
→ More replies (6)8
u/EMCoupling Mar 11 '20
By the same token, sometimes Shift + Insert will work in those situations where Ctrl + V won't.
18
Mar 10 '20
Almost every editor has a vim mode or plugin. By learning vim, I can use the same muscle memory regardless of whether I'm in Visual Studio, PyTorch, or fiddling with some config over SSH.
9
u/EMCoupling Mar 11 '20
I find that many Vim plugins aren't quite there in terms of some of the more obscure features. Manipulating buffers, marks, ranges, etc. never quite seems to work the way it does in actual Vim.
Useful for sure, but the true Vim experience can only be had in Vim.
11
16
u/remludar Mar 10 '20
In Visual Studio, highlight a word and press ctrl+r+r to enter refractor mode. Rename the word and press enter and it automatically gets renamed through the solution.
3
3
2
29
Mar 10 '20
if you like those, you should try shift+home and shift+end
15
u/redViperOfDorne7 Mar 11 '20
Dont leave us hanging, wat does it do?
11
Mar 11 '20
selects the whole line starting to the left of the cursor, or right of the cursor
bonus: page up/down do the same thing, but with the entire page, except I guess they stop on the first/last line in the same position as you started, which is...interesting
6
12
u/ojitoo Mar 10 '20
Holding CTRL + left or right arrow keys lets you jump whole words instead of characters.
20
u/leroydev Mar 10 '20
In Visual Studio Code and Chrome DevTools:
CTRL + G to go to the line number you enter in the popup it opens
CTRL + P to go to the file you enter in the popup it opens
10
u/life_pass Mar 10 '20
Alt+F12 in Visual Studio lets you preview a class so you don’t break flow/focus jumping to another file.
10
u/three_furballs Mar 10 '20
In many editors you can move line(s) around with alt up and alt down. You can duplicate them up or down by throwing in a shift.
23
u/0x2a Mar 10 '20
Deleting the whole line you're on:
vim: dd
eclipse: ctrl-d
Jump to line number:
vim :<number>
eclipse: ctrl-l
16
u/Mircearaul Mar 10 '20 edited Mar 10 '20
And for my fellow Visual Studio users:
Deleting the whole line: shift-delete - this is actually a cut command as it copies the deleted line to the clipboard, very useful if you just want to move a line of code.
On an related note, ctrl+c without any selected text will copy the whole line to the clipboard.
Jump to line number: ctrl+g. This also works on other IDE and editors, such as Notepad++ or Visual Studio Code.
All these commands also work in the IntelliJ IDE as well.
→ More replies (2)3
3
u/whizbangapps Mar 10 '20
Select multiple lines
Shift-v then j or k or up and down arrows
y to copy
p to paste
5
u/EMCoupling Mar 11 '20
Using ranges can be helpful with big sections of code.
Copying lines 159 to 189 in Vim
:159,189yDeleting lines 159 to 189 in Vim:
:159,189dJoining multiple lines:
:162,165jMost motions and ranges work well together.
→ More replies (1)
16
u/slicero Mar 11 '20
Accidentally closed a tab in your browser? Hit Ctrl+Shift+T or Command+Shift+T to reopen it.
This also works for multiple tabs and will open tabs in the order that you closed them
5
2
7
u/SenorTeddy Mar 11 '20
CMD + D / CMD + K
Highlight a word and everytime you press CMD+D it will highlight the next word in the document that is identical to the originally highlighted one.
Good if you want to change a bunch of variable names at the same time.
CMD + K lets you skip, so if you use a common word, you can just skip that specific one.
______________
ALT + UP / DOWN
Moves the current line of code up or down a line. I use this a lot when I went to move things in and out of conditionals, or move my console.log to track where a bug is without deleting it and then rewriting it.
2
u/scandii Mar 11 '20
I would use an IDE capable of more simple refactoring if I were you.
→ More replies (5)
7
Mar 11 '20
Small saviors:
Once the cursor is at the start or end of a block, click Ctrl + } to go start or end of the block. Very handy.
Ctrl + X cuts the entire line. No need to select the line if you want to cut and paste a line to a different location! You can then paste at any place.
[Windows] Shaking title bar of any application (for eg. Visual Studio) with the mouse will minimize all other windows. A quick fix to shut up annoying windows or clear the clutter.
If you feel an application is hidden but not showing upfront, then press Alt + Space + M, then click the arrow keys to bring the bugger in your view!
→ More replies (2)
6
u/Irishdude77 Mar 10 '20
Cntrl + tab to switch between windows/files. Also works in web browsers to switch tabs
5
u/blitz4 Mar 10 '20 edited Mar 11 '20
Ctrl+alt+esc in win is task mgr. Win+arrows moves windows around Win+d is desktop. Theres a hotkey for almost every win+key combo.
Use autohotkey to make new hotkeys
Edit: Ctrl+shift+esc is task manager
5
u/Orkaad Mar 10 '20
If you use spaces as a convention, let's say 4. You don't need to hit the space key 4 times, just hit the tab key once and it'll generate 4 spaces.
4
u/pancakeQueue Mar 10 '20
If you connect to Linux servers regularly, ssh keys are great. Mix that with an Alias and you don’t even need to type the full command.
Ctrl R and history | grep <find_old_command> are also great for finding old things you fed buy can’t remember the full thing.
3
u/packutz Mar 11 '20
Also
ctrl+a jump to beginning of command line
ctrl+e jump to end
ctrl+u you give up and just want to type the command again from scratch
ctrl+d delete all charcters after cursor
ctrl+w delete the last word
and there are many more
4
u/pixie_laluna Mar 10 '20
crying in vim
3
u/ProgrammerRookie Mar 11 '20
As stated above: <esc> :wq <enter> Now stop your incessant crying
→ More replies (12)3
u/EMCoupling Mar 11 '20
Sometimes you just want to leave without saving.
:q!instead→ More replies (2)
4
4
u/MirrorLake Mar 11 '20 edited Mar 11 '20
VS Code ones that I have written down:
ctrl + shift + K : Delete line the cursor is currently on.
ctrl + uparrow or downarrow : Scroll up/down. Modifiable in Preferences to perform multiple line scrolling.
alt + up/down : Move current line up or down. Works with multiple line selections, too
ctrl + Enter : When anywhere in a line, creates a new line below (inside block).
ctrl + shift + enter : When anywhere in a line, creates a new line above
Of course, you can just open preferences and look through the list to see the complete list.
→ More replies (3)
4
u/Totoro205 Mar 11 '20
If you're on windows writing "cmd" in the adress bar of a specific folder allows you to open a command line in that directory
7
u/MetamorphicFirefly Mar 10 '20
YES FUCK YES THIS IS AMAZING.
I SEE NO GOD UP HERE BUT ME AND GODLIKE SELECTION SKILLS
1
u/AacidD Mar 11 '20
In VS Code, mouse middle button click & drag to use multi line selection (vertical selection / rectangular selection)
1
u/CockGoblinReturns Mar 11 '20
how is this different from left click drag?
1
u/AacidD Mar 11 '20
Difference is explained in this video Rectangular / Vertical / Box / Column Selection
1
1
u/sheep_cmdr Mar 11 '20
I don’t know if anything has made me more productive that learning how to use substitutions properly in vim. It’s just so useful.
1
1
6
u/morningcoma Mar 10 '20
Wait, how is OPs thing a programming tip? Anyone that has ever used a mouse in any program ever should know this. Am I missing something?
4
3
Mar 11 '20
Lots of people don’t use a mouse much when writing.
But it’s a handy general use thing to know ..for example I need to do a fair bit of grabbing guids or api keys that are long strings, triple-click to select means I’ve quickly got the whole thing and with no risk of accidentally copying a leading space or whatever that can happen on click+drag.
3
Mar 10 '20
Ctrl+. (the period) then Enter when you have changed a class name will change the name throughout the solution in Visual Studio2019...if you are missing a using staement, you can do the same and it will automatically put it at the top (C#). It actualy gives you a dropdown so you can select from multiple items.
Also CTRL+K, S will let you surround the highlighted code with a list that drops down (I usually use it for #region)
3
3
u/ryonnsan Mar 11 '20
Windows + L, for when you need to go to toilet or simply getting a snack from the kitchen
3
u/hunterman25 Mar 11 '20
This one’s obvious, and most people know it. But for those who don’t, their lives will be a living hell. CTRL F. Find keywords. And by all that is holy make sure to locate the replace button too.
3
u/yazalama Mar 11 '20
If someone would enlighten me on how to delete an entire line in a Unix terminal, if be mighty grateful.
→ More replies (2)
4
u/PPewt Mar 10 '20
Most programming shortcuts tend to be pretty specific to the tools you use.
It isn't really a "shortcut" in the same sense that key sequences or mouse clicks are, but regular expressions and basic Unix utilities really improve your workflow. Also, knowing a lot of the features of your text editor helps a lot: personally I'm a fan of vim for that since it sort of forces you to learn them properly as there's no lazy alternative.
4
u/Blando-Cartesian Mar 10 '20
IDEs have a shortcut for deleting a line. It's the most useful feature ever.
→ More replies (3)
2
u/SlightlyOTT Mar 10 '20
In most IDEs cmd + / will comment or uncomment the lines you have selected. It’s language aware and usually does the right thing.
2
2
u/DrFunkenstyne Mar 10 '20
You just blew my damn mind. I also just figured out if you triple click and then drag, it will select the whole lines of where you drag. Game changer
2
u/emberBR Mar 10 '20
I've seriously sped up my code typing and typing in general by using CTRL+ARROW to jump whole words and actually use HOME and END to go to the beginning or end of a line. It's a relief to stop mashing the arrows trying to get to a specific place.
You can combo with SHIFT for selection as well. Its so much less friction. Using Vim must be great, as far as I know Vim is an OP version of this.
Ex. To delete a whole line you could press END, hold SHIFT + HOME, DELETE, I know there are other shortcuts for this but this isn't too slow either, the three keys are all together and this works everywhere. I like it.
5
u/EMCoupling Mar 11 '20
Vim equivalents
Jump a word forward or backward:
worbore, depending on where exactly you want your cursor to be.Go to beginning of line:
0Go to first non whitespace character in the line:
^Go to end of line:
$Selecting a range of characters: Combine
vwith the above, e.g.v$orvworVDelete an entire line:
dd→ More replies (3)
2
2
u/Darthcolo Mar 11 '20 edited Mar 11 '20
To undo an action:
Ctrl + zTo redo an action:
Ctrl + yThe redo can be performed multiple times when using formatting in Excel files, and is not necessarily related to Ctrl+z. For example, you paint the background of a cell in Excel, then click in a new cell and press Ctrl+y to repeat that last action.
2
2
u/Ella_loves_Louie Mar 11 '20
In windows, holding shift reveres the 'direction' of you keyboard shortcuts.
2
Mar 11 '20
Not useful for coding, but middle mouse click (scroll wheel click) for browser tabs. Middle click a link to open in new tab. Middle click an existing tab to close it.
→ More replies (1)
2
u/Kohana55 Mar 11 '20
Hitting tab twice on some C# stuff builds a basic outline.
So like if( TAB TAB
Sudden it’s all
If (something) {
}
Then the “something” is highlighted ready to type into.
2
u/Darthcolo Mar 12 '20
In VS Code: Ctrl + Enter in the middle of a line will create a new line under the active one, and take the cursor to this new line (no need to go to the end of the line and press Enter to create a new line).
3
u/hkbertoson Mar 10 '20
Not programming related. But Windows key + L. It amazes the amount of people that don’t know this.
→ More replies (1)5
1
u/semi_88 Mar 10 '20
Take a look at some productivity tutorials for your IDE/editor. Vscode is packed full of them. One of my favourites is to select a word that needs replacing a few times, then alt D to select the next one too. Creates a multi cursor and whatever you type goes in every position. Need to add the same thing after every word/line? Select the first one, alt D to select tmas many as you need, then right arrow. Now you have a multi line at the end of each word. Amazing for changing variable names
1
u/grapesicles Mar 10 '20
If you need to change multiple lines or words that are the exact same, click on one of them and hold Ctrl and hit D for each item you'd like to change. It will select all the words or lines that match what you have highlighted and you can edit them all at once.
1
u/manablight Mar 10 '20
I love Rider to auto complete a ton of stuff, helps me streamline the boiler plate.
1
u/3lRey Mar 10 '20
Alt+Shift+ArrowAlt+Click-Drag
click-drag enables you to draw a box around what you want to copy, alt+shift allows you to select multiple lines at a time for typing. Say you're typing the same thing in every line, you just alt+shift+arrow the lines you need and then type whatever it is, it will fill in every line.
ctrl+a selects all text
1
1
u/tyrantmikey Mar 10 '20
In Visual Studio, at the bottom of the code editor, there's a status bar with the current line and character in the file on it.
If you double-click that, a dialog will appear prompting you for the line number you want to navigate to.
Really useful when you have a stack trace with a line number in it, and your code file in a legacy project is monstrously large.
2
1
u/rusou Mar 10 '20
On macOS, Option-(Left/Right) lets you skip to the previous/next delimiter. Command-(Left/Right) takes you to the beginning/end of the line. Not sure what the Windows/Linux equivalent is.
1
1
u/Morkex Mar 10 '20
In java eclipse (I don't know if it applies with other languages) ctrl + space to autofill. So, if you write just syso plus ctrl + space it writes System.out.println();. Very usefull when starting learning java. Ctrl + Shift + F to auto indent the whole code in eclipse. Ctrl +K, ctrl + D to do the same in VS
1
u/autonomousErwin Mar 10 '20
Collapsing/Uncollapsing nested functions/classes, super useful for understanding code other people have written in BIG files. For VS Code it's CMD+K+0
1
1
1
u/dmitryanashko Mar 10 '20
Double shift in IntelliJ to search for a file. Some how my colleague didnt know that
1
u/SapiensSA Mar 10 '20
So many shortcuts in ide/text editors that I don’t use.
Any useful shortcut to sublime and pycharm?
1
1
Mar 10 '20
If you like that, learn an editor which gives you fine-grained keyboard movement and selection,such as emacs or vi.
1
u/IWoreMyPartyPants Mar 10 '20
Clicking also has different effects when holding ctrl and cmd / alt... try em out.
1
u/Saltillokid11 Mar 10 '20
different editors have different shortcuts but in VScode / sublime text / atom CTRL + d is great. Within a file if you double click a variable to select it and do a ctrl+d you will select the next instance of that word.
1
u/slowfly1st Mar 10 '20
In intellij, CTRL+W does the same, but w/o using the mouse ;-) - with a good IDE, you probably should be able to do 99% of the tasks without mouse. I highly suggest to check out the navigation menu entries. E.g. in intellij, CTRL+ALT+left/right-arrows navigate forward/backwards based on where the cursor was. CTRL+E opens an dialog which shows the latest open files.
Oh and try CTRL+SHIFT+Left/Right-Arrow.
1
1
u/mojimystery Mar 10 '20
Go to https://duckduckgo.com then search: [name of the application] cheat sheet. e.g. vs code cheat sheet. I like the layout it offers and u can learn shortcuts of the said application quickly.
1
u/jacobcole123 Mar 11 '20
Visual Studio: F12: go to definition Cntl + -: go backwards from F12’s Cntl + F: Find in one file Cntl + Shift + F: find in solution
1
1
Mar 11 '20
use your End and Home buttons to navigate to beginning and end of lines. This also works in conjunction with holding ctrl + shift to highlight entire lines instantly, also using your left or right arrow keys along with ctrl + shift will highlight entire words space delimited.
1
u/marvinhozi Mar 11 '20
In IntelliJ IDEA, typing “sout” without the quotations and then pressing enter will automatically make system.out.println() for you.
1
1
u/FurkinLurkin Mar 11 '20
Eclipse: Ctrl Shift O fixes imports Ctrl plus left arrow or right arrow used to navigate between the different things you were looking at. Ctrl H power ful search wizard Ctrl left click navigate to the implementation of a method. Highlight the method name or attribute name, etc and right click and you have a slew of options. One being to list the call heirarchy. I use that one non stop
1
u/BrumDawgMillionare Mar 11 '20
If you are creating a script and using vi/vim you can do and you are pasting in code you can use the following command
:set paste
And this will keep the spacing format and not mess up your beautifully formatted code
1
1
u/SteamGirl666 Mar 11 '20
If you use VS Code ... heres a handy shortcut printable. I have this taped to the wall above my PC.
https://code.visualstudio.com/docs/getstarted/keybindings#_keyboard-shortcuts-reference
A lot of these shortcuts can be applied to other editors, or other editors be configured to have VS code shortcuts...
Hope this helps!
1
u/babbagack Mar 11 '20
one of the best is formatting, look up keyboard shortcuts and format or format selection in VS code for your OS. I set my in settings to ctrl + command + L on mac and its wonderful.
1
1
1
u/r0ck0 Mar 11 '20
double clicking to highlight a whole word
This is one reason I prefer underscores over hyphens for a lot of stuff... I wish UUIDs used underscores so I could just select the whole thing like this.
1
1
1
u/cheezzy4ever Mar 11 '20
My most used are probably:
Ctrl + [Shift +] Tab -- navigate to the next [previous] tab
Ctrl + [Left Arrow|Right Arrow] -- move the cursor [left|right] one full word
1
u/OddShaman Mar 11 '20
Here's a list of essential JetBrains (intellij, pycharm, etc.) shortcuts that i use pretty much daily at work:
ctrl+shift+n: search and open file
ctrl+shift+alt+n: search symbol. This will find methods and variables and such
ctrl, ctrl(hold), up/down arrow: multi-line cursor
shift, shift: search everywhere (like, even IDE settings and stuff)
shift+delete: cut line (adds it to clipboard)
ctrl+shift+v: open clipboard. Let's you paste from your copy history
ctrl+q: opens function documentation for whatever function name the cursor is in.
ctrl+b: go to function definition/find usages. (middle mouse click or ctrl+click works too)
And as a bonus windows+shift+s is the new snipping tool. It copies the snip to the clipboard so you can just paste it places
1
Mar 11 '20
Not exactly coding but ctrl+k will clear out your console window. Very useful when you want to capture a snippet from logs with minimal effort. As in:
tail -f yourlogs.log
get ready to do whatever you need
ctrl+k
do whatever you need
see your logs update
ctrl+c
Now your console window only has relevant piece of logging saved.
1
u/random314 Mar 11 '20
Have to tried vim? There's a sharp learning curve but once you get the hang of it you pretty much 10x your shortcut power.
1
u/Historica97 Mar 11 '20
With JetBrains Keybindings, Alt + Shift + <up or down arrow> moves line up and down
You can also use it in Word to move a table line up and down.
1
1
1
u/pandorazboxx Mar 11 '20
It's not really programming but you can rename files from the file explorer by selecting the file and pressing f2. This also works in Excel. So instead of double clicking a cell or selecting the cell then the text box, you can just navigate with arrow keys and edit cells with f2 instead of overwriting.
1
1
u/aplawson7707 Mar 11 '20
This is the best thread ever.
Also I can't convince my coworkers to use CTRL + C or CTRL + V, so I'm just gonna have to enjoy these myself
2
u/Exkywor Mar 11 '20
You should make them see how fast some teachers type in some programming courses. The guy who teaches CS50's Mobile App course left me with my mouth open at how fast he types and selects and rearranges stuff in VIM.
→ More replies (4)
1
u/itsmenish Mar 11 '20
In VScode atleast, pressing ctrl + d while selecting something selects the next match or that selection. Its really helpful when you need to quickly change that variable name or something.
→ More replies (1)
1
u/redditreader783 Mar 11 '20
Shift + arrow keys to highlight words with the keyboard. Similar to what you have except you don’t have to use the mouse.
1
u/Aceofsquares_orig Mar 11 '20
Pressing the END key to go to the end of the line and the HOME key to go to the beginning of a line.
1
u/beapythondev Mar 11 '20
My current two favorite shortcuts from visual code are:
ctrl+p to jump to a file
ctrl+shift+f to find in files
1
u/Exkywor Mar 11 '20
Ctrl + right/left arrow: Navigate in a text word by word instead of letter by letter.
Ctrl + shift + right/left arrow: Select whole words!
Ctrl + up/down arrow: Navigate between PARAGRAPHS!
Ctrl + shift + up/down arrow: Select WHOLE PARAGRAPHS!!!
Yeah, this was revolutionary for me, it saves so much time.
1
1
u/VicariousRedditor Mar 11 '20
Most text editors and command lines will let you hold CTRL + < or > to skip over words.
Edit: < > being the arrow keys
1
u/Blaz3 Mar 11 '20
Not specifically programming but Ctrl + L takes you to your url bar and often other search bars
Ctrl + p to quickly navigate is essential too. If you've got a big project and know the name of the class you're after, most ides you can press Ctrl + p and it'll provide you with a "search" box. Very useful
1
u/evaluating-you Mar 11 '20
I made a video about this topic as I couldn't watch my students operating their IDE so inefficient.
1
u/RoninNoJitsu Mar 11 '20
Holding shift while clicking on a taskbar icon will open a new window instance in Linux and Win OS, can't speak for Mac. Super useful when you have need for new windows to cut / copy / paste. Which by the way are CTRL with X to cut, C to copy, or V to paste.
Also, in Excel if you are at the top of a large set of data with a linear progression, you can hold CTRL and Shift from cell A1, and press the arrow keys down and right to select all the data. Super useful for formatting or dumping into a pivot.
153
u/Loves_Poetry Mar 10 '20
F12 in Visual Studio and Visual Studio Code takes you to the definition of a variable/method/class