Draft: modules #1
5 changed files with 40 additions and 9 deletions
|
@ -213,11 +213,11 @@
|
||||||
},
|
},
|
||||||
"nix2lua": {
|
"nix2lua": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1713641247,
|
"lastModified": 1713645801,
|
||||||
"narHash": "sha256-UDAxwO1vSkaPtmby04xjiHq5dxd03IBD3lkpFKYlV7Q=",
|
"narHash": "sha256-pev5YkdskHDS4OpGdYb5F/44hKrFmqzCwNGs0vSzqM8=",
|
||||||
"ref": "refs/heads/main",
|
"ref": "refs/heads/main",
|
||||||
"rev": "8c4f3ca834ef7c07c9e3be3e006d7395c69a176c",
|
"rev": "3c08fa87d14704db1c1648b2486ed49e721dfe18",
|
||||||
"revCount": 36,
|
"revCount": 37,
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://git.pleshevski.ru/mynix/nix2lua"
|
"url": "https://git.pleshevski.ru/mynix/nix2lua"
|
||||||
},
|
},
|
||||||
|
|
|
@ -250,13 +250,10 @@
|
||||||
group_empty = true;
|
group_empty = true;
|
||||||
full_name = true;
|
full_name = true;
|
||||||
};
|
};
|
||||||
keymaps = [
|
|
||||||
{ mode = "n"; bind = "<leader>nt"; command = "<CMD>NvimTreeToggle<CR>"; }
|
|
||||||
{ mode = "n"; bind = "<leader>nf"; command = "<CMD>NvimTreeFindFile<CR>"; }
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
nvim-treesitter = { };
|
nvim-treesitter = { };
|
||||||
git = { };
|
gitsigns-nvim = { };
|
||||||
|
neoformat = { };
|
||||||
};
|
};
|
||||||
|
|
||||||
plugins = with prev.nix2lua.lib; {
|
plugins = with prev.nix2lua.lib; {
|
||||||
|
|
|
@ -2,8 +2,10 @@
|
||||||
|
|
||||||
with nix2lua.lib;
|
with nix2lua.lib;
|
||||||
{
|
{
|
||||||
|
g = varName: expr: set "vim.g.${varName}" expr;
|
||||||
fn.isdirectory = file: call1 "vim.fn.isdirectory" (var file);
|
fn.isdirectory = file: call1 "vim.fn.isdirectory" (var file);
|
||||||
|
|
||||||
|
cmd' = expr: call1 "vim.cmd" expr;
|
||||||
cmd.cd = file: call1 "vim.cmd.cd" (var file);
|
cmd.cd = file: call1 "vim.cmd.cd" (var file);
|
||||||
|
|
||||||
keymap.set = { mode, bind, command, opts ? { } }:
|
keymap.set = { mode, bind, command, opts ? { } }:
|
||||||
|
|
32
modules/neoformat.nix
Normal file
32
modules/neoformat.nix
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
{ vim, ... }:
|
||||||
|
|
||||||
|
{ configs ? {
|
||||||
|
neoformat_enabled_markdown = [ "denofmt" ];
|
||||||
|
neoformat_rust_rustfmt = {
|
||||||
|
exe = "rustfmt";
|
||||||
|
args = [ "--edition 2021" ];
|
||||||
|
stdin = 1;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}:
|
||||||
|
|
||||||
|
let inherit (builtins) concatLists attrValues mapAttrs; in
|
||||||
|
{
|
||||||
|
neoformat = concatLists [
|
||||||
|
[
|
||||||
|
(vim.g "neoformat_try_node_exe" 1)
|
||||||
|
(vim.g "neoformat_only_msg_on_error" 1)
|
||||||
|
]
|
||||||
|
|
||||||
|
(attrValues (mapAttrs vim.g configs))
|
||||||
|
|
||||||
|
[
|
||||||
|
(vim.cmd' ''
|
||||||
|
aug fmt
|
||||||
|
au!
|
||||||
|
au BufWritePre * try | undojoin | Neoformat | catch /E790/ | Neoformat | endtry
|
||||||
|
aug END
|
||||||
|
'')
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
Reference in a new issue