STOP Creating New Files This! But Do THIS in VS Code!!!

Поделиться
HTML-код
  • Опубликовано: 21 авг 2024
  • #shorts

Комментарии • 81

  • @selimkaraca549
    @selimkaraca549 Год назад +84

    Exactly the way I use it. Intuitively this is how I was expecting it to work in the first place. I think this should be the new default, and the older version should be either added to the settings to enable or be mapped to a different shortcut. I'm sure 99% of developers will appreciate.

    • @yokowasis
      @yokowasis Год назад +2

      Sometimes you just want new file but not saved it. That's the default behavior of every text editor.

    • @yokowasis
      @yokowasis Год назад +2

      @@selimkaraca549 people seems to forgot that vscode is a text editor. Not an IDE.

    • @Muescha
      @Muescha Год назад

      exactly this way - this should be the default behavior

  • @knwkn1
    @knwkn1 Год назад +132

    This saved me 150ms instead of clicking the new file button and now I’m a multi-billionaire.

    • @elProdigio
      @elProdigio Год назад +1

      😂 😂 😂 😂 😂

    • @selimkaraca549
      @selimkaraca549 Год назад +13

      Yeah, but it's the little things that add up. Using keyboard shortcuts wherever possible rather than clicking with the mouse will greatly increase your efficiency.

    • @severgun
      @severgun Год назад +1

      @@selimkaraca549 not in this case.

    • @Handy-Handy
      @Handy-Handy Год назад

      per Day 30-40files -> right-hand way to the mouse is more than 150ms PLUS you need the way back to the keyboard!

    • @ahmednesartahsinchoudhury2628
      @ahmednesartahsinchoudhury2628 6 месяцев назад

      It's not only about the time. It's just incredibly annoying to pick up the mouse and click on the button so many times a day. Having shortcuts for things that are used frequently is great.

  • @bagorolin
    @bagorolin Год назад +26

    Bonus tipp: if you add slashes in the name it will automatically add the folder hierarchy with it

    • @code
      @code  Год назад +7

      OP tip

  • @LucasRassilanVilanova
    @LucasRassilanVilanova 11 месяцев назад +4

    For those who don't like to click on the small new file icon, you can also click twice on the empty space on the files explorer panel.

  • @JonLynchIsAlive
    @JonLynchIsAlive Год назад +8

    Nice shortcut. A lot of times I want to create a new file for notes, scratch, etc that I don’t want to save into the current project.

    • @8koi245
      @8koi245 Год назад +1

      really recommend obsidian for notes

    • @gjones4383
      @gjones4383 Год назад

      @@8koi245 which is better, obsidian or notion

    • @Flowermouth
      @Flowermouth Год назад

      @@gjones4383 comparing apples or oranges

  • @shyamtripathi2097
    @shyamtripathi2097 Год назад +6

    I do like this:
    Open terminal and run the command: code
    The file opens in the editor and just hit ctrl-S to save

  • @ewerybody
    @ewerybody Год назад +3

    But Ctrl+Shift+N opens a new Code instance!! I use that more often than creating new files via VS Code 😂

  • @Gloubichou
    @Gloubichou 15 дней назад

    Thank you for this tip. The default behaviour is quite horrendous

  • @kayc2934
    @kayc2934 Год назад +2

    Really nice. Keeps them coming

  • @AnindoSarker
    @AnindoSarker Год назад +1

    I did this at the very beginning
    Another tip
    Add a shortcut to create a new folder
    I did this as ctrl + alt + l

  • @kresnasatya
    @kresnasatya 5 месяцев назад

    I have been years using VS Code. But, I don't know that I can do create a file or even create a file inside folder even faster with this keybinding. Damn!

  • @nicolasferrada
    @nicolasferrada 5 месяцев назад

    This is really useful!, thanks a lot.

  • @mhassankhan8677
    @mhassankhan8677 5 месяцев назад

    There is even better way, just install the extension "advanced-new-file", It will give you option to choose path as well.

  • @akashmacha1999
    @akashmacha1999 Год назад

    This is what I was looking for! Thanks!

  • @asaduzmn
    @asaduzmn 6 дней назад

    Thanks buddy!!

  • @thaynaemillycavalcantesant3687
    @thaynaemillycavalcantesant3687 Месяц назад

    Soooo useful!! Tyyyy

  • @robertlowther7442
    @robertlowther7442 Год назад +1

    The only thing this cuts out is the ctrl-s/cmd-s shortcut. Are you so busy creating new files that this matters?

  • @danielcovarrubiassanchez4432
    @danielcovarrubiassanchez4432 9 месяцев назад +2

    There is a way to always create the file on the root path of the project?
    Note: When you are on a file that it is inside of a directory, vs code, will try to create the new file inside of this directory

    • @AlejandroDeLuca
      @AlejandroDeLuca 8 месяцев назад +1

      What you ask is key and it makes the difference. I used to create files from root in JetBrains IDEs but I can't find a way to do the same with VSCode.

    • @peter3818
      @peter3818 8 месяцев назад +1

      you could do ctrl + shift + e, esc, ctrl + n

  • @wasd3108
    @wasd3108 Год назад +1

    great now I am around 100 file creations behind in time

  • @iwatchtvwithportal5367
    @iwatchtvwithportal5367 Год назад +2

    if i have to program tweak my ide like this i would have switched to neovim already

  • @SirXtC
    @SirXtC Год назад +4

    its so hard to just right-click on the file explorer and click "new file"

    • @magnomp
      @magnomp Год назад

      It's a mater of personal taste, I think. But imho the mouse way of doing takes some time and breaks ur mental flow

  • @aarond309
    @aarond309 Год назад

    I have the file utils extension, so I use that, but if i’m using the native way, I just do ctrl n, type the name, ctrl s, enter, and delete the name. it’s faster than it sounds

  • @sohelshekh7
    @sohelshekh7 Год назад +1

    This should be default behaviour

  • @no-distrx
    @no-distrx Год назад

    People created extensions for this and you destroyed them in 15 seconds. Thank you for video)

  • @FunctionGermany
    @FunctionGermany Год назад +1

    and how do i create that file in a specific folder?

  • @jamesmay5088
    @jamesmay5088 Год назад

    Wow, thank you very much!

  • @adryelbarros3250
    @adryelbarros3250 Год назад

    I use an extension named advanced new file, it finds the directory by fuzzy match and I can create folders as well

  • @SandyGe
    @SandyGe Год назад

    If @code are saying this why are you not just implementing this as default??

  • @saadkashif880
    @saadkashif880 Год назад

    Thanks bro this trick save my lot of time 😊😊

  • @gidmanone
    @gidmanone Год назад

    Creating features for the sole purpose of creating features

  • @RigelVision
    @RigelVision Год назад +1

    What would you do for the amount of times you saved??

  • @juliocardenas4485
    @juliocardenas4485 Год назад +4

    Or just do touch myfile.txt in the command line

  • @zhandolia
    @zhandolia 5 месяцев назад

    Shift+Cmd+P (not N)

  • @weareloved
    @weareloved Год назад

    Thanks!!

  • @LambdaCreates
    @LambdaCreates Год назад

    I think you meant: "new files this way".

  • @linustorvalds306
    @linustorvalds306 Год назад +1

    question: I added it... but still getting default action...

  • @hehelldldldd88
    @hehelldldldd88 8 месяцев назад

    this is too simple to be made into a short haha

  • @rohitkharche7562
    @rohitkharche7562 Год назад +2

    Or just use advanced-new-file extension that will create files anywhere in your workspace

  • @kul000
    @kul000 4 месяца назад

    Why on earth is this not the default? FUCK!

  • @bilalrasheed8272
    @bilalrasheed8272 Год назад

    Nyc
    Thanks bro

  • @anonymous........
    @anonymous........ Год назад

    thanks

  • @dancehalllyrics1303
    @dancehalllyrics1303 Год назад +2

    You can also double click in the file hierarchy side panel in VS Code, name your file and hit enter.
    Bonus tip:
    If you want your file(s) in a folder, you can simply just write the name of the folder followed by a slash (this method can be used to dig into sub-folders, too) then followed by the file name plus extension at the very end, and VS Code will save it in that folder. If the folder(s) is/are yet to exist, it’ll create the folder(s) for you first and then save the file in the spot you specified.

  • @andreiKspb
    @andreiKspb Год назад

    You da best!

  • @bobbymattta4860
    @bobbymattta4860 Год назад

    How do I even get to command thing

  • @odunsi
    @odunsi Год назад

    Nice

  • @rupeshbiswas4885
    @rupeshbiswas4885 Год назад

    how to add shortcut for new folder creation?

    • @selimkaraca549
      @selimkaraca549 Год назад +3

      You can use the shortcut in the video for folders as well. For example, if you want to create a folder named public with css in it, you can use the same shortcut and name the file public/style.css and it will create that folder with the file.

  • @yogitech33
    @yogitech33 Год назад

    What if your in react and need to switch .Dir before creating a file?

    • @IllllIIllllI
      @IllllIIllllI Год назад

      CTRL+SHIFT+E (focus explorer)
      Arrow keys to move up/down or open/close directories
      CTRL+N (new file)

  • @purduetom90
    @purduetom90 Год назад

    💤

  • @saryakan
    @saryakan Год назад +1

    Or you just touch file.js. 🤷‍♂️

  • @JordanMetroidManiac
    @JordanMetroidManiac Год назад

    It couldn’t be any easier than that! Except that VS Code doesn’t work that way out of the box 😒 So typical of MS

  • @trumpetpunk42
    @trumpetpunk42 Год назад

    Literally the only step he cut from his own list was the Ctrl+S to save. This is the dumbest tip ever

  • @VuDuc-lw5xp
    @VuDuc-lw5xp Год назад

    useful