Draft: modules #1
5 changed files with 40 additions and 9 deletions
|
@ -213,11 +213,11 @@
|
|||
},
|
||||
"nix2lua": {
|
||||
"locked": {
|
||||
"lastModified": 1713641247,
|
||||
"narHash": "sha256-UDAxwO1vSkaPtmby04xjiHq5dxd03IBD3lkpFKYlV7Q=",
|
||||
"lastModified": 1713645801,
|
||||
"narHash": "sha256-pev5YkdskHDS4OpGdYb5F/44hKrFmqzCwNGs0vSzqM8=",
|
||||
"ref": "refs/heads/main",
|
||||
"rev": "8c4f3ca834ef7c07c9e3be3e006d7395c69a176c",
|
||||
"revCount": 36,
|
||||
"rev": "3c08fa87d14704db1c1648b2486ed49e721dfe18",
|
||||
"revCount": 37,
|
||||
"type": "git",
|
||||
"url": "https://git.pleshevski.ru/mynix/nix2lua"
|
||||
},
|
||||
|
|
|
@ -250,13 +250,10 @@
|
|||
group_empty = 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 = { };
|
||||
git = { };
|
||||
gitsigns-nvim = { };
|
||||
neoformat = { };
|
||||
};
|
||||
|
||||
plugins = with prev.nix2lua.lib; {
|
||||
|
|
|
@ -2,8 +2,10 @@
|
|||
|
||||
with nix2lua.lib;
|
||||
{
|
||||
g = varName: expr: set "vim.g.${varName}" expr;
|
||||
fn.isdirectory = file: call1 "vim.fn.isdirectory" (var file);
|
||||
|
||||
cmd' = expr: call1 "vim.cmd" expr;
|
||||
cmd.cd = file: call1 "vim.cmd.cd" (var file);
|
||||
|
||||
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