What can't you do in Neovim? VimConf.live 2020

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
how's that yeah now i'm muted so there's no feedback why am i getting feedback you guys are hearing the feedback too i mean it's kind of groovy but it's killing my time stop [Music] all right how about that i just won't listen to anything all right if people are trickling in then what i'm going to do is uh play some music to get it started since i'm on the session now i'm gonna i'm gonna put all the exciting stuff up front so we're improvising here you guys ready for this in the beginning there was the big bang and then in 1993 ashgan kiani was born and neovim was never the same again let's just hope you guys can hear my music [Music] and that's perfect [Music] ah good stuff one more time foster oh yeah that's what we'd like to see good stuff yeah yeah yeah yeah music maybe it is playing do you guys like plugins well how about these plugins do you guys like snippets well how about these snippets live evaluation of lua code what's that um let's do like some of this five is that a snippet or is that just a mini turing complete computer in disguise who knows uh do you guys like the game of life [Music] then how about this life what i programmed this today each one of those is a floating window i think this is just about the maximum that i could put in and how about with a bigger resolution boom boom boom boom boom boom all right i'm gonna pause the music because i can't hear it and i can't tell if i'm just being a weirdo so so yeah uh hopefully that got people's attention i'm gonna switch back to a normal screen um we'll start the music again later this we're going to do a little intro for people who don't know me and then i'll go back to the disco disco because i feel like freestyling it tonight all right my talk is called what can't you gianni and let me pull up my notes because i forgot my name for a second hi i'm ash gankiani and i'm a software engineer living in tokyo and also a neobim core developer you may know me as the guy who finally got the lsp client merged or the guy who writes a bunch of lua code and never gets it published i like long walks on the beach at sunset and pina coladas and writing new event plugins but enough about me i'm just kidding it's all about me uh i started using vim about eight years ago at my first college internship and then that was good because i got paid to learn bim and then i heard about neo vim on hacker news and immediately switched over after teruda announced it i liked a lot of the ideas i had about remote apis and that whole server client separation it's good stuff but i didn't really start getting hack or didn't really start hacking on new of them until about a year and a half ago at the time i was unemployed and just messing around with various computer science concepts and researching random things and one of those things was embedded languages which led me naturally to lua which is one of the most popular embedded languages it's got legit as a variant which can do pretty fast code evaluation as everyone's probably talked about and it's also used in a lot of game engines and stuff i was personally looking into it as a method for it doesn't matter data processing but while i was trying to get familiar with lua i started some projects some little projects and then a medium-sized project and that medium-sized project was i think i have some notes on this ah yes elkron that's what i call my cron daemon that i wrote it was also my first introduction to lib uv's bindings that neovim uses also called love which i have which are so useful that i have it on a snippet so that i can automatically and easily load it uh it was a real eye-opener on how quickly i could write little utilities for things i didn't feel like writing uh full you know see your rust program well russ was i don't know crs programs and um especially with the ability to hot load code hot load lua itself so elkron is my uh these are the bits of libiv's bindings that i use and just super easily start a timer start a watcher for the file system which if you've ever written the native code version it's a little bit hard to get cross-platform going with that and um this is my config reloading code and this is the main code that runs the cron daemon you might ask why i wrote my own crown daemon instead of just use cron or f con or whatever one of the many ones and it's because i wanted second level resolution instead of minute level resolution because there are some tasks that i run more frequently like uh at the time it was the prometheus for tracking like my computer statistics um and not only does it have file system and uh what's it called timers it has easy access to pipes tcp and all that so i started using lua i started writing some cool stuff and i still use this elkron to this day like i mentioned the um the configuration the the fact that i could evaluate lua dynamically means my configuration is actually written in lua this will be a common theme for pretty much everything i've written ever since i find lua is a very good configuration language so some basic stuff like uh permanent do some checking of whether or not it's light outside i use sunset and sunrise calculation based on my geography um other stuff blah blah blah blah blah add keys from github this one's useful uh if you want your computers to automatically bootstrap themselves anyway it's a basic thing uh the point was got into lua and then um but at this point i still wasn't hacking on the open it wasn't until one of my plugins broke that i did my normal routine i got frustrated i disabled it but then i remembered that neovim had added lua support and so i thought to myself what if instead of just disabling it and never using it again i write my own and so i decided to write a colorizer which you might have seen before some of you might be using it's uh it's probably it got a little bit of traction on hyper news it was on the top eight um this colorizer was my first uh introduction to how much of a benefit you could get from using lua because all the plugins that have been written for it at that point were remote plugins they were in go or they were in python and with that you suffer heavily with the ability to do it's going to be hard for you to be able to do something like this where you can in real time calculate the color codes oh i forgot i still have my chroma key on so it looks black to you but it's not actually black well let me disable that we'll enable it later when we go back to this going uh filter chroma key disable yes close all right because i want you to see the full rainbow and as you can see it's working pretty much it's it's amazing how much work is being done inside of this little snippet in each step of a new line being detected it's parsing the line looking for color code sequences and then adding a new highlight if it hasn't found one it's calculating color conversions from hsl to rgb and it's doing all this and just lua there's i do use a little luagit for writing a tree that's not super space inefficient but most of it just normal and i do plan on moving that to lua c module potentially for even more speed um but yeah not only that it works on many types of color sequences it uh you can use percent here you can do opacity and i actually allow you to define custom ones so this might be in a branch i don't think i've heard this yet but if you want to have uh custom sas rules then you can um i like to make pretty much everything i write extensible so if we look at the code where is it works and then colorizer lua colorizer uh all of this stuff is pretty it's fairly legible there's a lot of color functions i need to export these i like writing things that are both utilities and also plugins potentially and i only figured that out way later this was officially my first thing that i want but you'll see there's logic in here for the ability to define custom matches and whatnot and evaluate things in real time and this is a later feature but the ability to use uh color sliders so one two three four zero one two three four for quick jumping hsl because you know it is easier to reason about so h s l and it'll convert it to a hex sequence when you really i got a little sidetracked i forgot how much i liked the colorizer but um the point was showing you how sweet lua can be and this is one of the first things that i wrote that made me realize that um so yeah what's next i so as a result of writing the colorizer though it i was pretty early to the lua game still and uh there weren't that many it made me want to rewrite all of my dot files in lua as well but the the process of doing that wasn't very ergonomic at the time so two things happened one i started becoming very active on the neo-vm getter and two i started writing little utilities and making and then justin keys the leap maintainer started uh encouraging me to contribute some of those back to the core so if you're familiar with uh master then some of these might look familiar to you before when i was converting my dot files over i had to do the old way of calling vim functions and as some of you might know the lua api currently isn't completely feature complete with all of the vim functions and so if you want to if you want to call event function you have you used to have to do this and i thought well that's silly we could do better so i created which uses the meta methods uh can i evaluate that oh right it would be that function ah it's a little messy but you can see the meta table here it uses the accessor index to be able to do some special magic and i wrote the same thing inspired by that for bo wo etc and uh some ones that didn't make it into core yet that we decided this was too complicated so uh it was trying to do commands as if they were functions and we decided it's a lot simpler if we just do a shortcut for normal command calling and uh think to someone else they're actually documented now which i didn't do but anyway back to journey to the core so as a result of these little contributions i uh started getting more active indigenous started talking to the other guys started technique bjorn and justin and uh blue eyes and blue eyed and other people and um then justin i don't remember exactly how it happened but i discussed uh working on the lsp as like a bigger project and neovim had built up because i was unemployed had built up some some donations at the time so i even managed to get uh paid for my time because that was good because i had been unemployed for about a year at that point and it ended up being a full-time job essentially though eight hours a day or more uh learning the lsp spec and writing lua code and um yes wait for applause to finish thank you thank you for the lsp and uh oh you're too kind uh pain humility etc all right let's go back to uh demos now i guess what else is there all right my uh back to the title uh yeah the entire time that i i was doing this the the a little thought had been in the back of my mind what else should i put into knew of him and that relates back to the title of the talk what can't you put in new of him and uh essentially the answer is uh nothing so especially if yarn has his way about it so why don't i just show off some of the things that i've written we have um i should probably open the chat honestly um what else what are the things that i've written let's go for something i i wrote let's go historically after the colorizer i started getting very into colors and i was like wait a minute if i have written a colorizer then uh then then couldn't i use this to do i had been working with like gitlab ci logs and whatnot so as a result i wrote terminal mode and i need to find the link for that sun john in the in gitter is very active and did a very cool thing he made this which looks like nonsense but all of these little bits are color codes and i thought well what if i want to see this in vim i tried doing it with the terminal mode but it turns out if you just use conceal and all the colorizer magic that i had already learned you can just do color sequences live in here you can act it's a decent way of learning how uh escape codes work in the first place so if you want to play around with it as like a live demo a lot of my things do turn out to be live don't they i do like uh live demos as you can see with this this is something i wrote recently thanks to bjorn i re originally he added uh v lua which i only recently realized has a a very nice use case in incremental highlighting if i use equals and do v that lua i have a global variable i call cc which is case change so i can go per say from s which is uh these are all just aliases because i'm lazy from snake case to screaming snake case and it goes in it live wow look at that or if i want to go to title case or if i want to go back to screaming or if i want to go to kebab case this is the the power of lua is the fact that i can reevaluate all this stuff instantly and uh something else that i didn't think about doing until much recently was if sometimes i want the ability to do like lua's uh formatting style inside of the replacements and what you could do is ta-da or two or three or you know other stuff you can evaluate whatever you want and if you guys don't know about this slash equals yeah it's this slash equals is uh evaluate expression inside of the second part of seth so let's go to some more interesting plugins uh how about yeah it's already queued up so i was watching a lot of tara's house while coronavirus was happening and so you know what i did i downloaded some subtitles for the episodes that didn't have them because i didn't know japanese that well yet and i wrote myself a little subtitle player this subtitle format turned out to be actually pretty easy to parse so you know what i did i wrote a little one second loop inspired by my elkron stuff and actually might have been 100 milliseconds and as it scans through the timestamps it'll display them on cue so if i just queued this up queued up the episode on netflix boom solve my own problem and it took me 20 minutes to write uh let's step it up a bit what else can i put in here so how about spotify control you got music this is some weird music oh i hope it's not too loud i didn't check uh yeah it's not too loud controlling my spotify from within neovim was actually one of the best things i've ever done and uh left right pause play i i should just mute it because i can't tell if it's playing or pausing and uh not only that but liking a song which is very useful for when i want to maintain my playlist i'm in the middle of programming i'm listening to the song oh quickly just like it move on how do you do that spotify this part's actually interesting i thought i just called python oh i showed you my client secrets i need to reset those now good job uh i'll do that later let's see what else have i written bluetooth manager obviously i got tired of using the bluetooth control cli so what did i do i uh i created this concept of synthetic endpoints and then i added one for bluetooth so this is my phone you can tell because it's got icon phone this is my beats pill this is my ps4 controller this is my air pods and all i can do is press c and it'll do connect you know how this works it's just a bit of lua parsing the straight up output from bluetooth control lua is great for a little bit of ad hoc pattern matching parsing especially when you slap in some co routines to linearize those callbacks what else is there i gotta go quickly there's only eight minutes left uh file navigation boom you know what uh live uv has files file interfaces for walking directories uh you know what else i use that i go here i can do ooh file navigation i could do little quick shortcuts ooh quick preview i can do um i don't know split uh we can go i found this file earlier and i thought it was hilarious lifeadvice.md what is that buy more code genius ship that uh you know where else i use that file navigation fuzzy finder i wrote this the last month i got tired of having to depend on a binary especially when that binary is kind of slow uh but you know what's fast lua not even luagit so it's currently searching 118 entries in under one millisecond that time there is milliseconds in the cost on the bottom left and so here's my one for searching current file directory here's my one for searching recent files including the buffers here's the one for searching buffers here's the one for searching windows and all of these are just variations on a very simple function what's this one oh yeah this one's pretty useful searching the current file directory let's go up let's go up works nvm dash whatever and this fuzzy finding is just a very naive form of fuzzy finding that does engram searching because that was the quickest thing i could find what else is there what else is there uh oh i showed this at the start let's let's add it back uh this is my base 16 editor this is uh the plugin is https github dot com nor cali and then base16.lua this i feel like was an underappreciated feature but once i i released this theme editor which isn't a branch it's called theme editor uh the ability to modify my theme actually made me make my theme so if anyone asks what my color scheme is this is a custom creation i made and you know what it can do you can style each individual piece using the color picker from the colorizer composability that's nice uh and you know what you want more colors let's keep that green in there what would we do now uh uh require palette do you ever find editing highlights to be cumbersome well say no more i forgot how to use this like that editing highlights cumbersome why not just do it live do it live do it live i need a file that has oh my god that's i searing uh let's go back let's go back quick get back back main.c something with lspr or something with lsp errors i don't have any errors in my code you're not going to find one um briefly yeah warning perfect quickly edit it bold i don't remember how to do bold to be honest uh g-u-i-f-g equals do you like hole is that it yeah it turned bold see it's very subtle oh you have to uh reset it separately anyway what else is that how much time we got four minutes i'm gonna use all of it snippets you know what a snippet is it's just the arbitrary code evaluation exit uh what's a snippet check this snippet engine we do uh we use a lua format in the first part so let's say i want uh base one we'll do that and then how many do i want ten of them and uh no 16. how many do i or how do i want to separate them with a new line boom code inserted uh you wanna you want to copyright your code very heavily gpl boom boom and it inserts it with the the comment all figured out to do boom done uh i showed this off earlier the calculator this is actually pretty sweet and if you didn't know uh what is it legit adds support for exponents which is pretty sweet um what else is there what else is there three minutes the terminal model just 4k oh yeah the game of life i showed this earlier i wrote this literally today uh i'm gonna push it i might might as well push it now um i should have used my thing because it's actually way better for doing this works life lua life yep there's only 100 lines of code what it does roughly speaking this is the emulation of the game of life conway's game of life if you don't know conway's game of life go look it up um this is the part that does the evaluation to the next step and this part allocates a bunch of floating windows and then moves them around and the the final result is these are my parameters i do 100 milliseconds between each update because i'm cool like that i want maximum number of windows math.huge and then we kick it off and it goes that's life starts with a random screen and then evaluates the game of life rules and um what else is it what else is that we got a minute left you see all these little artifacts left on the screen this is actually the thing i'm most interested or most excited for which is um this whole thing you're seeing right now is being directly rendered from a frame buffer from my personally written neo-mui which is actually the future now i think i've hit the limits of what i could do in a terminal but i think there's a lot more to explore on the creativity of a dui and i think what can't you do in neo-vm is yet to be fully answered until i play around with the gui uh use some opengl rendering or vulcan or whatever to to throw some 3d in there or throw some other stuff related to tree sitter hush hush semantic editing with structural editing has a lot of components in the visual spectrum that you know we still have to play around with what else is there no time for questions because obviously but since i have a twitch i'll just continue on there uh one dot next here's my twitch ashkan kyani or https twitch.tv and um yeah i hope you guys don't have questions because we don't have time for them go go
Info
Channel: Ashkan / アシュカン
Views: 11,601
Rating: undefined out of 5
Keywords:
Id: 78WrSwEKNuM
Channel Id: undefined
Length: 28min 50sec (1730 seconds)
Published: Tue Sep 08 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.