Automatically Execute *Anything* in Nvim

  Рет қаралды 75,043

TJ DeVries

TJ DeVries

Күн бұрын

Пікірлер: 159
@gregoryshields4258
@gregoryshields4258 5 күн бұрын
Two years on from the release of this video, I just want to say that although I cannot speak for others, I do know that there is definitely someone (me) who is actually following along with what you are showing, and learning from it, without any forceful expectation of anything further. I've been learning/using Vim, and now Neovim, for about seven years now, and it is truly inspiring to see the dedication and insight you have displayed in helping to bring the Vim code base to new heights. It's very clear that you lead by example, even to the point of Reading the Friendly Manual publicly in its entirety, taking that crude, old acronym and turning it into something a little more positive. Thank you, from one passionate user to another.
@leptanian
@leptanian 2 жыл бұрын
Great content as always. I appreciate these vids that explain bits and pieces of nvim even more after my switch to Lua. Thanks Tj!
@teej_dv
@teej_dv 2 жыл бұрын
Awesome :) hope you're having fun!
@jakeshoemaker1483
@jakeshoemaker1483 2 жыл бұрын
dude - you and prime opened a black hole with neovim for me and i love it bro. thanks for the content
@no_name4796
@no_name4796 7 ай бұрын
Yeah, he is the reason i was able to get into neovim lol Docs are good, but if they don't give you a more general understanding of how thing work
@TheFalloo92
@TheFalloo92 2 жыл бұрын
This is precisely what I was looking for, my dear. Great job!
@arnaudf.67
@arnaudf.67 2 жыл бұрын
Wow its so much easier and extensible to do these things in lua rather than in vimscript. I remeber back in the days were it was a pain doing something like that neatly when you start having non trivial function. Thanks TJ, and I really looking forward to watch the video you mentioned at the end, on how to attach and detach with command!
@rsmith31416
@rsmith31416 2 жыл бұрын
The extensibility shouldn't be any different between the lua and vimscript version. I don't know why you had issues before, but this is the vimscript version that does pretty much the same in 10 lines: let s:bufnr = 4 function Callback(channel, msg) call appendbufline(s:bufnr, '$', a:msg) endfunction augroup GoGroup autocmd! autocmd BufWritePost *.go call deletebufline(bufname(s:bufnr), 1, '$') | \ call job_start(["go", "run", "main.go"], {'callback': function('Callback')} ) augroup END The neovim implementation of jobs is pretty similar.
@maheshwarimurli
@maheshwarimurli 2 жыл бұрын
Damn this can be super-helpful for running tests for competitive programming
@teej_dv
@teej_dv 2 жыл бұрын
Yeah! Just save the file and BOOM it's running :)
@vahidss
@vahidss 2 жыл бұрын
Thanks. I really needed it. I hadn't gotten in to autocmd so what I did was to have a nodemon (usually in a toggleterm) run what I want to do
@steveaguay
@steveaguay 2 жыл бұрын
The greatest part of watching others use vim is some simple thing said in the off hand will be revolutionary to me. I had a block where I never thought to use leader twice.
@driden1987
@driden1987 Жыл бұрын
Hi TJ, rewatching this series in 2023, expecting a part 3 !!! Love ya
@majam1n
@majam1n 2 жыл бұрын
TJ we're lucky to have you taking us on these awesome Neovim / Lua journeys. Do more, please.
@n0kodoko143
@n0kodoko143 2 жыл бұрын
Good the patience you have to walk is through this to this level of granularity, didn't go unnoticed. Sincerely, thank you! Sorry interested in seeing more!
@tobiasweyer5063
@tobiasweyer5063 2 жыл бұрын
as complete beginner to neovim, this was great to see where the journey of learning neovim, will bring me. :) Thx for the great video.
@gurparv1993
@gurparv1993 2 жыл бұрын
If its Tj video then 2 things in the following order. : 1. Like first, 👍 2. and then watch .
@abujessica
@abujessica 2 жыл бұрын
So good at explaining stuff keep it up, truly love these videos
@teej_dv
@teej_dv 2 жыл бұрын
Thank you :) so happy to hear that after posting a video!
@lalitmee
@lalitmee 2 жыл бұрын
Man, I don't need all these other plugins then. It will be simple and useful. You are a wizard, man.
@teej_dv
@teej_dv 2 жыл бұрын
Thanks! :) let me know if you do anything cool with it!
@mischavandenburg
@mischavandenburg Жыл бұрын
Thank you so much for this video! I've completely re-done my nvim configuration taking your kickstart.nvim as a starting point and I'm improving my lua to take my customisation to the next level. Please keep making these lua coding walkthroughs, they are a great way to learn!
@Ash-qp2yw
@Ash-qp2yw 2 жыл бұрын
This is actually really cool and I like it. I'm considering doing something similar that opens a buffer automatically and runs a specific linting tool, so I might be able to use some of this - although, I'd want to have it on it's own command, instead of on save, but that can't be too tricky to do
@lsouza1327
@lsouza1327 2 жыл бұрын
it's pretty easy to do, just use vim.keymap.set(), just pass the function that you would pass to the autocmd to this function and you are done.
@wuilliam321
@wuilliam321 2 жыл бұрын
Yeah! Same here!
@ayoubelmhamdi7920
@ayoubelmhamdi7920 2 жыл бұрын
This video explains the question I asked in the comments of the previous video, thank you very much
@Cih2001
@Cih2001 2 жыл бұрын
Thanks. Your videos are awesome, and I've learned a lot. Although this is something that people can figure on their own, in the tutorial, it could be helpful to explain how to create a new buffer and open it in a new window for the output using the nvim api.
@alexwexov4298
@alexwexov4298 2 жыл бұрын
Amazing ! I always wondered how to write to buffers or run jobs. This kind of videos that show how to build plugins are great. Thanks.
@Hedshodd
@Hedshodd 2 жыл бұрын
Oh, I could use this to "lua-fy" my current auto commands, which are just calling vimscript inside of my .lua config. Thanks for the video!
@thaddaeusmarkle1665
@thaddaeusmarkle1665 2 жыл бұрын
Awesome vid TJ! Would love to see a part 2 (yes I did leave a like 😁), and maybe something like adding the output to the quickfix list if it has a non-zero exit code would be cool too.
@Tazato
@Tazato 2 жыл бұрын
Whenever I think my nvim is slick, youtube gives me a video of yours to make it better. Thank you for the tutorial!
@teej_dv
@teej_dv 2 жыл бұрын
That's very high praise! Thanks!
@Zeioth
@Zeioth Жыл бұрын
I have an autocmd that, every time I write a buffer into the directory "personal-notes" it uses rclone to upload the content of the directory to an online storage service. Then on my phone I have a Termux script "Download notes" to download the same backlog I have on my computer on my phone, and I can read it and edit it on vim. Exactly the same way I would do on my computer.
@adriansrfr
@adriansrfr 2 жыл бұрын
These 10 minute vids are great, keep them coming!
@connect_to_the_dots
@connect_to_the_dots 2 жыл бұрын
Your lesson helped a lot, after that i wrote my first lody. Thank you very much.
@vmnog
@vmnog 2 жыл бұрын
waiting for the continuation :) great tutorial !
@nilsgg
@nilsgg 2 жыл бұрын
Really enjoy these small practical Neovim Lua examples. Has made it possible to write my own automation functions! Thank you 😊
@davedwad852
@davedwad852 2 жыл бұрын
Masterful. You and the other lad always knocking out top notch content. You're Body he's Doyle. Nuff said.
@abohm25
@abohm25 2 жыл бұрын
Love this!! Great job TJ! I appreciate all the hard work you put into stuff like this. Keep them coming!
@yyba2371
@yyba2371 2 жыл бұрын
Awsome explanation TJ, Sure we want a another video
@santiagoosoriosanchez250
@santiagoosoriosanchez250 2 жыл бұрын
Thanks alot I really mean it!. your way to teach is awesome giving ideas and not just how to do a specific thing
@muhammadsulthanmazaya2388
@muhammadsulthanmazaya2388 2 жыл бұрын
Dang u just become my fav youtuber & streamer! Nice video as always teej
@avimehenwal
@avimehenwal 2 жыл бұрын
amazing amazing, best video on demystifying neovim ever :D Thankyou so much for sharing. Huge like from my side
@kyleMcBurnett
@kyleMcBurnett Ай бұрын
This reminds me of mirc scrpting. The mastalgia! Oh! You just sold me in neovim
@korney4eg
@korney4eg 2 жыл бұрын
As always very useful staff and practical examples! Keep going!
@wuilliam321
@wuilliam321 2 жыл бұрын
Greeeeoeatttttttt! I was trying to do something like this with no success xD. This is great, i just didn't want to store the buffers anywhere, just something temporal. But thanks! Seems to be useful!
@lucasefe
@lucasefe 2 жыл бұрын
You and prime are rocking it. Thanks. Should we be watching someone else talking about neovim?
@kristupasqwert9888
@kristupasqwert9888 2 жыл бұрын
We need more of these. Ive learned so mu ch from watching these! Thanks TJ
@teej_dv
@teej_dv 2 жыл бұрын
I've got a list of things kind of like this that I'm going to try and make it in between some of the larger videos :) glad you liked it !
@lukasz_kostka
@lukasz_kostka 2 жыл бұрын
I'd like to see more of things like this.
@Alpha_Dev
@Alpha_Dev 2 жыл бұрын
Thanks TJ, awesome idea, I will use it soon on my config. Have a great day.
@jpbuilds6167
@jpbuilds6167 2 жыл бұрын
This is so awesome and well explained. I have so many ideas. Thanks Tj
@JulianInsua
@JulianInsua Жыл бұрын
Love this kind of stuff!!! Thanks!
@andredasilva6807
@andredasilva6807 2 жыл бұрын
thats really nice. would love to see more lua scripts
@СергейЛюбимов-у3ф
@СергейЛюбимов-у3ф 2 жыл бұрын
Thank you very much for such a great content, TJ! Have you considered creating some kind of course on Nvim, explaining and showcasing core concepts?
@jesseleite
@jesseleite 2 жыл бұрын
Love these types of tutorial vids man! Do more of this stuff!
@MrCradleman
@MrCradleman 2 жыл бұрын
Great video. Finally vim could do something close to Emacs can do since 90-s :)
@teej_dv
@teej_dv 2 жыл бұрын
haha :) well the feature has been around for a lot longer than that, I just find doing it via Lua and Lua autocmds much more elegant. But yes, emacs can do a lot of cool things of course :)
@DanielTateNZ
@DanielTateNZ 2 жыл бұрын
These basics are amazing! More basics!
@chairlovawitabat
@chairlovawitabat 2 жыл бұрын
Thank you TJ! This is so cool. Can you actually do a demo of creating a to-do list using only telescope and the bufwrite api? I think it’d be cool showing how you can create a list of times and then write them programmatically to a local file using lua and the nvim apis. I am playing w the idea of using nvim for latex documents. It’s 90% of the way there. The only thing missing is bibliography management-for me, being able to use a simple UI interface to add/remove refs would easily have NeoVim blow other dedicated editors out of the water .
@willhleucka821
@willhleucka821 2 жыл бұрын
Fantastic! Thank you, TJ!
@IgetsugaS2
@IgetsugaS2 Жыл бұрын
Great content as always!
@robertjmccabe
@robertjmccabe 2 жыл бұрын
This is awesome. Keep these coming.
@frydac
@frydac 2 жыл бұрын
heh, already 1000+ likes within 24 hours, I guess you know what to do. I would be interested to see this maybe in combo with makeprg and errorformat, which I never bothered to try out, as I'm not sure I would like it for C++ with sometimes very long error messages as I would think it gets hard to read when they are in the quickfix window, or even to get the complete error message with errorformat, and I don't know where the stdout goes which also interests me. Currently I use kitty hints to parse the terminal scrollback buffer and neovim remote to open the running nvim instance on the file:line:column of the errormsg. Anyway, great video, never used jobstart, def learned something new again :)
@mohitkumar-jv2bx
@mohitkumar-jv2bx 2 жыл бұрын
Lets get this video 1k likes fast!!. And thanks Tj as always for the great video.
@armynyus9123
@armynyus9123 2 жыл бұрын
Best vid on nevim.
@encode_this1817
@encode_this1817 2 жыл бұрын
This is great and you should feel great.
@PhanTanThangTH
@PhanTanThangTH 2 жыл бұрын
Thank you so much, I really really appreciate that :)
@chrisjames278
@chrisjames278 2 жыл бұрын
another awesome video, Thanks TJ
@rickhackro
@rickhackro 2 жыл бұрын
There's a lot of useful stuff on the nvim_{whatever} API
@CharlieSmithv2
@CharlieSmithv2 2 жыл бұрын
Nice vid! Im curious if the same could be done using tmux and a new pane versus a new nvim buffer? Or am i doing it wrong?
@vellankiindeevar5530
@vellankiindeevar5530 2 жыл бұрын
its just beautiful
@dimitardimitrov3421
@dimitardimitrov3421 2 жыл бұрын
WOW, great tutorial!
@saltytab
@saltytab 2 жыл бұрын
Thank you for the again another informative video. At the risk of sounding cliched may I asked what is the colorscheme you are using.
@VinnyMeller
@VinnyMeller 2 жыл бұрын
How do you get the lsp to recognize the builtin nvim api stuff? e.g you were getting autocomplete when typing vim.api.nvim_
@WillEhrendreich
@WillEhrendreich 2 жыл бұрын
Awesome stuff TJ. How about taking this idea and defeating the enterprise feature for visual studio called live unit testing
@ChrisCox-wv7oo
@ChrisCox-wv7oo Жыл бұрын
I use fswatch to monitor for any changed files in my project directory, when a file is changed, it recompiles and runs tests. The results aren't tightly integrated with nvim but it does give me real time notification as things break / fixed.
@WillEhrendreich
@WillEhrendreich Жыл бұрын
@@ChrisCox-wv7oo I haven't done fswatch, is that similar to dotnet watch? I have done that.
@fernandobaroni1497
@fernandobaroni1497 2 жыл бұрын
Great tutorial!
@patriciourrutia2297
@patriciourrutia2297 2 жыл бұрын
Great video TJ! I'm gona try to use it to compile my md-latex docs with pandoc. The autosave.lua file is located in a special folder or it doesn't matter?
@teej_dv
@teej_dv 2 жыл бұрын
You can put it anywhere you want! You just execute it to turn it on.
@bhaveshverma8629
@bhaveshverma8629 2 жыл бұрын
Awesome again learn so much. Thanks you so much....................
@gamer-tantrik
@gamer-tantrik 2 жыл бұрын
Hey Tj love your content as always and a big fan. Why don't we make a cool informative guide to neovim and like setup 3, 4 projects where beginners could learn how to make certain plugins. I think it would really help the community and for interesting people like me who want to contribute to neovim but don't have that much time to go through complete documentation.
@webmandman
@webmandman 2 жыл бұрын
dude, I thought I had subscribed to your channel a long time ago. so sorry dude. keep up the great work.
@teej_dv
@teej_dv 2 жыл бұрын
all is forgiven :)
@lucastperez
@lucastperez 2 жыл бұрын
I do pretty much the same with tmux and a vim plugin called VimTmuxRunner (it sends commands to tmux panes), but the full neovim + lua solution is much cooler! 😄
@KronosaurusRex
@KronosaurusRex 2 жыл бұрын
Hello TJ, this is great! Any chance you can explain your tj#saveandexec thing? I find interesting that it sources and kind of reloads neovim. I'm always quitting and opening again.
@teej_dv
@teej_dv 2 жыл бұрын
Well it sources and reloads a particular file -- it doesn't do the whole neovim. I write code that allows things to be re-executed though (and use some knowledge of lua to do so). I will add it to my list to cover reloading nvim from within the same instance though :)
@andrespotapczynski2665
@andrespotapczynski2665 Жыл бұрын
Hey TJ, where can I put questions and suggestions about topic videos? I'm new to neovim but I want to use some of the ideas that you have shown in the videos for my own use cases.
@danilo2735
@danilo2735 Жыл бұрын
Man, that's impressive
@benjinguyen9965
@benjinguyen9965 2 жыл бұрын
hey TJ-what colorscheme is that? It's sick!
@webmandman
@webmandman 2 жыл бұрын
Yo tj, you didn't mention how dynamically create a new buffer and append the stdout lines to it. But I think one can use print(data) which will automatically create a buffer horizontally at the bottom?
@roa234
@roa234 2 жыл бұрын
Amazing ❤️
@WilmanArambillete
@WilmanArambillete 2 жыл бұрын
rookie question: how do you split your screen in panes (you have 3 and have seen you handle your buffers like that in your other videos). Thanks
@adriansrfr
@adriansrfr 8 ай бұрын
Wow, very cool!
@joseduarte9823
@joseduarte9823 2 жыл бұрын
How did you properly set up the Lua NVim API (autocompletion, etc)?
@teej_dv
@teej_dv 2 жыл бұрын
I have sumneko lua lsp + builtin LSP and it should work with those two I think.
@ricardoislasruiz3186
@ricardoislasruiz3186 Жыл бұрын
Damn beautiful!
@_zh3ro_
@_zh3ro_ Жыл бұрын
AMAZING!!!
@QmVuamFtaW4
@QmVuamFtaW4 Жыл бұрын
you've got some beautiful hair.
@scc4213
@scc4213 2 жыл бұрын
really helpful !
@rajaravivarmar
@rajaravivarmar 6 ай бұрын
How do I set such a cursor in my mac Terminal? I have enabled blinking but I don't know how to set that return symbol.
@patersr
@patersr 2 жыл бұрын
Thanks
@picosdrivethru
@picosdrivethru Жыл бұрын
wowowow
@kodder
@kodder 2 жыл бұрын
Good Stuff
@jazzochannel
@jazzochannel 7 ай бұрын
I'd like to see a follow up to this, please!
@DragonKidPlaysMC
@DragonKidPlaysMC 2 жыл бұрын
More tutorials please!
@miyalys
@miyalys 2 жыл бұрын
Does vim have an event log to help you see/debug when various events fire exactly?
@sp4yke
@sp4yke 2 жыл бұрын
which plugin is used for the autocompletion with signature support ?
@sirisaac8727
@sirisaac8727 2 жыл бұрын
How can we write this in the the new syntax? `autocmd BufRead,BufEnter *.astro set filetype=astro`
@jithin.johnson
@jithin.johnson 2 жыл бұрын
How about using a Makefile and running make command on BufWritePost?
@ricardorien
@ricardorien 2 жыл бұрын
Thanks!
@greendog105
@greendog105 2 жыл бұрын
hey, I can make things happen upon saving with the "BufWritePost" but I can't make them happen upon opening up a file or Nvim automatically. Wasnt is supposed to work with BufEnter?
@samiurkhan
@samiurkhan 11 ай бұрын
This is it. I will swap from emacs now.
@zen-ventzi-marinov
@zen-ventzi-marinov 2 жыл бұрын
Hi Tj, I guess you don't use any neovim distribution but if you did, which ones would you seriously consider?
@nodidog
@nodidog 2 жыл бұрын
Top stuff 🥳
@darkarie
@darkarie 2 жыл бұрын
nice!
Execute **anything** in neovim (now customizable)
11:02
TJ DeVries
Рет қаралды 37 М.
Magically format embedded languages in Neovim
17:01
TJ DeVries
Рет қаралды 46 М.
Turn Off the Vacum And Sit Back and Laugh 🤣
00:34
SKITSFUL
Рет қаралды 6 МЛН
Мама у нас строгая
00:20
VAVAN
Рет қаралды 11 МЛН
Увеличили моцареллу для @Lorenzo.bagnati
00:48
Кушать Хочу
Рет қаралды 8 МЛН
PDE: A different take on editing code
20:01
TJ DeVries
Рет қаралды 78 М.
The Ultimate Database Control. Right WITHIN NEOVIM
9:35
DevOps Toolbox
Рет қаралды 60 М.
My neovim autocomplete setup: explained
11:32
TJ DeVries
Рет қаралды 36 М.
What are filetypes in Neovim? (and how to configure)
7:33
TJ DeVries
Рет қаралды 19 М.
Effective Neovim: Instant IDE
16:16
TJ DeVries
Рет қаралды 827 М.
Vim Motions & Tricks I Wish I Learned Sooner
9:25
Henry Misc
Рет қаралды 44 М.
Vim Dadbod - My Favorite SQL Plugin
6:01
TJ DeVries
Рет қаралды 38 М.
DONT use Neovim!! (in these scenarios)
8:56
typecraft
Рет қаралды 36 М.
Why I’m Switching To Go in 2024
8:10
Awesome
Рет қаралды 90 М.
Tmux has forever changed the way I write code.
13:30
Dreams of Code
Рет қаралды 1 МЛН
Turn Off the Vacum And Sit Back and Laugh 🤣
00:34
SKITSFUL
Рет қаралды 6 МЛН