This commit is contained in:
parent
a0575bdb2a
commit
703bf836de
210 changed files with 1 additions and 1 deletions
6
modules/nixvim/aliases.nix
Normal file
6
modules/nixvim/aliases.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
flake.modules.nixvim.custom = {
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
};
|
||||
}
|
24
modules/nixvim/auto-save.nix
Normal file
24
modules/nixvim/auto-save.nix
Normal file
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
flake.modules.nixvim.custom.plugins.auto-save = {
|
||||
enable = true;
|
||||
|
||||
settings.condition = ''
|
||||
function(buf)
|
||||
local excluded_filetypes = {
|
||||
"harpoon",
|
||||
"oil",
|
||||
}
|
||||
|
||||
local excluded_filenames = {}
|
||||
|
||||
if vim.tbl_contains(excluded_filetypes, vim.fn.getbufvar(buf, "&filetype"))
|
||||
or vim.tbl_contains(excluded_filenames, vim.fn.expand("%:t"))
|
||||
then
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
'';
|
||||
};
|
||||
}
|
6
modules/nixvim/colorscheme.nix
Normal file
6
modules/nixvim/colorscheme.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
flake.modules.nixvim.custom.colorschemes.catppuccin = {
|
||||
enable = true;
|
||||
settings.flavour = "mocha";
|
||||
};
|
||||
}
|
57
modules/nixvim/completion/cmp.nix
Normal file
57
modules/nixvim/completion/cmp.nix
Normal file
|
@ -0,0 +1,57 @@
|
|||
{
|
||||
flake.modules.nixvim.custom.plugins.cmp = {
|
||||
enable = true;
|
||||
|
||||
autoEnableSources = true;
|
||||
|
||||
settings = {
|
||||
mapping = {
|
||||
"<C-e>" = "cmp.mapping.close()";
|
||||
|
||||
"<C-h>" = ''
|
||||
cmp.mapping(function()
|
||||
if ls.locally_jumpable(-1) then
|
||||
ls.jump(-1)
|
||||
end
|
||||
end)
|
||||
'';
|
||||
|
||||
"<C-l>" = ''
|
||||
cmp.mapping(function()
|
||||
if ls.expand_or_locally_jumpable() then
|
||||
ls.expand_or_jump()
|
||||
end
|
||||
end)
|
||||
'';
|
||||
|
||||
"<C-n>" = "cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select })";
|
||||
"<C-p>" = "cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select })";
|
||||
|
||||
"<C-y>" = "cmp.mapping.confirm({ select = true })";
|
||||
|
||||
"<CR>" = "nil";
|
||||
"<S-Tab>" = "nil";
|
||||
"<Tab>" = "nil";
|
||||
};
|
||||
|
||||
snippet.expand = ''
|
||||
function(args)
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
end
|
||||
'';
|
||||
|
||||
sources = [
|
||||
{ name = "nvim_lsp"; }
|
||||
{ name = "nvim_lua"; }
|
||||
{
|
||||
name = "luasnip";
|
||||
keyword_length = 2;
|
||||
}
|
||||
{
|
||||
name = "buffer";
|
||||
keyword_length = 3;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
16
modules/nixvim/completion/luasnip.nix
Normal file
16
modules/nixvim/completion/luasnip.nix
Normal file
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
flake.modules.nixvim.custom.plugins = {
|
||||
cmp_luasnip.enable = true;
|
||||
|
||||
luasnip = {
|
||||
enable = true;
|
||||
|
||||
fromLua = [
|
||||
{
|
||||
lazyLoad = true;
|
||||
paths = ./snippets;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
10
modules/nixvim/completion/snippets/asciidoc.lua
Normal file
10
modules/nixvim/completion/snippets/asciidoc.lua
Normal file
|
@ -0,0 +1,10 @@
|
|||
return {
|
||||
s("dev", t("__Under development...__")),
|
||||
|
||||
s("source", fmta([[
|
||||
[source<options>]
|
||||
----
|
||||
<finish>
|
||||
----
|
||||
]], { finish = i(0), options = i(1) })),
|
||||
}
|
3
modules/nixvim/completion/snippets/javascript.lua
Normal file
3
modules/nixvim/completion/snippets/javascript.lua
Normal file
|
@ -0,0 +1,3 @@
|
|||
return {
|
||||
s("log", fmta("console.log(<>);", { i(1, "value") })),
|
||||
}
|
13
modules/nixvim/completion/snippets/lua.lua
Normal file
13
modules/nixvim/completion/snippets/lua.lua
Normal file
|
@ -0,0 +1,13 @@
|
|||
return {
|
||||
s(
|
||||
"req",
|
||||
fmt([[local {} = require "{}"]], {
|
||||
f(function(import_name)
|
||||
local parts = vim.split(import_name[1][1], ".", true)
|
||||
|
||||
return parts[#parts] or ""
|
||||
end, { 1 }),
|
||||
i(1),
|
||||
})
|
||||
)
|
||||
}
|
111
modules/nixvim/completion/snippets/nix.lua
Normal file
111
modules/nixvim/completion/snippets/nix.lua
Normal file
|
@ -0,0 +1,111 @@
|
|||
return {
|
||||
s("home_packages", fmta("home.packages = with pkgs; [ <> ];", i(0))),
|
||||
|
||||
s(
|
||||
"homepage_options",
|
||||
fmta(
|
||||
[[
|
||||
homepage.name = mkOption {
|
||||
default = "<name>";
|
||||
type = types.str;
|
||||
};
|
||||
|
||||
homepage.description = mkOption {
|
||||
default = "<description>";
|
||||
type = types.str;
|
||||
};
|
||||
|
||||
homepage.icon = mkOption {
|
||||
default = "<icon>";
|
||||
type = types.str;
|
||||
};
|
||||
|
||||
homepage.category = mkOption {
|
||||
default = "<finish>";
|
||||
type = types.str;
|
||||
};
|
||||
]],
|
||||
{
|
||||
description = i(2),
|
||||
finish = i(0),
|
||||
icon = i(3),
|
||||
name = i(1),
|
||||
}
|
||||
)
|
||||
),
|
||||
|
||||
s(
|
||||
"imports",
|
||||
fmta(
|
||||
[[
|
||||
{
|
||||
imports = [
|
||||
<>
|
||||
];
|
||||
}
|
||||
]],
|
||||
{ i(0) }
|
||||
)
|
||||
),
|
||||
|
||||
s(
|
||||
"new_flake",
|
||||
fmta(
|
||||
[[
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";<inputs>
|
||||
};
|
||||
|
||||
outputs =
|
||||
{ nixpkgs, ... }:
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
|
||||
inherit (pkgs) mkShell;
|
||||
in
|
||||
{
|
||||
devShells.${system}.default = mkShell {
|
||||
packages = with pkgs; [ <pkgs> ];
|
||||
};<finish>
|
||||
|
||||
formatter.${system} = pkgs.nixfmt-classic;
|
||||
};
|
||||
}
|
||||
]],
|
||||
{ inputs = i(1), pkgs = i(2), finish = i(0) }
|
||||
)
|
||||
),
|
||||
s(
|
||||
"new_module",
|
||||
fmta(
|
||||
[[
|
||||
{ config, lib, ... }:
|
||||
|
||||
let
|
||||
name = "<name>";
|
||||
cfg = config.<namespace>.${name};
|
||||
in
|
||||
{
|
||||
options.<namespace>.${name} = {
|
||||
enable = lib.mkEnableOption "Enable ${name}";<more_options>
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
<finish>
|
||||
};
|
||||
}
|
||||
]],
|
||||
{
|
||||
finish = i(0),
|
||||
more_options = i(3),
|
||||
name = i(1),
|
||||
namespace = i(2),
|
||||
},
|
||||
{ repeat_duplicates = true }
|
||||
)
|
||||
),
|
||||
|
||||
s("system_packages", fmta("environment.systemPackages = with pkgs; [<>];", i(0))),
|
||||
}
|
55
modules/nixvim/completion/snippets/php.lua
Normal file
55
modules/nixvim/completion/snippets/php.lua
Normal file
|
@ -0,0 +1,55 @@
|
|||
return {
|
||||
s("func", fmta("function <>(<>)<> {\n <>\n}<>", { i(1), i(2), i(3), i(4), i(0) })),
|
||||
|
||||
s(
|
||||
"met",
|
||||
fmta(
|
||||
[[
|
||||
<> function <>(<>)<> {
|
||||
<>
|
||||
}<>
|
||||
]],
|
||||
{ c(1, { t "public", t "protected", t "private" }), i(2), i(3), i(4), i(5), i(0) }
|
||||
)
|
||||
),
|
||||
|
||||
s("pest", fmta("<>('<>', function() {\n <>\n});", { c(1, { t "it", t "test" }), i(2), i(0) })),
|
||||
|
||||
s(
|
||||
"test",
|
||||
fmta(
|
||||
[[
|
||||
public function test<>(): void {
|
||||
<>
|
||||
}<>
|
||||
]],
|
||||
{ i(1), i(2), i(0) }
|
||||
)
|
||||
),
|
||||
|
||||
s(
|
||||
"testan",
|
||||
fmta(
|
||||
[[
|
||||
/** @test */
|
||||
public function <>(): void {
|
||||
<>
|
||||
}<>
|
||||
]],
|
||||
{ i(1), i(2), i(0) }
|
||||
)
|
||||
),
|
||||
|
||||
s(
|
||||
"testat",
|
||||
fmta(
|
||||
[[
|
||||
[#Test]
|
||||
public function <>(): void {
|
||||
<>
|
||||
}<>
|
||||
]],
|
||||
{ i(1), i(2), i(0) }
|
||||
)
|
||||
)
|
||||
}
|
54
modules/nixvim/completion/snippets/rst.lua
Normal file
54
modules/nixvim/completion/snippets/rst.lua
Normal file
|
@ -0,0 +1,54 @@
|
|||
local fmta = require("luasnip.extras.fmt").fmta
|
||||
|
||||
local fill_line = function(char)
|
||||
return function()
|
||||
local row = vim.api.nvim_win_get_cursor(0)[1]
|
||||
local lines = vim.api.nvim_buf_get_lines(0, row - 2, row, false)
|
||||
return string.rep(char, #lines[1])
|
||||
end
|
||||
end
|
||||
|
||||
return {
|
||||
s("class", t(".. class:: ", i(1))),
|
||||
|
||||
s("footer", t(".. footer:: ", i(1))),
|
||||
|
||||
s("link", t(".. _", i(1), ":")),
|
||||
|
||||
s("raw", t(".. raw:: ", i(1))),
|
||||
|
||||
-- TODO: add an optional new line and ":width" property.
|
||||
s("image", t(".. image:: ", i(1))),
|
||||
|
||||
s("head", f(fill_line "=", {})),
|
||||
|
||||
s("sub", f(fill_line "-", {})),
|
||||
|
||||
s("subsub", f(fill_line "^", {})),
|
||||
|
||||
-- Add a page break with an optional page template.
|
||||
s(
|
||||
"pb",
|
||||
fmta(
|
||||
[[
|
||||
.. raw:: pdf
|
||||
|
||||
PageBreak<>
|
||||
]],
|
||||
{ i(0) }
|
||||
)
|
||||
),
|
||||
|
||||
-- Add a new speaker note.
|
||||
s(
|
||||
"ta",
|
||||
fmta(
|
||||
[[
|
||||
.. raw:: pdf
|
||||
|
||||
TextAnnotation "<>"
|
||||
]],
|
||||
{ i(0) }
|
||||
)
|
||||
),
|
||||
}
|
19
modules/nixvim/completion/snippets/twig.lua
Normal file
19
modules/nixvim/completion/snippets/twig.lua
Normal file
|
@ -0,0 +1,19 @@
|
|||
return {
|
||||
s("do", fmta("{% <> %}<>", { i(1), i(0) })),
|
||||
s("dump", fmta("{{ dump(<>) }}<>", { i(1), i(0) })),
|
||||
s("echo", fmta("{{ <> }}<>", { i(1), i(0) })),
|
||||
|
||||
s(
|
||||
"for",
|
||||
fmta(
|
||||
[[
|
||||
{% for <> in <> %}
|
||||
<>
|
||||
{% endfor %}<>
|
||||
]],
|
||||
{ i(1), i(2), i(3), i(0) }
|
||||
)
|
||||
),
|
||||
|
||||
s("if", fmta("{% if <> %}<>{% endif %}<>", { i(1), i(2), i(0) })),
|
||||
}
|
3
modules/nixvim/conform.nix
Normal file
3
modules/nixvim/conform.nix
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
flake.modules.nixvim.custom.plugins.conform-nvim.enable = true;
|
||||
}
|
12
modules/nixvim/diagnostics.nix
Normal file
12
modules/nixvim/diagnostics.nix
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
flake.modules.nixvim.custom.diagnostic.settings = {
|
||||
signs = true;
|
||||
underline = false;
|
||||
update_in_insert = false;
|
||||
|
||||
virtual_text = {
|
||||
enable = true;
|
||||
spacing = 2;
|
||||
};
|
||||
};
|
||||
}
|
59
modules/nixvim/edit-alternate/config.nix
Normal file
59
modules/nixvim/edit-alternate/config.nix
Normal file
|
@ -0,0 +1,59 @@
|
|||
{
|
||||
flake.modules.nixvim.custom.extraConfigLua = ''
|
||||
local add_rule = function(ft, fn)
|
||||
vim.fn["edit_alternate#rule#add"](ft, fn)
|
||||
end
|
||||
|
||||
add_rule("go", function(filename)
|
||||
return filename:find "_test%.go$"
|
||||
and filename:gsub("_test%.go$", ".go")
|
||||
or filename:gsub("%.go$", "_test.go")
|
||||
end)
|
||||
|
||||
add_rule("php", function(filename)
|
||||
if filename:find "Test.php$" then
|
||||
filename = filename:gsub("Test.php$", ".php")
|
||||
|
||||
return filename:find "tests/src/"
|
||||
and filename:gsub("tests/src/(.-)/", "src/")
|
||||
or filename:gsub("tests/", "src/")
|
||||
else
|
||||
local test_filename = filename:gsub("%.php$", "Test.php")
|
||||
|
||||
if test_filename:find "modules/custom" then
|
||||
local test_types = { "Functional", "FunctionalJavaScript", "Kernel", "Unit" }
|
||||
|
||||
for _, test_type in ipairs(test_types) do
|
||||
local candidate = test_filename:gsub("src/", string.format("tests/src/%s/", test_type))
|
||||
|
||||
if vim.fn.filereadable(candidate) == 1 then
|
||||
return candidate
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return test_filename
|
||||
end
|
||||
end)
|
||||
|
||||
if vim.fn.filereadable "composer.json" == 1 then
|
||||
add_rule("json", function(filename)
|
||||
return filename:find "composer.json" and filename:gsub("%.json$", ".lock") or nil
|
||||
end)
|
||||
|
||||
add_rule("lock", function(filename)
|
||||
return filename:find "composer.lock" and filename:gsub("%.lock$", ".json") or nil
|
||||
end)
|
||||
end
|
||||
|
||||
if vim.fn.filereadable "fractal.config.js" == 1 then
|
||||
add_rule("twig", function(filename)
|
||||
return filename:gsub("%.twig$", ".config.yml")
|
||||
end)
|
||||
|
||||
add_rule("yml", function(filename)
|
||||
return filename:gsub("%.config.yml$", ".twig")
|
||||
end)
|
||||
end
|
||||
'';
|
||||
}
|
31
modules/nixvim/edit-alternate/extra-plugins.nix
Normal file
31
modules/nixvim/edit-alternate/extra-plugins.nix
Normal file
|
@ -0,0 +1,31 @@
|
|||
{ inputs, ... }:
|
||||
|
||||
{
|
||||
flake.modules.nixvim.custom =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
extraPlugins =
|
||||
let
|
||||
inherit (pkgs.vimUtils) buildVimPlugin;
|
||||
in
|
||||
[
|
||||
(buildVimPlugin {
|
||||
pname = "conf-vim";
|
||||
src = inputs.conf-vim;
|
||||
version = "unstable";
|
||||
})
|
||||
|
||||
(buildVimPlugin {
|
||||
pname = "edit-alternate-vim";
|
||||
src = inputs.edit-alternate-vim;
|
||||
version = "unstable";
|
||||
})
|
||||
|
||||
(buildVimPlugin {
|
||||
pname = "standard-vim";
|
||||
src = inputs.standard-vim;
|
||||
version = "unstable";
|
||||
})
|
||||
];
|
||||
};
|
||||
}
|
9
modules/nixvim/edit-alternate/keymaps.nix
Normal file
9
modules/nixvim/edit-alternate/keymaps.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
flake.modules.nixvim.custom.keymaps = [
|
||||
{
|
||||
action = "<cmd>EditAlternate<CR>";
|
||||
key = "<leader>ea";
|
||||
mode = "n";
|
||||
}
|
||||
];
|
||||
}
|
10
modules/nixvim/extra-packages.nix
Normal file
10
modules/nixvim/extra-packages.nix
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
flake.modules.nixvim.custom =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
extraPackages = with pkgs; [
|
||||
nixfmt-rfc-style
|
||||
stylua
|
||||
];
|
||||
};
|
||||
}
|
3
modules/nixvim/fidget.nix
Normal file
3
modules/nixvim/fidget.nix
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
flake.modules.nixvim.custom.plugins.fidget.enable = true;
|
||||
}
|
17
modules/nixvim/filetypes.nix
Normal file
17
modules/nixvim/filetypes.nix
Normal file
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
flake.modules.nixvim.custom.filetype = {
|
||||
extension = {
|
||||
"neon.dist" = "yaml";
|
||||
inc = "php";
|
||||
install = "php";
|
||||
module = "php";
|
||||
neon = "yaml";
|
||||
pcss = "scss";
|
||||
theme = "php";
|
||||
};
|
||||
|
||||
filename = {
|
||||
"composer.lock" = "json";
|
||||
};
|
||||
};
|
||||
}
|
13
modules/nixvim/flake-outputs.nix
Normal file
13
modules/nixvim/flake-outputs.nix
Normal file
|
@ -0,0 +1,13 @@
|
|||
{ config, ... }:
|
||||
|
||||
{
|
||||
perSystem =
|
||||
{ inputs', pkgs, ... }:
|
||||
{
|
||||
packages.neovim = inputs'.nixvim.legacyPackages.makeNixvimWithModule {
|
||||
inherit pkgs;
|
||||
|
||||
module = config.flake.modules.nixvim.custom;
|
||||
};
|
||||
};
|
||||
}
|
9
modules/nixvim/ftplugin/gitcommit.nix
Normal file
9
modules/nixvim/ftplugin/gitcommit.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
flake.modules.nixvim.custom.extraFiles."after/ftplugin/gitcommit.lua".text =
|
||||
# lua
|
||||
''
|
||||
vim.opt_local.colorcolumn = "50,72"
|
||||
vim.opt_local.spell = true
|
||||
vim.opt_local.textwidth = 72
|
||||
'';
|
||||
}
|
11
modules/nixvim/ftplugin/just.nix
Normal file
11
modules/nixvim/ftplugin/just.nix
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
flake.modules.nixvim.custom = {
|
||||
extraFiles."after/ftplugin/just.lua".text =
|
||||
# lua
|
||||
''
|
||||
local opt = vim.opt_local
|
||||
|
||||
opt.shiftwidth = 4
|
||||
'';
|
||||
};
|
||||
}
|
22
modules/nixvim/ftplugin/markdown.nix
Normal file
22
modules/nixvim/ftplugin/markdown.nix
Normal file
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
flake.modules.nixvim.custom = {
|
||||
plugins.cmp-path.enable = true;
|
||||
|
||||
extraFiles."after/ftplugin/markdown.lua".text =
|
||||
# lua
|
||||
''
|
||||
local opt = vim.opt_local
|
||||
|
||||
opt.spell = true
|
||||
opt.wrap = true
|
||||
|
||||
local cmp = require "cmp"
|
||||
local sources = cmp.get_config().sources
|
||||
|
||||
-- TODO: confirm these aren't aleady in the list of sources to avoid duplicate suggestions.
|
||||
table.insert(sources, { name = "path" })
|
||||
|
||||
cmp.setup.buffer { sources = sources }
|
||||
'';
|
||||
};
|
||||
}
|
18
modules/nixvim/fugitive.nix
Normal file
18
modules/nixvim/fugitive.nix
Normal file
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
flake.modules.nixvim.custom = {
|
||||
plugins.fugitive.enable = true;
|
||||
|
||||
keymaps = [
|
||||
{
|
||||
key = "<leader>gc";
|
||||
action = "<cmd>Git commit<CR><C-w>K";
|
||||
}
|
||||
|
||||
{
|
||||
# Open the ":Git" window in its own buffer, not a split.
|
||||
key = "<leader>gs";
|
||||
action = "<cmd>0Git<CR>";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
48
modules/nixvim/gitsigns.nix
Normal file
48
modules/nixvim/gitsigns.nix
Normal file
|
@ -0,0 +1,48 @@
|
|||
{
|
||||
flake.modules.nixvim.custom = {
|
||||
plugins.gitsigns.enable = true;
|
||||
|
||||
keymaps = [
|
||||
{
|
||||
action = "<cmd>Gitsigns prev_hunk<CR>";
|
||||
key = "[h";
|
||||
}
|
||||
|
||||
{
|
||||
action = "<cmd>Gitsigns next_hunk<CR>";
|
||||
key = "]h";
|
||||
}
|
||||
|
||||
{
|
||||
action = "<cmd>Gitsigns reset_hunk<CR>";
|
||||
key = "<leader>hr";
|
||||
}
|
||||
|
||||
{
|
||||
action = "<cmd>Gitsigns reset_buffer<CR>";
|
||||
key = "<leader>hR";
|
||||
}
|
||||
|
||||
{
|
||||
action = "<cmd>Gitsigns stage_hunk<CR>";
|
||||
key = "<leader>hs";
|
||||
mode = [
|
||||
"n"
|
||||
"v"
|
||||
];
|
||||
}
|
||||
|
||||
{
|
||||
action = "<cmd>Gitsigns stage_buffer<CR>";
|
||||
key = "<leader>hS";
|
||||
mode = "n";
|
||||
}
|
||||
|
||||
{
|
||||
action = "<cmd>Gitsigns undo_stage_hunk<CR>";
|
||||
key = "<leader>hu";
|
||||
mode = "x";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
45
modules/nixvim/harpoon.nix
Normal file
45
modules/nixvim/harpoon.nix
Normal file
|
@ -0,0 +1,45 @@
|
|||
let
|
||||
leaderBinding = key: command: {
|
||||
key = "<leader>${key}";
|
||||
action = "<cmd>${command}<CR>";
|
||||
options.silent = true;
|
||||
};
|
||||
in
|
||||
{
|
||||
flake.modules.nixvim.custom = {
|
||||
plugins.harpoon = {
|
||||
enable = true;
|
||||
enableTelescope = true;
|
||||
};
|
||||
|
||||
keymaps = [
|
||||
{
|
||||
key = "<leader>a";
|
||||
action.__raw = "function() require'harpoon':list():add() end";
|
||||
}
|
||||
|
||||
{
|
||||
key = "<C-e>";
|
||||
action.__raw = ''
|
||||
function()
|
||||
require 'harpoon'.ui:toggle_quick_menu(require'harpoon':list())
|
||||
end
|
||||
'';
|
||||
}
|
||||
]
|
||||
++ (map
|
||||
(num: leaderBinding "${toString num}" "lua require(\"harpoon\"):list():select(${toString num})")
|
||||
[
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
]
|
||||
);
|
||||
};
|
||||
}
|
86
modules/nixvim/keymaps.nix
Normal file
86
modules/nixvim/keymaps.nix
Normal file
|
@ -0,0 +1,86 @@
|
|||
{
|
||||
flake.modules.nixvim.custom.keymaps = [
|
||||
{
|
||||
action = "<Esc>A,<Esc>";
|
||||
key = ",,";
|
||||
mode = "i";
|
||||
}
|
||||
|
||||
{
|
||||
action = "<Esc>A;<Esc>";
|
||||
key = ";;";
|
||||
mode = "i";
|
||||
}
|
||||
|
||||
{
|
||||
action = "<cmd>!drush cache-rebuild<CR>";
|
||||
key = "<leader>dcr";
|
||||
}
|
||||
|
||||
{
|
||||
action = "<cmd>:edit todo.txt<CR>";
|
||||
key = "<leader>et";
|
||||
}
|
||||
|
||||
{
|
||||
action = "<cmd>lua vim.lsp.buf.format()<CR>";
|
||||
key = "<leader>f";
|
||||
options.silent = true;
|
||||
}
|
||||
|
||||
{
|
||||
action = "\"+y";
|
||||
key = "<leader>y";
|
||||
mode = [
|
||||
"n"
|
||||
"x"
|
||||
];
|
||||
}
|
||||
|
||||
{
|
||||
action = "@q";
|
||||
key = "Q";
|
||||
}
|
||||
|
||||
{
|
||||
action = "<cmd>silent !tmux new-window tmux-sessionizer<CR>";
|
||||
key = "<C-f>";
|
||||
options.silent = true;
|
||||
}
|
||||
|
||||
{
|
||||
action = "<Esc>:w<CR>";
|
||||
key = "<C-s>";
|
||||
mode = [
|
||||
"i"
|
||||
"n"
|
||||
];
|
||||
}
|
||||
|
||||
{
|
||||
action = "<cmd>tabnew<CR>";
|
||||
key = "<C-t>";
|
||||
}
|
||||
|
||||
{
|
||||
action = "<cmd>!composer install<CR>";
|
||||
key = "<leader>ci";
|
||||
}
|
||||
|
||||
{
|
||||
action = "<cmd>edit composer.json<CR>";
|
||||
key = "<leader>ec";
|
||||
}
|
||||
|
||||
{
|
||||
action = "<cmd>edit flake.nix<CR>";
|
||||
key = "<leader>ef";
|
||||
}
|
||||
|
||||
{
|
||||
action = "<Esc>";
|
||||
key = "jk";
|
||||
mode = "i";
|
||||
}
|
||||
];
|
||||
}
|
6
modules/nixvim/leader.nix
Normal file
6
modules/nixvim/leader.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
flake.modules.nixvim.custom.globals = {
|
||||
mapleader = " ";
|
||||
maplocalleader = " ";
|
||||
};
|
||||
}
|
3
modules/nixvim/lint.nix
Normal file
3
modules/nixvim/lint.nix
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
flake.modules.nixvim.custom.plugins.lint.enable = true;
|
||||
}
|
23
modules/nixvim/lsp.nix
Normal file
23
modules/nixvim/lsp.nix
Normal file
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
flake.modules.nixvim.custom.plugins.lsp = {
|
||||
enable = true;
|
||||
|
||||
keymaps = {
|
||||
diagnostic = {
|
||||
"<leader>dl" = "setqflist";
|
||||
};
|
||||
|
||||
lspBuf = {
|
||||
"<leader>ca" = "code_action";
|
||||
"<leader>cr" = "rename";
|
||||
K = "hover";
|
||||
gD = "declaration";
|
||||
gT = "type_definition";
|
||||
gd = "definition";
|
||||
gr = "references";
|
||||
};
|
||||
};
|
||||
|
||||
servers.phpactor.enable = true;
|
||||
};
|
||||
}
|
3
modules/nixvim/lsp/bash.nix
Normal file
3
modules/nixvim/lsp/bash.nix
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
flake.modules.nixvim.custom.lsp.servers.bashls.enable = true;
|
||||
}
|
6
modules/nixvim/lsp/css.nix
Normal file
6
modules/nixvim/lsp/css.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
flake.modules.nixvim.custom.lsp.servers = {
|
||||
cssls.enable = true;
|
||||
tailwindcss.enable = true;
|
||||
};
|
||||
}
|
3
modules/nixvim/lsp/go.nix
Normal file
3
modules/nixvim/lsp/go.nix
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
flake.modules.nixvim.custom.lsp.servers.gopls.enable = true;
|
||||
}
|
3
modules/nixvim/lsp/html.nix
Normal file
3
modules/nixvim/lsp/html.nix
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
flake.modules.nixvim.custom.lsp.servers.html.enable = true;
|
||||
}
|
6
modules/nixvim/lsp/javascript.nix
Normal file
6
modules/nixvim/lsp/javascript.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
flake.modules.nixvim.custom.plugins = {
|
||||
lsp.servers.eslint.enable = true;
|
||||
typescript-tools.enable = true;
|
||||
};
|
||||
}
|
3
modules/nixvim/lsp/lua.nix
Normal file
3
modules/nixvim/lsp/lua.nix
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
flake.modules.nixvim.custom.lsp.servers.lua_ls.enable = true;
|
||||
}
|
3
modules/nixvim/lsp/nix.nix
Normal file
3
modules/nixvim/lsp/nix.nix
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
flake.modules.nixvim.custom.lsp.servers.nixd.enable = true;
|
||||
}
|
3
modules/nixvim/lsp/php.nix
Normal file
3
modules/nixvim/lsp/php.nix
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
flake.modules.nixvim.custom.lsp.servers.phpactor.enable = true;
|
||||
}
|
15
modules/nixvim/mini.nix
Normal file
15
modules/nixvim/mini.nix
Normal file
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
flake.modules.nixvim.custom.plugins.mini = {
|
||||
enable = true;
|
||||
|
||||
modules = {
|
||||
ai = { };
|
||||
align = { };
|
||||
bracketed = { };
|
||||
move = { };
|
||||
operators = { };
|
||||
splitjoin = { };
|
||||
surround = { };
|
||||
};
|
||||
};
|
||||
}
|
23
modules/nixvim/oil.nix
Normal file
23
modules/nixvim/oil.nix
Normal file
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
flake.modules.nixvim.custom = {
|
||||
plugins.oil = {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
delete_to_trash = true;
|
||||
|
||||
keymaps."-" = "actions.parent";
|
||||
|
||||
skip_confirm_for_simple_edits = true;
|
||||
view_options.show_hidden = true;
|
||||
};
|
||||
};
|
||||
|
||||
keymaps = [
|
||||
{
|
||||
action = "<cmd>Oil<CR>";
|
||||
key = "-";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
27
modules/nixvim/options.nix
Normal file
27
modules/nixvim/options.nix
Normal file
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
flake.modules.nixvim.custom.opts = {
|
||||
expandtab = true;
|
||||
exrc = true;
|
||||
foldlevel = 1;
|
||||
foldlevelstart = 99;
|
||||
foldmethod = "indent";
|
||||
inccommand = "split";
|
||||
laststatus = 3;
|
||||
list = true;
|
||||
number = true;
|
||||
relativenumber = true;
|
||||
scrolloff = 5;
|
||||
shiftwidth = 2;
|
||||
signcolumn = "yes:1";
|
||||
smartindent = true;
|
||||
softtabstop = 2;
|
||||
splitbelow = true;
|
||||
splitright = true;
|
||||
swapfile = false;
|
||||
syntax = "on";
|
||||
tabstop = 2;
|
||||
termguicolors = true;
|
||||
updatetime = 1000;
|
||||
wrap = false;
|
||||
};
|
||||
}
|
19
modules/nixvim/phpactor.nix
Normal file
19
modules/nixvim/phpactor.nix
Normal file
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
flake.modules.nixvim.custom =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
extraPlugins = with pkgs.vimPlugins; [ phpactor ];
|
||||
|
||||
keymaps = [
|
||||
{
|
||||
key = "<leader>pm";
|
||||
action = "<cmd>PhpactorContextMenu<CR>";
|
||||
}
|
||||
|
||||
{
|
||||
key = "<leader>pn";
|
||||
action = "<cmd>PhpactorClassNew<CR>";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
54
modules/nixvim/refactoring.nix
Normal file
54
modules/nixvim/refactoring.nix
Normal file
|
@ -0,0 +1,54 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
{
|
||||
flake.modules.nixvim.custom = {
|
||||
plugins.refactoring = {
|
||||
enable = true;
|
||||
enableTelescope = true;
|
||||
};
|
||||
|
||||
keymaps = [
|
||||
{
|
||||
key = "<leader>ri";
|
||||
action = "<cmd>Refactor inline_var<CR>";
|
||||
mode = "n";
|
||||
}
|
||||
|
||||
{
|
||||
key = "<leader>re";
|
||||
action = "<cmd>Refactor extract<CR>";
|
||||
mode = "x";
|
||||
}
|
||||
|
||||
{
|
||||
key = "<leader>ri";
|
||||
action = "<cmd>Refactor inline_var<CR>";
|
||||
mode = "x";
|
||||
}
|
||||
|
||||
{
|
||||
key = "<leader>rv";
|
||||
action = "<cmd>Refactor extract_var<CR>";
|
||||
mode = "x";
|
||||
}
|
||||
];
|
||||
# ++
|
||||
# lib.optionals
|
||||
# (
|
||||
# config.flake.modules.nixvim.custom.plugins.refactoring.enable
|
||||
# && config.flake.modules.nixvim.custom.plugins.refactoring.enableTelescope
|
||||
# )
|
||||
# [
|
||||
# {
|
||||
# mode = "n";
|
||||
# key = "<leader>rR";
|
||||
# action.__raw = ''
|
||||
# function()
|
||||
# require('telescope').extensions.refactoring.refactors()
|
||||
# end
|
||||
# '';
|
||||
# options.silent = true;
|
||||
# }
|
||||
# ];
|
||||
};
|
||||
}
|
132
modules/nixvim/spell/en.utf-8.add
Normal file
132
modules/nixvim/spell/en.utf-8.add
Normal file
|
@ -0,0 +1,132 @@
|
|||
ANP
|
||||
AWS
|
||||
Acquia
|
||||
Ansible
|
||||
Appnovation
|
||||
Architected
|
||||
BAU
|
||||
Behat
|
||||
Bitbucket
|
||||
Bluecheese
|
||||
BrumPHP
|
||||
CMSes
|
||||
CTI
|
||||
Cachix
|
||||
Centarro
|
||||
CiviCRM
|
||||
Configs
|
||||
D7
|
||||
DDEV
|
||||
DevOps
|
||||
DigitalOcean
|
||||
Drupal
|
||||
Drupal's
|
||||
DrupalCamp
|
||||
DrupalCon
|
||||
DrupalEasy
|
||||
Drupaler
|
||||
Drush
|
||||
FPM
|
||||
FTSE
|
||||
GitLab
|
||||
Gitea
|
||||
HDN
|
||||
HashiCorp
|
||||
Hetzner
|
||||
Homelab
|
||||
Immich
|
||||
InvalidArgumentException
|
||||
Inviqa
|
||||
JSON
|
||||
Jellyfin
|
||||
Kickstart
|
||||
Lando
|
||||
Laravel
|
||||
Linode
|
||||
Magento
|
||||
MariaDB
|
||||
Microserve
|
||||
Mischa
|
||||
MySQL
|
||||
NGINX
|
||||
Neovim
|
||||
Netlify
|
||||
Nginx
|
||||
NixOS
|
||||
NodeInterface
|
||||
Nomensa
|
||||
OpenID
|
||||
OpenTofu
|
||||
PDOException
|
||||
PHPDoc
|
||||
PHPStan
|
||||
PHPUnit
|
||||
Packagist
|
||||
PhpStorm
|
||||
PostBuilder
|
||||
PostNodeRepository
|
||||
Pulumi
|
||||
S3
|
||||
SHA
|
||||
SQLSTATE
|
||||
SQLite
|
||||
SSO
|
||||
Sculpin
|
||||
Silex
|
||||
SimpleTest
|
||||
Sylius
|
||||
Symfony
|
||||
TODO
|
||||
TermInterface
|
||||
Themers
|
||||
Traefik
|
||||
TypeScript
|
||||
Ubercart
|
||||
VSCode
|
||||
Vaultwarden
|
||||
WCAG
|
||||
WSL
|
||||
Wellbeing
|
||||
ZSH
|
||||
Zellij
|
||||
Zettelkasten
|
||||
architected
|
||||
assertContainsOnlyInstancesOf
|
||||
assertSame
|
||||
bootcamp
|
||||
contrib
|
||||
devenv
|
||||
dotfiles
|
||||
drupal
|
||||
eCommerce
|
||||
foreach
|
||||
getPost
|
||||
ghostty
|
||||
hotfix
|
||||
isNotPublished
|
||||
isPublished
|
||||
localhost
|
||||
macOS
|
||||
mentees
|
||||
nixpkgs
|
||||
nodeStorage
|
||||
opdavies
|
||||
osCommerce
|
||||
param
|
||||
reStructuredText
|
||||
rebase
|
||||
rebasing
|
||||
roadmapping
|
||||
rst2pdf
|
||||
rwxrob
|
||||
src
|
||||
stylesheet
|
||||
stylesheets
|
||||
testbot
|
||||
tmux
|
||||
url
|
||||
vhost
|
||||
wildcard
|
||||
worktree
|
||||
worktrees
|
||||
www
|
31
modules/nixvim/telescope.nix
Normal file
31
modules/nixvim/telescope.nix
Normal file
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
flake.modules.nixvim.custom.plugins.telescope = {
|
||||
enable = true;
|
||||
|
||||
extensions = {
|
||||
live-grep-args.enable = true;
|
||||
fzf-native.enable = true;
|
||||
ui-select.enable = true;
|
||||
};
|
||||
|
||||
keymaps = {
|
||||
"<leader>/" = "current_buffer_fuzzy_find";
|
||||
"<leader>fb" = "buffers";
|
||||
"<leader>fd" = "find_files";
|
||||
"<leader>fg" = "live_grep";
|
||||
|
||||
"<leader>gw" = {
|
||||
action = "grep_string";
|
||||
mode = [
|
||||
"n"
|
||||
"v"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
settings.defaults.layout_config.prompt_position = "top";
|
||||
settings.defaults.sorting_strategy = "ascending";
|
||||
|
||||
settings.pickers.find_files.hidden = true;
|
||||
};
|
||||
}
|
50
modules/nixvim/treesitter.nix
Normal file
50
modules/nixvim/treesitter.nix
Normal file
|
@ -0,0 +1,50 @@
|
|||
{
|
||||
flake.modules.nixvim.custom =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
plugins = {
|
||||
treesitter = {
|
||||
enable = true;
|
||||
|
||||
grammarPackages = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [
|
||||
bash
|
||||
comment
|
||||
css
|
||||
csv
|
||||
dockerfile
|
||||
gitattributes
|
||||
gitignore
|
||||
go
|
||||
html
|
||||
javascript
|
||||
json
|
||||
kdl
|
||||
lua
|
||||
luadoc
|
||||
make
|
||||
markdown
|
||||
markdown_inline
|
||||
nix
|
||||
php
|
||||
phpdoc
|
||||
query
|
||||
rst
|
||||
scss
|
||||
sql
|
||||
terraform
|
||||
twig
|
||||
typescript
|
||||
vim
|
||||
vimdoc
|
||||
vue
|
||||
xml
|
||||
yaml
|
||||
];
|
||||
|
||||
settings.highlight.enable = true;
|
||||
};
|
||||
|
||||
treesitter-textobjects.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
12
modules/nixvim/undotree.nix
Normal file
12
modules/nixvim/undotree.nix
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
flake.modules.nixvim.custom = {
|
||||
plugins.undotree.enable = true;
|
||||
|
||||
keymaps = [
|
||||
{
|
||||
action = "<cmd>UndotreeToggle<CR>";
|
||||
key = "<leader>u";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
24
modules/nixvim/use-in-home.nix
Normal file
24
modules/nixvim/use-in-home.nix
Normal file
|
@ -0,0 +1,24 @@
|
|||
{ config, inputs, lib, ... }:
|
||||
|
||||
{
|
||||
flake.modules.homeManager.base =
|
||||
hmArgs@{ pkgs, ... }:
|
||||
let
|
||||
# Ideally:
|
||||
# nixvim = self.packages.${pkgs.system}.nixvim;
|
||||
# but https://github.com/danth/stylix/pull/415#issuecomment-2832398958
|
||||
neovim = inputs.nixvim.legacyPackages.${pkgs.system}.makeNixvimWithModule {
|
||||
inherit pkgs;
|
||||
|
||||
extraSpecialArgs.homeConfig = hmArgs.config;
|
||||
|
||||
module = config.flake.modules.nixvim.custom;
|
||||
};
|
||||
in
|
||||
{
|
||||
home = {
|
||||
packages = [ neovim ];
|
||||
sessionVariables.EDITOR = lib.mkForce (lib.getExe neovim);
|
||||
};
|
||||
};
|
||||
}
|
7
modules/nixvim/vim-cool.nix
Normal file
7
modules/nixvim/vim-cool.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
flake.modules.nixvim.custom =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
extraPlugins = [ pkgs.vimPlugins.vim-cool ];
|
||||
};
|
||||
}
|
7
modules/nixvim/vim-dadbod.nix
Normal file
7
modules/nixvim/vim-dadbod.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
flake.modules.nixvim.custom.plugins = {
|
||||
vim-dadbod.enable = true;
|
||||
vim-dadbod-completion.enable = true;
|
||||
vim-dadbod-ui.enable = true;
|
||||
};
|
||||
}
|
25
modules/nixvim/vim-heritage.nix
Normal file
25
modules/nixvim/vim-heritage.nix
Normal file
|
@ -0,0 +1,25 @@
|
|||
{ inputs, ... }:
|
||||
|
||||
{
|
||||
flake.modules.nixvim.custom =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
extraPlugins = [
|
||||
(pkgs.vimUtils.buildVimPlugin {
|
||||
src = inputs.vim-heritage;
|
||||
pname = "vim-heritage";
|
||||
version = "unstable";
|
||||
})
|
||||
];
|
||||
|
||||
keymaps = [
|
||||
# https://github.com/jessarcher/vim-heritage/blob/574baeb0679681a710adce5110a0d8b2ae1c2637/README.md#L28-L33
|
||||
{
|
||||
action = ":edit %:h/<cfile><cr>";
|
||||
key = "gf";
|
||||
mode = "n";
|
||||
options.silent = true;
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
11
modules/nixvim/vim-highlightedyank.nix
Normal file
11
modules/nixvim/vim-highlightedyank.nix
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
flake.modules.nixvim.custom =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
extraPlugins = [ pkgs.vimPlugins.vim-highlightedyank ];
|
||||
|
||||
extraConfigVim = ''
|
||||
let g:highlightedyank_highlight_duration = 100
|
||||
'';
|
||||
};
|
||||
}
|
20
modules/nixvim/vim-test.nix
Normal file
20
modules/nixvim/vim-test.nix
Normal file
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
flake.modules.nixvim.custom = {
|
||||
plugins.vim-test.enable = true;
|
||||
|
||||
keymaps = [
|
||||
{
|
||||
key = "<leader>tf";
|
||||
action = "<cmd>TestFile<CR>";
|
||||
}
|
||||
{
|
||||
key = "<leader>tl";
|
||||
action = "<cmd>TestLast<CR>";
|
||||
}
|
||||
{
|
||||
key = "<leader>tn";
|
||||
action = "<cmd>TestNearest<CR>";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
17
modules/nixvim/vim-textobj-xmlattr.nix
Normal file
17
modules/nixvim/vim-textobj-xmlattr.nix
Normal file
|
@ -0,0 +1,17 @@
|
|||
{ inputs, ... }:
|
||||
|
||||
{
|
||||
flake.modules.nixvim.custom =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
extraPlugins = with pkgs.vimPlugins; [
|
||||
vim-textobj-user
|
||||
|
||||
(pkgs.vimUtils.buildVimPlugin {
|
||||
src = inputs.vim-textobj-xmlattr;
|
||||
pname = "vim-textobj-xmlattr";
|
||||
version = "unstable";
|
||||
})
|
||||
];
|
||||
};
|
||||
}
|
3
modules/nixvim/web-devicons.nix
Normal file
3
modules/nixvim/web-devicons.nix
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
flake.modules.nixvim.custom.plugins.web-devicons.enable = false;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue