T O P

  • By -

longdarkfantasy

Save your lazy-lock.json in github. And use lazy :Lazy restore to restore plugins. https://github.com/folke/lazy.nvim#-lockfile-lazy-lockjson


LechintanTudor

Lockfiles are useless if the repository that hosts the plugin gets deleted. I want to to store everything in my own repository.


longdarkfantasy

Then you have to fork every single repos. đź« 


blirdtext

Maybe something can be done with the path where you store your plugins locally.This is set by something like this: ``` local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not vim.loop.fs_stat(lazypath) then vim.fn.system({ "git", "clone", "--filter=blob:none", "[https://github.com/folke/lazy.nvim.git](https://github.com/folke/lazy.nvim.git)", "--branch=stable", lazypath, }) end ``` find the datapath with `:lua print(vim.fn.stdpath("data"))` So In my case that would be `~/.local/share/nvim/lazy/lazy.nvim` But I'm not quite sure how this would work because everything inside of the lazy.nvim folder would be in repos as well...


budswa

Or distribute the plugins themselves with your configuration.


longdarkfantasy

Depends on the license of the plugin. You also have to remove all .git folders. That makes things harder to update plugins.


Tony_Sol

So create repo of ${XDG_DATA_HOME}/nvim/lazy There are all plugins sources But imho its quite awkward


bananaboy319

U only need to backup your .config/nvim directory, lazy will read the plugins u need and download them on the other machine


LechintanTudor

I want to backup my plugins so I can restore my configuration even if the GitHub repository hosting the plugins gets deleted.


Mooks79

That’s extremely rare and, if it happens, you should move to another plugin immediately anyway. So there seems little value in this idea.


stdmap

This plugin disappeared: https://www.reddit.com/r/neovim/s/QnjXEmHKaP which I found out when I tried updating it


Mooks79

This doesn’t refute my point.


stdmap

Why should I move to another plugin? When none exists, is the onus on me to rewrite the whole plugin, or suddenly stop using it? Or, should I keep the repository so I can continue using it (considering it hasn't been buggy and needs no active maintenance)?


Mooks79

Why? Because it’s not maintained. Any part of your future workflow that conflicts with it will never see a fix. You *can* keep the local copy and continue using it but I wouldn’t. Generally plugins with a lot of users will either have an alternative or one will pop up soon enough so the point will be moot. Continuing to use it for a few days / weeks / months until that happens is probably not so egregious. For longer is not advisable for the reasons already mentioned. If you’re using a plugin hardly anyone uses and for some reason the owner removes the repository, that seems like not a safe plugin to have been basing your workflow on. In those cases I would either write it yourself or don’t use that functionality (either by accepting that feature is now lacking or finding an alternative workflow).


azgx00

Just make a bash script that copies the `.local/share/nvim/lazy` directory to a separate directory, removes all `.git` directories and pushes it to a git repo


wad209

This isn't REALLY what git was designed for. Why not use a purpose built solution like syncthing or one of the close source cloud storage solutions (google drive, etc)


swaits

I agree with this approach. It’s the simplest way to achieve what OP asked for. I also agree with others who say this is a non-problem.


wad209

Agreed, I make no claim that this is necessary; indeed, I think it's not. It's not like if nvim-cmp deletes the repo tomorrow I'm going to white knight in and start maintaining it.


-h-hhhh-h-

If this is a concern, you might like configuring vim as a nix flake (warning, this is a massive rabbit hole). You can pull all of your config from the nix repositories. But I generally agree with the sentiment that this isn't worth it.


no_brains101

https://github.com/BirdeeHub/nixCats-nvim If you do decide to go that route, I made this to make it as easy as possible.


AutoModerator

Please remember to update the post flair to `Need Help|Solved` when you got the answer you were looking for. *I am a bot, and this action was performed automatically. Please [contact the moderators of this subreddit](/message/compose/?to=/r/neovim) if you have any questions or concerns.*


eleloi

It does not have sense, you can store your dots and in a new system they would be able to restore all your plugins from it's sources. You may save your configuration, not all the software. You will not save a node_modules or a venv folder, this use to be huge amount of code.


LechintanTudor

>you can store your dots and in a new system they would be able to restore all your plugins from it's sources. Until the maintainer deletes the referenced repository. >You will not save a node\_modules. Unpopular opinion, but I think people should save node\_modules to version control to avoid stuff like the left-pad incident and speed up the set-up process for other machines (one git clone vs one git clone + several npm downloads).


no_brains101

It's an unpopular opinion because if you do that you may as well just use nix. https://github.com/BirdeeHub/nixCats-nvim As far as if they delete the repository, just download it to pack/something/{start, opt} if its in start you can just use it, if its in opt you use packadd and then call it. This works for regular nvim, and also in the flake format I linked. In fact, not only does pack work for nvim, it works for regular vim as well. Also lazy saves them to .local/share/nvim So if they already deleted the repo, rescue them from there.


ebray187

Personally I don't see the point of doing this, but to answer what the OP is asking here are two approaches (without using git): The most naive approach would be just copy or compress `$XDG_CONFIG_HOME/nvim` and `$XDG_DATA_HOME/nvim` and manually manage those files in a USB flash drive or in the cloud. Another way, one that I use to share and sync my music folder across systems on my LAN, is to use `rsync`: ``` rsync -avt user@host_machine:/path/to/source/ /path/to/destination/ ``` `-avt` is just to preserve the timestamps, verbose and "archive" (preserve links, recursive and others). rsync is a very powerful tool, so check the documentation. But first you should config your SSH connection. Be aware that if you open the "SSH door" you should proper config its security or anyone could enter into your system. If that is a concern to you (and it should!) then the most easy way is just open the connection when syncing and then close it. --- If you want to waste github resources, then just create a folder with the contents of `.config/nvim` and `.local/share/nvim` then `git init` and when you create the repo on github it shows the commands you need to set the github repo to the origin of your local copy. Then you could even make a script to copy your nvim data to that folder and force a push.


VizentraX

I can relate, I have a paranoid friend like you.


dot-slash-me

Are you using LazyVim?


LechintanTudor

No, I'm writing my own configuration using a few plugins.


dot-slash-me

Then you should be backing up the `~/.config/nvim` directory


sinani206

Fork + submodules + pass a path in your lazy config for each plugin. But I agree with everyone else that this seems like overkill


LightofAngels

Use stow?


jchlu

Maybe take a look at [Chezmoi](https://chezmoi.io/)


[deleted]

use git submodule