How do you use vim.fn.* functions as methods with lua?
I was looking at vim.fn.getenv(), specifically at this part:
Can also be used as a method:
GetVarname()->getenv()
And I got wondering whether there was syntax I'm unaware of that'd let me run getenv() as a lua method. I've tried various forms but I can't seem to get it to work any other way than with vim.fn.getenv('HOME').
Anyone know of syntax that'd enable you to apply these vimscript method recommendations in builtin.txt to lua? So that you could do something like 'HOME':getenv().
Posted Apr 23, 2022, 3:05 PM UTC
Vim already has
vim.envmethod in lua since 5.0For example:
Oh. I didn't know about that one. Neovim has so much in it. D: