15 Useful Shortcuts to Code Faster with Visual Studio

แชร์
ฝัง
  • เผยแพร่เมื่อ 27 ธ.ค. 2024

ความคิดเห็น • 97

  • @Catalyst8487
    @Catalyst8487 2 ปีที่แล้ว +22

    This is the most useful 12 minutes I've watched in a long time. Thank you for making this video!

  • @imtiyaz215
    @imtiyaz215 ปีที่แล้ว +24

    Visual Studio Productive Tips
    Duplicate line: CTRL +D
    Delete line: CTRL + SHIFT + L
    Selecting all instances of word: ALT + SHIFT + .(period) and then pressing .(period) repeatedly
    Vertical Selection: Hold down Alt Key and making the selection with either the mouse or keyboard.
    To create multiple cursors in arbitrary locations: CTRL + Alt + Click
    Cut Entire Line: CTRL + X
    Comment: CTRL + [K, C]
    Un-Comment: CTRL + [K, U]
    Add Line Above: CTRL + Enter
    Below: CTRL + SHIFT + Enter
    Rename (Anything): CTRL + [R, R]
    Go To Definition: F12
    Find All References: SHIFT + F12
    Refactor to Method: CTRL + [R, M]
    Move Code Up: ALT + UpArrow
    Down: / ALT + DownArrow
    Format Document: CTRL + [K, D]
    Surround with Snippet: CTRL + [K, S]
    Collapse Class to Definitions: CTRL + [M,M] for collapsing one method and CTRL + [M, O] for all methods
    Organize Using Statements: CTRL + [R, G]
    Quick Fix (Add Methods, implement interface, etc): CTRL + . (period)
    Solution Explorer: CTRL + ALT + L
    Search to class or file: CTRL + ;
    Unity Project Explorer: SHIFT + ALT + E
    Creating Code Snippets:
    Creating Constructor: type ctor and then hit the tab
    Creating Properties: type prop and then hit the tab
    Creating Properties with full set and get snippets: type propfull and then hit the tab
    Creating try catch block: type try and then hit the tab
    Creating try finally block: type tryf and then hit the tab
    Switching between tabs: CTRL + tab
    Switch to next Tab: CTRL + F6
    Switch to previous tab: CTRL + Shift + F6
    Closing tab: CTRL + F4
    Closing all tabs: ALT + [W,L] ;
    Opening file without using solution explorer: CTRL + , (comma)

    • @letscode1388
      @letscode1388 8 หลายเดือนก่อน

      imtiaz bhai jazakAllah

  • @yummybunny7351
    @yummybunny7351 2 ปีที่แล้ว +17

    1:03 to select multiple lines, it is more convenient to hold the LMB (left mouse button) and select line numbers on the left side of the lines (works in all IDEs)

    • @OneWheelStudio
      @OneWheelStudio  2 ปีที่แล้ว +2

      That is amazing! Had no idea. Love it.

    • @kazukisenpai2405
      @kazukisenpai2405 ปีที่แล้ว +1

      or just select start, move mouse to the end and hold shift + LMB

  • @kristophsams5036
    @kristophsams5036 2 ปีที่แล้ว +5

    As someone who has been coding for 20 years, these shortcuts are very valuable. Keep them in a notebook, notepad, OneNote, etc. These will help you and don't worry about not remembering every single little trick. No one knows everything or can remember everything even if you use them on a daily basis. I'm also sure there are more than listed here but either way, this is very helpful to everyone coding. Get in those practices and habits. It will save you time and probably money in the long run.

  • @Vastlee
    @Vastlee 2 ปีที่แล้ว +13

    The code generator text like prop, ctor, for, foreach, etc with the Tab+Tab is often overlooked but super useful.

    • @OneWheelStudio
      @OneWheelStudio  2 ปีที่แล้ว +2

      Oh yeah! Easily missed by folks and oh so useful!

  • @Rovsau
    @Rovsau 2 ปีที่แล้ว +6

    Great video! Thanks for all the great tips.
    To clarify: It's not necessary to press CTRL twice. Just hold it. The rest are sequential.
    CTRL + K + C

    • @OneWheelStudio
      @OneWheelStudio  2 ปีที่แล้ว +3

      So true! Definitely found that confusing when I first looked up shortcuts. I was trying to keep my stuff similar to the official documentation- but should have totally addressed it in the video.

  • @mohammed-24946
    @mohammed-24946 2 หลายเดือนก่อน +1

    How do I change the selection of the suggested word from the tab or shift button in Visual Studio Community?

  • @trul77
    @trul77 2 ปีที่แล้ว +4

    search to class or file in vs use CTRL + ;
    it opens explorer in search field and you can start typing the class name
    Thanks, very useful video!

  • @Atezian
    @Atezian 2 ปีที่แล้ว +2

    Instead of f12 to jump to definition you can cntrl + left click on the instance. Thanks for the video, had no idea about the latter half on the video. Cheers.

  • @ahmedyousry8266
    @ahmedyousry8266 ปีที่แล้ว +2

    Thanks for the video
    I also find CTRL + ALT + LMB and ALT + SHIFT + ARROW UP / DOWN very useful to add multi-carets for typing the same thing on multiple lines.

  • @smartboybr2657
    @smartboybr2657 2 ปีที่แล้ว +1

    - Great. I learned about the new line above and below from this video, and now I will use it a lot.
    - About comments, I use the toggle command. "Ctrl + Shift + ;" or "Ctrl + K, Ctrl + ;". About renaming I use F2.

  • @micaiahstevens8840
    @micaiahstevens8840 2 ปีที่แล้ว +4

    Some brains don't work like others.
    Control-R, Control-M
    I get HOW we get here, but WOW.
    Control-Refactor, Control-Method
    MUCH easier to remember.

  • @nikescar
    @nikescar 2 ปีที่แล้ว +3

    Plenty of these that I haven't even thought about. Thanks!
    Another useful one is holding Alt while clicking and dragging to edit multiple lines at once. For example changing a group of private variable to public, or making the all static. Works with cut and paste too

    • @OneWheelStudio
      @OneWheelStudio  2 ปีที่แล้ว

      I remember seeing that one, but couldn't find it. Thanks!

  • @MuhammadO19
    @MuhammadO19 ปีที่แล้ว +1

    1:48 Shift + Enter is enough to add a new lkne below the current one, thabks for the Ctrl + Enter I didn't know that

  • @linzenmeyer
    @linzenmeyer 2 ปีที่แล้ว +2

    Awesome! All the good "cuts" in one place!

  • @DeeTasticGaming
    @DeeTasticGaming 9 หลายเดือนก่อน

    Awesome stuff! It always baffles me how fast you can make a workflow change!

  • @Betruet
    @Betruet 2 ปีที่แล้ว +2

    Find all references! Holy crap I needed that tip thanks

  • @gamedevj.j.7240
    @gamedevj.j.7240 2 ปีที่แล้ว +4

    We can also use F2 for renaming.

    • @pj-wille
      @pj-wille 2 ปีที่แล้ว +1

      This is actually a fairly standard keybind across most programs for renaming. Very helpful to know.

  • @halivudestevez2
    @halivudestevez2 2 ปีที่แล้ว +1

    Great tutorial!
    I would like to add one:
    ctrl + click on a idendifier executes also "Go to Definition"

    • @OneWheelStudio
      @OneWheelStudio  2 ปีที่แล้ว +1

      I’m working from my laptop this week and don’t have my macro keys. So now this is extra helpful!😎

  • @work3644
    @work3644 2 ปีที่แล้ว

    Your video is so so helpful! You doing fantastic work on editing videos. It is so nice and easy to understand. The video that is divided into parts is so powerful. I came back already 4 times to find a shortcut - and it was so easily! Big Thanks!

  • @furkan4657
    @furkan4657 2 ปีที่แล้ว +1

    Super useful shortcuts, thank you !

  • @fdai0097
    @fdai0097 7 หลายเดือนก่อน

    that was the most useful video for the year, thanks a lot

  • @hawkgamedev
    @hawkgamedev 2 ปีที่แล้ว +1

    Wow you are really changing the way I approach coding, thanks!

  • @gustorvo
    @gustorvo 2 ปีที่แล้ว +43

    Cut Entire Line: CTRL + X
    Comment / UnComment: CTRL + [K, C] / CTRL + [K, U]
    Add Line Above/Below: CTRL + Enter/CTRL + SHIFT + Enter
    Rename (Anything): CTRL + [R, R]
    Go To Definition: F12
    Find All References: SHIFT + F12
    Refactor to Method: CTRL + [R, M]
    Move Code Up/Down: ALT + Up / ALT + Down
    Format Document: CTRL + [K, D]
    Surround with Snippet: CTRL + [K, S]
    Collapse Class to Definitions: CTRL + [M, O]
    Organize Using Statements: CTRL + [R, G]
    Quick Fix (Add Methods, implement interface, etc): CTRL + . (period)
    Solution Explorer: CTRL + ALT + L
    Search to class or file: CTRL + ;
    Unity Project Explorer: SHIFT + ALT + E

    • @m3coo
      @m3coo ปีที่แล้ว +2

      Thank you!

    • @AnteP-dx4my
      @AnteP-dx4my 11 หลายเดือนก่อน

      Why CTRL R + CTRL R opens some stupid window for renaming instead of acting like shown in the video? (CTRL R + R does nothing)
      (Running VS 2022 community)

    • @AyushSharma-re4sg
      @AyushSharma-re4sg 8 หลายเดือนก่อน +2

      You can also use "CTRL + /" to comment and uncomment lines of codes

    • @_Feiks
      @_Feiks 6 หลายเดือนก่อน

      Quick Fix: CTRL + . (period). You can also use "Alt + Enter" instead, feel it easier to press.

  • @rain2besoon
    @rain2besoon ปีที่แล้ว +1

    to find function/file/class within our outside current project, better to use (ctrl + , ) then type function name, it even supports fuzzy search

  • @steffenm.5124
    @steffenm.5124 ปีที่แล้ว

    Short question to the renaming (from 1:53). Say I copy a method or an event handler with the same text and just rename the method (e.g. a textBox event with some input logic) and I want to change only the names of the events in the new method/event. If I type Ctrl+R Ctrl+R it would change not only change the names in the method I am typing, but also the names of the method where I copied the code from. Is there any option available to change only the names in the current method?

  • @tranducviet21
    @tranducviet21 2 ปีที่แล้ว +1

    7:25 so how r we gonna re-open those again ?

    • @OneWheelStudio
      @OneWheelStudio  2 ปีที่แล้ว +2

      CRTL + M,P to expand all.
      www.visualstudiotips.co.uk/tip/expand-collapse-all/

    • @tranducviet21
      @tranducviet21 2 ปีที่แล้ว +2

      @@OneWheelStudio thank you

  • @programerbahar60
    @programerbahar60 2 ปีที่แล้ว +1

    Very helpful video for visual studio, thanks for your help tips

  • @oleksandrshvets
    @oleksandrshvets 2 ปีที่แล้ว +1

    Wow! It was really useful time! Thanks!

  • @julietmikealpha
    @julietmikealpha 2 ปีที่แล้ว +1

    Visual Studio Solution Explorer has a search bar, usually accessed with Ctrl+; (that's ctrl+semi-colon). It has had a search since 2012 so might want to check your install or do a reset? Unsure how to bring it back if it gets broken :/

    • @OneWheelStudio
      @OneWheelStudio  2 ปีที่แล้ว

      It’s the Unity explorer that doesn’t have a search bar. I so wish it did.

  • @jutekpixel
    @jutekpixel 2 ปีที่แล้ว +1

    Instead of CRTL+RR you can also press just F2 to rename. By the way it works as well in Unity for renamin files.

  • @DigitalNomadOnFIRE
    @DigitalNomadOnFIRE ปีที่แล้ว

    Amazing should have known these 20 years ago, this is a great use for layer 3 on my corne....

  • @Byynx
    @Byynx 11 หลายเดือนก่อน

    On MS Visual Studio 2022 if we rename a variable by pressing CTRL + R twice, it shows up a classic style dialogue box preventing from directly type the new name in the text editor. Is it possible to have it like yours where you keep writting the on text editor?

    • @mikipompon2024
      @mikipompon2024 9 หลายเดือนก่อน

      Hey, did you find a solution to this?

    • @Byynx
      @Byynx 9 หลายเดือนก่อน

      @@mikipompon2024 No.

    • @vijorsup
      @vijorsup 8 หลายเดือนก่อน +1

      Options... -> Text Editor -> C# -> Advanced -> Find "Rename" and under the "Where should the rename UI be shown?" chose "Show UI as a dashboard in top right"

  • @libberator5891
    @libberator5891 2 ปีที่แล้ว +3

    I like Shift + Delete to delete an entire line

  • @dumpworth9473
    @dumpworth9473 6 หลายเดือนก่อน +1

    Nice video. Thanks.

  • @guille_sanchez
    @guille_sanchez 2 ปีที่แล้ว +1

    This is gold!!! thanks a lot!

  • @Haapavuo
    @Haapavuo 2 ปีที่แล้ว +5

    Weird that no one hasn't commented about you spelling CTRL wrong for about 20 times in this video 😄

    • @OneWheelStudio
      @OneWheelStudio  2 ปีที่แล้ว +4

      Ha! I can't say I'm surprised I screwed that up. Can't spell for the life of me. Once spelled my own middle name wrong on a middle school student ID. Oops.

    • @zanagi
      @zanagi ปีที่แล้ว +1

      I just realise that

  • @Byynx
    @Byynx 11 หลายเดือนก่อน

    In many situations you don't need to press CTRL twice. For exampe CTRL K and then CTRL D, you can just do CTRL K + D.

  • @-Kadir_Demirci-
    @-Kadir_Demirci- 4 หลายเดือนก่อน

    Masterpiece. Thanks. 👍🏻👍🏻👍🏻

  • @DeathxStrike18
    @DeathxStrike18 2 ปีที่แล้ว +1

    my fav are alt+up to move blocks of text, or ctrl+.

  • @cheesymcnuggets
    @cheesymcnuggets ปีที่แล้ว +1

    This is gonna save me so much hassle

  • @MarekNijaki
    @MarekNijaki 2 ปีที่แล้ว

    Just pinging yt algorithm because I like your channel

  • @ezoray
    @ezoray 2 ปีที่แล้ว

    I use most of these but there seems to be a lot of differences on the Mac, or is that due to me using the Community edition?

    • @OneWheelStudio
      @OneWheelStudio  2 ปีที่แล้ว +1

      I've used the Mac version and it is VERY different. I don't think it's community version vs. some other. The mac version is fairly new (just a couple years old) and very different.

    • @ezoray
      @ezoray 2 ปีที่แล้ว

      @@OneWheelStudio It does feel like it was created by a separate team. One annoyance for me in VS is auto-complete, it can be a hindrance as much as a help at times. I used IntelliJ Idea for years and I think I got a bit spoiled by it, VS feels like a step backwards when it comes to focusing on developer productivity.

    • @OneWheelStudio
      @OneWheelStudio  2 ปีที่แล้ว

      It can be a bit aggressive. Though I’m the newest version on the pc side it’s written complete functions for me and sometimes it’s almost spooky how good it is.

  • @jameslavery2958
    @jameslavery2958 2 ปีที่แล้ว

    Oh man, thank you for this!

  • @b25671
    @b25671 10 หลายเดือนก่อน

    I don't know about unity specific but
    Ctrl+shift+t searches for files.
    Ctrl+q searches for settings.

  • @trannhan1432
    @trannhan1432 ปีที่แล้ว +1

    Thank you so muchhh

  • @DigitalNomadOnFIRE
    @DigitalNomadOnFIRE ปีที่แล้ว

    Programmable (split, ortho etc) keyboards like corne make you way more powerful here.
    You can have a layer with all these shortucts on and have multiple presses (eg ctrl+k, ctrl+d) as a single keypress. Next level and way more ergo than 1890s QWERTY keyboards.

  • @mrvastayan
    @mrvastayan 2 ปีที่แล้ว +1

    Thank you!

  • @micaiahstevens8840
    @micaiahstevens8840 2 ปีที่แล้ว +1

    QUICK Unfortunate Note - On Shift-F12? I THINK. (HATE remembering these.)
    This shows you all the calling classes, and SOME versions, think this was a pro only feature.
    You have it in your video, shows all the calling Functions.
    2 References
    public static vcid RequestPickup(...
    Prob a BAD example but without the static you can do this for Buttons for instance.
    0 references.
    public void Clicked_RequestPick(...
    This does NOT mean there are zero references, it COULD include OnClick events.
    I WISH there was a way for Visual Studio to track ALL those links.
    Would make me want to use them more and make them more useful.

  • @pedropc5824
    @pedropc5824 2 ปีที่แล้ว +1

    Wow that was great

  • @Justeego
    @Justeego 6 หลายเดือนก่อน

    My brain exploded with Alt up shortcut

    • @OneWheelStudio
      @OneWheelStudio  6 หลายเดือนก่อน +1

      One of my favorite!

  • @DigitalNomadOnFIRE
    @DigitalNomadOnFIRE ปีที่แล้ว

    Drag to move is a better way to move text than the keyboard IMHO

  • @DigitalNomadOnFIRE
    @DigitalNomadOnFIRE ปีที่แล้ว

    Why are you saying: Ctrl D + Ctrl K?
    What does this mean? They both do the same thing? You have to do one then the other? If the latter what effect does each one have? Not clear.

  • @Patricebrouh
    @Patricebrouh หลายเดือนก่อน

    Thanks

  • @aminullah5939
    @aminullah5939 ปีที่แล้ว

    please any these shortcut key write notepad

  • @sentient1640
    @sentient1640 8 หลายเดือนก่อน

    Thanks.

  • @AS-ih8jj
    @AS-ih8jj 8 หลายเดือนก่อน

    Ctrl + Shift + H
    For renaming is more accurate , cause the ctrl + r + r doesn’t rename all occurrences

  • @eladaksara2512
    @eladaksara2512 ปีที่แล้ว

    amazing

  • @DigitalNomadOnFIRE
    @DigitalNomadOnFIRE ปีที่แล้ว

    Error: Add line above is shift enter not ctrl enter

  • @beardordie5308
    @beardordie5308 2 ปีที่แล้ว

    I really enjoy changing my clothes and unshaving.

    • @OneWheelStudio
      @OneWheelStudio  2 ปีที่แล้ว

      I wondered if anyone would catch that! 😛

  • @KroneDev
    @KroneDev 2 ปีที่แล้ว

    Neat

  • @kbcubezz6190
    @kbcubezz6190 ปีที่แล้ว

    Lol sorry to notice but you wrote CRTL insted of CTRL on all the examples. CRTL = CTRL;

    • @kbcubezz6190
      @kbcubezz6190 ปีที่แล้ว

      Much respect. Video was very helpful.

  • @togyjames1795
    @togyjames1795 ปีที่แล้ว

    Ctrl + - : Navigate Back

  • @VirtusH
    @VirtusH 2 ปีที่แล้ว

    10 sec version of this video: Use Rider! :)

  • @DigitalNomadOnFIRE
    @DigitalNomadOnFIRE ปีที่แล้ว

    Add line above adds a line BELOW if you're at the end of the row. Broken feature.

  • @YoursTruelyMe2
    @YoursTruelyMe2 2 ปีที่แล้ว +1

    Snippets!!
    ctrl(cmd) + shift + p search for Configure user snippets > New global snippets file
    In between the brackets, you can enter something like what's below
    "pyfor": {
    "prefix": "pyfor",
    "body": [
    "${2:items} = [\"RED\", \"GREEN\", \"BLUE\"]",
    "",
    "for ${1:item} in ${2:items}:",
    "\tprint($1)",
    "$0",
    ],
    "description": "For loop in python"
    },
    After you save this file, anywhere you enter they keys pyfor > enter the above code will not only be populated but the $1 and $2 tells your cursor where to go when the tab key is hit. Whole programs can be written in a few keystrokes. Brilliant!

  • @verynotsuspicious
    @verynotsuspicious 11 หลายเดือนก่อน +1

    Thanks!