adapts neovim config
This commit is contained in:
parent
c69697bbd3
commit
7632c3686f
7 changed files with 554 additions and 579 deletions
|
|
@ -1,23 +0,0 @@
|
||||||
{ inputs, ... }:
|
|
||||||
{
|
|
||||||
flake.modules.nixos.clipboard =
|
|
||||||
{ pkgs, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
environment.systemPackages = with pkgs; [
|
|
||||||
wl-clipboard
|
|
||||||
cliphist
|
|
||||||
];
|
|
||||||
|
|
||||||
home-manager.sharedModules = [
|
|
||||||
inputs.self.modules.homeManager.clipboard
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
flake.modules.homeManager.clipboard =
|
|
||||||
{ pkgs, ... }:
|
|
||||||
{
|
|
||||||
# Watch clipboard and store history via cliphist
|
|
||||||
services.cliphist.enable = true;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -1,96 +1,96 @@
|
||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
{
|
{
|
||||||
programs.nixvim = {
|
programs.nixvim = {
|
||||||
plugins.sleuth.enable = true;
|
plugins.sleuth.enable = true;
|
||||||
plugins.nvim-surround.enable = true;
|
plugins.nvim-surround.enable = true;
|
||||||
plugins.flash.enable = true;
|
plugins.flash.enable = true;
|
||||||
|
|
||||||
plugins.blink-pairs = {
|
plugins.blink-pairs = {
|
||||||
enable = true;
|
enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
# Workaround: Neovim 0.11.x does not implement the is? / is-not? treesitter
|
# Workaround: Neovim 0.11.x does not implement the is? / is-not? treesitter
|
||||||
# predicates, but newer grammar query files (tree-sitter-nix, tree-sitter-javascript)
|
# predicates, but newer grammar query files (tree-sitter-nix, tree-sitter-javascript)
|
||||||
# use (#is-not? local) to scope highlights to non-local identifiers.
|
# use (#is-not? local) to scope highlights to non-local identifiers.
|
||||||
# Register no-op handlers to suppress the error; remove once Neovim
|
# Register no-op handlers to suppress the error; remove once Neovim
|
||||||
# ships with built-in support for these predicates.
|
# ships with built-in support for these predicates.
|
||||||
extraConfigLua = /* lua */ ''
|
extraConfigLua = /* lua */ ''
|
||||||
-- (#is?) always returns false (node never "is" something)
|
-- (#is?) always returns false (node never "is" something)
|
||||||
vim.treesitter.query.add_predicate("is?", function()
|
vim.treesitter.query.add_predicate("is?", function()
|
||||||
return false
|
return false
|
||||||
end, { force = true })
|
end, { force = true })
|
||||||
-- (#is-not?) always returns true (node is always "not" something)
|
-- (#is-not?) always returns true (node is always "not" something)
|
||||||
vim.treesitter.query.add_predicate("is-not?", function()
|
vim.treesitter.query.add_predicate("is-not?", function()
|
||||||
return true
|
return true
|
||||||
end, { force = true })
|
end, { force = true })
|
||||||
'';
|
'';
|
||||||
|
|
||||||
plugins.treesitter = {
|
plugins.treesitter = {
|
||||||
enable = true;
|
enable = true;
|
||||||
highlight.enable = true;
|
highlight.enable = true;
|
||||||
indent.enable = true;
|
indent.enable = true;
|
||||||
folding.enable = true;
|
folding.enable = true;
|
||||||
|
|
||||||
grammarPackages = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [
|
grammarPackages = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [
|
||||||
angular
|
angular
|
||||||
bash
|
bash
|
||||||
css
|
css
|
||||||
html
|
html
|
||||||
javascript
|
javascript
|
||||||
jsdoc
|
jsdoc
|
||||||
json
|
json
|
||||||
lua
|
lua
|
||||||
make
|
make
|
||||||
markdown
|
markdown
|
||||||
markdown_inline
|
markdown_inline
|
||||||
go
|
go
|
||||||
gomod
|
gomod
|
||||||
gotmpl
|
gotmpl
|
||||||
python
|
python
|
||||||
styled
|
styled
|
||||||
tsx
|
tsx
|
||||||
typescript
|
typescript
|
||||||
nix
|
nix
|
||||||
regex
|
regex
|
||||||
toml
|
toml
|
||||||
vim
|
vim
|
||||||
vimdoc
|
vimdoc
|
||||||
xml
|
xml
|
||||||
yaml
|
yaml
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
plugins.substitute = {
|
|
||||||
enable = true;
|
|
||||||
luaConfig.post = /* lua */ ''
|
|
||||||
local sub = require("substitute")
|
|
||||||
vim.keymap.set("n", "s", sub.operator, { noremap = true })
|
|
||||||
vim.keymap.set("n", "ss", sub.line, { noremap = true })
|
|
||||||
vim.keymap.set("n", "S", sub.eol, { noremap = true })
|
|
||||||
vim.keymap.set("x", "s", sub.visual, { noremap = true })
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
extraPlugins = [
|
|
||||||
pkgs.vimPlugins.vim-cool
|
|
||||||
];
|
|
||||||
|
|
||||||
autoCmd = [
|
|
||||||
{
|
|
||||||
callback.__raw = "function() vim.highlight.on_yank() end";
|
|
||||||
event = [
|
|
||||||
"TextYankPost"
|
|
||||||
];
|
|
||||||
}
|
|
||||||
{
|
|
||||||
event = [ "FileType" ];
|
|
||||||
pattern = "qf";
|
|
||||||
callback.__raw = /* lua */ ''
|
|
||||||
function()
|
|
||||||
vim.keymap.set("n", "<CR>", "<CR>", { buffer = true })
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
plugins.substitute = {
|
||||||
|
enable = true;
|
||||||
|
luaConfig.post = /* lua */ ''
|
||||||
|
local sub = require("substitute")
|
||||||
|
vim.keymap.set("n", "s", sub.operator, { noremap = true })
|
||||||
|
vim.keymap.set("n", "ss", sub.line, { noremap = true })
|
||||||
|
vim.keymap.set("n", "S", sub.eol, { noremap = true })
|
||||||
|
vim.keymap.set("x", "s", sub.visual, { noremap = true })
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
extraPlugins = [
|
||||||
|
pkgs.vimPlugins.vim-cool
|
||||||
|
];
|
||||||
|
|
||||||
|
autoCmd = [
|
||||||
|
{
|
||||||
|
callback.__raw = "function() vim.highlight.on_yank() end";
|
||||||
|
event = [
|
||||||
|
"TextYankPost"
|
||||||
|
];
|
||||||
|
}
|
||||||
|
{
|
||||||
|
event = [ "FileType" ];
|
||||||
|
pattern = "qf";
|
||||||
|
callback.__raw = /* lua */ ''
|
||||||
|
function()
|
||||||
|
vim.keymap.set("n", "<CR>", "<CR>", { buffer = true })
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,55 +1,55 @@
|
||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
{
|
{
|
||||||
programs.nixvim.plugins.conform-nvim = {
|
programs.nixvim.plugins.conform-nvim = {
|
||||||
enable = true;
|
enable = true;
|
||||||
settings = {
|
settings = {
|
||||||
formatters_by_ft = {
|
formatters_by_ft = {
|
||||||
typescriptreact = {
|
typescriptreact = {
|
||||||
__unkeyed-1 = "biome-check";
|
__unkeyed-1 = "biome-check";
|
||||||
__unkeyed-2 = "prettierd";
|
__unkeyed-2 = "prettierd";
|
||||||
stop_after_first = true;
|
stop_after_first = true;
|
||||||
};
|
|
||||||
astro = [ "prettierd" ];
|
|
||||||
typescript = {
|
|
||||||
__unkeyed-1 = "biome-check";
|
|
||||||
__unkeyed-2 = "prettierd";
|
|
||||||
stop_after_first = true;
|
|
||||||
};
|
|
||||||
javascript = {
|
|
||||||
__unkeyed-1 = "biome-check";
|
|
||||||
__unkeyed-2 = "prettierd";
|
|
||||||
stop_after_first = true;
|
|
||||||
};
|
|
||||||
javascriptreact = {
|
|
||||||
__unkeyed-1 = "biome-check";
|
|
||||||
__unkeyed-2 = "prettierd";
|
|
||||||
stop_after_first = true;
|
|
||||||
};
|
|
||||||
html = [ "prettierd" ];
|
|
||||||
htmlangular = [ "prettierd" ];
|
|
||||||
css = {
|
|
||||||
__unkeyed-1 = "biome-check";
|
|
||||||
__unkeyed-2 = "prettierd";
|
|
||||||
stop_after_first = true;
|
|
||||||
};
|
|
||||||
yaml = [ "prettierd" ];
|
|
||||||
markdown = [ "prettierd" ];
|
|
||||||
json = {
|
|
||||||
__unkeyed-1 = "biome-check";
|
|
||||||
__unkeyed-2 = "prettierd";
|
|
||||||
stop_after_first = true;
|
|
||||||
};
|
|
||||||
lua = [ "stylua" ];
|
|
||||||
go = [ "goimports" ];
|
|
||||||
gomod = [ "goimports" ];
|
|
||||||
gowork = [ "goimports" ];
|
|
||||||
gotmpl = [ "goimports" ];
|
|
||||||
};
|
};
|
||||||
format_on_save = {
|
astro = [ "prettierd" ];
|
||||||
timeout_ms = 500;
|
typescript = {
|
||||||
lsp_format = "fallback";
|
__unkeyed-1 = "biome-check";
|
||||||
|
__unkeyed-2 = "prettierd";
|
||||||
|
stop_after_first = true;
|
||||||
};
|
};
|
||||||
|
javascript = {
|
||||||
|
__unkeyed-1 = "biome-check";
|
||||||
|
__unkeyed-2 = "prettierd";
|
||||||
|
stop_after_first = true;
|
||||||
|
};
|
||||||
|
javascriptreact = {
|
||||||
|
__unkeyed-1 = "biome-check";
|
||||||
|
__unkeyed-2 = "prettierd";
|
||||||
|
stop_after_first = true;
|
||||||
|
};
|
||||||
|
html = [ "prettierd" ];
|
||||||
|
htmlangular = [ "prettierd" ];
|
||||||
|
css = {
|
||||||
|
__unkeyed-1 = "biome-check";
|
||||||
|
__unkeyed-2 = "prettierd";
|
||||||
|
stop_after_first = true;
|
||||||
|
};
|
||||||
|
yaml = [ "prettierd" ];
|
||||||
|
markdown = [ "prettierd" ];
|
||||||
|
json = {
|
||||||
|
__unkeyed-1 = "biome-check";
|
||||||
|
__unkeyed-2 = "prettierd";
|
||||||
|
stop_after_first = true;
|
||||||
|
};
|
||||||
|
lua = [ "stylua" ];
|
||||||
|
go = [ "goimports" ];
|
||||||
|
gomod = [ "goimports" ];
|
||||||
|
gowork = [ "goimports" ];
|
||||||
|
gotmpl = [ "goimports" ];
|
||||||
|
};
|
||||||
|
format_on_save = {
|
||||||
|
timeout_ms = 500;
|
||||||
|
lsp_format = "fallback";
|
||||||
};
|
};
|
||||||
extraPackages = [ pkgs.stylua ];
|
|
||||||
};
|
};
|
||||||
|
extraPackages = [ pkgs.stylua ];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,31 +1,31 @@
|
||||||
{ ... }:
|
{ ... }:
|
||||||
{
|
{
|
||||||
programs.nixvim = {
|
programs.nixvim = {
|
||||||
plugins.gitportal = {
|
plugins.gitportal = {
|
||||||
enable = true;
|
enable = true;
|
||||||
};
|
|
||||||
|
|
||||||
keymaps = [
|
|
||||||
{
|
|
||||||
key = "<leader>gll";
|
|
||||||
action = "<cmd>GitPortal<cr>";
|
|
||||||
options.desc = "Open line in Git provider";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<leader>gll";
|
|
||||||
action = "<cmd>GitPortal<cr>";
|
|
||||||
options.desc = "Open line in Git provider";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<leader>gly";
|
|
||||||
action = "<cmd>GitPortal copy_link_to_clipboard<cr>";
|
|
||||||
options.desc = "Copy link to line at Git provider";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<leader>glo";
|
|
||||||
action = "<cmd>GitPortal open_link<cr>";
|
|
||||||
options.desc = "Open link to line at Git provider";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
keymaps = [
|
||||||
|
{
|
||||||
|
key = "<leader>gll";
|
||||||
|
action = "<cmd>GitPortal<cr>";
|
||||||
|
options.desc = "Open line in Git provider";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<leader>gll";
|
||||||
|
action = "<cmd>GitPortal<cr>";
|
||||||
|
options.desc = "Open line in Git provider";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<leader>gly";
|
||||||
|
action = "<cmd>GitPortal copy_link_to_clipboard<cr>";
|
||||||
|
options.desc = "Copy link to line at Git provider";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<leader>glo";
|
||||||
|
action = "<cmd>GitPortal open_link<cr>";
|
||||||
|
options.desc = "Open link to line at Git provider";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,200 +1,200 @@
|
||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
{
|
{
|
||||||
programs.nixvim = {
|
programs.nixvim = {
|
||||||
plugins.lspconfig.enable = true;
|
plugins.lspconfig.enable = true;
|
||||||
|
|
||||||
lsp = {
|
lsp = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
servers = {
|
servers = {
|
||||||
lua_ls = {
|
lua_ls = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = pkgs.lua-language-server;
|
package = pkgs.lua-language-server;
|
||||||
packageFallback = true;
|
packageFallback = true;
|
||||||
};
|
};
|
||||||
nil_ls = {
|
nil_ls = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = pkgs.nil;
|
package = pkgs.nil;
|
||||||
packageFallback = true;
|
packageFallback = true;
|
||||||
};
|
};
|
||||||
gopls = {
|
gopls = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = pkgs.gopls;
|
package = pkgs.gopls;
|
||||||
packageFallback = true;
|
packageFallback = true;
|
||||||
};
|
};
|
||||||
ts_ls = {
|
ts_ls = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = pkgs.typescript-language-server;
|
package = pkgs.typescript-language-server;
|
||||||
packageFallback = true;
|
packageFallback = true;
|
||||||
};
|
};
|
||||||
jsonls = {
|
jsonls = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = pkgs.vscode-langservers-extracted;
|
package = pkgs.vscode-langservers-extracted;
|
||||||
packageFallback = true;
|
packageFallback = true;
|
||||||
};
|
};
|
||||||
cssls = {
|
cssls = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = pkgs.vscode-langservers-extracted;
|
package = pkgs.vscode-langservers-extracted;
|
||||||
packageFallback = true;
|
packageFallback = true;
|
||||||
};
|
};
|
||||||
html = {
|
html = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = pkgs.vscode-langservers-extracted;
|
package = pkgs.vscode-langservers-extracted;
|
||||||
packageFallback = true;
|
packageFallback = true;
|
||||||
};
|
};
|
||||||
astro = {
|
astro = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = pkgs.astro-language-server;
|
package = pkgs.astro-language-server;
|
||||||
packageFallback = true;
|
packageFallback = true;
|
||||||
config.init_options.typescript.tsdk = "${pkgs.typescript}/lib/node_modules/typescript/lib";
|
config.init_options.typescript.tsdk = "${pkgs.typescript}/lib/node_modules/typescript/lib";
|
||||||
};
|
};
|
||||||
eslint = {
|
eslint = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = pkgs.vscode-langservers-extracted;
|
package = pkgs.vscode-langservers-extracted;
|
||||||
packageFallback = true;
|
packageFallback = true;
|
||||||
config = {
|
config = {
|
||||||
root_markers = [
|
root_markers = [
|
||||||
".eslintrc"
|
".eslintrc"
|
||||||
".eslintrc.js"
|
".eslintrc.js"
|
||||||
".eslintrc.cjs"
|
".eslintrc.cjs"
|
||||||
".eslintrc.yaml"
|
".eslintrc.yaml"
|
||||||
".eslintrc.yml"
|
".eslintrc.yml"
|
||||||
".eslintrc.json"
|
".eslintrc.json"
|
||||||
"eslint.config.js"
|
"eslint.config.js"
|
||||||
"eslint.config.mjs"
|
"eslint.config.mjs"
|
||||||
"eslint.config.cjs"
|
"eslint.config.cjs"
|
||||||
"eslint.config.ts"
|
"eslint.config.ts"
|
||||||
"eslint.config.mts"
|
"eslint.config.mts"
|
||||||
"eslint.config.cts"
|
"eslint.config.cts"
|
||||||
"package.json"
|
"package.json"
|
||||||
];
|
];
|
||||||
settings = {
|
settings = {
|
||||||
validate = "on";
|
validate = "on";
|
||||||
useESLintClass = false;
|
useESLintClass = false;
|
||||||
experimental = {
|
experimental = {
|
||||||
useFlatConfig = true;
|
useFlatConfig = true;
|
||||||
|
};
|
||||||
|
codeActionOnSave = {
|
||||||
|
enable = false;
|
||||||
|
mode = "all";
|
||||||
|
};
|
||||||
|
format = true;
|
||||||
|
quiet = false;
|
||||||
|
onIgnoredFiles = "off";
|
||||||
|
rulesCustomizations = { };
|
||||||
|
run = "onType";
|
||||||
|
problems = {
|
||||||
|
shortenToSingleLine = false;
|
||||||
|
};
|
||||||
|
nodePath = "";
|
||||||
|
workingDirectory = {
|
||||||
|
mode = "location";
|
||||||
|
};
|
||||||
|
codeAction = {
|
||||||
|
disableRuleComment = {
|
||||||
|
enable = true;
|
||||||
|
location = "separateLine";
|
||||||
};
|
};
|
||||||
codeActionOnSave = {
|
showDocumentation = {
|
||||||
enable = false;
|
enable = true;
|
||||||
mode = "all";
|
|
||||||
};
|
|
||||||
format = true;
|
|
||||||
quiet = false;
|
|
||||||
onIgnoredFiles = "off";
|
|
||||||
rulesCustomizations = { };
|
|
||||||
run = "onType";
|
|
||||||
problems = {
|
|
||||||
shortenToSingleLine = false;
|
|
||||||
};
|
|
||||||
nodePath = "";
|
|
||||||
workingDirectory = {
|
|
||||||
mode = "location";
|
|
||||||
};
|
|
||||||
codeAction = {
|
|
||||||
disableRuleComment = {
|
|
||||||
enable = true;
|
|
||||||
location = "separateLine";
|
|
||||||
};
|
|
||||||
showDocumentation = {
|
|
||||||
enable = true;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
handlers = {
|
};
|
||||||
"eslint/openDoc".__raw = /* lua */ ''
|
handlers = {
|
||||||
function(_, result)
|
"eslint/openDoc".__raw = /* lua */ ''
|
||||||
if result then
|
function(_, result)
|
||||||
vim.ui.open(result.url)
|
if result then
|
||||||
end
|
vim.ui.open(result.url)
|
||||||
return {}
|
|
||||||
end
|
end
|
||||||
'';
|
return {}
|
||||||
"eslint/confirmESLintExecution" = /* lua */ ''
|
end
|
||||||
function(_, result)
|
'';
|
||||||
if not result then
|
"eslint/confirmESLintExecution" = /* lua */ ''
|
||||||
return
|
function(_, result)
|
||||||
end
|
if not result then
|
||||||
return 4 -- approved
|
return
|
||||||
end
|
|
||||||
'';
|
|
||||||
"eslint/probeFailed" = /* lua */ ''
|
|
||||||
function()
|
|
||||||
vim.notify("[lspconfig] ESLint probe failed.", vim.log.levels.WARN)
|
|
||||||
return {}
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
"eslint/noLibrary" = /* lua */ ''
|
|
||||||
function()
|
|
||||||
vim.notify("[lspconfig] Unable to find ESLint library.", vim.log.levels.WARN)
|
|
||||||
return {}
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
on_new_config.__raw = /* lua */ ''
|
|
||||||
function(config, new_root_dir)
|
|
||||||
-- This function is called when LSP attaches to a new buffer
|
|
||||||
-- Set the working directory to the root where eslint config is found
|
|
||||||
config.settings = config.settings or {}
|
|
||||||
config.settings.workspaceFolder = {
|
|
||||||
uri = new_root_dir,
|
|
||||||
name = vim.fn.fnamemodify(new_root_dir, ":t"),
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Detect flat config
|
|
||||||
local flat_config_files = {
|
|
||||||
"eslint.config.js",
|
|
||||||
"eslint.config.mjs",
|
|
||||||
"eslint.config.cjs",
|
|
||||||
"eslint.config.ts",
|
|
||||||
"eslint.config.mts",
|
|
||||||
"eslint.config.cts",
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, file in ipairs(flat_config_files) do
|
|
||||||
local config_path = new_root_dir .. "/" .. file
|
|
||||||
if vim.uv.fs_stat(config_path) then
|
|
||||||
config.settings.experimental = config.settings.experimental or {}
|
|
||||||
config.settings.experimental.useFlatConfig = true
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Support Yarn PnP
|
|
||||||
local pnp_cjs = new_root_dir .. "/.pnp.cjs"
|
|
||||||
local pnp_js = new_root_dir .. "/.pnp.js"
|
|
||||||
if vim.uv.fs_stat(pnp_cjs) or vim.uv.fs_stat(pnp_js) then
|
|
||||||
config.cmd = vim.list_extend({ "yarn", "exec" }, config.cmd or {})
|
|
||||||
end
|
end
|
||||||
|
return 4 -- approved
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
"eslint/probeFailed" = /* lua */ ''
|
||||||
|
function()
|
||||||
|
vim.notify("[lspconfig] ESLint probe failed.", vim.log.levels.WARN)
|
||||||
|
return {}
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
"eslint/noLibrary" = /* lua */ ''
|
||||||
|
function()
|
||||||
|
vim.notify("[lspconfig] Unable to find ESLint library.", vim.log.levels.WARN)
|
||||||
|
return {}
|
||||||
end
|
end
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
on_new_config.__raw = /* lua */ ''
|
||||||
biome = {
|
function(config, new_root_dir)
|
||||||
enable = true;
|
-- This function is called when LSP attaches to a new buffer
|
||||||
package = null;
|
-- Set the working directory to the root where eslint config is found
|
||||||
packageFallback = false;
|
config.settings = config.settings or {}
|
||||||
|
config.settings.workspaceFolder = {
|
||||||
|
uri = new_root_dir,
|
||||||
|
name = vim.fn.fnamemodify(new_root_dir, ":t"),
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Detect flat config
|
||||||
|
local flat_config_files = {
|
||||||
|
"eslint.config.js",
|
||||||
|
"eslint.config.mjs",
|
||||||
|
"eslint.config.cjs",
|
||||||
|
"eslint.config.ts",
|
||||||
|
"eslint.config.mts",
|
||||||
|
"eslint.config.cts",
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, file in ipairs(flat_config_files) do
|
||||||
|
local config_path = new_root_dir .. "/" .. file
|
||||||
|
if vim.uv.fs_stat(config_path) then
|
||||||
|
config.settings.experimental = config.settings.experimental or {}
|
||||||
|
config.settings.experimental.useFlatConfig = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Support Yarn PnP
|
||||||
|
local pnp_cjs = new_root_dir .. "/.pnp.cjs"
|
||||||
|
local pnp_js = new_root_dir .. "/.pnp.js"
|
||||||
|
if vim.uv.fs_stat(pnp_cjs) or vim.uv.fs_stat(pnp_js) then
|
||||||
|
config.cmd = vim.list_extend({ "yarn", "exec" }, config.cmd or {})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
biome = {
|
||||||
keymaps = [
|
enable = true;
|
||||||
{
|
package = null;
|
||||||
key = "<leader>ca";
|
packageFallback = false;
|
||||||
lspBufAction = "code_action";
|
};
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<leader>e";
|
|
||||||
action = "<cmd>lua vim.diagnostic.open_float()<cr>";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# Define diagnostic appearance
|
keymaps = [
|
||||||
diagnostic.settings = {
|
{
|
||||||
virtual_text = false;
|
key = "<leader>ca";
|
||||||
signs = true;
|
lspBufAction = "code_action";
|
||||||
underline = true;
|
}
|
||||||
update_in_insert = false;
|
{
|
||||||
severity_sort = false;
|
key = "<leader>e";
|
||||||
};
|
action = "<cmd>lua vim.diagnostic.open_float()<cr>";
|
||||||
|
}
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Define diagnostic appearance
|
||||||
|
diagnostic.settings = {
|
||||||
|
virtual_text = false;
|
||||||
|
signs = true;
|
||||||
|
underline = true;
|
||||||
|
update_in_insert = false;
|
||||||
|
severity_sort = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,50 +1,48 @@
|
||||||
{ ... }:
|
{ ... }:
|
||||||
{
|
{
|
||||||
programs.nixvim = {
|
programs.nixvim = {
|
||||||
globals = {
|
globals = {
|
||||||
mapleader = " ";
|
mapleader = " ";
|
||||||
maplocalleader = " ";
|
maplocalleader = " ";
|
||||||
};
|
|
||||||
|
|
||||||
clipboard.register = "unnamedplus";
|
|
||||||
|
|
||||||
opts = {
|
|
||||||
backup = false;
|
|
||||||
cmdheight = 1;
|
|
||||||
conceallevel = 0;
|
|
||||||
fileencoding = "utf-8";
|
|
||||||
hlsearch = true;
|
|
||||||
ignorecase = true;
|
|
||||||
mouse = "a";
|
|
||||||
pumheight = 10;
|
|
||||||
showmode = false;
|
|
||||||
smartindent = true;
|
|
||||||
breakindent = true;
|
|
||||||
showtabline = 0;
|
|
||||||
smartcase = true;
|
|
||||||
splitbelow = true;
|
|
||||||
splitright = true;
|
|
||||||
swapfile = false;
|
|
||||||
termguicolors = true;
|
|
||||||
timeoutlen = 600;
|
|
||||||
undofile = true;
|
|
||||||
updatetime = 230;
|
|
||||||
writebackup = false;
|
|
||||||
expandtab = true;
|
|
||||||
shiftwidth = 2;
|
|
||||||
tabstop = 2;
|
|
||||||
cursorline = true;
|
|
||||||
number = true;
|
|
||||||
relativenumber = true;
|
|
||||||
numberwidth = 2;
|
|
||||||
signcolumn = "yes";
|
|
||||||
linebreak = true;
|
|
||||||
breakat = " ^I!@*-+;:,./?";
|
|
||||||
scrolloff = 4;
|
|
||||||
sidescrolloff = 4;
|
|
||||||
winbar = "";
|
|
||||||
foldlevel = 99;
|
|
||||||
foldlevelstart = 99;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
clipboard.register = "unnamedplus";
|
||||||
|
|
||||||
|
opts = {
|
||||||
|
backup = false;
|
||||||
|
cmdheight = 1;
|
||||||
|
conceallevel = 0;
|
||||||
|
fileencoding = "utf-8";
|
||||||
|
hlsearch = true;
|
||||||
|
ignorecase = true;
|
||||||
|
mouse = "a";
|
||||||
|
pumheight = 10;
|
||||||
|
showmode = false;
|
||||||
|
showtabline = 0;
|
||||||
|
smartcase = true;
|
||||||
|
splitbelow = true;
|
||||||
|
splitright = true;
|
||||||
|
swapfile = false;
|
||||||
|
termguicolors = true;
|
||||||
|
timeoutlen = 600;
|
||||||
|
undofile = true;
|
||||||
|
updatetime = 230;
|
||||||
|
writebackup = false;
|
||||||
|
expandtab = true;
|
||||||
|
shiftwidth = 2;
|
||||||
|
tabstop = 2;
|
||||||
|
cursorline = true;
|
||||||
|
number = true;
|
||||||
|
relativenumber = true;
|
||||||
|
numberwidth = 2;
|
||||||
|
signcolumn = "yes";
|
||||||
|
linebreak = true;
|
||||||
|
breakat = " ^I!@*-+;:,./?";
|
||||||
|
scrolloff = 4;
|
||||||
|
sidescrolloff = 4;
|
||||||
|
winbar = "";
|
||||||
|
foldlevel = 99;
|
||||||
|
foldlevelstart = 99;
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,172 +1,172 @@
|
||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
{
|
{
|
||||||
programs.nixvim = {
|
programs.nixvim = {
|
||||||
plugins.oil = {
|
plugins.oil = {
|
||||||
enable = true;
|
enable = true;
|
||||||
settings = {
|
settings = {
|
||||||
keymaps = {
|
keymaps = {
|
||||||
"q" = "actions.close";
|
"q" = "actions.close";
|
||||||
};
|
|
||||||
columns = [
|
|
||||||
"icon"
|
|
||||||
"permissions"
|
|
||||||
"size"
|
|
||||||
"mtime"
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
columns = [
|
||||||
|
"icon"
|
||||||
|
"permissions"
|
||||||
|
"size"
|
||||||
|
"mtime"
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
extraPlugins = [ pkgs.vimPlugins.snacks-nvim ];
|
|
||||||
extraConfigLua = /* lua */ ''
|
|
||||||
local Snacks = require("snacks");
|
|
||||||
local filter_lsp_definitions = function(item)
|
|
||||||
if item.file:match("/react/ts5.0/") or item.file:match("react.d.ts") then
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
Snacks.setup({
|
|
||||||
bigfile = { enabled = true },
|
|
||||||
bufdelete = { enabled = true },
|
|
||||||
git = { enabled = true },
|
|
||||||
indent = { enabled = true },
|
|
||||||
input = { enabled = true },
|
|
||||||
notifier = { enabled = true },
|
|
||||||
picker = {
|
|
||||||
enabled = true,
|
|
||||||
prompt = "λ ",
|
|
||||||
layout = { preset = "ivy" },
|
|
||||||
},
|
|
||||||
statuscolumn = { enabled = true },
|
|
||||||
})
|
|
||||||
'';
|
|
||||||
|
|
||||||
keymaps = [
|
|
||||||
# Git
|
|
||||||
{
|
|
||||||
key = "<leader>gb";
|
|
||||||
action.__raw = "function() Snacks.git.blame_line() end";
|
|
||||||
options.desc = "Show git blame for current line";
|
|
||||||
}
|
|
||||||
# Picker
|
|
||||||
{
|
|
||||||
key = "<leader>.";
|
|
||||||
action.__raw = "function() Snacks.picker.files({ hidden = true }) end";
|
|
||||||
options.desc = "Files";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<leader><leader>";
|
|
||||||
action.__raw = "function() Snacks.picker.git_files() end";
|
|
||||||
options.desc = "Git files";
|
|
||||||
}
|
|
||||||
# Find
|
|
||||||
{
|
|
||||||
key = "<leader>fr";
|
|
||||||
action.__raw = "function() Snacks.picker.recent() end";
|
|
||||||
options.desc = "Recent";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<leader>fp";
|
|
||||||
action.__raw = "function() Snacks.picker.projects() end";
|
|
||||||
options.desc = "Projects";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<leader>bb";
|
|
||||||
action.__raw = "function() Snacks.picker.buffers() end";
|
|
||||||
options.desc = "List buffers";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<leader>bd";
|
|
||||||
action.__raw = "function() Snacks.bufdelete() end";
|
|
||||||
options.desc = "Delete buffer";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<leader>bD";
|
|
||||||
action.__raw = "function() Snacks.bufdelete.all() end";
|
|
||||||
options.desc = "Delete all buffers";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<leader>bo";
|
|
||||||
action.__raw = "function() Snacks.bufdelete.other() end";
|
|
||||||
options.desc = "Delete other buffers";
|
|
||||||
}
|
|
||||||
# Search
|
|
||||||
{
|
|
||||||
key = "<leader>ss";
|
|
||||||
action.__raw = "function() Snacks.picker.grep() end";
|
|
||||||
options.desc = "Grep";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
mode = [
|
|
||||||
"n"
|
|
||||||
"x"
|
|
||||||
];
|
|
||||||
key = "<leader>sw";
|
|
||||||
action.__raw = "function() Snacks.picker.grep_word() end";
|
|
||||||
options.desc = "Visual selection or word";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<leader>su";
|
|
||||||
action.__raw = "function() Snacks.picker.undo() end";
|
|
||||||
options.desc = "Undo History";
|
|
||||||
}
|
|
||||||
# Diagnostics
|
|
||||||
{
|
|
||||||
key = "<leader>td";
|
|
||||||
action.__raw = "function() Snacks.picker.diagnostics_buffer() end";
|
|
||||||
options.desc = "Buffer Diagnostics";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<leader>ta";
|
|
||||||
action.__raw = "function() Snacks.picker.diagnostics() end";
|
|
||||||
options.desc = "Diagnostics";
|
|
||||||
}
|
|
||||||
# LSP
|
|
||||||
{
|
|
||||||
key = "gd";
|
|
||||||
action.__raw = "function() Snacks.picker.lsp_definitions({ filter = { filter = filter_lsp_definitions } }) end";
|
|
||||||
options.desc = "Goto Definition";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "gD";
|
|
||||||
action.__raw = "function() Snacks.picker.lsp_declarations() end";
|
|
||||||
options.desc = "Goto Declaration";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "grr";
|
|
||||||
action.__raw = "function() Snacks.picker.lsp_references() end";
|
|
||||||
options = {
|
|
||||||
desc = "References";
|
|
||||||
nowait = true;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "gI";
|
|
||||||
action.__raw = "function() Snacks.picker.lsp_implementations() end";
|
|
||||||
options.desc = "Goto Implementation";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "gy";
|
|
||||||
action.__raw = "function() Snacks.picker.lsp_type_definitions() end";
|
|
||||||
options.desc = "Goto T[y]pe Definition";
|
|
||||||
}
|
|
||||||
# Notifications and highlights
|
|
||||||
{
|
|
||||||
key = "<leader>on";
|
|
||||||
action.__raw = "function() Snacks.notifier.show_history() end";
|
|
||||||
options.desc = "Open notification history";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<leader>oh";
|
|
||||||
action.__raw = "function() Snacks.picker.highlights() end";
|
|
||||||
options.desc = "List highlights";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
key = "<leader>n";
|
|
||||||
action = "<cmd>Oil<cr>";
|
|
||||||
options.desc = "Opens file explorer";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extraPlugins = [ pkgs.vimPlugins.snacks-nvim ];
|
||||||
|
extraConfigLua = /* lua */ ''
|
||||||
|
local Snacks = require("snacks");
|
||||||
|
local filter_lsp_definitions = function(item)
|
||||||
|
if item.file:match("/react/ts5.0/") or item.file:match("react.d.ts") then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
Snacks.setup({
|
||||||
|
bigfile = { enabled = true },
|
||||||
|
bufdelete = { enabled = true },
|
||||||
|
git = { enabled = true },
|
||||||
|
indent = { enabled = true },
|
||||||
|
input = { enabled = true },
|
||||||
|
notifier = { enabled = true },
|
||||||
|
picker = {
|
||||||
|
enabled = true,
|
||||||
|
prompt = "λ ",
|
||||||
|
layout = { preset = "ivy" },
|
||||||
|
},
|
||||||
|
statuscolumn = { enabled = true },
|
||||||
|
})
|
||||||
|
'';
|
||||||
|
|
||||||
|
keymaps = [
|
||||||
|
# Git
|
||||||
|
{
|
||||||
|
key = "<leader>gb";
|
||||||
|
action.__raw = "function() Snacks.git.blame_line() end";
|
||||||
|
options.desc = "Show git blame for current line";
|
||||||
|
}
|
||||||
|
# Picker
|
||||||
|
{
|
||||||
|
key = "<leader>.";
|
||||||
|
action.__raw = "function() Snacks.picker.files({ hidden = true }) end";
|
||||||
|
options.desc = "Files";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<leader><leader>";
|
||||||
|
action.__raw = "function() Snacks.picker.git_files() end";
|
||||||
|
options.desc = "Git files";
|
||||||
|
}
|
||||||
|
# Find
|
||||||
|
{
|
||||||
|
key = "<leader>fr";
|
||||||
|
action.__raw = "function() Snacks.picker.recent() end";
|
||||||
|
options.desc = "Recent";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<leader>fp";
|
||||||
|
action.__raw = "function() Snacks.picker.projects() end";
|
||||||
|
options.desc = "Projects";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<leader>bb";
|
||||||
|
action.__raw = "function() Snacks.picker.buffers() end";
|
||||||
|
options.desc = "List buffers";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<leader>bd";
|
||||||
|
action.__raw = "function() Snacks.bufdelete() end";
|
||||||
|
options.desc = "Delete buffer";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<leader>bD";
|
||||||
|
action.__raw = "function() Snacks.bufdelete.all() end";
|
||||||
|
options.desc = "Delete all buffers";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<leader>bo";
|
||||||
|
action.__raw = "function() Snacks.bufdelete.other() end";
|
||||||
|
options.desc = "Delete other buffers";
|
||||||
|
}
|
||||||
|
# Search
|
||||||
|
{
|
||||||
|
key = "<leader>ss";
|
||||||
|
action.__raw = "function() Snacks.picker.grep() end";
|
||||||
|
options.desc = "Grep";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = [
|
||||||
|
"n"
|
||||||
|
"x"
|
||||||
|
];
|
||||||
|
key = "<leader>sw";
|
||||||
|
action.__raw = "function() Snacks.picker.grep_word() end";
|
||||||
|
options.desc = "Visual selection or word";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<leader>su";
|
||||||
|
action.__raw = "function() Snacks.picker.undo() end";
|
||||||
|
options.desc = "Undo History";
|
||||||
|
}
|
||||||
|
# Diagnostics
|
||||||
|
{
|
||||||
|
key = "<leader>td";
|
||||||
|
action.__raw = "function() Snacks.picker.diagnostics_buffer() end";
|
||||||
|
options.desc = "Buffer Diagnostics";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<leader>ta";
|
||||||
|
action.__raw = "function() Snacks.picker.diagnostics() end";
|
||||||
|
options.desc = "Diagnostics";
|
||||||
|
}
|
||||||
|
# LSP
|
||||||
|
{
|
||||||
|
key = "gd";
|
||||||
|
action.__raw = "function() Snacks.picker.lsp_definitions({ filter = { filter = filter_lsp_definitions } }) end";
|
||||||
|
options.desc = "Goto Definition";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "gD";
|
||||||
|
action.__raw = "function() Snacks.picker.lsp_declarations() end";
|
||||||
|
options.desc = "Goto Declaration";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "grr";
|
||||||
|
action.__raw = "function() Snacks.picker.lsp_references() end";
|
||||||
|
options = {
|
||||||
|
desc = "References";
|
||||||
|
nowait = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "gI";
|
||||||
|
action.__raw = "function() Snacks.picker.lsp_implementations() end";
|
||||||
|
options.desc = "Goto Implementation";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "gy";
|
||||||
|
action.__raw = "function() Snacks.picker.lsp_type_definitions() end";
|
||||||
|
options.desc = "Goto T[y]pe Definition";
|
||||||
|
}
|
||||||
|
# Notifications and highlights
|
||||||
|
{
|
||||||
|
key = "<leader>on";
|
||||||
|
action.__raw = "function() Snacks.notifier.show_history() end";
|
||||||
|
options.desc = "Open notification history";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<leader>oh";
|
||||||
|
action.__raw = "function() Snacks.picker.highlights() end";
|
||||||
|
options.desc = "List highlights";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<leader>n";
|
||||||
|
action = "<cmd>Oil<cr>";
|
||||||
|
options.desc = "Opens file explorer";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue