2024-06-18 17:14:05 +03:00
|
|
|
{ modulesPath, lib, pkgs, ... }:
|
2024-05-10 02:39:22 +03:00
|
|
|
|
|
|
|
let
|
|
|
|
inherit (lib.mod) ctrl;
|
2024-06-18 17:14:05 +03:00
|
|
|
inherit (lib.nix2lua) pipe1 require call0 nf var;
|
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-06-18 17:14:05 +03:00
|
|
|
./configs
|
|
|
|
./plugins
|
2024-05-10 02:39:22 +03:00
|
|
|
];
|
|
|
|
|
2024-05-17 22:26:17 +03:00
|
|
|
vim.opt = {
|
|
|
|
list = true;
|
2024-10-22 16:46:42 +03:00
|
|
|
formatoptions = "roqnlj";
|
2024-05-17 15:28:57 +03:00
|
|
|
};
|
|
|
|
|
2024-06-09 16:52:03 +03:00
|
|
|
buffer.filetype = {
|
2024-06-16 05:35:09 +03:00
|
|
|
text-options = {
|
|
|
|
pattern = [ "txt" "markdown" "mail" "man" ];
|
2024-10-22 16:46:42 +03:00
|
|
|
opt = { formatoptions = "roqwnjp"; };
|
2024-06-09 16:52:03 +03:00
|
|
|
};
|
2024-06-18 17:14:05 +03:00
|
|
|
};
|
2024-05-10 02:39:22 +03:00
|
|
|
|
2024-05-17 22:26:17 +03:00
|
|
|
filetype.detect = {
|
|
|
|
d2 = "*.d2";
|
|
|
|
nickel = "*.ncl";
|
|
|
|
psql = "*.psql";
|
2024-08-10 06:26:53 +03:00
|
|
|
sql = "*.pgsql";
|
2024-05-17 22:26:17 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
# Enable fast navigation between windows
|
|
|
|
vim.keymap.set = map (k: { mode = "n"; lhs = ctrl k; rhs = "${ctrl "w"}${k}"; }) [ "h" "l" "j" "k" ];
|
|
|
|
|
2024-11-08 23:47:04 +03:00
|
|
|
plugins.style.nvim-treesitter = {
|
|
|
|
extraGrammars = {
|
|
|
|
tree-sitter-d2 = rec {
|
|
|
|
language = "d2";
|
|
|
|
version = "1e6d8ca3d85c0031ff010759bb60804dd47b95f2";
|
|
|
|
src = pkgs.fetchFromGitea {
|
|
|
|
domain = "git.pleshevski.ru";
|
|
|
|
owner = "pleshevskiy";
|
|
|
|
repo = "tree-sitter-d2";
|
|
|
|
rev = version;
|
|
|
|
sha256 = "sha256-ld9zlJ7tXl/SyrHJXwPKviDHePbw/jhI9WPT3aNntt8=";
|
|
|
|
};
|
2024-05-10 22:26:33 +03:00
|
|
|
};
|
|
|
|
};
|
2024-11-08 23:47:04 +03:00
|
|
|
|
|
|
|
# Source: https://github.com/DariusCorvus/tree-sitter-language-injection.nvim/blob/main/lua/tree-sitter-language-injection/init.lua
|
|
|
|
extraQueries.javascript.injections =
|
|
|
|
let
|
|
|
|
lang = "sql";
|
|
|
|
langMatch = ''^//+( )*${lang}( )*|^/[*]+( )*${lang}( )*[*]+/$'';
|
|
|
|
in
|
|
|
|
''
|
|
|
|
((comment) @comment .
|
|
|
|
([ (string(string_fragment) @injection.content)
|
|
|
|
(template_string(string_fragment) @injection.content)
|
|
|
|
] @injection.content
|
|
|
|
)
|
|
|
|
(#match? @comment "${langMatch}")
|
|
|
|
(#set! injection.language "${lang}")
|
|
|
|
)
|
|
|
|
'';
|
2024-05-10 22:26:33 +03:00
|
|
|
};
|
|
|
|
|
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-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
|
|
|
}
|