robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
08ebf8d3a8
master
1-- Test "nvim -l foo.lua …" 2 3local function printbufs () 4local bufs ='' 5for _ , v in ipairs ( vim . api . nvim_list_bufs ()) do 6local b =vim . fn . bufname ( v ) 7if b : len () > 0 then 8bufs =( '%s %s' ): format ( bufs , b ) 9end 10end 11(( 'bufs:%s' ): format ( bufs )) 12end 13 14local function parseargs ( args ) 15local exitcode =nil 16for i =1 , # args do 17if args [ i ] == '--exitcode' then 18exitcode =tonumber ( args [ i + 1 ]) 19end 20end 21return exitcode 22end 23 24local function main () 25printbufs () 26( 'nvim args:' , # vim . v . argv ) 27( 'lua args:' , vim . inspect ( _G . arg )) 28 29local exitcode =parseargs ( _G . arg ) 30if type ( exitcode ) == 'number' then 31os . exit ( exitcode ) 32end 33end 34 35main ()