Lilja / vim-chezmoi

Let's you apply files on write to chezmoi
11 stars 1 forks source link

Can't use vim-chezmoi with Neovim #1

Closed mhalano closed 3 years ago

mhalano commented 3 years ago

I'm trying to use vim-chezmoi with vim-plug and Neovim but doesn't seem working.

I have in my Neovim this config:

filetype plugin indent on
syntax on
call plug#begin()
Plug 'Lilja/vim-chezmoi'
call plug#end()
let g:chezmoi = "enabled"

I'm checking if work monitoring a file (with watch) and changing it in another tab with chezmoi edit <file>. The idea is after I save with :w the watch should show the change I made.

The plugin was installed with :PlugInstall.

Am I doing anything wrong?

mhalano commented 3 years ago

I found what is wrong, I just don't know how to fix it. The problem is related to Snap. If I use the Chezmoi with a regular package, it works as expected.

Here is the debug log when I execute forcing the use of Snap (snap run chezmoi edit ...):

Executable exists
Getting parent pid
Getting parent pid cmd args
Parent args: /snap/chezmoi/233/chezmoi edit /home/mhalano/.config/nvim/init.vim
['/snap/chezmoi/233/chezmoi', 'edit', '/home/mhalano/.config/nvim/init.vim']
Chezmoi edit command not found on parent process. It's probably not a chezmoi invoke.
Press ENTER or type command to continue
Lilja commented 3 years ago

Hey @mhalano! Thanks for using my plugin. I haven't really touched the code for this in a while. So I had a quick look. I think, to make the if work, in this case, maybe we need to run a basename of l:parentPidFileSplitted[0] if it contains a slash in the beginning.

Do you think you are up for a challenge and send a PR?

Lilja commented 3 years ago

Can you try this branch? Plug 'Lilja/vim-chezmoi', { 'branch': 'contains-chezmoi-executable' }

mhalano commented 3 years ago

@Lilja Just made a pull request.

mhalano commented 3 years ago

Your solution seems fine. I think is even better than mine. :100:

Lilja commented 3 years ago

Thanks for your PR, I think that mine makes a tiny bit more sense when I thought about it a second time. I hope this PR solves your issue with those pesky absolute paths!