Skip to main content

almost 4 years ago Syntax Podcast

Supper Club × Neovim, Lua, RPC and Twitch with TJ DeVries

TJ DeVries

TJ DeVries Guest

Wes Bos

Wes Bos Host

Scott Tolinski

Scott Tolinski Host

Topic 0 11:55

Lua simplicity compared to JavaScript

Guest 1

I forget what the wording was. Adaptive UIs.

Guest 2

Yeah. Yeah.

Guest 2

my editor do exactly what I want for this Particular scenario.

Guest 1

the languages we use and are much smarter and amazing. And then you look at the, like, docs of And, like, I could literally just let's put a manual in 1 scroll.

Guest 1

That's that's really cool. So one of I was reading reading Neo Vim and some of the, like, The goals of, like like, why would you fork them? And one of the goals was, and your your your GUI, your UI to actually use it is the terminal at the very basic. Right? And but then there there are other gooeys that are built, so that you can create more.

Guest 1

And I was like, okay, I I get it. And, like, may maybe it is worth, Welcome to syntax, the podcast with the tastiest web development treats Out there, we've got a supper club for you today with TJ DeVries. We're gonna talk about, I love the UI of

Guest 1

That's wild because, like, you think a lot of people use the

Guest 1

podcast might think that these other languages are for people who are

Guest 1

Transcending

Guest 2

It'd be kind of fun to build something in this. Yeah. And I think the the nice thing is For Lua, like, it is really simple, and it's supposed to be really straightforward to learn. And that's what you want in, like, an Extension language for a project. Right? It doesn't have all the fancy bells and whistles that you would have, like, in TypeScript. Right? There's no way to say this variable is unable to be changed. Right. Like, there's no final keyword or something or, like, there's no constant keyword. Oh, yeah. Or there's no, like, way you know? And so The other part is Neomim is a pretty small in terms of, like, resource consumption

Topic 1 09:27

Benefits of Lua for non-web devs

Guest 2

functions, tables, and coroutines. I think I I listed them all. And and nil, and that's it. So so there's nothing else that exists. You wanna put something in a table, like, in a list, you put it in a table. You wanna make a map, you put it in a tape. Like, it's all the same, And so that makes it really great for people who wanna do something simple with their editor. Right? I wanna change a few options or wanna write some small little script for myself. Well, cool. You can get up to speed on that in 30 minutes. You don't have to learn, like, well, how do I transpile this TypeScript to JavaScript again and get it loaded and you're like, No. That doesn't exist. That's not a difficulty for this situation. Yeah. There's a lot of things we're talking about here with Lua that You're, like, reflecting very closely on what our life life is like writing TypeScript or JavaScript.

Guest 1

Zig and,

Guest 3

Yeah. It is it's making me feel a little uneasy here. Yeah.

Guest 1

the benefit to that is you get the

Guest 2

generally speaking. I mean, it's possible to do just like it's possible to do in other languages, but you kinda have to be, like, attempting had. But, a few years ago, Neovim forked Vim at around Vim 7.4.

Guest 1

a lot of rust and stuff like that. And there

Guest 1

the size and the all those stuff of c, but it's It's a much nicer language to write. I'm just looking at examples of it. I have never I've written a lot to see in my life in school, and that was awful.

Guest 1

I guess

Guest 2

And then and then I see this. I'm like, this looks a lot nicer. Is is that the main draw? Is there stuff with memory as well that It's different. Yeah. I think, I mean, you're a lot safer writing Lua than you are writing c. Right? Like, you can just accidentally access a bunch of memory that you're not post 2 and c, that's just not, like, a thing which is great. The other thing too is Lua is is, like, a very small and simple language. So you could probably get up to speed on writing Lua if you've written other code, right, of course, in, like, 30 minutes or less. Like, It's it's very small, very simple. One of the, like, sort of features of Lua is that it's sort of less is more. There's only emits Events when it wants to do something, when it wants to draw new characters on the screen, when it wants you to scroll, when it wants you to add a new window, etcetera, etcetera. Right? All of the things community and friends along the way of of building stuff. You know? You get to know people a lot more than just from, like, pull request comments and things like that. So it's been It's been super exciting.

Guest 1

the speed and the

Guest 2

to do that. Right? You're like, oh, load up some FFI thing and do all this other stuff and then intentionally break it. You're like, sure. Yes. That's possible. But, I mean, in terms of, like, just writing regular everyday code, You're not gonna, like, crash, patching of you know, sort of porting over patches from VIM into Neovim. So we still share, like, a lot of code, Which is really good for things where if be this thing that can be embedded and extended and used in unique and interesting ways Because we have standardized the way that we're omitting events to integrate with c. So

Guest 2

in Lua, And, I mean, it's the Internet. Right? So people like to do that. And I was just like, do you not understand? Like, we're friends. You know, like, you can be 2 projects, and we can be friends still. That's cool. So what Neovim core, especially around LSP integration and Lua integration, and we can talk about those. I think those are some of the really fun and exciting features And there's one final last little piece of it is that Lua 5.1 has a really incredible the data types are booleans, numbers, strings,

Guest 1

primarily JavaScript, TypeScript, Ruby, PHP, that type of stuff. And, like, recently, we've been having a lot of people on the podcast who write language that are not, like I'm I'm putting quotes at your web development languages here. And then you start to see things like like lua, and we had

Sponsored by 3 companies

Guest 1

innovative incident response. We'll talk about all of them partway through the episode. So So which is the fastest way to build

Guest 2

welcome, TJ. Thank you so much for coming on. Yeah. Thanks for having me. Really excited to chat, and I love getting to just chat about tech stuff and kneel them and excited to see where we go. We are. We were just before the episode, we were talking about,

Guest 1

a headless website, Hasura GraphQL API on your existing database and fire hydrant,

Guest 1

Gatsby,

Topic 3 13:38

Neovim goal of adaptive UIs

Guest 2

In, let's say, quote, modern IDEs or something like that, right, where you have this pop up window or whatever. So that was one of the first phases of things that Neovim was doing. But, additionally, And a lot of different

Guest 2

are emitted over RPC

Guest 2

outside of the world. And there's icons.

Guest 2

there's sort of a base layer of Things that have now been added to both VIM and Neovim, including things like pop up windows inside of Neovim. So if you wanted to sort of, like, float something above the text. You can do that now. Now it's if it's rendered in the terminal, it's still going to be Over time, VIM and Neovim have diverged more.

Guest 1

Okay. Yeah. I'm just looking at FM itself.

Guest 1

Can you talk a little bit more about that? Because that has always been a hang up for me, is that

Guest 2

GUIs for Neovim are basically just plug ins. And what I mean by that is Neovim to target both.

Guest 2

Right? And so this whole concept

Guest 2

But but those abilities to do that allow you to do really exciting things,

Guest 1

v s code a lot more because you get a little bit more flexibility in terms of how you can display information

Guest 2

that are the Neovim editing experience so desired by the author of that GUI. And so that's why I'm saying, like, GUIs are just plug ins. Like, they're

Guest 1

you literally just install it as, like, a Command on your computer,

Guest 2

I guess, to add more functionality, and f Vim is one of those. Right? Yeah. Yeah. That's exactly right. And so then instead of running it in the terminal, editor, and Lua is a very tiny language. So It doesn't

Guest 2

Neovim says, I see that I'm not being run-in a terminal. I'll just keep omitting these events about what We need to do, you know, redraw the status line, add a new window, show completions, blah blah blah, all these kind of things. Right? And FM says, I speak that language, And then it displays those for you in whatever format it's been a blast and super sort of interesting way to build a new like, the binary that we end up shipping by including some other language. It just is small and fits inside.

Guest 2

GUIs like Neo V Day. That's written in Rust. There's one called, I think, f of them, and it's written in, like, f sharp, I think. And these can support, you know, multiple different font sizes in the same thing. Right? So, like, you're editing markdown by events. And so you could write Any program you want in whatever language you want using whatever UI tooling you want to display those things. So there exists a few pretty popular, there's a lot and you do a header. It can make that text big. Right? There's nothing. Neovim just tells you where it wants you to draw the columns, but you can pick how you want those to be displayed.

Guest 1

maybe we should say For people listening to podcast, because some sometimes we just assume people know how all this stuff works is that when you use Vim or Neovim, Learning a second people always ask that, should I learn a second language? You know?

Guest 2

Yeah. Honey, well, we have icons too, but yeah. Nerd font. They're usually not SVG. They're just nerd fonts. Yeah. Is that what you do? Okay. Okay. Mhmm. Yeah. Speaking of this, I I've been using something for a little bit now. LunarVim. Has that reached your

Guest 2

limitation.

Topic 4 00:00

Transcript

Announcer

so buckle up and grab that old handle because this ride is going to get wild.

Guest 1

We are sponsored by 3 awesome companies today.

Announcer

This

Announcer

is the Syntax supper club.

Guest 1

Neo Vim, something he works on as well as,

Announcer

I sure hope you're hungry.

Announcer

Oh, I'm starving.

Announcer

Wash those hands, pull up a chair, and secure that feed bag, because it's time to listen to Scott Tolinski and Wes Bos attempt to use human language to converse with and pick the brains of other developers. I thought there was gonna be food,

Guest 1

probably anything else that that pops up is gonna be interesting, so buckle up.

Topic 5 03:45

Difference between Vim and Neovim

Guest 2

style bindings that VIM doesn't have, and VIM has been going down a different route.

Guest 2

Exactly Project associated with it called LuaJit, and creating new events for new and interesting applications that we never thought would be possible Well to do before.

Guest 2

But in terms of, like, when you open up the editors and when you move around and do those things, they'll be Literally the same, and most likely, they're running over exactly the same code paths for VIM and Neovim. And, we even send features and patches back To VIM, from Neovim's side, if we find some bug or we find some feature that seems to make sense, you know, we talk about those in the issue tracker, and then sometimes Bram or someone else will implement those inside of him as well. So we still have a really,

Guest 2

Productive relationship between the 2 projects even if sometimes, people in the comment section Mhmm. Are a little more antagonistic.

Guest 2

at least at the maintainer level, a really kind and nice,

Guest 2

Neovim introduced Lua Like, the project that I've written called Telescope NVIM, which is like a fuzzy finder for Neovim.

Guest 2

experiences.

Guest 2

today, but many Plug ins, if they're targeting both, it's possible in Neovim,

Guest 2

there's, like, a lot of history of how you would expect different commands and movements and all these things. And if you go into different sort of Vim emulators, right, inside of different editors, they don't do

Guest 2

So Neovim is really, in a lot of ways, Left out of the language, but that's intentional. Right? The language is designed to be the small, simple language, which maybe you wouldn't wanna build your next Startup in. Like, I wouldn't wanna build a startup in Lua. That seems weird. There's better tools for that kind of thing. But I I would wanna write a small script in Lua to Configure what happens when I write something on save so that I can easily configure

Guest 2

of VIM script. And so there are some incompatibilities Yeah. Well, you know, I mean, I like winter, but you're definitely inside more during the wintertime. So maybe there's some correlation JIT compiler It's basically like, how can we make Neovim Basically,

Guest 2

Neovim is actually a fork of Vim.

Guest 2

what you think that they should do. Right? They often do most of them or they cover some 80% coverage.

Guest 2

So it's not like a rewrite, and it's not that we just wanted to do, like, feature for feature exactly what Vim Yeah. This is a good question.

Guest 2

And even to the point of we still have VIM script and we can run VIM script Plug ins. And so if you had plug ins in VIM, you can run most of those in Neovim.

Guest 2

there's, Exactly the same as Vim for sort of your introductory

Guest 2

And Neovim, even now, we Still do a lot of, like, tool things.

Topic 6 01:25

Guest is Dutch and from Michigan

Guest 1

being Dutch and from Michigan, which is, like, a 100%

Guest 2

live coding on Twitch, thanks to the Primagen, and, and we can pass that into c And, like, store that in a list of stuff so that you could call that function on some certain command,

Guest 2

It's a small world sometimes. You know? What? You guys know my little town I live in? Wow. That's pretty exciting. You know? When you open up the fuzzy finder, it pops up Optionally in the middle of the screen, and it's got a few different windows. And 1 window is the list of entries, 1 is where you're typing, and then another one is a preview of the file or whatever it is. Right? So you can so you can still, like, do the kinds of things that you would sort of expect And so yeah. So those are those are the big things that I I've been doing these days, and I I really like working on developer that basically makes Lua sort of APIs restricted by the fact that, you know, they have to be the same font size and other things like that, whatever. That's, You know, a terminal

Guest 3

So, I mean, maybe we should get right into the Vim stuff. I know we talked a little bit about Vim with, the private gen when he was on. And Wes and I are neither of us are necessarily VIM users, but we are VIM competent. We we know how to use it at the super covering. Yeah. Or yeah. Yeah. I I guess the the biggest questions that I think the audience might wonder, command

Guest 2

They're of, spending time in your basement huddled up with a nice blanket and a coffee, and you're like, well, it's dark out. I guess I'll just write some Yeah. People are too busy hiking out here to learn how to program where I'm at. Yeah. They're like, we've got fun things to do, like mountains good stuff. You know? Mhmm. So you wanna give us a quick rundown of who you are, which do, all that good stuff? Yeah. So,

Guest 1

overlap with the interests of Scott and I. So that's a fun little One little pregame.

Guest 3

and, you know, I might wonder this myself,

Guest 1

either Canadians or people from Michigan on the show. It seems like half the guests So far, I've been been that.

Guest 1

It's it's actually funny how often we have

Guest 3

is Vim and Neovim.

Guest 2

One of the main things that I like to do is I work on a lot of different open source projects, particularly, like, related to Neovim, although not exclusively. I've done a lot of work in

Topic 7 17:56

Discussion of LunarVim Neovim distribution

Guest 3

Yeah. There there's a lot of feature, but I I Still have kind of a hard time really converting myself Are they 2 separate things? Is 1 a layer on top of another? What's the difference between Vim and Neovim?

Guest 3

Yeah. It's like a distribution for Neil. Distribution. Yeah. Yeah. That that tracks. Yeah. Yeah. And I like it because it does feel a little bit more Versus Cody in terms of you do get More of those preset things. You could do image previews in it.

Guest 3

or the the

Guest 3

p or whatever. Right? I I wonder how like, what you would think about this. So

Guest 3

One thing that I've always

Guest 3

felt was off is that people often say that VIM is a lot faster,

Guest 3

mostly because, your, yeah, so it's a Weslutervim is, like, kind of, like, a gooey

Guest 3

the menu, f to bring up, like, the fuzzy finder and then start typing. We're in, like, Versus code, it's

Guest 3

So you're often hitting space and then several other Keyboard commands. Is this just how it is, or or am I doing something wrong? Like, are you typically having to do 3 or 4,

Guest 3

system for,

Guest 3

type of, like, IDE

Guest 3

in terms of being able to have that muscle memory for keyboard shortcuts do things. But most of the time to do simple things like fuzzy find a file,

Guest 3

Yeah.

Guest 3

I found it took, like, more keystrokes. So, like, for instance, with LunarVim, you would hit space bar to bring up the finder

Guest 3

Neovim. Correct?

Topic 8 06:15

Why Neovim added Lua integration

Guest 2

c functions, and it has a really nice FFI boundary and all these really interesting, easy ways to tightly integrate them. An easy, simple example of that is we can actually take, like, a Lua function, he told me that I should just give it a go and say I said okay. And

Guest 2

will still run-in Lua today. That's good for the kinds of things that you would like to have for your editor. Right? Like, you just Write it, and then it you know it's gonna work forever.

Guest 1

And, like, why do you choose to start

Guest 2

the language server client inside of Neovim that's built in and ships By default with Neovim

Guest 2

and simple way to configure Neovim and to write plug ins in Neovim since Lua is sort of Sort of like a real programming language that you could learn and have a use for outside of just Neo. Okay. That's cool because I I was gonna ask that we had so this audience is primarily web developers, Rewriting it or adding additional features in Lua? Yeah. So Vim is written in c, and Neovim is primarily also written in c because it's a fork of Vim.

Guest 2

is all written in Lua. So we didn't have to write any c code or, like, worry about that or anything. We used Lua. It's super easy to write and extend, and then so there are features being built inside of Neovim core in Lua, but Lua's sort of primary use case for a lot of people is that it's a much, in my opinion, more elegant completely separate, and you could install different ones and have your exact same Neovim setup in different ones. There's even there's one written in Go called, go on BIM. So there's, like, all these different ones with people exploring new ideas and interesting ways to to use NeoBIM, And then the last part is, especially with Lua 5.1, which is the version of Lua that we have inside of Neovim,

Guest 2

as fast as, like, writing steam

Guest 2

We chose Lua inside of Neovim for a variety of reasons. The primary reasons being Lua is incredibly easy

Guest 2

maintained by Mike Paul. And Mike Paul has often been called a robot from the future because LuaJit is just An incredibly fast and elegant and beautiful like, like I was introduced, I'm TJ.

Guest 2

version as in there will never be any changes. It's just done. So code that you wrote for Lua 10 years ago Sometimes if you're being smart about how you're using it, which is incredible. Uh-huh. So so those features altogether sort of why we brought Lua in. There are features inside of Neovim that are written in Lua today. For example,

Guest 2

It is a finished

Guest 1

Vim like, what is Vim written in originally?

Guest 2

quadruple or 10 x or a 100 x the size of the, for Neil Vem. And a few years ago, I started doing

Guest 2

you can pass around and, in fact, even write Lua code that directly accesses Introduced the 9 script, which is sort of like, the next version versus VIM. Is is that what you mean by that? Yeah. So there's a there's a couple things. I think

Guest 1

was

Guest 2

right, inside of them. So, like, those are super easy to interoperate even though, like, the inner part of Neovim is written in c, and you're passing around this Lua function. They play together super nice.

Share

Empowering developers for over 286201581235 milliseconds!