TakeTuesday E03: Introduction to LuaSnip

Ғылым және технология

In the third episode of #TakeTuesday, we show off the incredible LuaSnip. This is the first of three videos explaining the plugin.
Plugin: github.com/L3MON4D3/LuaSnip
Please let me know/share the video if you like the intro. It took a lot of time -- and I had tons of fun -- so it makes me happy to hear from you!
To become a sponsor: github.com/sponsors/tjdevries
My Stream: / teej_dv
My Dotfiles: github.com/tjdevries/config_m...
00:00 Introduction
02:31 Start of video
21:05 Outro
22:16 Bonus Content
Plugin to highlight just some of the buffer: github.com/folke/zen-mode.nvim
Notes about friendly snippets: github.com/L3MON4D3/LuaSnip#a...
#neovim #luasnip #lua #programming #nvim

Пікірлер: 195

  • @jankapko9338
    @jankapko93382 жыл бұрын

    "then i found LuaSnips and my life did a whole three sixty" lmaooo

  • @teej_dv

    @teej_dv

    2 жыл бұрын

    I was hoping someone would catch this haha

  • @thaddaeusmarkle1665

    @thaddaeusmarkle1665

    2 жыл бұрын

    180 degree turns are for noobs. BeginBot goes all the way.

  • @eduardoaranda4379
    @eduardoaranda43792 жыл бұрын

    This is another level of intro 😄

  • @teej_dv

    @teej_dv

    2 жыл бұрын

    haha thanks! Trying to raise the bar each time.

  • @gomezhyuuga
    @gomezhyuuga2 жыл бұрын

    Can't express how much I loved the intro!

  • @teej_dv

    @teej_dv

    2 жыл бұрын

    Wow! That's so generous and kind of you :) thanks so much! I will keep on trying to make people laugh and learn at the same time!

  • @luislindgren5615
    @luislindgren56152 жыл бұрын

    What a masterpiece hahaha Learned a lot and laughed hard, 11/10!

  • @teej_dv

    @teej_dv

    2 жыл бұрын

    Dang, 11/10. Idk how I can keep trying to top that haha! So happy you liked it :)

  • @luiscarloscorderopena7030
    @luiscarloscorderopena70302 жыл бұрын

    intro is god level

  • @dimitardimitrov3421
    @dimitardimitrov34212 жыл бұрын

    Bruh, the intro is another level! Excellent video! Keep up the great work, it’s much appreciated!

  • @nguyenthanh1479
    @nguyenthanh1479 Жыл бұрын

    With first 2'30 mins for the intro. Gave me the motivation to watch for the rest of video without skipping any minutes. Keep doing. Good job TJ :)

  • @elyezer
    @elyezer2 жыл бұрын

    The bar was set very high in this one! Looking forward to to the upcoming ones. Great vid as always! Thank you for the great content.

  • @teej_dv

    @teej_dv

    2 жыл бұрын

    Uh oh, now the pressure is on!

  • @elyezer

    @elyezer

    2 жыл бұрын

    @@teej_dv no pressure :D

  • @nitinmax1000
    @nitinmax10002 жыл бұрын

    Super cool intro Teej! Loved alot and as usual awesome neovim content.

  • @ertugrulsrt5761
    @ertugrulsrt5761 Жыл бұрын

    breaking change: to set snippets you need to use add_snippets ls.add_snippets('all', { ls.parser.parse_snippet("expand", "als;dfjasldkflasdfj"), }) ls.add_snippets('lua', { ls.parser.parse_snippet('lf', 'local $1 = function($2) $0 end') })

  • @cattohappy9263
    @cattohappy92632 жыл бұрын

    Holy cow, I love that I've found your YT channel. Looking forward for the new episode.

  • @teej_dv

    @teej_dv

    2 жыл бұрын

    Welcome :) looking forward to making it!

  • @zilizhang3555
    @zilizhang35552 жыл бұрын

    Holy moly truly appreciate the humour and mostly importantly the knowledge

  • @davidsicilia5316
    @davidsicilia5316 Жыл бұрын

    Thanks for this video, these are so much better than reading through docs

  • @saikoushikmacha7379
    @saikoushikmacha73792 жыл бұрын

    Love the video have been waiting for this from the first episode of this series. Waiting for the next episode hope it comes too soon.

  • @ellisonleao
    @ellisonleao2 жыл бұрын

    my day just got a lot better after watching this video

  • @teej_dv

    @teej_dv

    2 жыл бұрын

  • @mohityadav21
    @mohityadav212 жыл бұрын

    The intro is awesome. Also, nice transitions.

  • @teej_dv

    @teej_dv

    2 жыл бұрын

    Awesome! We're trying hard to get better each video!

  • @kylewoock
    @kylewoock2 жыл бұрын

    This is the best neovim / programming video I have ever seen.

  • @goosechaser
    @goosechaser Жыл бұрын

    Had no idea you posted this but found it from the LuaSnips documentation. Great video hahaha

  • @Acorn10
    @Acorn10 Жыл бұрын

    Awesome Billy Mayes impersonation. I'm sold! Placing my order now

  • @Oswee
    @Oswee2 жыл бұрын

    You both made my day! :D Superb job! :)

  • @astrophilo2000
    @astrophilo200011 ай бұрын

    that intro is CRAZY !!! love it

  • @bhaveshverma8629
    @bhaveshverma86292 жыл бұрын

    Super super video. Thank you so much to learn.

  • @teej_dv

    @teej_dv

    2 жыл бұрын

    Glad you liked it

  • @zeocamo
    @zeocamo2 жыл бұрын

    this was so cool, i when back in time to watch it again

  • @yttos7358
    @yttos73582 жыл бұрын

    Yooo this was exactly what I was looking for!😁 I just started porting all of my `.vim` files to `.lua` and `hrsh7th/cmp` was on that list. Liked and Subbed👍 Can't wait to see the next installment

  • @willernst
    @willernst2 жыл бұрын

    Oh, man! I don't know if the editing or the grooming is more impressive. I guess I can just say "Amazing cuts!"

  • @teej_dv

    @teej_dv

    2 жыл бұрын

    ahahahahaha yes, i love it!

  • @bl_nkspac_9650

    @bl_nkspac_9650

    2 жыл бұрын

    Underrated comment.

  • @adgai
    @adgai2 жыл бұрын

    Worth the one month waited. Especially the intro. And sorry for the pestering you on Twitch 😂

  • @teej_dv

    @teej_dv

    2 жыл бұрын

    Haha, it motivated me to keep working on it!

  • @benjaminpapin4312
    @benjaminpapin43122 жыл бұрын

    holly shit this video cracks me up, well done for the content and the energy, keep it up !!

  • @teej_dv

    @teej_dv

    2 жыл бұрын

    Awesome! Makes me so happy to hear that I'm making people laugh!

  • @geekstakulus
    @geekstakulus Жыл бұрын

    Nice one, TJ!

  • @vivemexicoofertas
    @vivemexicoofertas Жыл бұрын

    Loved it!

  • @TG-ll6kf
    @TG-ll6kf2 жыл бұрын

    It took a whopping 30 seconds for this vid to get my like.. Keep up the great content!!

  • @julian-fricker
    @julian-fricker2 жыл бұрын

    So much thumbnail, so much hype.

  • @craigdanielmaceacher
    @craigdanielmaceacher2 жыл бұрын

    Finally taking the dive into setting up luasnip with cmp, the options and config is a bit overwhelming for novice Lua people like myself (long time Vim user though). I'm not a programmer by trade (I'm a tech writer) so someone talking it through like this really helps. One criticism in otherwise great video: the first few characters of the line (check @7:17) are cutoff for some reason.

  • @teej_dv

    @teej_dv

    2 жыл бұрын

    Thanks! I'll keep that in mind for next time

  • @alexwall7204
    @alexwall72042 жыл бұрын

    Really helpful video, thank you!

  • @prankobano9076
    @prankobano9076 Жыл бұрын

    Great content!

  • @narwashius1176
    @narwashius11762 жыл бұрын

    Saw thumbnail.... hit that like button !! If my Tuesdays were like this, I hope to contribute nvim sooner.

  • @teej_dv

    @teej_dv

    2 жыл бұрын

    haha, I hope you liked it even more after watching!

  • @TheFalloo92
    @TheFalloo922 жыл бұрын

    Strong @ThePrimeagen vibes. Love the energy, love the luasnip.

  • @teej_dv

    @teej_dv

    2 жыл бұрын

    He's the reason I got started with streaming

  • @jessedarko
    @jessedarko2 жыл бұрын

    Amazing work TJ

  • @teej_dv

    @teej_dv

    2 жыл бұрын

    Thanks Jesse :) was really happy with this one!

  • @dadinhoschannel4003
    @dadinhoschannel40032 жыл бұрын

    Duuuude! Where is the video two?!! hahah Awesome work, man. keep at it. Best regards

  • @teej_dv

    @teej_dv

    2 жыл бұрын

    Filming is almost complete. Editing time now :)

  • @drewdaniels9577
    @drewdaniels957710 ай бұрын

    I smashed that like button as hard as that guy hit that mattress

  • @inzaghinaji1800
    @inzaghinaji1800 Жыл бұрын

    thanks man that was great ^^

  • @DaviAreias
    @DaviAreias10 ай бұрын

    wasnt expecting a github link to be this fun lol

  • @felgenh399
    @felgenh3992 жыл бұрын

    Gotta love the intro

  • @mikloscsepella2743
    @mikloscsepella27432 жыл бұрын

    amazing! i mean your content is another level. i just wish you would teach me to use all of my plugins like that. thank you

  • @teej_dv

    @teej_dv

    2 жыл бұрын

    Slowly but surely I'm working on it!

  • @olalekanadekanmbi3771
    @olalekanadekanmbi3771 Жыл бұрын

    that looks so powerful

  • @kevinjahns2746
    @kevinjahns2746 Жыл бұрын

    This is awesome

  • @_jdfx
    @_jdfx2 жыл бұрын

    tacos AND this? amazing, thanks TJ 😄

  • @dr.akalanka6591
    @dr.akalanka65912 жыл бұрын

    That font is awesome!

  • @MarkHegreberg
    @MarkHegreberg2 жыл бұрын

    more OS projects need unhinged commercials with the ghost of a dead promo guy

  • @lamprospitsillou6325
    @lamprospitsillou63252 жыл бұрын

    What a thumbnail ! Can't wait

  • @teej_dv

    @teej_dv

    2 жыл бұрын

    ITS HAPPENING!!!

  • @KronosaurusRex
    @KronosaurusRex2 жыл бұрын

    Okay, so you were right. I really had to watch this intro. Honestly I can’t even imagine what will you give us next. Btw, hoy do you show the CR and the tabulations? I’m intrigued. And nice video!

  • @teej_dv

    @teej_dv

    2 жыл бұрын

    Ha! I'm happy you liked it so much! You're looking for ":help listchars"

  • @KronosaurusRex

    @KronosaurusRex

    2 жыл бұрын

    @@teej_dv huge thanks!

  • @CodeSmell
    @CodeSmell2 жыл бұрын

    🤣 I needed this. At 1.75 speed, the intro is a pretty bangin' rap!

  • @teej_dv

    @teej_dv

    2 жыл бұрын

    ahaha, I hadn't tried that myself but now I'll need to go back

  • @sanskarsharma9494
    @sanskarsharma9494 Жыл бұрын

    super cool and helpful :]

  • @JusticeHunter
    @JusticeHunter2 жыл бұрын

    This is amazing.

  • @davidklsn
    @davidklsn2 жыл бұрын

    Amazing! Thanks for this!

  • @teej_dv

    @teej_dv

    2 жыл бұрын

    Glad to help :)

  • @ninjarogue
    @ninjarogue Жыл бұрын

    Thank you!!!

  • @RoxCodes
    @RoxCodes2 жыл бұрын

    Absolutely legendary

  • @teej_dv

    @teej_dv

    2 жыл бұрын

    Excellent cameo

  • @Jorres-qx1lu
    @Jorres-qx1lu2 жыл бұрын

    Patentless technology lmao!!! Great work TJ!

  • @teej_dv

    @teej_dv

    2 жыл бұрын

    So happy someone caught that line. Was really pleased with myself with that one haha

  • @voidmice1669
    @voidmice16692 жыл бұрын

    I died laughing at the intro and then I died a second time when you bleeped out VS C***. LMAO

  • @teej_dv

    @teej_dv

    2 жыл бұрын

    we don't curse here, so no saying VS C***

  • @TheGogiu
    @TheGogiu7 ай бұрын

    Give at this guy an oscar please!!!

  • @gunnarleber7856
    @gunnarleber78562 жыл бұрын

    You lost me at $0 for the last argument. Say whaaaaat??? Great work by the way, keep on rocking!

  • @ryanleemartin7758
    @ryanleemartin77582 жыл бұрын

    "co-workers giggling behind my back as I slowly type boilerplate" lmao. dead

  • @Max-bh8tg
    @Max-bh8tg2 жыл бұрын

    Love the intro

  • @teej_dv

    @teej_dv

    2 жыл бұрын

    Thank you, thank you :)

  • @robertjmccabe
    @robertjmccabe2 жыл бұрын

    Thanks!

  • @marcelfahle
    @marcelfahle2 жыл бұрын

    omg dude 😃 content is amazing too, thanks 🙂

  • @marcelfahle

    @marcelfahle

    2 жыл бұрын

    autotune ftw

  • @orbital1337
    @orbital13372 жыл бұрын

    Interesting, I had basically zero clue of how to properly use snippets (I never really used them in any editor) but this got me to try out some things with LuaSnip. The fruit of my labor today is a snippet for Lua development that automatically generates the LuaDoc string for a function. Basically, it uses treesitter to get the parameters of the next function after the cursor and then uses a dynamic node to create a comment like "-- @param p {}" for every every parameter p of the function. Surprisingly this is less than 20 lines of Lua code plus another 10 lines or so for the snippet itself. Neat, and should be easy to generalize to my other main languages!

  • @teej_dv

    @teej_dv

    2 жыл бұрын

    Talking about awesome code and NOT SHARING A LINK?!?!?!?! :)

  • @orbital1337

    @orbital1337

    2 жыл бұрын

    @@teej_dv Unless I'm going crazy here, I responded to this comment earlier with a link and I think KZread automatically deleted it. Or maybe its like flagged for review or something? I don't know how KZread does things around links these days... This is what I wrote (roughly): I actually just expanded the snippet a bit more - it now also detects whether the function contains a return statement and if so, adds a "-- @return" comment, too. In fact, it checks whether there is a return statement which is not just "return" (i.e. it returns something non-nil), so we don't have false positives for functions that use early returns as control flow. It's on my github at t-troebst/config.nvim/lua/user/snippets/lua.lua (please chill KZread.. :P). I also had some fun with C++ which is my main language. I wrote some snippets that generate the special member functions (constructor, move assignment, etc.) automatically. They use treesitter to check whether the snippet is being inside of a class or not. If we're inside of a class, we get the name of the class via treesitter and generate the appropriate inline declaration / definition. Otherwise, we use the different syntax to define stuff outside of classes. In that case the use has to enter the name of the class but the templates are still correctly stripped via lua patterns / regex. The code for this stuff is also in the repo (in the snippets/cpp.lua file).

  • @teej_dv

    @teej_dv

    2 жыл бұрын

    KZread comments are actually so bad :'( this comment will probably disappear as well

  • @orbital1337

    @orbital1337

    2 жыл бұрын

    @@teej_dv Yeah like they don't even have the decency to give you an error saying "you can't post links" - they just silently remove the comment after the fact... Anyway, very nice video - it's been fun to toy around with this stuff. :P

  • @Formatik
    @Formatik2 жыл бұрын

    Hey TJ, beautiful vid! I can't seem to get my snippet file to source. Is there a guide somewhere on this? Not sure where you required it or how it's imported into luasnip...

  • @teej_dv

    @teej_dv

    2 жыл бұрын

    Hmm, just make sure it's somewhere like `plugin/mysnippets.lua` or something like that.

  • @AndreaSchiavini
    @AndreaSchiavini2 жыл бұрын

    Hey this is great content! I'm loving it :) May I ask what's the colorscheme used here? It doesn't look like the gruvbuddy I see in your dots. Keep up the great work TJ!

  • @teej_dv

    @teej_dv

    2 жыл бұрын

    Should be gruvbuddy (the picture on gruvbuddy readme is probably just out of date haha)

  • @BennyPowers
    @BennyPowers2 жыл бұрын

    Loving this. Do neogit and vgit next!

  • @teej_dv

    @teej_dv

    2 жыл бұрын

    neogit is on the list to explore!

  • @n0kodoko143
    @n0kodoko1432 жыл бұрын

    YES!

  • @gharbimohamed8302
    @gharbimohamed83022 жыл бұрын

    Best intro ever 🤣🤣

  • @AntonKastritskiy
    @AntonKastritskiy2 жыл бұрын

    These intros are getting out of hand! Nice job 👍

  • @teej_dv

    @teej_dv

    2 жыл бұрын

    doin my best :)

  • @nonefvnfvnjnjnjevjenjvonej3384
    @nonefvnfvnjnjnjevjenjvonej33842 жыл бұрын

    Hahaha. This was such a good video

  • @viraatchandra8498
    @viraatchandra8498 Жыл бұрын

    get this man a million subs

  • @wyfyj
    @wyfyj2 жыл бұрын

    omg that intro

  • @paologonzales4361
    @paologonzales43612 жыл бұрын

    ahckk finally

  • @RictorScale
    @RictorScale Жыл бұрын

    LOL you are the man TJ

  • @clearlyajit
    @clearlyajit2 жыл бұрын

    TJ, I just moved over to doom emacs. If you'd keep posting videos like this, I might have to consider moving back to neovim. 😂

  • @teej_dv

    @teej_dv

    2 жыл бұрын

    /me *scrambles furiously to put out new content*

  • @MegaMario0007
    @MegaMario00072 жыл бұрын

    Stupid question but what do you use for split navigation now then? Could only find etc. in your dots

  • @teej_dv

    @teej_dv

    2 жыл бұрын

    I'm not sure what you mean. I navigate splits w/ control + hjkl

  • @tokiomutex4148
    @tokiomutex41482 жыл бұрын

    Great intro

  • @teej_dv

    @teej_dv

    2 жыл бұрын

    Thanks sir palpatine

  • @jrmoulton
    @jrmoulton2 жыл бұрын

    I love this

  • @teej_dv

    @teej_dv

    2 жыл бұрын

    Thanks! I had so much fun making it!

  • @lesmpt
    @lesmpt2 жыл бұрын

    Can't remember that I have ever commented on a yt video. But this is hilarious.

  • @teej_dv

    @teej_dv

    2 жыл бұрын

    Wow! That's high praise! Thanks

  • @nyxkrage
    @nyxkrage2 жыл бұрын

    very cool

  • @sabyabhoi8841
    @sabyabhoi88412 жыл бұрын

    LMFAO bruh how much effort do you put in your videos? Keep up the good work!

  • @teej_dv

    @teej_dv

    2 жыл бұрын

    Well there's a reason we're only on episode 3.... LUL

  • @null_bite
    @null_bite2 жыл бұрын

    Lmaoo, perfection 👌

  • @robertjmccabe
    @robertjmccabe2 жыл бұрын

    Suggestion for a future take Tuesday: in my journey to update my workflow to neovim with modern Lua plugins I am having a rough time getting used to the nvim-tree plugin. I used nerdtree for years and got really used to it 😞. Some of my annoyances: the file explorer window doesn’t resize to fit the file name width. Also, It isn’t easy to easily get a file explorer pane for the current file (it only allows a single nvim-tree pane per window) - I’m used to just doing something like :e % to get a file explorer in the directory of interest. I know these seem like little things but it is throwing off my workflow big time.

  • @robertjmccabe

    @robertjmccabe

    2 жыл бұрын

    Nevermind. I went back to the native netrw file explorer. nvim-tree was too weird for me.

  • @sonicCat
    @sonicCat Жыл бұрын

    What colorscheme is it?

  • @blovio
    @blovio Жыл бұрын

    Anyone else having trouble with luasnip recognizing snippets (timestamp 13:28 and 14:37) I found this after reading the docs: ls.add_snippets("all", { ls.parser.parse_snippet("expand", "-- this is what was expanded!"), ls.parser.parse_snippet("lf", "local $1 = function($2) $0 end"), }) Not sure if i'm implementing it wrong or if they changed the method names in a recent commit... but the ls.add_snippets() is what worked to recognize my snippets.

  • @zwiebec78
    @zwiebec78 Жыл бұрын

    #amazing

  • @Tondz1
    @Tondz12 жыл бұрын

    Intro reminds me of Better Call Sual

  • @hackerzol
    @hackerzol Жыл бұрын

    Why make a whole keymap for s when you can do :so and you don't have to make a keymap and its the same number of keystrokes?

  • @DanielTateNZ
    @DanielTateNZ2 жыл бұрын

    Maaan the fact that the luasnip api has changed really messed me up

  • @swastikacharyya
    @swastikacharyya2 жыл бұрын

    Teej it's official , you are going shoot ad for my new video , with beginbot 🤣🤣

  • @teej_dv

    @teej_dv

    2 жыл бұрын

    haha, maybe I found a new career... ;)

  • @vsz-z2428
    @vsz-z2428 Жыл бұрын

    12:30 lmaoo

  • @jereziah
    @jereziah2 жыл бұрын

    Not even mad.

  • @teej_dv

    @teej_dv

    2 жыл бұрын

    BUT WAIT THERES MORE

  • @cam545
    @cam5452 жыл бұрын

    damnit TJ

  • @teej_dv

    @teej_dv

    2 жыл бұрын

    wait a second... that's not your line

  • @eyesight2073
    @eyesight2073 Жыл бұрын

    1:48 🤣🤣🤣

  • @frydac
    @frydac2 жыл бұрын

    damn I made a bunch of luasnip snippets without the extras.. I made my own rep() function after a significant time figuring out how to do this.. I can't believe I missed the extras in the docs (assuming it's there, it is right? EDIT: yes extras is metioned, but fmt() is undocumented for as far as I can see) Also without the fmt() it is not really very readable and quite a bit of punctuation.. and of course I didn't think of creating something like that myself :) And I assume it would be a considerable effort. hopefully vid 2 and 3 will be posted soon Currently using both luasnip and ultisnips as I have to port a bunch of snippets still (which use a fair bit of python I want to get rid of and replace by lua only, it will be glorious!) Thanks for this!

  • @teej_dv

    @teej_dv

    2 жыл бұрын

    but you learned more things, so that's good :) Working on 2, but it's still a bit away.

  • @shubhampawar7921
    @shubhampawar79212 жыл бұрын

    Does LuaSnip support friendly-snippets?

  • @teej_dv

    @teej_dv

    2 жыл бұрын

    github.com/L3MON4D3/LuaSnip#add-snippets Yup!

  • @BrazenNL
    @BrazenNL2 жыл бұрын

    So, your life turned around 360º, huh? You must like ballet. 😄

  • @yourdadsbestfriend7101
    @yourdadsbestfriend71012 жыл бұрын

    so when is the next video?

  • @teej_dv

    @teej_dv

    2 жыл бұрын

    haha, great queestion. I'm not sure right now. Still working on the script and what not. Can't give any good timelines at this point. Sorry about that

Келесі