plugin intelligence
parent
7914c40d91
commit
fd4ff2cbbc
|
@ -0,0 +1,9 @@
|
||||||
|
# Local nixlib in `nix repl`
|
||||||
|
|
||||||
|
Pretty useful for airplane-driven development
|
||||||
|
```console
|
||||||
|
nixlib = import <nixpkgs/lib>
|
||||||
|
|
||||||
|
nix-repl> nixlib.genAttrs
|
||||||
|
«lambda @ /nix/var/nix/profiles/per-user/root/channels/nixpkgs/lib/attrsets.nix:619:5»
|
||||||
|
```
|
|
@ -3,7 +3,7 @@
|
||||||
The current [`scripts/vim.dsl`](../scripts/vim.dsl) grabs the upstream supported vim plugins
|
The current [`scripts/vim.dsl`](../scripts/vim.dsl) grabs the upstream supported vim plugins
|
||||||
onto a sqlite database to be stored in memory. We could perform some data exploration via this database
|
onto a sqlite database to be stored in memory. We could perform some data exploration via this database
|
||||||
|
|
||||||
## Explore which plugins should be added to `neovim.nix`
|
## Example: Explore which plugins should be added to `neovim.nix`
|
||||||
|
|
||||||
Gather list of plugins need to be added. This can be done simply by adding
|
Gather list of plugins need to be added. This can be done simply by adding
|
||||||
a print statement on `WPlug` in `../native_configs/neovim/init.lua` then run neovim
|
a print statement on `WPlug` in `../native_configs/neovim/init.lua` then run neovim
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
# modules = ./nix/modules;
|
# modules = ./nix/modules;
|
||||||
|
|
||||||
cellBlocks = let
|
cellBlocks = let
|
||||||
inherit (std.blockTypes) devshells functions anything installables;
|
inherit (std.blockTypes) devshells functions anything installables runnables;
|
||||||
in [
|
in [
|
||||||
(devshells "devshells")
|
(devshells "devshells")
|
||||||
(devshells "userShells")
|
(devshells "userShells")
|
||||||
|
@ -65,6 +65,7 @@
|
||||||
(anything "home-configs")
|
(anything "home-configs")
|
||||||
(installables "packages")
|
(installables "packages")
|
||||||
(anything "lib")
|
(anything "lib")
|
||||||
|
(runnables "formatter")
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
@ -76,5 +77,6 @@
|
||||||
|
|
||||||
# TODO: Debug only
|
# TODO: Debug only
|
||||||
homeProfiles = std.pick self [["repo" "home-profiles"]];
|
homeProfiles = std.pick self [["repo" "home-profiles"]];
|
||||||
|
formatter = std.harvest self [["repo" "formatter"]];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,12 +18,13 @@ endif
|
||||||
local Plug = vim.fn['plug#']
|
local Plug = vim.fn['plug#']
|
||||||
|
|
||||||
-- prepare a list of installed plugins from rtp
|
-- prepare a list of installed plugins from rtp
|
||||||
|
--- @type table<string, boolean>
|
||||||
local installed_plugins = {}
|
local installed_plugins = {}
|
||||||
-- NOTE: nvim_list_runtime_paths will expand wildcard paths for us.
|
-- NOTE: nvim_list_runtime_paths will expand wildcard paths for us.
|
||||||
for _, path in ipairs(vim.api.nvim_list_runtime_paths()) do
|
for _, path in ipairs(vim.api.nvim_list_runtime_paths()) do
|
||||||
local last_folder_start = path:find("/[^/]*$")
|
local last_folder_start = path:find("/[^/]*$")
|
||||||
if last_folder_start then
|
if last_folder_start then
|
||||||
local plugin_name = path:sub(last_folder_start + 1)
|
local plugin_name = string.lower(path:sub(last_folder_start + 1))
|
||||||
installed_plugins[plugin_name] = true
|
installed_plugins[plugin_name] = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -31,13 +32,23 @@ end
|
||||||
local wplug_log = require('plenary.log').new({ plugin = 'wplug_log', level = 'debug', use_console = false })
|
local wplug_log = require('plenary.log').new({ plugin = 'wplug_log', level = 'debug', use_console = false })
|
||||||
-- Do Plug if plugin not yet linked in `rtp`. This takes care of Nix-compatibility
|
-- Do Plug if plugin not yet linked in `rtp`. This takes care of Nix-compatibility
|
||||||
local function WPlug(plugin_path, ...)
|
local function WPlug(plugin_path, ...)
|
||||||
|
-- hrsh7th/cmp-nvim -> cmp-nvim
|
||||||
local plugin_name = string.lower(plugin_path:match("/([^/]+)$"))
|
local plugin_name = string.lower(plugin_path:match("/([^/]+)$"))
|
||||||
if not installed_plugins[plugin_name] then
|
if not installed_plugins[plugin_name] then
|
||||||
wplug_log.info("Plugging " .. plugin_path)
|
wplug_log.info("Missing in rtp: " .. plugin_name .. " path: " .. plugin_path)
|
||||||
Plug(plugin_path, ...)
|
Plug(plugin_path, ...)
|
||||||
end
|
end
|
||||||
|
installed_plugins[plugin_name] = false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Borked, reason unknown
|
||||||
|
-- for plugin, plugged in pairs(installed_plugins) do
|
||||||
|
-- if plugged ~= false then
|
||||||
|
-- wplug_log.info("Plugin " .. plugin .. " added to rtp but not WPlug-ed")
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
|
||||||
|
|
||||||
vim.call('plug#begin')
|
vim.call('plug#begin')
|
||||||
|
|
||||||
-- libs and dependencies
|
-- libs and dependencies
|
||||||
|
@ -943,7 +954,12 @@ local setup = {
|
||||||
settings = {
|
settings = {
|
||||||
["nil"] = {
|
["nil"] = {
|
||||||
formatting = {
|
formatting = {
|
||||||
command = { "nix", "run", "nixpkgs#alejandra" },
|
-- NOTE: nil_ls automatically adds the specific path to the filename
|
||||||
|
-- at the end, so we couldn't really have a fallback mechanism without
|
||||||
|
-- wrapping.
|
||||||
|
command = {
|
||||||
|
"nix", "run", "nixpkgs#alejandra"
|
||||||
|
},
|
||||||
},
|
},
|
||||||
nix = {
|
nix = {
|
||||||
flake = {
|
flake = {
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
inputs,
|
||||||
|
cell,
|
||||||
|
}:
|
||||||
|
inputs.nixpkgs.alejandra
|
|
@ -84,6 +84,16 @@ in {
|
||||||
# NOTE: this adds path to the wrapped version of neovim
|
# NOTE: this adds path to the wrapped version of neovim
|
||||||
extraPackages = nvim_pkgs;
|
extraPackages = nvim_pkgs;
|
||||||
extraLuaConfig = builtins.readFile "${inputs.self}/native_configs/neovim/init.lua";
|
extraLuaConfig = builtins.readFile "${inputs.self}/native_configs/neovim/init.lua";
|
||||||
|
/*
|
||||||
|
* type: (either derivation pluginWithConfigType)
|
||||||
|
* pluginWithConfigType {
|
||||||
|
* config: nullOr lines,
|
||||||
|
* type: enum[],
|
||||||
|
* optional: (mkType (mkDefault false) bool), # Don't load by default (:packadd)
|
||||||
|
* plugin: package,
|
||||||
|
* runtime: (mkType (mkDefault {}) {?})
|
||||||
|
* }
|
||||||
|
*/
|
||||||
plugins = let
|
plugins = let
|
||||||
inherit
|
inherit
|
||||||
(inputs.nixpkgs-latest.legacyPackages.${system}.vimPlugins)
|
(inputs.nixpkgs-latest.legacyPackages.${system}.vimPlugins)
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
{inputs, cell}: let
|
{
|
||||||
|
inputs,
|
||||||
|
cell,
|
||||||
|
}: let
|
||||||
# decorator for now, for data collecting :)
|
# decorator for now, for data collecting :)
|
||||||
nix-conf = a: a;
|
nix-conf = a: a;
|
||||||
in {
|
in {
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
#!/usr/bin/env python3 # A simple playground to explore vim plugins that are available in nixpkgs
|
#!/usr/bin/env python3
|
||||||
|
"""
|
||||||
|
A simple playground to explore vim plugins that are available in nixpkgs
|
||||||
|
"""
|
||||||
|
|
||||||
import csv
|
import csv
|
||||||
import urllib.request
|
import urllib.request
|
||||||
|
@ -45,11 +48,11 @@ class VimPlugins:
|
||||||
return self.conn.cursor().execute(query).fetchall()
|
return self.conn.cursor().execute(query).fetchall()
|
||||||
|
|
||||||
|
|
||||||
def vim_plugin_slug(name: str):
|
def vim_plugin_slug(name: str) -> str:
|
||||||
return name.replace(".", "-").lower()
|
return name.replace(".", "-").lower()
|
||||||
|
|
||||||
|
|
||||||
def name_from_repo(repo: str):
|
def name_from_repo(repo: str) -> str:
|
||||||
spl = repo.split("/")
|
spl = repo.split("/")
|
||||||
return vim_plugin_slug(spl[-1] or spl[-2])
|
return vim_plugin_slug(spl[-1] or spl[-2])
|
||||||
|
|
||||||
|
@ -86,7 +89,8 @@ L3MON4D3/LuaSnip
|
||||||
arthurxavierx/vim-caser
|
arthurxavierx/vim-caser
|
||||||
~/local_repos/ts-ql
|
~/local_repos/ts-ql
|
||||||
""".split()
|
""".split()
|
||||||
need_install_plugins = [plugin.strip() for plugin in need_install_plugins if plugin.strip()]
|
need_install_plugins = [plugin.strip()
|
||||||
|
for plugin in need_install_plugins if plugin.strip()]
|
||||||
|
|
||||||
# Create the GitHub URL list
|
# Create the GitHub URL list
|
||||||
need_install_plugins_gh = [
|
need_install_plugins_gh = [
|
||||||
|
@ -104,7 +108,7 @@ arthurxavierx/vim-caser
|
||||||
|
|
||||||
# Check if the repo is not in the list
|
# Check if the repo is not in the list
|
||||||
repos = [repo for repo, _ in values]
|
repos = [repo for repo, _ in values]
|
||||||
not_in_repo = [name_from_repo(gh) for gh in need_install_plugins_gh if gh not in repos]
|
not_in_repo = [name_from_repo(
|
||||||
print("not in repo", not_in_repo) # nvim-yati, yang-vim, Comment-nvim, inlay-hints-nvim, hlargs-nvim, vim-caser, gruvbox-community
|
gh) for gh in need_install_plugins_gh if gh not in repos]
|
||||||
|
# nvim-yati, yang-vim, Comment-nvim, inlay-hints-nvim, hlargs-nvim, vim-caser, gruvbox-community
|
||||||
|
print("not in repo", not_in_repo)
|
||||||
|
|
Loading…
Reference in New Issue