• Stars
    star
    333
  • Rank 126,599 (Top 3 %)
  • Language
    Lua
  • License
    GNU General Publi...
  • Created over 3 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Neovim configuration switcher written in Lua. Inspired by chemacs.
      ___           ___           ___           ___                                    ___     
     /  /\         /__/\         /  /\         /  /\          ___        ___          /__/\    
    /  /:/         \  \:\       /  /:/_       /  /::\        /__/\      /  /\        |  |::\   
   /  /:/           \__\:\     /  /:/ /\     /  /:/\:\       \  \:\    /  /:/        |  |:|:\  
  /  /:/  ___   ___ /  /::\   /  /:/ /:/_   /  /:/  \:\       \  \:\  /__/::\      __|__|:|\:\ 
 /__/:/  /  /\ /__/\  /:/\:\ /__/:/ /:/ /\ /__/:/ \__\:\  ___  \__\:\ \__\/\:\__  /__/::::| \:\
 \  \:\ /  /:/ \  \:\/:/__\/ \  \:\/:/ /:/ \  \:\ /  /:/ /__/\ |  |:|    \  \:\/\ \  \:\~~\__\/
  \  \:\  /:/   \  \::/       \  \::/ /:/   \  \:\  /:/  \  \:\|  |:|     \__\::/  \  \:\      
   \  \:\/:/     \  \:\        \  \:\/:/     \  \:\/:/    \  \:\__|:|     /__/:/    \  \:\     
    \  \::/       \  \:\        \  \::/       \  \::/      \__\::::/      \__\/      \  \:\    
     \__\/         \__\/         \__\/         \__\/           ~~~~                   \__\/    

License PRs Welcome Neovim version

Cheovim Showcase GIF

Neovim configuration switcher written in Lua. Inspired by chemacs.

IntroductionInstallationConfiguration


🌟 Introduction

Cheovim is a plugin designed to make your life easier by being able to manage several Neovim configurations simultaneously and allow you to fully seamlessly transition between them.

By default your configuration is stored under a static ~/.config/nvim directory. This means if you want to try out another chad's configuration you must first move away your configuration into a backup folder, install the other person's config, put it in the correct spot, clear your site/pack directory so that the plugin manager can work without conflicts, install the plugin manager, install the plugins and then start using the config. That's absolutely atrocious! Afterwards switching back is the exact same awful process.

But what if we told you all of that could be fully automated?

🕓 Installation

❗ Cheovim requires at least Neovim 0.7+ to operate, and may not work on Windows machines!

Cheovim only works with configurations that use the new init.lua configuration style. If we get enough requests we will implement init.vim support too, but for now keep up with the times!

To install cheovim, make sure to first move your configuration (located under ~/.config/nvim/) out of the way (into e.g. ~/.config/nvim.bak/). Afterwards be sure to clear everything from ~/.local/share/nvim/site/pack/, this is the directory where all of your current plugins are installed. Cheovim uses symlinks as part of its magic and needs this directory to be clean. Optionally, to make your life easier, remove any files inside your config that may autorun on startup and attempt to load plugins (like plugin/packer_compiled.lua) - this isn't necessary but you'll see that it makes the initial install a bunch easier in some cases.

Then we can start the installation!

git clone --depth=1 https://github.com/NTBBloodbath/cheovim ~/.config/nvim

Will clone cheovim into the config directory. You're almost ready to go! Now we just have to tell cheovim which configs to use: Navigate to ~/.config/nvim/ and open the profiles.lua file - this is where all the configuration resides.

This is the default file:

--[[
      ___           ___           ___           ___                                    ___     
     /  /\         /__/\         /  /\         /  /\          ___        ___          /__/\    
    /  /:/         \  \:\       /  /:/_       /  /::\        /__/\      /  /\        |  |::\   
   /  /:/           \__\:\     /  /:/ /\     /  /:/\:\       \  \:\    /  /:/        |  |:|:\  
  /  /:/  ___   ___ /  /::\   /  /:/ /:/_   /  /:/  \:\       \  \:\  /__/::\      __|__|:|\:\ 
 /__/:/  /  /\ /__/\  /:/\:\ /__/:/ /:/ /\ /__/:/ \__\:\  ___  \__\:\ \__\/\:\__  /__/::::| \:\
 \  \:\ /  /:/ \  \:\/:/__\/ \  \:\/:/ /:/ \  \:\ /  /:/ /__/\ |  |:|    \  \:\/\ \  \:\~~\__\/
  \  \:\  /:/   \  \::/       \  \::/ /:/   \  \:\  /:/  \  \:\|  |:|     \__\::/  \  \:\      
   \  \:\/:/     \  \:\        \  \:\/:/     \  \:\/:/    \  \:\__|:|     /__/:/    \  \:\     
    \  \::/       \  \:\        \  \::/       \  \::/      \__\::::/      \__\/      \  \:\    
     \__\/         \__\/         \__\/         \__\/           ~~~~                   \__\/    

	A config switcher written in Lua by NTBBloodbath and Vhyrro.
--]]

-- Defines the profiles you want to use
local profiles = {
    --[[
    Here's an example:

	<name_of_config> = { <path_or_url_to_config>, {
            -- Where to install plugins under site/pack
	        plugins = "packer",
            -- Whether or not to preconfigure a plugin manager for you
            preconfigure = "packer:opt",
		}
	}

    More in-depth information can be found in cheovim's README on GitHub.
    --]]
    my_config = { "<path_or_url>", {
    		plugins = "packer",
    		preconfigure = "packer",
	    }
    },
}

-- return <name_of_config>, <list_of_profiles>
return "my_config", profiles

You can tweak this file as you see fit, although we recommend reading the next section to actually know what you're doing.

🔧 Configuration

Cheovim has a fair amount of configuration that may not become apparent right off the bat. Here's the things that you can change:

local profiles = {
	my_config = { "/my/path", {
			setup = function()
				os.remove("some_important_file")
			end,
			config = "PackerSync",
			plugins = "<plugin_location>",
			preconfigure = "{packer|paq-nvim}:{start|opt}:<branch>",
		}
	}
}

return "my_config", profiles

Options

  • setup - can be either a function or a string, if it is a string it will get wrapped in a vim.cmd, so be warned. Gets invoked before the new configuration gets loaded.
  • config - can also be either a function or a string. Gets invoked after the configuration has been fully loaded. Designed to also work with asynchronous configurations.
  • plugins = "<plugin_location>" - where under ~/.local/share/nvim/site/pack/ to install plugins. Defaults to "packer", meaning plugins will be installed under ~/.local/share/nvim/site/pack/packer. By default different plugin managers will install themselves into different directories. Packer installs itself into packer, paq-nvim installs itself into paq-nvim, etc. There may be times where different configs install their plugin managers into different directories altogether, so you can change this value accordingly.
  • preconfigure = "<config>" - preconfigure a plugin manager before switching configs. Useful for seamless config transitions. Options are divided with :, but you needn't supply all of them. For example, a value of packer:opt:fix/premature-display-opening means "preconfigure packer, install it as an opt plugin, and use the fix/premature-display-opening branch". Not supplying parts of these parameters will use the default values instead, so packer::fix/premature-display-opening will be the equivalent of packer:start:fix/premature-display-opening, packer:opt will be the equivalent of packer:opt:master and finally packer is the equivalent of packer:start:master. The same principles apply to paq-nvim. This value can be set to nil too to perform no preconfiguration.
  • return "my_config", profiles - selects a configuration from a list of profiles. Make sure the first returned value has the same name as the key inside the profiles table (i.e. if I define a config called my_config = {} make sure to return "my_config"). Changing this will automatically switch configs the next time you launch Neovim.

Upon launching a new config that hasn't been preconfigured yet you will be greeted with a random message, can you find em' all?

The Cheovim Command

Ohoho, it doesn't stop there. Cheovim also supplies a :Cheovim command that you can use to clean up your configs, remove plugins, force reload the configuration on next boot, etc. These are the subcommands available:

  • :Cheovim reload - reloads the current configuration on next boot
  • :Cheovim version - prints the current version of cheovim
  • :Cheovim deep-clean - cleans all the configuration's plugins, deletes the current remote config if present and force reloads on next boot
  • :Cheovim force-reload - reloads the current configuration on next boot and also deletes the current remote config if present (remote configs are those that are pulled down by providing an url as the config path) for a completely clean start
  • :Cheovim clean-plugins - goes ahead and removes all the plugins from your current configuration
  • :Cheovim clean-remote-configs - removes all of the remote configurations that aren't defined in your profiles.lua file, therefore removing unused leftover junk configs

TODO

  • Add support for supplying URLs rather than regular paths to be able to check out different configurations without even needing to clone them yourself
  • Add the ability to execute a lua function or some vimscript code after switching configs via the config variable (inspired by packer)
  • Documentation for the above features
  • Hot reloading of configs whenever a change to the profiles.lua file is detected
Made with love by NTBBloodbath and Vhyrro ❤️

More Repositories

1

doom-nvim

A Neovim configuration for the advanced martian hacker
Lua
502
star
2

doom-one.nvim

doom-emacs' doom-one Lua port for Neovim
Lua
201
star
3

sweetie.nvim

A clean, delightful and highly customizable Neovim colorscheme written in Lua
Lua
99
star
4

dotfiles

/boot: No such file or directory. Discontinued, see https://github.com/NTBBloodbath/tundra
Shell
54
star
5

nvenv

A lightweight and blazing fast Neovim version manager.
V
53
star
6

color-converter.nvim

Easily convert your CSS colors without leaving your favorite editor.
Lua
36
star
7

nvim

My personal blazingly fast Neovim setup
Lua
34
star
8

zig-tools.nvim

Zig development tools for Neovim.
Lua
29
star
9

lcfetch

A fast and easy to configure alternative to neofetch written in C and configured using Lua
C
23
star
10

doom-one-vscode

VSCode port of Doom Emacs' doom-one colorscheme
15
star
11

norgolith

The monolithic Norg static site generator built with Rust
Rust
15
star
12

daylight.nvim

Automatic colorscheme/background switcher for Neovim based on your current time
Lua
13
star
13

exemplum.nvim

Seamlessly refactor code chunks within your projects while keeping an eye on the initial implementation
Lua
13
star
14

sun

Sun programming language source code
C
9
star
15

calc.py

A powerful Python REPL calculator
Python
8
star
16

doombox.nvim

A perfect mix between doom-one and gruvbox-material
Lua
8
star
17

selene-action

GitHub action for selene lua linter
TypeScript
6
star
18

temple.nvim

Dead simple yet powerful Neovim templates engine
6
star
19

logging.nvim

A very simple and asynchronous logging library for Neovim plugins
Lua
6
star
20

paul

Manage all your favorite system tools like ripgrep with just one command
5
star
21

better-neovim

I think the name says it all
4
star
22

NTBBloodbath

My bio
4
star
23

norg.py

Python parser for the Norg file format
Python
3
star
24

nvrg

Neovim Rockspecs Generator for plugins
Zig
3
star
25

bull

Svelte and Neorg in a SSG?
Zig
2
star
26

st

My personal suckless terminal build
C
2
star
27

ntbbloodbath.github.io

Just my small personal blog
HTML
2
star
28

dart-tree-sitter

Dart bindings for tree-sitter (WIP)
Dart
2
star
29

hive-ci

An experimental, modern and friendly CI engine
Rust
2
star
30

notes

My personal notes written in norg documents
1
star
31

Seconds

Transform seconds to minutes, hours, etc. and vice versa quickly, easily, understandable by humans and without external dependencies
Python
1
star
32

nasm-exercises

Some NASM exercises I'm writing to learn ASM because I don't care about my mental health
Assembly
1
star
33

tundra

Our Father who art in heaven, save me from infinite recursion
Shell
1
star