The VSCode team thinks of so many thing I didn't even know I needed!
@songokussj4cz2 жыл бұрын
They do. But in this exact example, this has been there for many, many years. And in Sublime Text years before that. I'm using it for about 8 years now. ST, now VSC. I don't undermine this technique, it's awesome. It's just not new at all. Three more shortcuts I do everyday are "CopyLineDown CTRL+SHIFT+D", AddSelectionToNextFindMatch CTRL+D" and "MoveLineDown/Up CTRL+SHIFT+DownArrow/UpArrow"
@sohn77672 жыл бұрын
@@songokussj4cz and in has been in vi/vim before most of us have been born
@bowiemtl2 жыл бұрын
@@songokussj4cz nobody cares if it’s new or not, just that they are introduced to it
@nevoyu2 жыл бұрын
Vim has had this for years before vscode thought of it
@TomDoesTech2 жыл бұрын
@@nevoyu And the VSCode team bought it to VSCode.
@TinyTiniaMan2 жыл бұрын
VsVim users be like : "Look what they do to mimic a fraction of our power"
@____-pb1lg2 жыл бұрын
What's VsVim ?
@MrEo892 жыл бұрын
VsVim? Plz. Just go straight to neovim and never look back.
@animeguywithexistentialcri50842 жыл бұрын
Haha yeah bro... $GA",^GI" Done.
@notme98012 жыл бұрын
@@animeguywithexistentialcri5084 hmm I'll try that. I'm used to doing A,uggVG:norm!.
@animeguywithexistentialcri50842 жыл бұрын
@@notme9801hmm... I tried your command strike but I don't get it. I read it like this: -> A = insert mode at end of line -> then hit , (comma) -> = go to normal mode -> ugg = undo and then go to the first line -> VG = visual line mode and go to end of file -> :norm!. (I don't understand this) and then (enter) But it doesn't seem to change anything tho... I'd like to look up for the 'norm' command after this.
@rahulr95392 жыл бұрын
This project was a huge relief as wordle only allows one game per day. And thank you for mentioning me. ☺
@SahilP26482 жыл бұрын
I know this video was meant to show off a VSCode feature, but in reality a simple text or CSV file would have been enough to load the list from disk into an array. In python (and similarly JS) it would take no more than 10 lines I think.
@rahulr95392 жыл бұрын
@@SahilP2648 Loading file is not what's taking all those lines. It is the logic and ui of the game. in python to load json you need 3 lines including import json, with open line, json.load line. In JS it is one line, const array = require('words.json'); for reading from txt in python, 3 lines - with open, file.read, and one line for converting the data to list. And in python reading csv with DictReader or anything else is even worse. Python is easy does not mean other programming languages are not easy to code.
@SahilP26482 жыл бұрын
@@rahulr9539 yeah I know. I am a developer too lol.
@rahulr95392 жыл бұрын
@@SahilP2648 😅
@wlockuz44672 жыл бұрын
@@rahulr9539 where can I find your video?
@Jakob75395112 жыл бұрын
When i need to do this, i usually do a Find+Replace the with ", \t". The cursor strategy might be faster, though. :)
@shichiha61382 жыл бұрын
Haha, I actually do the same thing!
@vibaked2 жыл бұрын
You can also use the regex "end of line" operator in your find replace, which is the dollar sign. Replace $ with ", for this example
@kadensharpin21562 жыл бұрын
@@vibaked and don't forget ^ for the start of the line!
@SirCamWA2 жыл бұрын
Regex for everything
@MewKnows2 жыл бұрын
I just make a text file with the words separated by a " " and read it and split by " " lol
@wile97632 жыл бұрын
Vim version: Press C-v to select columns. Then press I to insert in each column. Or you could just use a Vim macro.
@Plorpoise2 жыл бұрын
I'd use a macro just so I can watch it go through and add all of them. So satisfying :)
@Elwon202 жыл бұрын
:norm was made for this
@imseagull Жыл бұрын
Why do it the hard way when you can write a :g command. Ez pz.
@Gurj101 Жыл бұрын
@@Plorpoise yup that is fun
@TheSkepticSkwerl2 жыл бұрын
Lol. I've just been replacing with ", " ... Regex style
@Jelte_Dijkmans10 ай бұрын
Yeah waaaaaaaay easier
@snailedlt2 жыл бұрын
Faster and more precise way: 1. Select all -> Ctrl + shift + a 2. Cursor at end of each line -> alt + shift + i 3. Add quote and comma -> ', 4. Move cursor to beginning of each line -> home 5. Add quote -> '
@savantshuia2 жыл бұрын
NeoVim/Vim users: "Look What They Need to Mimic a Fraction of Our Power"
@user-fm7uq4fb3f2 жыл бұрын
This is the main reason I fell in love with sublime text years ago. I think I do more multi cursor editing to format things like this than anything else
@GottZ Жыл бұрын
and here I'm sitting just using the neovim extension for this..
@imjulianeral2 жыл бұрын
A few weeks ago I converted a CSV file to an INSERT SQL statement with vscode, these features are a lifesaver
@VezWay0072 жыл бұрын
I would've used find & replace " /n" with " ,/n" It's great to see that this is an actual "problem" that other people solves as well and not something stupid I do to myself.
@temmie33252 жыл бұрын
Isn't it easier just to store a file containing all of those and then just read it and then pick a random word from line array?
@JannisAdmek2 жыл бұрын
I love it. What also works is to replace ^ (regex) with " and $ with ",
@nicholasfinch40872 жыл бұрын
This is the better way to go. VScode has an upper limit on multiple cursors.
@mikejankowiak54342 жыл бұрын
Sure that fine and all that's pretty specific. You could just use the replace functionality and use regex to look for every new line that doesn't contain a bracket, then add a comma
@farhanaditya26472 жыл бұрын
That's what I'd do too.
@tinmancode2 жыл бұрын
Exactly
@Wylie2882 жыл бұрын
that requires knowing regex, pff, who knows that?
@happywednesday67412 жыл бұрын
My way is better
@utilyre2 жыл бұрын
Fun fact: vim has had this feature (in an easier way) since many years ago
@Temax62 жыл бұрын
Lol it's hilarious watching videos like these
@farhanaditya26472 жыл бұрын
how?
@Sw3d15h_F1s42 жыл бұрын
this isn't a new feature in vscode either
@nathanhedglin9312 жыл бұрын
Yup.
@KayOScode2 жыл бұрын
@@farhanaditya2647 visual mode lets you create a multiline cursor in the same way and macros are even more powerful allowing you to do the same thing without relying on word length being the same
@dgpsf2 жыл бұрын
I love VSC’s multiple cursors. you could also use Ruby and just wrap a %w() around the whitespace delimited strings :)
@happywednesday67412 жыл бұрын
What I do is put the words without a quote in a csv and then upload this to a sql server and then I write a quick Django app with a list template and just simply copy and paste the results of that once running the app, and then I write all the words out one by one and add quotes to each as I do 👍🏻
@gustavovasconcelos98572 жыл бұрын
I use this feature a lot, it's incredibly helpful
@GavHern2 жыл бұрын
if your keyboard has one, i recomend using the "home" button instead of using control arrow left. it will place you at the start of each line which is helpful if your list has some mutli-word lines
@IainSimmons2 жыл бұрын
I think the latest version of macOS broke this, home and end go to the start and end of the entire text block, respectively
@dawid02 жыл бұрын
@@IainSimmons on mac, you use command+arrow to go to the line start/end, and option+arrow to jump by words
@IainSimmons2 жыл бұрын
@@dawid0 yup, I know. But thanks for sharing!
@robertpietraru19392 жыл бұрын
Or use vim and press 0 or ^
@GavHern2 жыл бұрын
@@robertpietraru1939 vim and multi cursors has always been an issue for me
@iapplethis2 жыл бұрын
I use multicursors everyday, had colleagues that used to message me some files to do some multicursors on 😂
@lemonsavery2 жыл бұрын
This is such a life saver in data formatting
@elyipierre22842 жыл бұрын
I wish I new this a few days ago while working on select options 😢
@pmxi2 жыл бұрын
I had this exact same situation earlier, I was using vim keybindings so what I did was create to macro to do this, it is quite simple. It was also helpful in allowing me to lowercase all the text.
@aidanflynn53922 жыл бұрын
True! Although if you don't want to memorize another shortcut, just: 1. Select the newline at the end of the line 2. CMD+D until all lines are selected 3. Profit
@fred76152 жыл бұрын
I had to go into their source code to get that lost for my clone to, I did it in python :)
@floopyy_ Жыл бұрын
VSCode really pulling off the secret mortal kombat combos here
@rowan4042 жыл бұрын
I would’ve done ctrl+f and then replace every “ “ with “‘,“ but, honestly, this seems cleaner and more efficient!
@aurinator Жыл бұрын
Keyboard. Efficiency. FTW.
@sanyisasha2 жыл бұрын
What I usually do is moving the items to the left, tab, and then selecting tabs. But the last method is interesting
@demeter1793 Жыл бұрын
Ctrl+H, match ( \t), replace (, \t) I'm just using the parentheses for clarity, but it also wouldn't matter for the matching if you use regex.
@aayushanand82852 жыл бұрын
I've been using this technique for quite a while now...really helpful.. Love it
@Cansyrian2 жыл бұрын
Yesssssss yesssssss thank youuuuu! I thought there was no way to do this ! I really needed to use multiple cursors so many times to organize and edit code ! But it used to take a lot of time ! Now it will take less so thank u!
@kishiue2 жыл бұрын
You can also wrap the selected text in quotes by just having the text selected and inputing ' or ".
@Radi0actvChickn Жыл бұрын
That would just put quotes around the entire thing, not each line
@PanDiaxik2 жыл бұрын
I prefer the way multiple cursors work in sublime text
@johndon37822 жыл бұрын
Replace > $ for start of lines, ^ for end
@Crunchiest2 жыл бұрын
I needed this, especially to adding quotes and commas to each JSON string. Finally something that helps. Thank you, VSCode Team.
@juliasmith11822 жыл бұрын
Can also select the carriage return/line feed character. Beginning of line, shift+back arrow, select all 👍
@rafaelborgesbatista29612 жыл бұрын
Nice tip! I was needing that a couple of days ago and I did it the slow way
@d4v1dduart38 Жыл бұрын
Dude I always found your videos very useful thank you for your content
@csharpcoffee2 жыл бұрын
My personal way is to use Notepad++'s search and replace feature in extended or regex mode (regex only for edge cases and difficult tasks). With extended mode, you can do something like Find: Replace with: " Find: Replace with: ", And voila
@joshuaw1315 Жыл бұрын
API calls: Am I a joke to you?
@SirusStarTV2 жыл бұрын
There's a lot of string manipulation web tools in "browserling tools", it's nice
@grantpeterson2524 Жыл бұрын
Lmao, used this for the EXACT same use case when making a Wordle bot about a month ago to add commas
@Wynell2 жыл бұрын
this is also exactly a very good use case for vim's macros
@xst9880 Жыл бұрын
SSMS has this super handy feature 👍
@adamdavislee2 жыл бұрын
I can't resist the temptation to plug "Kakoune" here! 😄. The following keys would do the trick: % => Select all => Split on lines b => Select previous word i" => Insert quote a" => Append quote % => Select all i[ => Insert bracket a] => Append bracket
@dadestor2 жыл бұрын
I usually just enter a python interpreter and write a list comprehension for this kind of stuff lmao
that is an awesome feature after having a cursor at each word, why didn't you select the words and place quotes around them, instead of ctrl+left-ing your way to the front to place the second quote?
@skaramicke Жыл бұрын
That “space” after each word was probably the newline character and not a space.
@MrDicius9332 жыл бұрын
In sublime you can regex replace $(end of line) for commas.
@DarkSolidity Жыл бұрын
Vim users: let me know when something interesting happens...
@goblinslayer54042 жыл бұрын
if u dont know the shortcuts and cant find them, u can just put the words in a text file, and make a loop that updates each line to add the commas
@AssFaceNFT2 жыл бұрын
Bloody algorithm always sends you in the right direction 😂🙏🌹
@armadasilque83072 жыл бұрын
Oh my god. Oooooh my god. The amOUNT of times I've had to do this manually. Thanks you, god bless you
@askp71042 жыл бұрын
Glad I found this when I just started learning
@PomPiDoum2 жыл бұрын
Thanks !
@pessimistic55792 жыл бұрын
Multiple cursors are so useful to learn, i was really annoyed of using regex before i fully learnt this feature
@chongcaleb11312 жыл бұрын
I usually use alt + shift magic with Home and End button, it would be more straight forward 😂
@nftsolboi8321 Жыл бұрын
I knew about alt+shift+i, but what I needed to know was ctrl+shift+L, so this video was still very helpful for me 😂
@cedric17312 жыл бұрын
I don't know why but I always do some Python magic in cases like this. ^^
@RS-lh4gx2 жыл бұрын
***For more specific selections use Middle mouse!!!!!! I use that all the time
@sagshah102 жыл бұрын
I would just use regex find and replace, but you do you mate 😁
@andrewhamel12 жыл бұрын
This is exactly what I did making MY world clone. I actually coded the entire thing in something other than VSCODE but realized I needed this functionality so I switched for the remainder of the project 🤣
@sharp_iq67422 жыл бұрын
Find and replace with a small regex with group substitution is faster than all those key binds
@HeyItsMeDave2 жыл бұрын
Time to learn the vim keybindings to do this and much more, easily.
@Alec98212 жыл бұрын
I did a similar thing but it had all words in the dictionary. I had them stored in a database to make the word validation times quicker. Couldn’t really think of a better way. The JS made a XHR to a php API that communicates with the dB.
@rejul0082 жыл бұрын
I didn't know about it.. thanks for the info
@juni60202 жыл бұрын
nice i usually shift alt drag but this is nice
@That_Guy_You_Know2 жыл бұрын
Instead of arrowing back to the start of the line you can press the home key to do that instantly.
@m77mo652 жыл бұрын
I was looking for this ages ago. I even had to built java program to do this. I'm grateful for this one now.
@athief Жыл бұрын
Cool and well-know VSCode feature, but I mean you could as well read the file from the URL directly, and save so many lines of code.
@robertchavana39612 жыл бұрын
I was ecstatic when i found that feature in atom.
@isaacfink1232 жыл бұрын
Weird I was just building a wordle clone and used this, opened youtube and it was the first suggestion in shorts
@wildcatgerry2 жыл бұрын
I use this all the time. Select all ctrl+a, add cursor to every line ctrl+shift+L,end.
@bhumit0702 жыл бұрын
for me vim macros are life saver for these kind of things
@_Sizzin Жыл бұрын
I use Shift+Midde Mouse Button to select all that I want. But that's a nice way as well.
@lonlyman2212 жыл бұрын
For inserting the commas after you have a cursor at the end of every word just “ shift-home ” : to select from the cursor to the beginning of each line line “ “ “ : Press the quote key once to make every line a string “ , “ : Press comma key once to put comma at the end of the lines … but this will also select the [ ] will it not? Will have to give that a test!! Thanks for the awesome video!!!
@dalgo_na2 жыл бұрын
Why didn't I know of this when I needed this 😔😔
@Rizzarip Жыл бұрын
My man is higher than a rocket ship 🤣🤣🤣. His eyes are like glazed donuts
@mastershooter642 жыл бұрын
I just put that thing in a string and use a for loop to add commas and print it to the console and i copy paste that into an array lol
@EricLS2 жыл бұрын
Ohhhhh wow. Now I know how I’m going to clean up the lists of users needing access to various things I get from user tickets in my IT job.
@nikhilhukkerikar67532 жыл бұрын
Another approach I usually use first put double quotes at the start then replace using regex match with “, all done same results
@jt0992 жыл бұрын
One step faster it’s just to select all the words and click your “ button, this will automatically put quotes on both sides.
@abrams112 жыл бұрын
This is so useful
@dibbyo4562 жыл бұрын
I needed this a week ago.
@davidem32832 жыл бұрын
I've always put the whole thing in a pair of double quotes, used .replace(), console.logged and copied the result. This may take longer, but allow you to do virtually anything with the string and you don't have to remember any shortcut, just JavaScript syntax (or whatever your favourite programming language is)
@casualoutlaw540 Жыл бұрын
...or you can just use the built in find and replace feature
@dbaker2802 жыл бұрын
damn i’ve been doing this with concats in excel. so inefficient!
@jot38772 жыл бұрын
I do this everytime I receive a CSV file, and need to wrap it with quotes to feed it into node.js or SQL
@liamtolkkinen50252 жыл бұрын
It might have just been easier to read from the file and auto generate an array using the values of the file
@BigCreep Жыл бұрын
ctrl d " would have put quotes around each word selected
@caedenw2 жыл бұрын
honestly though this should just be a file you load and split by new lines to build an array. a lot of times if you need a feature for something as big as this, you should be coding in a different way instead.
@mixup22162 жыл бұрын
I didn’t know you could do this in vscode. I would have put it in notepad++ and used the advanced replace to replace
@jayztan64662 жыл бұрын
Hate to say this but took me a while to learn this in VS when changing from sublime
@umeshthakre4162 жыл бұрын
I think if you just save this using prettier extension it will add comas
@kawu422 жыл бұрын
Feel like an idiot that I've made this with regex before. Thank you for this time saving tip. :)
@stefanm5782 жыл бұрын
you also have ctrl f replace all
@happywednesday67412 жыл бұрын
So you should
@brucebruce41752 жыл бұрын
But this will only work with same length words. What if you have a list of words of varying lengths