Migrate more neovim modules to nix
This commit is contained in:
parent
e6f397f4be
commit
a456fe3781
|
@ -1722,11 +1722,11 @@
|
||||||
"nixpkgs": "nixpkgs_6"
|
"nixpkgs": "nixpkgs_6"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1695137077,
|
"lastModified": 1699966122,
|
||||||
"narHash": "sha256-wJ8EpYjsqrR4GFAF67wJKmZd4q86KuODWAag4acQL5Q=",
|
"narHash": "sha256-zEN3ET7jfXpIKYeYh/z4xekOBOoaFS+n0q3oL3sVh+0=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "nixd",
|
"repo": "nixd",
|
||||||
"rev": "e8f144ca50fe71e74d247e5308ae7ce122f0a0e6",
|
"rev": "b3bb9ea7cd3c2f07c89779a474d6468b2c11e303",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -227,12 +227,9 @@
|
||||||
let
|
let
|
||||||
mkHomeConfig = { system, hostname }:
|
mkHomeConfig = { system, hostname }:
|
||||||
home-manager.lib.homeManagerConfiguration {
|
home-manager.lib.homeManagerConfiguration {
|
||||||
inherit system;
|
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
extraSpecialArgs = specialArgs system;
|
extraSpecialArgs = specialArgs system;
|
||||||
modules = [
|
modules = [ ./home/${hostname}.nix ];
|
||||||
./home/${hostname}.nix
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
"mini.files": { "branch": "main", "commit": "dea80a8147aa4e3025c34d2e2aaa6f2aeb7b21dd" },
|
"mini.files": { "branch": "main", "commit": "dea80a8147aa4e3025c34d2e2aaa6f2aeb7b21dd" },
|
||||||
"mini.operators": { "branch": "main", "commit": "15f137f28412517e2248d39cf0663bd3a87aa24a" },
|
"mini.operators": { "branch": "main", "commit": "15f137f28412517e2248d39cf0663bd3a87aa24a" },
|
||||||
"mini.surround": { "branch": "main", "commit": "9d1956b576d7051da3a483b251dfc778121c60db" },
|
"mini.surround": { "branch": "main", "commit": "9d1956b576d7051da3a483b251dfc778121c60db" },
|
||||||
|
"neoconf": { "branch": "main", "commit": "64437787dba70fce50dad7bfbb97d184c5bc340f" },
|
||||||
"neoconf.nvim": { "branch": "main", "commit": "08f146d53e075055500dca35e93281faff95716b" },
|
"neoconf.nvim": { "branch": "main", "commit": "08f146d53e075055500dca35e93281faff95716b" },
|
||||||
"neodev.nvim": { "branch": "main", "commit": "9a5c0f0de5c15fba52d4fb83d425d3f4fa7abfa1" },
|
"neodev.nvim": { "branch": "main", "commit": "9a5c0f0de5c15fba52d4fb83d425d3f4fa7abfa1" },
|
||||||
"neogit": { "branch": "master", "commit": "e4c428239928425829cb5247e430f26d25d5788e" },
|
"neogit": { "branch": "master", "commit": "e4c428239928425829cb5247e430f26d25d5788e" },
|
||||||
|
@ -48,7 +49,7 @@
|
||||||
"nvim-comment": { "branch": "main", "commit": "e9ac16ab056695cad6461173693069ec070d2b23" },
|
"nvim-comment": { "branch": "main", "commit": "e9ac16ab056695cad6461173693069ec070d2b23" },
|
||||||
"nvim-lspconfig": { "branch": "master", "commit": "a981d4447b92c54a4d464eb1a76b799bc3f9a771" },
|
"nvim-lspconfig": { "branch": "master", "commit": "a981d4447b92c54a4d464eb1a76b799bc3f9a771" },
|
||||||
"nvim-tree.lua": { "branch": "master", "commit": "18c7a3119839adc4599d838726deae662859c8b2" },
|
"nvim-tree.lua": { "branch": "master", "commit": "18c7a3119839adc4599d838726deae662859c8b2" },
|
||||||
"nvim-treesitter": { "branch": "master", "commit": "93ee00cd9daf8d2e3fbaa2a18b8b9adcb4471b16" },
|
"nvim-treesitter": { "branch": "master", "commit": "0791b5ebb590a2d44e20640c52679df1fc42e8ab" },
|
||||||
"nvim-treesitter-context": { "branch": "master", "commit": "a17c31268b56d53624fdc9cb03a225d4a17cabdb" },
|
"nvim-treesitter-context": { "branch": "master", "commit": "a17c31268b56d53624fdc9cb03a225d4a17cabdb" },
|
||||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "9e519b6146512c8e2e702faf8ac48420f4f5deec" },
|
"nvim-treesitter-textobjects": { "branch": "master", "commit": "9e519b6146512c8e2e702faf8ac48420f4f5deec" },
|
||||||
"nvim-web-devicons": { "branch": "master", "commit": "ab899311f8ae00a47eae8e0879506cead8eb1561" },
|
"nvim-web-devicons": { "branch": "master", "commit": "ab899311f8ae00a47eae8e0879506cead8eb1561" },
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
local M = {
|
|
||||||
"ThePrimeagen/harpoon",
|
|
||||||
}
|
|
||||||
|
|
||||||
local function bindHarpoon(key, index)
|
|
||||||
vim.keymap.set("n", "<C-s>" .. key, function()
|
|
||||||
require("harpoon.ui").nav_file(index)
|
|
||||||
end, { desc = "Harpoon file " .. index })
|
|
||||||
end
|
|
||||||
|
|
||||||
function M.init()
|
|
||||||
vim.keymap.set("n", "<leader>H", function()
|
|
||||||
require("harpoon.mark").add_file()
|
|
||||||
end, { desc = "Add file to [h]arpoon" })
|
|
||||||
vim.keymap.set("n", "<C-a>", function()
|
|
||||||
require("harpoon.ui").toggle_quick_menu()
|
|
||||||
end, { desc = "Toggle harpoon quickmenu" })
|
|
||||||
|
|
||||||
bindHarpoon("q", 1)
|
|
||||||
bindHarpoon("w", 2)
|
|
||||||
bindHarpoon("e", 3)
|
|
||||||
bindHarpoon("r", 4)
|
|
||||||
bindHarpoon("a", 5)
|
|
||||||
bindHarpoon("s", 6)
|
|
||||||
bindHarpoon("d", 7)
|
|
||||||
bindHarpoon("f", 8)
|
|
||||||
bindHarpoon("z", 9)
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
|
|
@ -1,12 +0,0 @@
|
||||||
return {
|
|
||||||
"folke/neoconf.nvim",
|
|
||||||
cmd = "Neoconf",
|
|
||||||
opts = {
|
|
||||||
-- import existing settings from other plugins
|
|
||||||
import = {
|
|
||||||
vscode = true, -- local .vscode/settings.json
|
|
||||||
coc = false, -- global/local coc-settings.json
|
|
||||||
nlsp = false, -- global/local nlsp-settings.nvim json settings
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
|
@ -168,7 +168,7 @@ in
|
||||||
let
|
let
|
||||||
# God knows what this does
|
# God knows what this does
|
||||||
# https://github.com/glacambre/firenvim/blob/87c9f70d3e6aa2790982aafef3c696dbe962d35b/autoload/firenvim.vim#L592
|
# https://github.com/glacambre/firenvim/blob/87c9f70d3e6aa2790982aafef3c696dbe962d35b/autoload/firenvim.vim#L592
|
||||||
firenvim_init = pkgs.writeText "firenvim_init.vim" ''
|
firenvim_init = pkgs.writeText "firenvim_init.vim" /* vim */ ''
|
||||||
let g:firenvim_i=[]
|
let g:firenvim_i=[]
|
||||||
let g:firenvim_o=[]
|
let g:firenvim_o=[]
|
||||||
let g:Firenvim_oi={i,d,e->add(g:firenvim_i,d)}
|
let g:Firenvim_oi={i,d,e->add(g:firenvim_i,d)}
|
||||||
|
@ -177,7 +177,7 @@ in
|
||||||
let g:started_by_firenvim = v:true
|
let g:started_by_firenvim = v:true
|
||||||
'';
|
'';
|
||||||
|
|
||||||
firenvim_file_loaded = pkgs.writeText "firenvim_file_loaded.vim" ''
|
firenvim_file_loaded = pkgs.writeText "firenvim_file_loaded.vim" /* vim */ ''
|
||||||
try
|
try
|
||||||
call firenvim#run()
|
call firenvim#run()
|
||||||
catch /Unknown function/
|
catch /Unknown function/
|
||||||
|
@ -215,11 +215,13 @@ in
|
||||||
# {{{ Nvim-tree
|
# {{{ Nvim-tree
|
||||||
satellite.neovim.lazy.nvim-tree = {
|
satellite.neovim.lazy.nvim-tree = {
|
||||||
package = "kyazdani42/nvim-tree.lua";
|
package = "kyazdani42/nvim-tree.lua";
|
||||||
|
|
||||||
setup = true;
|
setup = true;
|
||||||
|
cond = nlib.blacklistEnv [ "vscode" "firenvim" ];
|
||||||
|
|
||||||
keys.mapping = "<C-n>";
|
keys.mapping = "<C-n>";
|
||||||
keys.desc = "Toggle [n]vim-tree";
|
keys.desc = "Toggle [n]vim-tree";
|
||||||
keys.action = "<cmd>NvimTreeToggle<cr>";
|
keys.action = "<cmd>NvimTreeToggle<cr>";
|
||||||
cond = nlib.blacklistEnv [ "vscode" "firenvim" ];
|
|
||||||
};
|
};
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ Lualine
|
# {{{ Lualine
|
||||||
|
@ -272,7 +274,7 @@ in
|
||||||
keys =
|
keys =
|
||||||
let keybind = mode: mapping: action: desc: {
|
let keybind = mode: mapping: action: desc: {
|
||||||
inherit mapping desc mode;
|
inherit mapping desc mode;
|
||||||
action = nlib.lua ''function () require("flash").${action}() end'';
|
action = nlib.thunk /* lua */ ''require("flash").${action}()'';
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
[
|
[
|
||||||
|
@ -295,7 +297,6 @@ in
|
||||||
cond = nlib.blacklistEnv [ "vscode" ];
|
cond = nlib.blacklistEnv [ "vscode" ];
|
||||||
event = "BufReadPost";
|
event = "BufReadPost";
|
||||||
|
|
||||||
opts.log_level = nlib.lua "vim.log.levels.DEBUG";
|
|
||||||
opts.format_on_save.lsp_fallback = true;
|
opts.format_on_save.lsp_fallback = true;
|
||||||
opts.formatters_by_ft = {
|
opts.formatters_by_ft = {
|
||||||
lua = [ "stylua" ];
|
lua = [ "stylua" ];
|
||||||
|
@ -304,5 +305,54 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
# }}}
|
# }}}
|
||||||
|
# {{{ Neoconf
|
||||||
|
satellite.neovim.lazy.neoconf = {
|
||||||
|
package = "folke/neoconf.nvim";
|
||||||
|
name = "neoconf";
|
||||||
|
|
||||||
|
cmd = "Neoconf";
|
||||||
|
opts.import = {
|
||||||
|
vscode = true; # local .vscode/settings.json
|
||||||
|
coc = false; # global/local coc-settings.json
|
||||||
|
nlsp = false; # global/local nlsp-settings.nvim json settings
|
||||||
|
};
|
||||||
|
};
|
||||||
|
# }}}
|
||||||
|
# {{{ Harpoon
|
||||||
|
satellite.neovim.lazy.harpoon = {
|
||||||
|
package = "ThePrimeagen/harpoon";
|
||||||
|
keys =
|
||||||
|
let goto = key: index: {
|
||||||
|
desc = "Goto harpoon file ${toString index}";
|
||||||
|
mapping = "<c-s>${key}";
|
||||||
|
action = nlib.thunk
|
||||||
|
/* lua */ ''require("harpoon.ui").nav_file(${toString index})'';
|
||||||
|
};
|
||||||
|
in
|
||||||
|
[
|
||||||
|
{
|
||||||
|
desc = "Add file to [h]arpoon";
|
||||||
|
mapping = "<leader>H";
|
||||||
|
action = nlib.thunk
|
||||||
|
/* lua */ ''require("harpoon.mark").add_file()'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
desc = "Toggle harpoon quickmenu";
|
||||||
|
mapping = "<c-a>";
|
||||||
|
action = nlib.thunk
|
||||||
|
/* lua */ ''require("harpoon.ui").toggle_quick_menu()'';
|
||||||
|
}
|
||||||
|
(goto "q" 1)
|
||||||
|
(goto "w" 2)
|
||||||
|
(goto "e" 3)
|
||||||
|
(goto "r" 4)
|
||||||
|
(goto "a" 5)
|
||||||
|
(goto "s" 6)
|
||||||
|
(goto "d" 7)
|
||||||
|
(goto "f" 8)
|
||||||
|
(goto "z" 9)
|
||||||
|
];
|
||||||
|
};
|
||||||
|
# }}}
|
||||||
# }}}
|
# }}}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,8 @@ let
|
||||||
|
|
||||||
# {{{ Custom types
|
# {{{ Custom types
|
||||||
myTypes = {
|
myTypes = {
|
||||||
|
zeroOrMore = t: types.nullOr (types.either t (types.listOf t));
|
||||||
|
|
||||||
luaCode = types.nullOr (types.oneOf [
|
luaCode = types.nullOr (types.oneOf [
|
||||||
types.str
|
types.str
|
||||||
types.path
|
types.path
|
||||||
|
@ -30,11 +32,6 @@ let
|
||||||
(types.listOf myTypes.luaValue)
|
(types.listOf myTypes.luaValue)
|
||||||
]);
|
]);
|
||||||
|
|
||||||
fileTypes = types.nullOr (types.oneOf [
|
|
||||||
types.str
|
|
||||||
(types.listOf types.str)
|
|
||||||
]);
|
|
||||||
|
|
||||||
# {{{ Key type
|
# {{{ Key type
|
||||||
lazyKey = types.oneOf [
|
lazyKey = types.oneOf [
|
||||||
types.str
|
types.str
|
||||||
|
@ -42,6 +39,7 @@ let
|
||||||
(_: {
|
(_: {
|
||||||
options.mapping = lib.mkOption {
|
options.mapping = lib.mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
|
description = "The lhs of the neovim mapping";
|
||||||
};
|
};
|
||||||
|
|
||||||
options.action = lib.mkOption {
|
options.action = lib.mkOption {
|
||||||
|
@ -49,22 +47,25 @@ let
|
||||||
types.str
|
types.str
|
||||||
myTypes.luaLiteral
|
myTypes.luaLiteral
|
||||||
]);
|
]);
|
||||||
|
description = "The rhs of the neovim mapping";
|
||||||
};
|
};
|
||||||
|
|
||||||
options.ft = lib.mkOption {
|
options.ft = lib.mkOption {
|
||||||
default = null;
|
default = null;
|
||||||
type = myTypes.fileTypes;
|
type = myTypes.zeroOrMore types.str;
|
||||||
description = "Filetypes on which this keybind should take effect";
|
description = "Filetypes on which this keybind should take effect";
|
||||||
};
|
};
|
||||||
|
|
||||||
options.mode = lib.mkOption {
|
options.mode = lib.mkOption {
|
||||||
default = null;
|
default = null;
|
||||||
type = types.nullOr types.str;
|
type = types.nullOr types.str;
|
||||||
|
description = "The vim modes the mapping should take effect in";
|
||||||
};
|
};
|
||||||
|
|
||||||
options.desc = lib.mkOption {
|
options.desc = lib.mkOption {
|
||||||
default = null;
|
default = null;
|
||||||
type = types.nullOr types.str;
|
type = types.nullOr types.str;
|
||||||
|
description = "Description for the current keymapping";
|
||||||
};
|
};
|
||||||
}))
|
}))
|
||||||
];
|
];
|
||||||
|
@ -116,11 +117,13 @@ let
|
||||||
dependencies.lua = lib.mkOption {
|
dependencies.lua = lib.mkOption {
|
||||||
default = [ ];
|
default = [ ];
|
||||||
type = types.listOf lazyModule;
|
type = types.listOf lazyModule;
|
||||||
|
description = "Lazy.nvim module dependencies";
|
||||||
};
|
};
|
||||||
|
|
||||||
dependencies.nix = lib.mkOption {
|
dependencies.nix = lib.mkOption {
|
||||||
default = [ ];
|
default = [ ];
|
||||||
type = types.listOf types.package;
|
type = types.listOf types.package;
|
||||||
|
description = "Nix packages to give nvim access to";
|
||||||
};
|
};
|
||||||
|
|
||||||
cond = lib.mkOption {
|
cond = lib.mkOption {
|
||||||
|
@ -139,19 +142,22 @@ let
|
||||||
|
|
||||||
event = lib.mkOption {
|
event = lib.mkOption {
|
||||||
default = null;
|
default = null;
|
||||||
type = types.nullOr (types.oneOf [
|
type = myTypes.zeroOrMore types.str;
|
||||||
types.str
|
|
||||||
(types.listOf types.str)
|
|
||||||
]);
|
|
||||||
description = "Event on which the module should be lazy loaded";
|
description = "Event on which the module should be lazy loaded";
|
||||||
};
|
};
|
||||||
|
|
||||||
ft = lib.mkOption {
|
ft = lib.mkOption {
|
||||||
default = null;
|
default = null;
|
||||||
type = myTypes.fileTypes;
|
type = myTypes.zeroOrMore types.str;
|
||||||
description = "Filetypes on which the module should be lazy loaded";
|
description = "Filetypes on which the module should be lazy loaded";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
cmd = lib.mkOption {
|
||||||
|
default = null;
|
||||||
|
type = myTypes.zeroOrMore types.str;
|
||||||
|
description = "Comands on which to load this plugin";
|
||||||
|
};
|
||||||
|
|
||||||
init = lib.mkOption {
|
init = lib.mkOption {
|
||||||
default = null;
|
default = null;
|
||||||
type = myTypes.luaCode;
|
type = myTypes.luaCode;
|
||||||
|
@ -172,11 +178,8 @@ let
|
||||||
|
|
||||||
keys = lib.mkOption {
|
keys = lib.mkOption {
|
||||||
default = null;
|
default = null;
|
||||||
type =
|
type = myTypes.zeroOrMore myTypes.lazyKey;
|
||||||
types.nullOr (types.oneOf [
|
description = "Keybinds to lazy-load the module on";
|
||||||
myTypes.lazyKey
|
|
||||||
(types.listOf myTypes.lazyKey)
|
|
||||||
]);
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}));
|
}));
|
||||||
|
@ -246,6 +249,7 @@ let
|
||||||
lib.isList
|
lib.isList
|
||||||
(luaEncoders.listOf encoder);
|
(luaEncoders.listOf encoder);
|
||||||
oneOrMany = encoder: luaEncoders.listOfOr encoder encoder;
|
oneOrMany = encoder: luaEncoders.listOfOr encoder encoder;
|
||||||
|
zeroOrMany = encoder: luaEncoders.nullOr (luaEncoders.oneOrMany encoder);
|
||||||
oneOrManyAsList = encoder: luaEncoders.map
|
oneOrManyAsList = encoder: luaEncoders.map
|
||||||
(given: if lib.isList given then given else [ given ])
|
(given: if lib.isList given then given else [ given ])
|
||||||
(luaEncoders.listOf encoder);
|
(luaEncoders.listOf encoder);
|
||||||
|
@ -368,6 +372,14 @@ in
|
||||||
type = types.functionTo myTypes.luaLiteral;
|
type = types.functionTo myTypes.luaLiteral;
|
||||||
description = "Generate a lazy.cond predicate which disables a module if one of the given envs is active";
|
description = "Generate a lazy.cond predicate which disables a module if one of the given envs is active";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
thunk = lib.mkOption {
|
||||||
|
default = given: cfg.lib.lua ''
|
||||||
|
function() return ${given} end
|
||||||
|
'';
|
||||||
|
type = types.functionTo myTypes.luaLiteral;
|
||||||
|
description = "Wrap a lua expression into a lua function";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
env = {
|
env = {
|
||||||
|
@ -398,7 +410,7 @@ in
|
||||||
lib.strings.stringToCharacters
|
lib.strings.stringToCharacters
|
||||||
(e.listAsOneOrMany e.string));
|
(e.listAsOneOrMany e.string));
|
||||||
desc = e.nullOr e.string;
|
desc = e.nullOr e.string;
|
||||||
ft = e.nullOr (e.oneOrMany e.string);
|
ft = e.zeroOrMany e.string;
|
||||||
});
|
});
|
||||||
|
|
||||||
lazyObjectEncoder = e.bind
|
lazyObjectEncoder = e.bind
|
||||||
|
@ -414,8 +426,9 @@ in
|
||||||
cond = e.nullOr (e.luaCode "cond");
|
cond = e.nullOr (e.luaCode "cond");
|
||||||
config = e.const (e.nullOr (e.boolOr (e.luaCode "config")) opts.setup);
|
config = e.const (e.nullOr (e.boolOr (e.luaCode "config")) opts.setup);
|
||||||
init = e.nullOr (e.luaCode "init");
|
init = e.nullOr (e.luaCode "init");
|
||||||
event = e.nullOr (e.oneOrMany e.string);
|
event = e.zeroOrMany e.string;
|
||||||
ft = e.nullOr (e.oneOrMany e.string);
|
cmd = e.zeroOrMany e.string;
|
||||||
|
ft = e.zeroOrMany e.string;
|
||||||
keys = e.nullOr (e.oneOrManyAsList lazyKeyEncoder);
|
keys = e.nullOr (e.oneOrManyAsList lazyKeyEncoder);
|
||||||
passthrough = e.anything;
|
passthrough = e.anything;
|
||||||
opts = e.anything;
|
opts = e.anything;
|
||||||
|
|
Loading…
Reference in a new issue