180 lines
4.2 KiB
Nix
180 lines
4.2 KiB
Nix
{ config, modulesPath, lib, pkgs, ... }:
|
|
|
|
let
|
|
inherit (lib.mod) ctrl;
|
|
inherit (lib.nix2lua) pipe1 require call call0 nf var;
|
|
|
|
mkLineLimiterOpts = limit: {
|
|
colorcolumn = toString (limit + 1);
|
|
textwidth = limit;
|
|
};
|
|
|
|
mkLineLimiterGroup = { limit, pattern }:
|
|
lib.nameValuePair
|
|
"line-limiter-${toString limit}"
|
|
{
|
|
inherit pattern;
|
|
opt = mkLineLimiterOpts limit;
|
|
};
|
|
in
|
|
{
|
|
imports = [
|
|
"${modulesPath}/profiles/recommended.nix"
|
|
./snippets.nix
|
|
];
|
|
|
|
vim.opt = {
|
|
list = true;
|
|
formatoptions = "tcroqwanljp";
|
|
};
|
|
|
|
buffer.filetype = {
|
|
python-options = {
|
|
pattern = [ "python" ];
|
|
opt = { formatoptions = "croqwaljp"; } // mkLineLimiterOpts 90;
|
|
};
|
|
} // lib.listToAttrs [
|
|
(mkLineLimiterGroup {
|
|
limit = 100;
|
|
pattern = [
|
|
"nix"
|
|
"javascript,javascriptreact"
|
|
"typescript,typescriptreact"
|
|
"rust"
|
|
"haskell"
|
|
];
|
|
})
|
|
(mkLineLimiterGroup {
|
|
limit = 80;
|
|
pattern = [
|
|
"json"
|
|
"yaml"
|
|
"markdown"
|
|
"html,htmldjango"
|
|
"css,scss,less"
|
|
"sql,psql"
|
|
];
|
|
})
|
|
];
|
|
|
|
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" ];
|
|
|
|
plugin.nlsp-settings-nvim = {
|
|
enable = true;
|
|
name = "nlspsettings";
|
|
setupSettings = { };
|
|
};
|
|
|
|
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=";
|
|
};
|
|
};
|
|
};
|
|
|
|
plugins.style.neoformat.autoformat = {
|
|
enable = true;
|
|
pattern = [ "*.ts" "*.tsx" "*.rs" "flake.nix" ];
|
|
};
|
|
|
|
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 = {
|
|
"${ctrl "k"}" = pipe1
|
|
(require "telescope-live-grep-args.actions")
|
|
(call0 "quote_prompt")
|
|
;
|
|
};
|
|
};
|
|
};
|
|
|
|
fn.lspconfig-eslint-on-attach = {
|
|
args = [ "client" "bufnr" ];
|
|
content = { bufnr, ... }: {
|
|
vim.augroup.eslint-fix = {
|
|
event = "BufWritePre";
|
|
buffer = bufnr;
|
|
command = "silent! EslintFixAll";
|
|
};
|
|
};
|
|
};
|
|
|
|
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;
|
|
};
|
|
};
|
|
tsserver = rec {
|
|
filetypes = [ "javascript" "typescript" "vue" ];
|
|
init_options.plugins = [
|
|
{
|
|
name = "@vue/typescript-plugin";
|
|
location = "./node_modules/@vue/typescript-plugin";
|
|
languages = filetypes;
|
|
}
|
|
];
|
|
};
|
|
eslint = {
|
|
on_attach = config.fn.lspconfig-eslint-on-attach.lambda;
|
|
};
|
|
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" ];
|
|
};
|
|
jdtls = { cmd = [ "jdtls" ]; };
|
|
};
|
|
|
|
plugins.snippet.luasnip.settings = {
|
|
ext_opts = [
|
|
(nf (var "luasnip_types.choiceNode") {
|
|
active.virt_text = [ [ "●" "WarningMsg" ] ];
|
|
})
|
|
(nf (var "luasnip_types.insertNode") {
|
|
active.virt_text = [ [ "●" "Title" ] ];
|
|
})
|
|
];
|
|
};
|
|
}
|