harrygallagher4 / nvim-parinfer-rust

lua replacement for parinfer-rust's vim plugin. uses luajit ffi
Creative Commons Zero v1.0 Universal
7 stars 2 forks source link

Can this plugin be installed via vim-plug? #6

Open daveyarwood opened 2 years ago

daveyarwood commented 2 years ago

Hi! This plugin looks great, but it isn't clear from the README if it is possible to install via vim-plug. What are your thoughts?

harrygallagher4 commented 2 years ago

It looks like vim-plug doesn't use vim's native packages, so installing parinfer-rust that way will not work. However, you can most likely install this plugin with vim-plug and then manually add parinfer-rust as an opt package (see :help packages).

Add parinfer-rust as an opt package

% parinfer="$HOME/.local/share/nvim/site/pack/parinfer-lib/opt/parinfer-rust"
% git clone https://github.com/eraserhd/parinfer-rust.git $parinfer
% cd $parinfer
% cargo build --release

In vimrc

call plug#begin()
" ...
Plug 'harrygallagher4/nvim-parinfer-rust'
" ...
call plug#end()

autocmd VimEnter * lua require('parinfer').setup()

This is probably the easiest way to do this. I'll look at how vim-plug works a little bit more but I doubt it can handle installing parinfer-rust without loading its builtin vim plugin which will definitely cause issues.

I've also wanted to set up some sort of GitHub action to build the library and an optional "installer" module to handle downloading/building the library so that this weird plugin hackery isn't required. I'll update this thread if I find a better solution.

Glad some more folks are interested :)

harrygallagher4 commented 2 years ago

Hi, I just pushed an update that should allow you to use vim-plug to install this. There's a section in the readme about using vim-plug now.

daveyarwood commented 2 years ago

Nice! I gave it a try and it did not work as-is. Parinfer stopped working altogether. I noticed that before, I had this in my vimrc:

Plug 'eraserhd/parinfer-rust', {'do': 'cargo build --release'}

Whereas your instructions say to do this:

Plug 'eraserhd/parinfer-rust', {'rtp': 'target/release', 'do': 'cargo build --release'}

I tried removing the 'rtp': 'target/release' part and parinfer started working again.

Is there a way to confirm that your plugin is active when I'm editing a Clojure buffer, as opposed to just using eraserhd/parinfer-rust?

harrygallagher4 commented 2 years ago

The rtp key is definitely necessary. Without it, the normal parinfer-rust plugin will be loaded and the compiled library won't be found. I just set up a minimal nvim configuration with the configuration from the readme and was able to get everything working. It did require running :PlugUpdate and then restarting nvim though.

Maybe a fresh install of both plugins would help?

daveyarwood commented 2 years ago

I tried re-adding the rtp part and then doing a clean install of both plugins (I ran rm -rf ~/.vim/bundle/{,nvim-}parinfer-rust to remove both plugins, then ran :PlugInstall to re-install them), but got the same result as before. Parinfer silently stops working altogether with the rtp part. When I remove the rtp part, it works, but then it isn't using nvim-parinfer-rust, as you said.

Are there maybe some logs that I can look at to try and figure out why nvim-parinfer-rust isn't working when I add the rtp part?

harrygallagher4 commented 2 years ago

Will you push your non-working config to another branch of https://github.com/daveyarwood/dotfiles? I'll try to diagnose it from there.

daveyarwood commented 2 years ago

Sure! I've pushed a branch here: https://github.com/daveyarwood/dotfiles/tree/nvim-parinfer-rust