2024-05-10 22:26:33 +03:00
|
|
|
{ config, modulesPath, lib, pkgs, ... }:
|
2024-05-10 02:39:22 +03:00
|
|
|
|
|
|
|
let
|
|
|
|
inherit (lib.mod) ctrl;
|
2024-05-23 01:38:44 +03:00
|
|
|
inherit (lib.nix2lua) pipe1 require call call0 nf var;
|
2024-05-10 02:39:22 +03:00
|
|
|
|
2024-06-09 16:50:35 +03:00
|
|
|
mkLineLimiterOpts = limit: {
|
|
|
|
colorcolumn = toString (limit + 1);
|
|
|
|
textwidth = limit;
|
|
|
|
};
|
|
|
|
|
2024-05-20 23:49:50 +03:00
|
|
|
mkLineLimiterGroup = { limit, pattern }:
|
2024-05-17 22:26:17 +03:00
|
|
|
lib.nameValuePair
|
|
|
|
"line-limiter-${toString limit}"
|
|
|
|
{
|
2024-05-20 23:49:50 +03:00
|
|
|
inherit pattern;
|
2024-06-09 16:50:35 +03:00
|
|
|
opt = mkLineLimiterOpts limit;
|
2024-05-17 22:26:17 +03:00
|
|
|
};
|
2024-05-10 02:39:22 +03:00
|
|
|
in
|
|
|
|
{
|
|
|
|
imports = [
|
|
|
|
"${modulesPath}/profiles/recommended.nix"
|
2024-05-20 23:03:25 +03:00
|
|
|
./snippets.nix
|
2024-05-10 02:39:22 +03:00
|
|
|
];
|
|
|
|
|
2024-05-17 22:26:17 +03:00
|
|
|
vim.opt = {
|
|
|
|
list = true;
|
2024-06-09 16:49:59 +03:00
|
|
|
formatoptions = "tcroqwanljp";
|
2024-05-17 15:28:57 +03:00
|
|
|
};
|
|
|
|
|
2024-06-09 16:52:03 +03:00
|
|
|
buffer.filetype = {
|
|
|
|
python-options = {
|
|
|
|
pattern = [ "python" ];
|
|
|
|
opt = { formatoptions = "croqwaljp"; } // mkLineLimiterOpts 90;
|
|
|
|
};
|
|
|
|
} // lib.listToAttrs [
|
2024-05-10 02:39:22 +03:00
|
|
|
(mkLineLimiterGroup {
|
2024-06-09 16:50:35 +03:00
|
|
|
limit = 100;
|
2024-05-20 23:49:50 +03:00
|
|
|
pattern = [
|
2024-05-17 22:26:17 +03:00
|
|
|
"nix"
|
|
|
|
"javascript,javascriptreact"
|
|
|
|
"typescript,typescriptreact"
|
|
|
|
"rust"
|
|
|
|
"haskell"
|
2024-05-10 02:39:22 +03:00
|
|
|
];
|
|
|
|
})
|
|
|
|
(mkLineLimiterGroup {
|
2024-06-09 16:50:35 +03:00
|
|
|
limit = 80;
|
2024-05-20 23:49:50 +03:00
|
|
|
pattern = [
|
2024-05-17 22:26:17 +03:00
|
|
|
"json"
|
|
|
|
"yaml"
|
|
|
|
"markdown"
|
2024-05-23 20:50:26 +03:00
|
|
|
"html,htmldjango"
|
|
|
|
"css,scss,less"
|
|
|
|
"sql,psql"
|
2024-05-10 02:39:22 +03:00
|
|
|
];
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2024-05-17 22:26:17 +03:00
|
|
|
filetype.detect = {
|
|
|
|
d2 = "*.d2";
|
|
|
|
nickel = "*.ncl";
|
|
|
|
psql = "*.psql";
|
|
|
|
};
|
|
|
|
|
|
|
|
# Enable fast navigation between windows
|
|
|
|
vim.keymap.set = map (k: { mode = "n"; lhs = ctrl k; rhs = "${ctrl "w"}${k}"; }) [ "h" "l" "j" "k" ];
|
|
|
|
|
2024-06-09 16:49:22 +03:00
|
|
|
plugin.nlsp-settings-nvim = {
|
|
|
|
enable = true;
|
|
|
|
name = "nlspsettings";
|
|
|
|
setupSettings = { };
|
|
|
|
};
|
|
|
|
|
2024-05-10 22:26:33 +03:00
|
|
|
plugins.style.nvim-treesitter.extraGrammars = {
|
|
|
|
tree-sitter-d2 = rec {
|
|
|
|
language = "d2";
|
|
|
|
version = "8a9d50043d58eedf1e375b0e2059e43efd856902";
|
|
|
|
# version = "e7507ddd983427cb71b4bd96b039c382c73d65c5";
|
|
|
|
src = pkgs.fetchFromGitea {
|
|
|
|
domain = "git.pleshevski.ru";
|
|
|
|
owner = "pleshevskiy";
|
|
|
|
repo = "tree-sitter-d2";
|
|
|
|
rev = version;
|
|
|
|
sha256 = "sha256-ZhVjxo7Xi7DaHN3qabUcykflY74bUqPcOA410fA3zRk=";
|
|
|
|
# sha256 = "sha256-m7ZCxnW4Q1bQp1GhntUF7l+p6DV1p/2AJXhVeRy8Rec=";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-05-17 01:29:34 +03:00
|
|
|
plugins.style.neoformat.autoformat = {
|
|
|
|
enable = true;
|
|
|
|
pattern = [ "*.ts" "*.tsx" "*.rs" "flake.nix" ];
|
|
|
|
};
|
|
|
|
|
2024-05-10 02:39:22 +03:00
|
|
|
plugins.navigation = {
|
|
|
|
nvim-tree.settings = {
|
|
|
|
renderer = {
|
|
|
|
group_empty = true;
|
|
|
|
full_name = true;
|
|
|
|
};
|
|
|
|
tab.sync = {
|
|
|
|
open = true;
|
|
|
|
close = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
telescope.extensions.telescope-live-grep-args-nvim.settings = {
|
|
|
|
auto_quoting = true;
|
|
|
|
mappings.i = {
|
2024-05-10 18:50:22 +03:00
|
|
|
"${ctrl "k"}" = pipe1
|
2024-05-10 02:39:22 +03:00
|
|
|
(require "telescope-live-grep-args.actions")
|
|
|
|
(call0 "quote_prompt")
|
|
|
|
;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-05-10 18:50:22 +03:00
|
|
|
fn.lspconfig-eslint-on-attach = {
|
|
|
|
args = [ "client" "bufnr" ];
|
|
|
|
content = { bufnr, ... }: {
|
|
|
|
vim.augroup.eslint-fix = {
|
|
|
|
event = "BufWritePre";
|
|
|
|
buffer = bufnr;
|
|
|
|
command = "silent! EslintFixAll";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-05-10 02:39:22 +03:00
|
|
|
plugins.language-server.lspconfig.serverSettings = {
|
|
|
|
nil_ls = { };
|
|
|
|
rust_analyzer = {
|
|
|
|
settings.rust-analyzer = {
|
|
|
|
"server.path" = "rust-analyzer";
|
|
|
|
"updates.prompt" = false;
|
|
|
|
"updates.checkOnStartup" = false;
|
|
|
|
"checkOnSave.enable" = true;
|
|
|
|
"checkOnSave.command" = "clippy";
|
|
|
|
"cargo.autoreload" = true;
|
|
|
|
};
|
|
|
|
};
|
2024-06-07 20:24:00 +03:00
|
|
|
tsserver = rec {
|
|
|
|
filetypes = [ "javascript" "typescript" "vue" ];
|
|
|
|
init_options.plugins = [
|
|
|
|
{
|
|
|
|
name = "@vue/typescript-plugin";
|
|
|
|
location = "./node_modules/@vue/typescript-plugin";
|
|
|
|
languages = filetypes;
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
2024-05-10 02:39:22 +03:00
|
|
|
eslint = {
|
2024-05-10 18:50:22 +03:00
|
|
|
on_attach = config.fn.lspconfig-eslint-on-attach.lambda;
|
2024-05-10 02:39:22 +03:00
|
|
|
};
|
|
|
|
volar = {
|
|
|
|
init_options = {
|
|
|
|
typescript.tsdk = "./node_modules/typescript/lib";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
ltex = {
|
|
|
|
language = "en-US";
|
|
|
|
languageToolHttpServerUri = "http://localhost:8081";
|
|
|
|
};
|
|
|
|
pylsp = { };
|
|
|
|
denols = {
|
|
|
|
root_dir = call "${config.plugin.nvim-lspconfig.varName}.util.root_pattern" [ "deno.json" "deno.jsonc" ];
|
|
|
|
};
|
2024-06-07 20:24:00 +03:00
|
|
|
jdtls = { cmd = [ "jdtls" ]; };
|
2024-05-10 02:39:22 +03:00
|
|
|
};
|
2024-05-23 01:38:44 +03:00
|
|
|
|
|
|
|
plugins.snippet.luasnip.settings = {
|
|
|
|
ext_opts = [
|
|
|
|
(nf (var "luasnip_types.choiceNode") {
|
|
|
|
active.virt_text = [ [ "●" "WarningMsg" ] ];
|
|
|
|
})
|
|
|
|
(nf (var "luasnip_types.insertNode") {
|
|
|
|
active.virt_text = [ [ "●" "Title" ] ];
|
|
|
|
})
|
|
|
|
];
|
|
|
|
};
|
2024-05-10 02:39:22 +03:00
|
|
|
}
|