Compare commits
No commits in common. "4f011cf8ef977ab97efcf9e516ea3e814a380985" and "59e4821b4ca961668c426cb0b0012e6dfb863a41" have entirely different histories.
4f011cf8ef
...
59e4821b4c
|
|
@ -1,10 +1,8 @@
|
||||||
require("nixCatsUtils").setup({ non_nix_value = true }) -- https://github.com/BirdeeHub/nixCats-nvim/blob/77dffad8235eb77684fcb7599487c8e9f23d5b8f/templates/example/init.lua
|
|
||||||
|
|
||||||
require("vim")
|
require("vim")
|
||||||
require("ftdetect")
|
require("ftdetect")
|
||||||
require("keymaps")
|
require("keymaps")
|
||||||
require("highlight")
|
require("highlight")
|
||||||
require("paq-setup") -- when not on nixCats
|
require("paq-setup")
|
||||||
require("diagnostic")
|
require("diagnostic")
|
||||||
|
|
||||||
-- vim.opt.background = "dark"
|
-- vim.opt.background = "dark"
|
||||||
|
|
|
||||||
|
|
@ -1,53 +0,0 @@
|
||||||
-- Source: https://github.com/BirdeeHub/nixCats-nvim/blob/main/templates/example/lua/nixCatsUtils/catPacker.lua
|
|
||||||
--[[
|
|
||||||
This directory is the luaUtils template.
|
|
||||||
You can choose what things from it that you would like to use.
|
|
||||||
And then delete the rest.
|
|
||||||
Everything in this directory is optional.
|
|
||||||
--]]
|
|
||||||
|
|
||||||
local M = {}
|
|
||||||
-- NOTE: This function is for defining a paq.nvim fallback method of downloading plugins
|
|
||||||
-- when nixCats was not used to install your config.
|
|
||||||
-- If you only ever load your config using nixCats, you don't need this file.
|
|
||||||
|
|
||||||
-- it literally just only runs it when not on nixCats
|
|
||||||
-- all neovim package managers that use the regular plugin loading scheme
|
|
||||||
-- can be used this way, just do whatever the plugin manager needs to put it in the
|
|
||||||
-- opt directory for lazy loading, and add the build steps so that when theres no nix the steps are ran
|
|
||||||
function M.setup(v)
|
|
||||||
if not vim.g[ [[nixCats-special-rtp-entry-nixCats]] ] then
|
|
||||||
local function clone_paq()
|
|
||||||
local path = vim.fn.stdpath("data") .. "/site/pack/paqs/start/paq-nvim"
|
|
||||||
local is_installed = vim.fn.empty(vim.fn.glob(path)) == 0
|
|
||||||
if not is_installed then
|
|
||||||
vim.fn.system({ "git", "clone", "--depth=1", "https://github.com/savq/paq-nvim.git", path })
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
local function bootstrap_paq(packages)
|
|
||||||
local first_install = clone_paq()
|
|
||||||
vim.cmd.packadd("paq-nvim")
|
|
||||||
local paq = require("paq")
|
|
||||||
if first_install then
|
|
||||||
vim.notify("Installing plugins... If prompted, hit Enter to continue.")
|
|
||||||
end
|
|
||||||
paq(packages)
|
|
||||||
paq.install()
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd("VimEnter", {
|
|
||||||
once = true,
|
|
||||||
callback = function()
|
|
||||||
local pkgs_count = #require("paq").query("to_install")
|
|
||||||
if pkgs_count < 1 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
vim.notify(string.format("There are %d to install", pkgs_count))
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
bootstrap_paq(vim.list_extend({ "savq/paq-nvim" }, v))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return M
|
|
||||||
|
|
@ -1,136 +0,0 @@
|
||||||
-- Source: https://github.com/BirdeeHub/nixCats-nvim/blob/main/templates/example/lua/nixCatsUtils/init.lua
|
|
||||||
--[[
|
|
||||||
This directory is the luaUtils template.
|
|
||||||
You can choose what things from it that you would like to use.
|
|
||||||
And then delete the rest.
|
|
||||||
Everything in this directory is optional.
|
|
||||||
--]]
|
|
||||||
|
|
||||||
local M = {}
|
|
||||||
|
|
||||||
--[[
|
|
||||||
This file is for making your config still work WITHOUT nixCats.
|
|
||||||
When you don't use nixCats to load your config,
|
|
||||||
you wont have the nixCats plugin.
|
|
||||||
|
|
||||||
The setup function defined here defines a mock nixCats plugin when nixCats wasnt used to load the config.
|
|
||||||
This will help avoid indexing errors when the nixCats plugin doesnt exist.
|
|
||||||
|
|
||||||
NOTE: If you only ever use nixCats to load your config, you don't need this file.
|
|
||||||
--]]
|
|
||||||
|
|
||||||
---@type boolean
|
|
||||||
M.isNixCats = vim.g[ [[nixCats-special-rtp-entry-nixCats]] ] ~= nil
|
|
||||||
|
|
||||||
---@class nixCatsSetupOpts
|
|
||||||
---@field non_nix_value boolean|nil
|
|
||||||
|
|
||||||
---This function will setup a mock nixCats plugin when not using nix
|
|
||||||
---It will help prevent you from running into indexing errors without a nixCats plugin from nix.
|
|
||||||
---If you loaded the config via nix, it does nothing
|
|
||||||
---non_nix_value defaults to true if not provided or is not a boolean.
|
|
||||||
---@param v nixCatsSetupOpts
|
|
||||||
function M.setup(v)
|
|
||||||
if not M.isNixCats then
|
|
||||||
local nixCats_default_value
|
|
||||||
if type(v) == "table" and type(v.non_nix_value) == "boolean" then
|
|
||||||
nixCats_default_value = v.non_nix_value
|
|
||||||
else
|
|
||||||
nixCats_default_value = true
|
|
||||||
end
|
|
||||||
local mk_with_meta = function(tbl)
|
|
||||||
return setmetatable(tbl, {
|
|
||||||
__call = function(_, attrpath)
|
|
||||||
local strtable = {}
|
|
||||||
if type(attrpath) == "table" then
|
|
||||||
strtable = attrpath
|
|
||||||
elseif type(attrpath) == "string" then
|
|
||||||
for key in attrpath:gmatch("([^%.]+)") do
|
|
||||||
table.insert(strtable, key)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
print("function requires a table of strings or a dot separated string")
|
|
||||||
return
|
|
||||||
end
|
|
||||||
return vim.tbl_get(tbl, unpack(strtable))
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
package.preload["nixCats"] = function()
|
|
||||||
local ncsub = {
|
|
||||||
get = function(_)
|
|
||||||
return nixCats_default_value
|
|
||||||
end,
|
|
||||||
cats = mk_with_meta({
|
|
||||||
nixCats_config_location = vim.fn.stdpath("config"),
|
|
||||||
wrapRc = false,
|
|
||||||
}),
|
|
||||||
settings = mk_with_meta({
|
|
||||||
nixCats_config_location = vim.fn.stdpath("config"),
|
|
||||||
configDirName = os.getenv("NVIM_APPNAME") or "nvim",
|
|
||||||
wrapRc = false,
|
|
||||||
}),
|
|
||||||
petShop = mk_with_meta({}),
|
|
||||||
extra = mk_with_meta({}),
|
|
||||||
pawsible = mk_with_meta({
|
|
||||||
allPlugins = {
|
|
||||||
start = {},
|
|
||||||
opt = {},
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
configDir = vim.fn.stdpath("config"),
|
|
||||||
packageBinPath = os.getenv("NVIM_WRAPPER_PATH_NIX") or vim.v.progpath,
|
|
||||||
}
|
|
||||||
return setmetatable(ncsub, {
|
|
||||||
__call = function(_, cat)
|
|
||||||
return ncsub.get(cat)
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
_G.nixCats = require("nixCats")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
---allows you to guarantee a boolean is returned, and also declare a different
|
|
||||||
---default value than specified in setup when not using nix to load the config
|
|
||||||
---@overload fun(v: string|string[]): boolean
|
|
||||||
---@overload fun(v: string|string[], default: boolean): boolean
|
|
||||||
function M.enableForCategory(v, default)
|
|
||||||
if M.isNixCats or default == nil then
|
|
||||||
if nixCats(v) then
|
|
||||||
return true
|
|
||||||
else
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
else
|
|
||||||
return default
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
---if nix, return value of nixCats(v) else return default
|
|
||||||
---Exists to specify a different non_nix_value than the one in setup()
|
|
||||||
---@param v string|string[]
|
|
||||||
---@param default any
|
|
||||||
---@return any
|
|
||||||
function M.getCatOrDefault(v, default)
|
|
||||||
if M.isNixCats then
|
|
||||||
return nixCats(v)
|
|
||||||
else
|
|
||||||
return default
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
---for conditionally disabling build steps on nix, as they are done via nix
|
|
||||||
---I should probably have named it dontAddIfCats or something.
|
|
||||||
---@overload fun(v: any): any|nil
|
|
||||||
---Will return the second value if nix, otherwise the first
|
|
||||||
---@overload fun(v: any, o: any): any
|
|
||||||
function M.lazyAdd(v, o)
|
|
||||||
if M.isNixCats then
|
|
||||||
return o
|
|
||||||
else
|
|
||||||
return v
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
||||||
-- Source: https://github.com/BirdeeHub/nixCats-nvim/blob/main/templates/example/lua/nixCatsUtils/lzUtils.lua
|
|
||||||
--[[
|
|
||||||
This directory is the luaUtils template.
|
|
||||||
You can choose what things from it that you would like to use.
|
|
||||||
And then delete the rest.
|
|
||||||
Everything in this directory is optional.
|
|
||||||
--]]
|
|
||||||
|
|
||||||
local M = {}
|
|
||||||
-- A nixCats specific lze handler that you can use to conditionally enable by category easier.
|
|
||||||
-- at the start of your config, register with
|
|
||||||
-- require('lze').register_handlers(require('nixCatsUtils.lzUtils').for_cat)
|
|
||||||
-- before any calls to require('lze').load using the handler have been made.
|
|
||||||
-- accepts:
|
|
||||||
-- for_cat = { "your" "cat" };
|
|
||||||
-- for_cat = { cat = { "your" "cat" }, default = bool }
|
|
||||||
-- for_cat = "your.cat";
|
|
||||||
-- for_cat = { cat = "your.cat", default = bool }
|
|
||||||
-- where default is an alternate value for when nixCats was NOT used to install the config
|
|
||||||
M.for_cat = {
|
|
||||||
spec_field = "for_cat",
|
|
||||||
set_lazy = false,
|
|
||||||
modify = function(plugin)
|
|
||||||
if type(plugin.for_cat) == "table" and plugin.for_cat.cat ~= nil then
|
|
||||||
if vim.g[ [[nixCats-special-rtp-entry-nixCats]] ] ~= nil then
|
|
||||||
plugin.enabled = nixCats(plugin.for_cat.cat) or false
|
|
||||||
else
|
|
||||||
plugin.enabled = plugin.for_cat.default
|
|
||||||
end
|
|
||||||
else
|
|
||||||
plugin.enabled = nixCats(plugin.for_cat) or false
|
|
||||||
end
|
|
||||||
return plugin
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
||||||
return M
|
|
||||||
|
|
@ -1,4 +1,38 @@
|
||||||
require("nixCatsUtils.catPacker").setup({
|
-- Automate paq installation {{{
|
||||||
|
local function clone_paq()
|
||||||
|
local path = vim.fn.stdpath("data") .. "/site/pack/paqs/start/paq-nvim"
|
||||||
|
local is_installed = vim.fn.empty(vim.fn.glob(path)) == 0
|
||||||
|
if not is_installed then
|
||||||
|
vim.fn.system({ "git", "clone", "--depth=1", "https://github.com/savq/paq-nvim.git", path })
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local function bootstrap_paq(packages)
|
||||||
|
local first_install = clone_paq()
|
||||||
|
vim.cmd.packadd("paq-nvim")
|
||||||
|
local paq = require("paq")
|
||||||
|
if first_install then
|
||||||
|
vim.notify("Installing plugins... If prompted, hit Enter to continue.")
|
||||||
|
end
|
||||||
|
paq(packages)
|
||||||
|
paq.install()
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("VimEnter", {
|
||||||
|
once = true,
|
||||||
|
callback = function()
|
||||||
|
local pkgs_count = #require("paq").query("to_install")
|
||||||
|
if pkgs_count < 1 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
vim.notify(string.format("There are %d to install", pkgs_count))
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- }}}
|
||||||
|
|
||||||
|
-- Set up paq plugins {{{
|
||||||
|
bootstrap_paq({
|
||||||
{ "savq/paq-nvim" },
|
{ "savq/paq-nvim" },
|
||||||
{ "jinh0/eyeliner.nvim" },
|
{ "jinh0/eyeliner.nvim" },
|
||||||
{ "ibhagwan/fzf-lua" },
|
{ "ibhagwan/fzf-lua" },
|
||||||
|
|
@ -43,3 +77,4 @@ require("nixCatsUtils.catPacker").setup({
|
||||||
{ "zbirenbaum/copilot-cmp" },
|
{ "zbirenbaum/copilot-cmp" },
|
||||||
{ "qvalentin/helm-ls.nvim", ft = "helm" },
|
{ "qvalentin/helm-ls.nvim", ft = "helm" },
|
||||||
})
|
})
|
||||||
|
-- }}}
|
||||||
|
|
|
||||||
|
|
@ -82,10 +82,5 @@
|
||||||
".inputrc".source = ../../dots/.inputrc;
|
".inputrc".source = ../../dots/.inputrc;
|
||||||
".bashrc.d/prompt".source = ../../dots/.bashrc.d/prompt;
|
".bashrc.d/prompt".source = ../../dots/.bashrc.d/prompt;
|
||||||
".bashrc.d/editor".source = ../../dots/.bashrc.d/editor;
|
".bashrc.d/editor".source = ../../dots/.bashrc.d/editor;
|
||||||
".config/kitty/kitty.conf".source = ../../dots/.config/kitty/kitty.conf;
|
|
||||||
".config/kitty/themes/zenwritten_light.conf".source =
|
|
||||||
../../dots/.config/kitty/themes/zenwritten_light.conf;
|
|
||||||
".config/kitty/themes/zenwritten_dark.conf".source =
|
|
||||||
../../dots/.config/kitty/themes/zenwritten_dark.conf;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue