Nvim: experimenting with different pre-configs

So I like to tinker, a LOT! Lately I’ve been messing with my neovim setup. I have it pretty close to what I want, but I still want to experiment with other configs.

The learning NEVER stops! :sunglasses:

This https://learnvimscriptthehardway.stevelosh.com/ was a wonderfully valuable resource, and I read page by page, learning the basics, etc.

Then I started messing around with pre-configured setups, I have tried:

After backing up my nvim folder, and before using any of those, I would read through their docs, make sure it wasn’t installing something crazy. And surely making sure I could cleanly remove it after I have used it. So far they’ve been pretty simple.

I have basically made a list of plugins they used. Install one, configure it, learn it, and if I like it - keep it. Else remove and on to the next one :slight_smile:

And then I found this :open_mouth: https://github.com/rockerBOO/awesome-neovim#preconfigured-configuration

Made me wonder, is there a reliable way of installing/testing/tinkering with these setups without always backing up my setup, installing, uninstalling, deleting, and reverting back to my backup?

Is there some script available to ease this process?!

I read somewhere I can start nvim with nvim -U path/to/newConfig. Haven’t tried it yet though.

I came across a bunch of lua setups and while they are insanely powerful, I kinda want to keep with just “regular vim”? Not lua? If that makes sense. I want to “learn to walk before I run”, kinda thing, lol.

1 Like

There may not be a script existing to do what you want, but keep in mind there is nothing stopping you from creating one. Basically the steps you have identified can be placed in a script file, and executed on demand. From there, if you want, you can add some interactivity (to specify what to move in, for example) - so it grows…

This is actually surprisingly easy to do (with some care) and can make such experimentation more enjoyable. Just remember to implement a ‘secondary backup’ while developing your script!

@freebird54

Well, like I said, the learning never stops, lol.

So following along with the idea of writing my first bash script.
(Thinking out loud here) …

#!/bin/bash
mv /home/$USER/.config/nvim ~/.config/nvim_backup.$(date +%F_%R)
mkdir /home/$USER/.config/nvim
touch /home/$USER/.config/nvim/init.vim

Then I can git clone whatever and continue from there, as most likely it’ll just overwrite the default location. Some of them, like SpaceVim, make a backup of /nvim. I know a few of these setups use lua and create a directory here of plugins .local/share/nvim/site/pack/packer/
So I would have to have a conditional statement that checks

PACKERDIR=/home/$USER/.local/share/nvim/site/pack/packer/
if [ -d "$PACKERDIR" ]; then
    rm -rf $PACKERDIR
    echo "$PACKERDIR has been deleted!"
else
    echo "$PACKERDIR not detected. You may proceed!"
fi

Not really sure what else I would need at the moment.

Thoughts?!

I am not familiar enough to give specific advice on your coding - but it looks like you have idea down OK. Whatever you use successfully with one statement at a time can be ‘automated’ - and there is nothing wrong with having more than 1 script with intentions of doing something else in between running them! The conditionals might have to wait on more practice in scripting - I had a few like that early on… I added the additional functionality later as I refined the goals…

Enjoy!

1 Like