Closed Anrock closed 1 day ago
Hi @Anrock, I'm very sorry to hear about your experience. As you can see in luarock package https://luarocks.org/modules/superbo/fugit2.nvim, nvim-web-devicons is already listed as dependencies, I don't know why it is not installed when you use with Rocks install
. Can you share with me your config file so I can replicate this on my local machine.
About this suggestion Installation guide could be more convenient if it was restructed into sections that go in order like libgit2 installation, plugin installation, plugin configuration where each section describes different ways/OS-specifics to achieve section goal instead of current inside-out approach where different ways/OSes are separate sections which we'll have to repeat same snippets for each OS.
I will restructure wiki following your suggestion. Thank you for this idea.
@SuperBo don't be sorry and please excuse me if it sounded like some kind of personal attack.
Anyway, here's my config
And rocks.toml file
One interesting thing I've noticed is that while devicons are indeed in dependency file - Rocks install it. But I do have other deps: nui and plenary (maybe from other plugins). Could be an issue with Rocks actually.
thank @Anrock, I need to create an isolated neovim config to test your config, so it may take a while. Do you manage to run Fugit2?
P/s: nui
and plenary
is also in dependencies list. You can see lazy.nvim config to see all dependencies :D
Oops, I messed up my previous message. What I meant is that nui and plenary were installed by Rocks but nvim-web-devicons wasn't, for some reason. But I probably had nui and plenary because I have neorg installed. Could be something wrong with Rocks.
Anyway, I installed devicons manually via Rocks and Fugit2 starts without errors now.
@Anrock, I write a dedicated part for libgit2 installation. https://github.com/SuperBo/fugit2.nvim/wiki/Install-libgit2. Do you have anything to add?
@SuperBo I guess no, except it seems it's just a copy of whatever was before in installation guide? With same config copypasted under each section for each OS over and over. I was thinking about remaking installation guide into something like:
:Rocks install fugit2.nvim
whatever is needed for lazy
...
sudo apt-get install libgit2
sudo pacman -S libgit2
...
how to get actual path to libgit2.so goes here
-- Fugit2 setup table
{
libgit2_path = 'libgit2.so.1.7',
...
}
require('fugit2.nvim').setup({ libgit2_path = ... })
...
Hi. I'm here with the same problem after searching for "attempt to index field 'C'" Today I was excited to see fugit2 and wanted to try it. I installed an appimage of neovim 10 specially for the purpose. And installed Rocks because that's what the readme said. (My other config uses lazy).
Then I did Rocks install fugit2.nvim
because that's what the Readme said. (I was also curious to try out Rocks for first time)
Running :Fugit2
now gives:
Error executing Lua callback: ...cal/share/nvim-rocks/rocks/rocks_rtp/lua/fugit2/git2.lua:1972: attempt to index field 'C' (a nil value)
stack traceback:
...cal/share/nvim-rocks/rocks/rocks_rtp/lua/fugit2/git2.lua:1972: in function 'open'
...cal/share/nvim-rocks/rocks/rocks_rtp/lua/fugit2/init.lua:68: in function 'open_repository'
...cal/share/nvim-rocks/rocks/rocks_rtp/lua/fugit2/init.lua:87: in function <...cal/share/nvim-rocks/rocks/rocks_rtp/lua/fugit2/init.lua:86>
nvim
:version
NVIM v0.10.0
Build type: Release
LuaJIT 2.1.1713484068
Run ":verbose version" for more info
Pasted the sample lazy config into my lazy settings but I still ge the same message. So I need to add this: but where does it go? I tried putting it into opts along with the width setting from the sample lazy config
opts = {
width = 70,
libgit2_path = 'libgit2.so.1.1',
},
Great, now I get a different error
Error executing Lua callback: ...ickstart-modular/lazy/fugit2.nvim/lua/fugit2/view/ui.lua:19: loop or previous error loading module 'fugit2.view.git_status'
stack traceback:
[C]: in function 'require'
...ickstart-modular/lazy/fugit2.nvim/lua/fugit2/view/ui.lua:19: in function 'new_fugit2_status_window'
...m-kickstart-modular/lazy/fugit2.nvim/lua/fugit2/init.lua:70: in function <...m-kickstart-modular/lazy/fugit2.nvim/lua/fugit2/init.lua:66>
Restarted nivm and now it works.
So I tripped up in a similar way to the OP.
@bitterjug, sorry for your experience. I didn't test with rocks installation before :(. I will try to fix this asap T_T.
hi @bitterjug, @Anrock can you test new installation guide mentioned here.
@SuperBo looks great. Small nitpicks/suggestions:
require('fugit2.nvim').setup(...)
and it works.:Rocks install fugit2.nvim 2.0
should automatically add fugit2.nvim to plugin list (and potentially do other things automagically in future versions of rocks). :Rocks install fugit2.nvim
which should automatically pick up latest non-dev version, add it to rocks.toml thus potentially saving you and that user some headache.libgit2_path = "libgit2"
and that actually works (TIL). But in libgit2 installation guide (which user is supposed to read) it tells user to use other value for that option. This inconsistency between two guides which user is supposed to read one after the other may raise some WTFs. I suggest to leave libgit2_path = "libgit2"
as default (and actually make it default value in options table?) since that will probably work for 80% of widespread OSes and only provide snippets with overriding for specific systems like MacOS, NixOS and so on. That way 80% of users who use mainstream OS like ubuntu will check the guide, see that for their mainstream OS the only thing needed is generic sudo apt-get install libgit2
and the rest will work automagically using default values.hi @Anrock, actually libgit2_path = "libgit2"
is already the default value. However the problem with my plugin is that the setup
function must be called once to set it up. So, the actual usage of section [plugins."fugit2.nvim".config]
is just triggering setup function call.
For require('fugit2.nvim').setup(...)
, where do you put it? In init.lua
(after Rocks.nvim setup) or in a separate file?
For versioning problem, as long as we don't specify pin=true
, we can always update fugit2.nvim
by :Rocks update
command.
Do you think it will be better if I separate Rocks
installation guide from lazy.nvim
?
actually libgit2_path = "libgit2" is already the default value.
My bad, I missed it.
For require('fugit2.nvim').setup(...), where do you put it?
Just somewhere in init.lua after rock setup, yes.
For versioning problem, as long as we don't specify pin=true, we can always update fugit2.nvim by :Rocks update command.
Ah, I stand corrected about being stuck in specific version then. However fugit won't be updated unless user explicitly executes :Rocks update
after installing then, no?
Do you think it will be better if I separate Rocks installation guide from lazy.nvim?
No strong opinion on this. I have a feeling that actually both guides can be in one page actually without it being too long if structured properly.
@Anrock, I updated this guide https://github.com/SuperBo/fugit2.nvim/wiki/%F0%9F%93%A6-Installation
the version is removed, plain lua config is provided beside rocks-config.nvim
@SuperBo LGTM. I consider this issue resolved (w.r.t. my specific setup) unless @bitterjug has something else to add.
I will update README.md then close this issue later. @Anrock Thank you again for your contribution :D
Did you check the docs?
Is your feature request related to a problem? Please describe.
I'm using neovim 0.11.0 and Rocks.
I've checked installation section in README and made sure I have libgit2 installed via my package manager.
I've checked corresponding Rocks section which told me I don't need anything else except just installing the plugin.
I've executed
:Rocks install fugit2.nvim
and plugin was succesfully installedI've restarted my neovim and executed
:Fugit2
(I was already in git repo), got an error:I've rechecked the README file and found there is separate installation guide. First part was copypasted from README for some reason but there was a section about libgit2.
Apparently I have to set libgit2 path in plugin config. All examples for setting libgit2 are given using some specific package manager I don't use.
I've checked plugin source code to see how it's configured. The usual
require(...).setup({...})
it seems. I've added setup call to my config, restarted neovim and tried executing:Fugit2
and now I got:Weird. Neither README, nor Installation Guide mentioned that I need nvim-web-devicons. I also expected
Rocks
to bring any dependencies that plugin has - after all it's the main selling point of using luarocks for plugins. I've also looked at other wiki pages and searched the issues but I've no mention of that dependency (even optional) and also haven't found an option to turn it off.Describe the solution you'd like
Mention that you need to configure libgit2 path explicitly in the readme.
Make plugin log more user-frienly error in case libgit2 path isn't configured or something else is wrong with libgit2
Mention that nvim-web-dev-icons is required dependency or fix plugin crashing if it can't find it.
Installation guide could be more convenient if it was restructed into sections that go in order like libgit2 installation, plugin installation, plugin configuration where each section describes different ways/OS-specifics to achieve section goal instead of current inside-out approach where different ways/OSes are separate sections which we'll have to repeat same snippets for each OS.
Describe alternatives you've considered
Keep debugging this plugin until it finally works on my machine. Abandon this and try using another plugin. Keep using tig for git things.
Additional context
No response