Jarred-Sumner / git-peek

git repo to local editor instantly
MIT License
716 stars 17 forks source link

Doesn't work on macOS with vim #3

Closed soheilpro closed 3 years ago

soheilpro commented 3 years ago

This is a great idea, thanks.

But it doesn't work on my macOS with Homebrew-installed vim:

Screen Shot 2021-02-12 at 08 08 00
Jarred-Sumner commented 3 years ago

oh right now it only looks for vim, I will also have it check vi.

soheilpro commented 3 years ago

I changed my EDITOR to "vim" but still have the same problem.

Jarred-Sumner commented 3 years ago

I just pushed a fix about 10 seconds ago ("version": "1.1.10") Let me know if that fixes it!

Jarred-Sumner commented 3 years ago

One thing I'm unsure of: it logs a few messages after opening the editor, which appears in vim on top of vim's text.

Is it better if I silence the logs for vim/vi?

soheilpro commented 3 years ago

The new version works. Thanks.

Yeah, I noticed that too. I think it's better to open the editor after you've fetched the repo.

Another issue that I'm having is that I only see the README file and no other files.

Jarred-Sumner commented 3 years ago

It would be a lot slower to wait for the entire repository to download, but I see what you're saying – it only shows the README file because it hasn't finished downloading the rest of the repository by the time vim opens and vim doesn't automatically refresh the directory listing (unlike VSCode/Sublime Text/others)

I guess what I could do instead is make it open the readme on vim by default (or linked file), so that if you want to go to a different file, when you go up, its probably loaded most of the files by then.

If it delayed opening until the repository is completely finished, it wouldn't be fast enough I think

soheilpro commented 3 years ago

I'm personally fine with waiting for the whole repo to download before opening the editor.

The current behavior is a bit confusing.

rushi commented 3 years ago

I tried it with "version": "1.1.15" and the issue still persists when $EDITOR is vim. For now i'm just using git peek -e code

Jarred-Sumner commented 3 years ago

@rushi can you screenshot/paste terminal output? I'm not sure how to reproduce.

One issue I'm seeing on macOS is that $EDITOR isn't propagating to the node process. It sounds like something related to System Integrity Protection, which is unfortunate.

rushi commented 3 years ago

@rushi can you screenshot/paste terminal output? I'm not sure how to reproduce.

This is how it looks like when EDITOR=vim for git peek https://github.com/Jarred-Sumner/git-peek Technically the editor does open up, but the output is still on the CLI so it interferes with vim, and the vim UI doesn't refresh when new directories and such are fetched

image

One issue I'm seeing on macOS is that $EDITOR isn't propagating to the node process. It sounds like something related to System Integrity Protection, which is unfortunate.

/tmp
○ export EDITOR=code

/tmp
○ node test.js
process.env.EDITOR is code

/tmp
○ export EDITOR=vim

/tmp
○ node test.js
process.env.EDITOR is vim

/tmp
○ node -v
v12.19.1

I justed on my environment and it's definitely being picked up by node v12

Jarred-Sumner commented 3 years ago

@rushi @soheilpro I added a --wait flag which waits for the entire repository to finish downloading & extracting before opening the editor. This flag is always enabled if the chosen editor is vi/vim, but otherwise defaults to disabled. So it should just work the way you expect now.

I justed on my environment and it's definitely being picked up by node v12

Hmm, I think you're right. I read this somewhere when investigating an $EDITOR issue earlier. In any case, I manually tested it in vim after setting $EDITOR to vim and it seems to work right

Please re-open the issue if you're still seeing any problems.