Developing a Neovim Docker Plugin from Scratch
Vložit
- čas přidán 16. 07. 2024
- Time for a bit of Lua hacking. Ever since I fell down the Neovim rabbit hole I've been having a tonne of fun building little extensions and plugins. And I found that by using Telescope as a framework, it's fairly easy to take any command-line tool that emits JSON and get a nice little browser/manager going. So let me walk you through it.
We'll start from an empty directory and end with a plugin that lets you browse through all the docker images you have available, and start a VM directly from inside the editor. (VM in ViM!)
Links:
* The Docker/Neovim source code: github.com/krisajenkins/teles...
* Similar, for Kafka: github.com/krisajenkins/teles...
* Similar, for Quix: github.com/krisajenkins/teles...
* Telescope's Developer's Guide: github.com/nvim-telescope/tel...
* My Neovim Config: github.com/krisajenkins/neovi...
0:00 Intro
1:15 Setting up for development
2:55 A simple Telescope picker
5:25 Dealing with richer data
7:14 A simple previewer
9:05 Displaying richer data
11:29 Nicer display with syntax highlighting
12:20 Talking to Docker
15:20 Tidying it up
16:13 What 'ordinal' actually does
16:53 This could work with any JSON tool
17:47 Adding the action to run an image
22:17 Until next time...
kinda speechless over how good this video is, I hope I can explain something this clearly someday
That was absolutely epic. I wish I could have seen this video much much earlier in my neovim life. I remember trying to figure out how to do this sort of thing for when I was picking processes to have DAP attach to. It was doable, but difficult, because I don't know what I don't know. Having this incredible, clear demonstration of how to to make this work will help so much when I can't remember how to do it yet again. Haha. Great work, please do more this was chefs kiss.
Thanks! I wish I could have posted it when you needed it, because that would mean I'd discovered Neovim sooner too. 😁
This is the epitome of casual brilliance
This is the greatest illustration I've ever seen of how powerful Neovim, Lua and Telescope truly are
Awesome video. More neovim stuff please
this man went next level... nvim telescope instead of the cli fzf... je suis intrigued
That was probably the most succinct tutorial/run through I have watch on CZcams, I now need to look at your back catalogue and see what other wonders you have 😊
That was amazing pedagogy. You're incredibly clear and engaging. Kudos! 😀
Using neovim/telescope for years.. but this just blew my mind. Awesome video.
Amazing, this could just be the most useful neovim/lua video I've ever seen. Keep it up!
Been using neovim for a couple of years and vim a lot longer, but I gotta say watching the way you use it for programming is a learning experience. I like the way you work!
Wow Kris! This was my intro to Neovim plugin development and I feel ready to make some useful things!
It was great to see your workflow here
You, my friend, need to make more videos like this. Great pace, great narration, easy to follow along... Five Stars!
On an unrelated note, anyone else think the narration bears an uncanny resemblance to that guy on the YT channel who's cracking cryptic Sudoku puzzles? Get these two an audio book deal! (At least for us North American listeners...)
great video.. I've been using neovim for a long time, but never felt like making my own plugins until now.. Please do more neovim videos.. this is EPIC!!
Very well explained and great pacing!
This was great to watch. Learned so much, thanks 😊
Maybe I've not been subbed long enough, but this is the first tutorial/walthrough I've seen from you. I'd love to see some other topics!
Neglected the main purpose if my iriginal comment, which was to say: I love your style/qpproach in these more tutorial-centric videoa!
Glad you like them! Keep an eye on this playlist - I'll be adding more there as they come: czcams.com/play/PLuiPju9KQBnatff3GerbYpqPijpDRJp9p.html 🙂
This is an extremely high quality tutorial type of presentation!
Crystal clear!
Brilliant. I’ve been using neovim and docker for years. You just created a super convenient entry point for me to build on.
This was extremely helpful and insightful, thank you sir! You got yourself a new sub can't wait for more.
This video cleared up the mystery of developing a Telescope extension for me and got me really excited about all of the extensions I can build. Thank you so much for your clear explanation, for starting simple and progressively making it more and more powerful!
Wow! ❤ that's so inspiring! I can't wait to finish my breakfast, jump into nvim and write some telescope plugins 🚀🙌
This made my day! Thank you so much!
This is the best "tutorial" on how to start writing plugins to nvim I have seen. THANK YOU so much! Please do more
Love this video. Just made my very first telescope plugin. Thank you for such amazing contents.
amazing video! highly educational and very well explained!! Thanks a lot for these sort of videos
This a great video! Learned a lot from this, also a very useful module since I use docker ..
Sick video Kris
Simply amazing 👍
I love these videos
Your content is *chef's kiss*
Welcome to the club! ❤
Insane tutorial. Insta-subscribed.
Thank you, it was great!
That was very interesting and engaging!
Thank you!
Incredible!
I'm still a noob, but I enjoyed the thought process and general pacing of the whole video.
It doesnt have to be "tutorial" either or Neovim specially, initially watched your videos from the Odin interview with Ginger Bill.
Great illustration. want to learn more about the how buffer/windows/tab work in neovim
Stunned.
I'm not a neovim person but it's very very nice seeing Lua actually being USED for something.
legendary!
that was a gold nugget there
That's so so cool!!!! Really wished that neoview would be more integrated with game dev flows tho - it's such a pleasure as an text editor, but without the additional tooling involved it's quite difficult to make it usable to day to day game development...
nice vid!
Nice!
One thing I am wondering about. The command returns a number of items, yet in the the entry maker you deal with the entries individually. Where is the splitting happening?
Absolutely fantastic and so much fun. Thanks for taking us along on the ride and to make it so practical. Can't wait for the next installment.
That'll be Telescope. Somewhere in the telescope codebase there'll be a for loop working its magic. 🙂
Glad you enjoyed it! Stay tuned for more. 😉
Looking at your debug output again, it seems that you JSON is JSON lines with one JSON per line, so probably telescope is splitting by line. This is also consistent with your yes, no, maybe example before.
Beautiful. Thoroughly enjoyed the video. I see you have Kafka telescope extension. Do you mind making a video on that?
One of us. One of us. One of us.
Very well explained! But now I'll want to create telescope plugin for pretty much everything..
Ha, me too. 😅
How is there not more likes?
This is a huge motivator to start trying to write a telescope plugin, thank you! I'm struggling to figure out how command_generator works, I'm trying to construct my json payloads with a shell for loop, and it doesn't like it :). Also I see in your sample code you use finders.new_dynamic instead of finders.new_async_job, so I'm trying to find the docs on how to use all of these.
I switched it to show me the containers instead of images.
I think I’m gonna do the same for k8s
i would like to learn more about lua and neovim
Very nice, but the thing i'm missing a bit is how you found the commands .. did you ask the community, TJ or searched the readme's / docs?
Ah, great question. So I started off with this developer's guide: github.com/nvim-telescope/telescope.nvim/blob/master/developers.md
...and then the rest I picked up from reading source code.
Cooool~ How about building container, pulling image, running command in contain and so on. The thing that bothers me the most is how to edit in container with full neovim ability such as lsp, dap etc. I use -v to mount the directory in host and use the neovim on the host but can no use the lsp like vscode. Is there better solution for that? Thank you in advance!
I have to admit reading some of these comments back, I'm thinking they lack a lot of experience. I wonder what kind of superlatives these individuals would dish out on some of TJs videos (creator of neovim). LOL.
Jokes aside, definitely a great educational video for anyone new to Lua and extending neovim and you deserve big kudos for that!
How do you feel about neovim vs eMacs?
I really like both of them. Emacs (with evil-mode) was my main editor for years, and I think either is a great choice.
I find Emacs Lisp to be more fun to write than Lua, because the interactive development experience is absolutely world class. Lua's still good, it's just that elisp is astonishingly good.
But some of Emacs' UI experience is need of a refresh, which gives Neovim a day-to-day edge. The Neovim team have done a great job of pulling the terminal into the 21st century. :-)
Emacs it is really faster with this task i just quit telescope that sometimes miss things out
Which plugin did you use to jump around by typing letters? Was it hop?
Funnily enough, I only found out about hop last night. So in the video it was easymotion, but I think it's going to be hop going forward. :-)
@@DeveloperVoices there's also leap.nvim, in case you want a different flavor
I really like these ~20min coding videos! Would love to see more like this. Also really enjoyed following along with your Purescript / Quickcheck video - czcams.com/video/4bpc8NpNHRc/video.html
hmm is this via terminal or with gui app?
Terminal. I'm using Kitty: sw.kovidgoyal.net/kitty/
thanks, I'm familiar :) @@DeveloperVoices
awesome! just awesome! you are my man! Unfortunately, i have no idea how to make this work besides running "source". when i startup my nvim, i get a bunch of errors like: [lspconfig] Cannot access configuration for lua_ls. Ensure this server is listed in `server_configurations.md` or added as a custom server.
Sounds like you need to install `lua-language-server`. On OSX that's `brew install lua-language-server`, but YMMV. :-)
made it work to load the plugin via packer. now i have to figure out, how to setup a keybinding and stuff. Oh man, i am new to neovim but loving it :) thanks!