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;
|
|
|
|
inherit (lib.nix2lua) lambda0 set pipe1 require call call0;
|
|
|
|
|
2024-05-10 22:27:42 +03:00
|
|
|
mkFiletypeDetect = ft: pattern: {
|
|
|
|
"filetype-detect-${ft}" = {
|
|
|
|
event = [ "BufNewFile" "BufRead" ];
|
|
|
|
inherit pattern;
|
|
|
|
command = "setfiletype ${ft}";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-05-10 02:39:22 +03:00
|
|
|
mkLineLimiterGroup = { limit, pattern }: {
|
|
|
|
"line-limiter-${toString limit}" = {
|
|
|
|
event = [ "BufNewFile" "BufRead" ];
|
|
|
|
inherit pattern;
|
|
|
|
callback = lambda0 (set "vim.wo.colorcolumn" (toString limit));
|
|
|
|
};
|
|
|
|
};
|
|
|
|
in
|
|
|
|
{
|
|
|
|
imports = [
|
|
|
|
"${modulesPath}/profiles/recommended.nix"
|
|
|
|
];
|
|
|
|
|
2024-05-13 16:21:37 +03:00
|
|
|
vim.opt = {
|
|
|
|
# Better Unix support
|
|
|
|
viewoptions = [ "folds" "options" "cursor" "unix" "slash" ];
|
|
|
|
encoding = "utf-8";
|
|
|
|
|
|
|
|
# Enable 24-bit color
|
|
|
|
termguicolors = true;
|
|
|
|
|
|
|
|
# Other options
|
|
|
|
backspace = [ "indent" "eol" "start" ];
|
|
|
|
laststatus = 2;
|
|
|
|
showmode = false;
|
|
|
|
|
|
|
|
# Tabs as spaces
|
|
|
|
expandtab = true;
|
|
|
|
tabstop = 2;
|
|
|
|
softtabstop = 2;
|
|
|
|
shiftwidth = 2;
|
|
|
|
|
|
|
|
# Fixes broken cursor on Linux
|
|
|
|
guicursor = "";
|
|
|
|
|
|
|
|
# Disable mouse / touchpad
|
|
|
|
mouse = "";
|
|
|
|
|
|
|
|
# Incremental substitutin
|
|
|
|
inccommand = "split";
|
|
|
|
|
|
|
|
# Hide files when leaving them.
|
|
|
|
hidden = true;
|
|
|
|
# Show line numbers.
|
|
|
|
number = true;
|
|
|
|
# Minimum line number column width.
|
|
|
|
numberwidth = 1;
|
|
|
|
# Number of screen lines to use for the commandline.
|
|
|
|
cmdheight = 2;
|
|
|
|
# Lines length limit (0 if no limit).
|
|
|
|
textwidth = 0;
|
|
|
|
# Don't cut lines in the middle of a work.
|
|
|
|
linebreak = true;
|
|
|
|
# Show matching parenthesis.
|
|
|
|
showmatch = true;
|
|
|
|
# Time during which the matching parenthesis is shown.
|
|
|
|
matchtime = 2;
|
|
|
|
# Sensible default line auto cutting and formatting.
|
|
|
|
formatoptions = "jtcrq";
|
|
|
|
# Copy/Past to/from clipboard.
|
|
|
|
clipboard = "unnamedplus";
|
|
|
|
# Highlight line cursor is currently on.
|
|
|
|
cursorline = true;
|
|
|
|
# Invisible characters representation when :set list
|
|
|
|
listchars = {
|
|
|
|
tab = "→ ";
|
|
|
|
trail = "~";
|
|
|
|
nbsp = "␣";
|
|
|
|
eol = "¬";
|
|
|
|
};
|
|
|
|
|
|
|
|
# Search
|
|
|
|
# Incremental search.
|
|
|
|
incsearch = true;
|
|
|
|
# Case insensitive.
|
|
|
|
ignorecase = true;
|
|
|
|
# Case insensitive if no uppercase letter in pattern, case sensitive otherwise.
|
|
|
|
smartcase = true;
|
|
|
|
|
|
|
|
# Fold level
|
|
|
|
foldlevel = 99;
|
|
|
|
foldlevelstart = 99;
|
|
|
|
foldminlines = 3;
|
|
|
|
foldnestmax = 5;
|
|
|
|
};
|
|
|
|
|
2024-05-10 02:39:22 +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" ];
|
|
|
|
|
|
|
|
vim.augroup = lib.mkMerge [
|
2024-05-10 22:27:42 +03:00
|
|
|
(mkFiletypeDetect "d2" "*.d2")
|
|
|
|
(mkFiletypeDetect "nickel" "*.ncl")
|
|
|
|
(mkFiletypeDetect "psql" "*.psql")
|
|
|
|
|
2024-05-10 02:39:22 +03:00
|
|
|
(mkLineLimiterGroup {
|
|
|
|
limit = 101;
|
|
|
|
pattern = [
|
|
|
|
"*.nix"
|
|
|
|
"*.ts"
|
|
|
|
"*.tsx"
|
|
|
|
"*.js"
|
|
|
|
"*.jsx"
|
|
|
|
"*.rs"
|
|
|
|
"*.hs"
|
|
|
|
];
|
|
|
|
})
|
|
|
|
(mkLineLimiterGroup {
|
|
|
|
limit = 81;
|
|
|
|
pattern = [
|
|
|
|
"*.json"
|
|
|
|
"*.yml"
|
|
|
|
"*.yaml"
|
|
|
|
"*.md"
|
|
|
|
"*.html"
|
|
|
|
"*.css"
|
|
|
|
"*.scss"
|
|
|
|
"*.less"
|
|
|
|
];
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
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-10 16:35:54 +03:00
|
|
|
plugins.style.neoformat.autoformat.enable = true;
|
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
tsserver = { };
|
|
|
|
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" ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|