dhruvasagar / vim-prosession

Handle vim sessions like a pro
254 stars 22 forks source link

Revert argv() to v:argv #91

Closed Gee19 closed 2 years ago

Gee19 commented 2 years ago

I mistakenly switched this to argv() when I reverted my original change in #89

This seemingly breaks git jump grep 'some_string' again (#84), the whole purpose of my original PR in #85 😆

Tested working on vim 8.2 and neovim 0.4.4/0.7

dhruvasagar commented 2 years ago

@Gee19 will take a look, let me know if / when this is complete.

Gee19 commented 2 years ago

@dhruvasagar Current approach seems okay but I wouldn't trust my vimscript skills. Open to suggestions and still need to test on nvim-0.4

I've tested and it works on latest nvim 0.7 and vim 8.2 with/without -q flag.

Gee19 commented 2 years ago

Tested and sessions still load automatically on 0.4.4 but argv() seemingly returns an empty list even if I launch nvim with some flags..

I might be able to do something hacky like calling out to ps..

split(system("ps -o command= -p " . getpid()))

dhruvasagar commented 2 years ago

@Gee19 we're already checking argc to see if any files were supplied in the argument list so we don't need to check argv() again, this is not the same as v:argv which is the command line arguments, also including argument list, however, the argument list will not include flags, v:argv should.

Gee19 commented 2 years ago

Yes I definitely misunderstood the two when I wrote that. Unfortunately v:argv doesn't exist for all neovim versions before 0.6.1 #87 and vim versions before 8.1.2233 but I suppose you can always suggest upgrading as an easy fix.

dhruvasagar commented 2 years ago

@Gee19 good point, i'll update to make sure this doesn't crash