feat: initial nixvim configuration

This commit is contained in:
Michael Thomas 2024-06-03 17:25:35 -04:00
parent a4947f9b71
commit e64b39b896
72 changed files with 4176 additions and 21 deletions

298
flake.lock generated
View File

@ -87,6 +87,28 @@
"type": "github"
}
},
"devshell": {
"inputs": {
"flake-utils": "flake-utils_4",
"nixpkgs": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1713532798,
"narHash": "sha256-wtBhsdMJA3Wa32Wtm1eeo84GejtI43pMrFrmwLXrsEc=",
"owner": "numtide",
"repo": "devshell",
"rev": "12e914740a25ea1891ec619bb53cf5e6ca922e40",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "devshell",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
@ -119,6 +141,72 @@
"type": "github"
}
},
"flake-compat_3": {
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"revCount": 57,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz"
}
},
"flake-compat_4": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1715865404,
"narHash": "sha256-/GJvTdTpuDjNn84j82cU6bXztE0MSkdnTWClUCRub78=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "8dc45382d5206bd292f9c2768b8058a8fd8311d9",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-root": {
"locked": {
"lastModified": 1713493429,
"narHash": "sha256-ztz8JQkI08tjKnsTpfLqzWoKFQF4JGu2LRz8bkdnYUk=",
"owner": "srid",
"repo": "flake-root",
"rev": "bc748b93b86ee76e2032eecda33440ceb2532fcd",
"type": "github"
},
"original": {
"owner": "srid",
"repo": "flake-root",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems_3"
@ -177,6 +265,24 @@
"inputs": {
"systems": "systems_6"
},
"locked": {
"lastModified": 1701680307,
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_5": {
"inputs": {
"systems": "systems_7"
},
"locked": {
"lastModified": 1705309234,
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
@ -191,9 +297,9 @@
"type": "github"
}
},
"flake-utils_5": {
"flake-utils_6": {
"inputs": {
"systems": "systems_8"
"systems": "systems_9"
},
"locked": {
"lastModified": 1681202837,
@ -209,6 +315,55 @@
"type": "github"
}
},
"git-hooks": {
"inputs": {
"flake-compat": "flake-compat_4",
"gitignore": "gitignore",
"nixpkgs": [
"nixvim",
"nixpkgs"
],
"nixpkgs-stable": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1716213921,
"narHash": "sha256-xrsYFST8ij4QWaV6HEokCUNIZLjjLP1bYC60K8XiBVA=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "0e8fcc54b842ad8428c9e705cb5994eaf05c26a0",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "git-hooks.nix",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"nixvim",
"git-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
@ -251,6 +406,27 @@
"type": "github"
}
},
"home-manager_3": {
"inputs": {
"nixpkgs": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1717052710,
"narHash": "sha256-LRhOxzXmOza5SymhOgnEzA8EAQp+94kkeUYWKKpLJ/U=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "29c69d9a466e41d46fd3a7a9d0591ef9c113c2ae",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"hyprcursor": {
"inputs": {
"hyprlang": [
@ -290,11 +466,11 @@
"xdph": "xdph"
},
"locked": {
"lastModified": 1717362715,
"narHash": "sha256-EnkKVUYqVfYqJso4t8ScuuMNEge7eybpdvtPCy4uwlc=",
"lastModified": 1717442018,
"narHash": "sha256-GhL4f5CedZE0UiuzUFkMwGXD+zqlhrzo0y4FC4wQLTM=",
"ref": "refs/heads/main",
"rev": "358e59e69d27a69381bc0872b5b8d1184bc6b6a1",
"revCount": 4756,
"rev": "5517cc506b2754cb2485b1bf3e46918ee638ea6d",
"revCount": 4760,
"submodules": true,
"type": "git",
"url": "https://github.com/hyprwm/Hyprland"
@ -392,11 +568,11 @@
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1717346559,
"narHash": "sha256-SpwWUYctOViUjTp3e7x8VxwxntS1tNtpfef7YJKikgs=",
"lastModified": 1717443201,
"narHash": "sha256-a0ZXSNQvklHhUkCnX+4wGN8Bu5WkG+I85h7NcKlehdk=",
"owner": "JakeStanger",
"repo": "ironbar",
"rev": "5d1054abd8ab5e538073b75450bc1618bd537a7b",
"rev": "6e921eb567164f4ad46a7c74d665b3dc6223f928",
"type": "github"
},
"original": {
@ -423,6 +599,27 @@
"type": "github"
}
},
"nix-darwin": {
"inputs": {
"nixpkgs": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1716993688,
"narHash": "sha256-vo5k2wQekfeoq/2aleQkBN41dQiQHNTniZeVONWiWLs=",
"owner": "lnl7",
"repo": "nix-darwin",
"rev": "c0d5b8c54d6828516c97f6be9f2d00c63a363df4",
"type": "github"
},
"original": {
"owner": "lnl7",
"repo": "nix-darwin",
"type": "github"
}
},
"nix-vscode-extensions": {
"inputs": {
"flake-compat": "flake-compat",
@ -542,13 +739,41 @@
"type": "github"
}
},
"nixvim": {
"inputs": {
"devshell": "devshell",
"flake-compat": "flake-compat_3",
"flake-parts": "flake-parts",
"flake-root": "flake-root",
"git-hooks": "git-hooks",
"home-manager": "home-manager_3",
"nix-darwin": "nix-darwin",
"nixpkgs": [
"nixpkgs"
],
"treefmt-nix": "treefmt-nix"
},
"locked": {
"lastModified": 1717444597,
"narHash": "sha256-8enVHsN7hLn1hPkY1U5Cfr3rzij4FsWRUx4jjHUHZQE=",
"owner": "nix-community",
"repo": "nixvim",
"rev": "b7a8b0319098fdbaa719ef4dc375337ec4543c6e",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixvim",
"type": "github"
}
},
"nur": {
"locked": {
"lastModified": 1717429509,
"narHash": "sha256-c7mqDqNUP5BVtUZLTeglj5NjM1jvncUZy9fhydhB8RQ=",
"lastModified": 1717443933,
"narHash": "sha256-hKPYAOnbqvy/eZMsp85KRHn5+K3QkGeU8cyLiXtxT48=",
"owner": "nix-community",
"repo": "NUR",
"rev": "963de5e47dbd9550a36d90c9075b40002000547a",
"rev": "0122b0f415811dd2a367f362a595070b6451ff9a",
"type": "github"
},
"original": {
@ -567,6 +792,7 @@
"nix-vscode-extensions": "nix-vscode-extensions",
"nixos-wsl": "nixos-wsl",
"nixpkgs": "nixpkgs_4",
"nixvim": "nixvim",
"nur": "nur",
"rust-overlay": "rust-overlay_2",
"unstable": "unstable",
@ -598,15 +824,15 @@
},
"rust-overlay_2": {
"inputs": {
"flake-utils": "flake-utils_4",
"flake-utils": "flake-utils_5",
"nixpkgs": "nixpkgs_5"
},
"locked": {
"lastModified": 1717406456,
"narHash": "sha256-voWbxOZu1DM6hLOlOkLqSrZ8BsOY6F9h/tYB9C0jOXs=",
"lastModified": 1717442957,
"narHash": "sha256-w0fqHofxM2hf3pGDXCPSdH0A09v6FgHm6I38nCWA96k=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "711ff40be18b09bf096930f52e1fb2fcbee9adf0",
"rev": "025e1742de4fa75b3fb63818bd9726d17da6a102",
"type": "github"
},
"original": {
@ -735,6 +961,42 @@
"type": "github"
}
},
"systems_9": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"treefmt-nix": {
"inputs": {
"nixpkgs": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1715940852,
"narHash": "sha256-wJqHMg/K6X3JGAE9YLM0LsuKrKb4XiBeVaoeMNlReZg=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "2fba33a182602b9d49f0b2440513e5ee091d838b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
},
"unstable": {
"locked": {
"lastModified": 1717196966,
@ -752,7 +1014,7 @@
},
"utils": {
"inputs": {
"systems": "systems_7"
"systems": "systems_8"
},
"locked": {
"lastModified": 1710146030,
@ -770,7 +1032,7 @@
},
"vscode-server": {
"inputs": {
"flake-utils": "flake-utils_5",
"flake-utils": "flake-utils_6",
"nixpkgs": [
"nixpkgs"
]

View File

@ -18,6 +18,11 @@
};
utils.url = "github:numtide/flake-utils";
nixvim = {
# url = "github:nix-community/nixvim/nixos-24.05";
url = "github:nix-community/nixvim";
inputs.nixpkgs.follows = "nixpkgs";
};
rust-overlay.url = "github:oxalica/rust-overlay";
nix-vscode-extensions.url = "github:nix-community/nix-vscode-extensions";
hyprland.url = "git+https://github.com/hyprwm/Hyprland?submodules=1";
@ -67,7 +72,11 @@
in {
# Your custom packages
# Accessible through 'nix build', 'nix shell', etc
packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system});
packages = forAllSystems (system:
import ./pkgs {
pkgs = nixpkgs.legacyPackages.${system};
inherit inputs;
});
overlays = import ./overlays {inherit inputs;};

View File

@ -3,7 +3,11 @@
vscode-extensions = inputs.nix-vscode-extensions.overlays.default;
# This one brings our custom packages from the 'pkgs' directory
additions = final: _prev: import ../pkgs final.pkgs;
additions = final: _prev:
import ../pkgs {
pkgs = final.pkgs;
inherit inputs;
};
# This one contains whatever you want to overlay
# You can change versions, add patches, set compilation flags, anything really.

View File

@ -1,4 +1,5 @@
pkgs: {
{pkgs, ...} @ args: {
homer = pkgs.callPackage ./homer {};
keycloak-theme-keywind = pkgs.callPackage ./keywind {};
nvim-custom = import ./nvim/default.nix args;
}

View File

@ -0,0 +1,125 @@
{
plugins = {
bufferline = {
enable = true;
separatorStyle = "thick"; # “slant”, “padded_slant”, “slope”, “padded_slope”, “thick”, “thin”
offsets = [
{
filetype = "neo-tree";
text = "Neo-tree";
highlight = "Directory";
text_align = "left";
}
];
};
};
keymaps = [
{
mode = "n";
key = "<Tab>";
action = "<cmd>BufferLineCycleNext<cr>";
options = {
desc = "Cycle to next buffer";
};
}
{
mode = "n";
key = "<S-Tab>";
action = "<cmd>BufferLineCyclePrev<cr>";
options = {
desc = "Cycle to previous buffer";
};
}
{
mode = "n";
key = "<S-l>";
action = "<cmd>BufferLineCycleNext<cr>";
options = {
desc = "Cycle to next buffer";
};
}
{
mode = "n";
key = "<S-h>";
action = "<cmd>BufferLineCyclePrev<cr>";
options = {
desc = "Cycle to previous buffer";
};
}
{
mode = "n";
key = "<leader>bd";
action = "<cmd>bdelete<cr>";
options = {
desc = "Delete buffer";
};
}
{
mode = "n";
key = "<leader>bb";
action = "<cmd>e #<cr>";
options = {
desc = "Switch to Other Buffer";
};
}
# {
# mode = "n";
# key = "<leader>`";
# action = "<cmd>e #<cr>";
# options = {
# desc = "Switch to Other Buffer";
# };
# }
{
mode = "n";
key = "<leader>br";
action = "<cmd>BufferLineCloseRight<cr>";
options = {
desc = "Delete buffers to the right";
};
}
{
mode = "n";
key = "<leader>bl";
action = "<cmd>BufferLineCloseLeft<cr>";
options = {
desc = "Delete buffers to the left";
};
}
{
mode = "n";
key = "<leader>bo";
action = "<cmd>BufferLineCloseOthers<cr>";
options = {
desc = "Delete other buffers";
};
}
{
mode = "n";
key = "<leader>bp";
action = "<cmd>BufferLineTogglePin<cr>";
options = {
desc = "Toggle pin";
};
}
{
mode = "n";
key = "<leader>bP";
action = "<Cmd>BufferLineGroupClose ungrouped<CR>";
options = {
desc = "Delete non-pinned buffers";
};
}
];
}

View File

@ -0,0 +1,8 @@
{
colorschemes = {
base16 = {
enable = false;
colorscheme = "mountain";
};
};
}

View File

@ -0,0 +1,48 @@
{
colorschemes = {
catppuccin = {
enable = true;
settings = {
background = {
light = "macchiato";
dark = "mocha";
};
flavour = "mocha"; # "latte", "mocha", "frappe", "macchiato" or raw lua code
disable_bold = false;
disable_italic = false;
disable_underline = false;
transparent_background = true;
term_colors = true;
integrations = {
cmp = true;
noice = true;
notify = true;
neotree = true;
harpoon = true;
gitsigns = true;
which_key = true;
illuminate = {
enabled = true;
};
treesitter = true;
treesitter_context = true;
telescope.enabled = true;
indent_blankline.enabled = true;
mini.enabled = true;
native_lsp = {
enabled = true;
inlay_hints = {
background = true;
};
underlines = {
errors = ["underline"];
hints = ["underline"];
information = ["underline"];
warnings = ["underline"];
};
};
};
};
};
};
}

View File

@ -0,0 +1,14 @@
{
colorschemes = {
rose-pine = {
enable = false;
settings = {
styles = {
italic = true;
bold = true;
transparency = false;
};
};
};
};
}

View File

@ -0,0 +1,130 @@
{
plugins = {
cmp-nvim-lsp = {enable = true;}; # lsp
cmp-buffer = {enable = true;};
copilot-cmp = {enable = true;}; # copilot suggestions
cmp-path = {enable = true;}; # file system paths
cmp_luasnip = {enable = true;}; # snippets
cmp-cmdline = {enable = false;}; # autocomplete for cmdline
cmp = {
enable = true;
autoEnableSources = false;
settings = {
experimental = {
ghost_text = true;
};
};
settings = {
mapping = {
__raw = ''
cmp.mapping.preset.insert({
['<C-j>'] = cmp.mapping.select_next_item(),
['<C-k>'] = cmp.mapping.select_prev_item(),
['<C-e>'] = cmp.mapping.abort(),
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<CR>'] = cmp.mapping.confirm({ select = true }),
['<S-CR>'] = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }),
})
'';
};
snippet = {
expand = "function(args) require('luasnip').lsp_expand(args.body) end";
};
sources = {
__raw = ''
cmp.config.sources({
{name = 'nvim_lsp'},
{name = 'copilot'},
{name = 'path'},
{name = 'luasnip'},
{name = 'cmdline'},
}, {
{name = 'buffer'},
})
'';
};
performance = {
debounce = 60;
fetching_timeout = 200;
max_view_entries = 30;
};
window = {
completion = {
border = "rounded";
winhighlight = "Normal:Normal,FloatBorder:FloatBorder,CursorLine:Visual,Search:None";
};
documentation = {
border = "rounded";
};
};
formatting = {
fields = ["kind" "abbr" "menu"];
expandable_indicator = true;
};
};
};
};
extraConfigLua = ''
luasnip = require("luasnip")
kind_icons = {
Text = "󰊄",
Method = "",
Function = "󰡱",
Constructor = "",
Field = "",
Variable = "󱀍",
Class = "",
Interface = "",
Module = "󰕳",
Property = "",
Unit = "",
Value = "",
Enum = "",
Keyword = "",
Snippet = "",
Color = "",
File = "",
Reference = "",
Folder = "",
EnumMember = "",
Constant = "",
Struct = "",
Event = "",
Operator = "",
TypeParameter = "",
}
local cmp = require'cmp'
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline({'/', "?" }, {
sources = {
{ name = 'buffer' }
}
})
-- Set configuration for specific filetype.
cmp.setup.filetype('gitcommit', {
sources = cmp.config.sources({
{ name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it.
}, {
{ name = 'buffer' },
})
})
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline(':', {
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'cmdline' }
}),
}) '';
}

View File

@ -0,0 +1,46 @@
{
plugins.copilot-lua = {
enable = true;
panel = {
enabled = false;
autoRefresh = true;
keymap = {
jumpPrev = "[[";
jumpNext = "]]";
accept = "<CR>";
refresh = "gr";
open = "<M-CR>";
};
layout = {
position = "bottom"; # | top | left | right
ratio = 0.4;
};
};
suggestion = {
enabled = false;
autoTrigger = true;
debounce = 75;
keymap = {
accept = "<M-l>";
acceptWord = false;
acceptLine = false;
next = "<M-]>";
prev = "<M-[>";
dismiss = "<C-]>";
};
};
filetypes = {
yaml = false;
markdown = false;
help = false;
gitcommit = false;
gitrebase = false;
hgcommit = false;
svn = false;
cvs = false;
"." = false;
};
copilotNodeCommand = "node"; # Node.js version must be > 18.x
serverOptsOverrides = {};
};
}

View File

@ -0,0 +1,12 @@
{
plugins.lspkind = {
enable = true;
symbolMap = {
Copilot = "";
};
extraOptions = {
maxwidth = 50;
ellipsis_char = "...";
};
};
}

View File

@ -0,0 +1,222 @@
{
plugins.dap = {
enable = true;
signs = {
dapBreakpoint = {
text = "";
texthl = "DapBreakpoint";
};
dapBreakpointCondition = {
text = "";
texthl = "DapBreakpointCondition";
};
dapLogPoint = {
text = "";
texthl = "DapLogPoint";
};
};
extensions = {
dap-python = {
enable = true;
};
dap-ui = {
enable = true;
floating.mappings = {
close = ["<ESC>" "q"];
};
};
dap-virtual-text = {
enable = true;
};
};
configurations = {
java = [
{
type = "java";
request = "launch";
name = "Debug (Attach) - Remote";
hostName = "127.0.0.1";
port = 5005;
}
];
};
};
keymaps = [
{
mode = "n";
key = "<leader>dB";
action = "
<cmd>lua require('dap').set_breakpoint(vim.fn.input('Breakpoint condition: '))<cr>
";
options = {
silent = true;
desc = "Breakpoint Condition";
};
}
{
mode = "n";
key = "<leader>db";
action = ":DapToggleBreakpoint<cr>";
options = {
silent = true;
desc = "Toggle Breakpoint";
};
}
{
mode = "n";
key = "<leader>dc";
action = ":DapContinue<cr>";
options = {
silent = true;
desc = "Continue";
};
}
{
mode = "n";
key = "<leader>da";
action = "<cmd>lua require('dap').continue({ before = get_args })<cr>";
options = {
silent = true;
desc = "Run with Args";
};
}
{
mode = "n";
key = "<leader>dC";
action = "<cmd>lua require('dap').run_to_cursor()<cr>";
options = {
silent = true;
desc = "Run to cursor";
};
}
{
mode = "n";
key = "<leader>dg";
action = "<cmd>lua require('dap').goto_()<cr>";
options = {
silent = true;
desc = "Go to line (no execute)";
};
}
{
mode = "n";
key = "<leader>di";
action = ":DapStepInto<cr>";
options = {
silent = true;
desc = "Step into";
};
}
{
mode = "n";
key = "<leader>dj";
action = "
<cmd>lua require('dap').down()<cr>
";
options = {
silent = true;
desc = "Down";
};
}
{
mode = "n";
key = "<leader>dk";
action = "<cmd>lua require('dap').up()<cr>";
options = {
silent = true;
desc = "Up";
};
}
{
mode = "n";
key = "<leader>dl";
action = "<cmd>lua require('dap').run_last()<cr>";
options = {
silent = true;
desc = "Run Last";
};
}
{
mode = "n";
key = "<leader>do";
action = ":DapStepOut<cr>";
options = {
silent = true;
desc = "Step Out";
};
}
{
mode = "n";
key = "<leader>dO";
action = ":DapStepOver<cr>";
options = {
silent = true;
desc = "Step Over";
};
}
{
mode = "n";
key = "<leader>dp";
action = "<cmd>lua require('dap').pause()<cr>";
options = {
silent = true;
desc = "Pause";
};
}
{
mode = "n";
key = "<leader>dr";
action = ":DapToggleRepl<cr>";
options = {
silent = true;
desc = "Toggle REPL";
};
}
{
mode = "n";
key = "<leader>ds";
action = "<cmd>lua require('dap').session()<cr>";
options = {
silent = true;
desc = "Session";
};
}
{
mode = "n";
key = "<leader>dt";
action = ":DapTerminate<cr>";
options = {
silent = true;
desc = "Terminate";
};
}
{
mode = "n";
key = "<leader>du";
action = "<cmd>lua require('dapui').toggle()<cr>";
options = {
silent = true;
desc = "Dap UI";
};
}
{
mode = "n";
key = "<leader>dw";
action = "<cmd>lua require('dap.ui.widgets').hover()<cr>";
options = {
silent = true;
desc = "Widgets";
};
}
{
mode = ["n" "v"];
key = "<leader>de";
action = "<cmd>lua require('dapui').eval()<cr>";
options = {
silent = true;
desc = "Eval";
};
}
];
}

View File

@ -0,0 +1,84 @@
{
# Import all your configuration modules here
imports = [
./sets.nix
./keymaps.nix
./bufferlines/bufferline.nix
./colorschemes/base16.nix
./colorschemes/catppuccin.nix
./colorschemes/rose-pine.nix
./completion/cmp.nix
./completion/copilot.nix
./completion/lspkind.nix
./dap/dap.nix
./filetrees/neo-tree.nix
./git/gitsigns.nix
./git/diffview.nix
# ./git/lazygit.nix
./git/neogit.nix
./languages/nvim-jdtls.nix
./languages/nvim-lint.nix
./languages/typescript-tools-nvim.nix
./languages/treesitter/treesitter.nix
./languages/treesitter/treesitter-context.nix
./languages/treesitter/treesitter-textobjects.nix
./languages/treesitter/ts-autotag.nix
./languages/treesitter/ts-context-commentstring.nix
./lsp/conform.nix
./lsp/fidget.nix
./lsp/lsp.nix
./lsp/lspsaga.nix
./lsp/trouble.nix
./none-ls/none-ls.nix
./snippets/luasnip.nix
./statusline/lualine.nix
./statusline/staline.nix
./telescope/telescope.nix
./ui/alpha.nix
./ui/dressing-nvim.nix
./ui/indent-blankline.nix
./ui/noice.nix
./ui/nvim-notify.nix
./ui/nui.nix
./utils/better-escape.nix
./utils/neocord.nix
./utils/flash.nix
./utils/hardtime.nix
./utils/harpoon.nix
./utils/illuminate.nix
./utils/markdown-preview.nix
./utils/mini.nix
./utils/neodev.nix
./utils/neotest.nix
./utils/nvim-autopairs.nix
./utils/nvim-colorizer.nix
./utils/nvim-surround.nix
./utils/oil.nix
./utils/persistence.nix
./utils/plenary.nix
./utils/project-nvim.nix
./utils/sidebar.nix
./utils/tmux-navigator.nix
./utils/todo-comments.nix
./utils/toggleterm.nix
./utils/ultimate-autopair.nix
./utils/undotree.nix
./utils/vim-be-good.nix
./utils/wakatime.nix
./utils/whichkey.nix
./utils/wilder.nix
];
}

View File

@ -0,0 +1,64 @@
{
plugins.neo-tree = {
enable = false;
enableDiagnostics = true;
enableGitStatus = true;
enableModifiedMarkers = true;
enableRefreshOnWrite = true;
closeIfLastWindow = true;
popupBorderStyle = "rounded"; # Type: null or one of “NC”, “double”, “none”, “rounded”, “shadow”, “single”, “solid” or raw lua code
buffers = {
bindToCwd = false;
followCurrentFile = {
enabled = true;
};
};
window = {
width = 40;
height = 15;
autoExpandWidth = false;
mappings = {
"<space>" = "none";
};
};
};
# keymaps = [
# {
# mode = "n";
# key = "<leader>e";
# action = ":Neotree toggle reveal_force_cwd<cr>";
# options = {
# silent = true;
# desc = "Explorer NeoTree (root dir)";
# };
# }
# {
# mode = "n";
# key = "<leader>E";
# action = "<cmd>Neotree toggle<CR>";
# options = {
# silent = true;
# desc = "Explorer NeoTree (cwd)";
# };
# }
# {
# mode = "n";
# key = "<leader>be";
# action = ":Neotree buffers<CR>";
# options = {
# silent = true;
# desc = "Buffer explorer";
# };
# }
# {
# mode = "n";
# key = "<leader>ge";
# action = ":Neotree git_status<CR>";
# options = {
# silent = true;
# desc = "Git explorer";
# };
# }
# ];
}

View File

@ -0,0 +1,5 @@
{
plugins.diffview = {
enable = true;
};
}

View File

@ -0,0 +1,92 @@
{
plugins.gitsigns = {
enable = true;
settings = {
trouble = true;
current_line_blame = false;
};
};
keymaps = [
{
mode = ["n" "v"];
key = "<leader>gh";
action = "gitsigns";
options = {
silent = true;
desc = "+hunks";
};
}
{
mode = "n";
key = "<leader>ghb";
action = ":Gitsigns blame_line<CR>";
options = {
silent = true;
desc = "Blame line";
};
}
{
mode = "n";
key = "<leader>ghd";
action = ":Gitsigns diffthis<CR>";
options = {
silent = true;
desc = "Diff This";
};
}
{
mode = "n";
key = "<leader>ghp";
action = ":Gitsigns preview_hunk<CR>";
options = {
silent = true;
desc = "Preview hunk";
};
}
{
mode = "n";
key = "<leader>ghR";
action = ":Gitsigns reset_buffer<CR>";
options = {
silent = true;
desc = "Reset Buffer";
};
}
{
mode = ["n" "v"];
key = "<leader>ghr";
action = ":Gitsigns reset_hunk<CR>";
options = {
silent = true;
desc = "Reset Hunk";
};
}
{
mode = ["n" "v"];
key = "<leader>ghs";
action = ":Gitsigns stage_hunk<CR>";
options = {
silent = true;
desc = "Stage Hunk";
};
}
{
mode = "n";
key = "<leader>ghS";
action = ":Gitsigns stage_buffer<CR>";
options = {
silent = true;
desc = "Stage Buffer";
};
}
{
mode = "n";
key = "<leader>ghu";
action = ":Gitsigns undo_stage_hunk<CR>";
options = {
silent = true;
desc = "Undo Stage Hunk";
};
}
];
}

View File

@ -0,0 +1,20 @@
{pkgs, ...}: {
extraPlugins = with pkgs.vimPlugins; [
lazygit-nvim
];
extraConfigLua = ''
require("telescope").load_extension("lazygit")
'';
keymaps = [
{
mode = "n";
key = "<leader>gg";
action = "<cmd>LazyGit<CR>";
options = {
desc = "LazyGit (root dir)";
};
}
];
}

View File

@ -0,0 +1,12 @@
{
plugins.neogit = {
enable = true;
};
keymaps = [
{
mode = "n";
key = "<leader>gg";
action = "<cmd>Neogit<CR>";
}
];
}

View File

@ -0,0 +1,526 @@
# Thanks for the keybinds primeagen and folke!
{
globals.mapleader = " ";
# TODO: Move general mappings to which-key
keymaps = [
# Disable arrow keys
{
mode = ["n" "i"];
key = "<Up>";
action = "<Nop>";
options = {
silent = true;
noremap = true;
desc = "Disable Up arrow key";
};
}
{
mode = ["n" "i"];
key = "<Down>";
action = "<Nop>";
options = {
silent = true;
noremap = true;
desc = "Disable Down arrow key";
};
}
{
mode = ["n" "i"];
key = "<Right>";
action = "<Nop>";
options = {
silent = true;
noremap = true;
desc = "Disable Right arrow key";
};
}
{
mode = ["n" "i"];
key = "<Left>";
action = "<Nop>";
options = {
silent = true;
noremap = true;
desc = "Disable Left arrow key";
};
}
# General maps
{
mode = "n";
key = "<leader>f";
action = "+find/file";
}
{
mode = "n";
key = "<leader>s";
action = "+search";
}
{
mode = "n";
key = "<leader>q";
action = "+quit/session";
}
{
mode = ["n" "v"];
key = "<leader>g";
action = "+git";
}
{
mode = "n";
key = "<leader>u";
action = "+ui";
}
{
mode = "n";
key = "<leader>w";
action = "+windows";
}
{
mode = "n";
key = "<leader><Tab>";
action = "+tab";
}
{
mode = ["n" "v"];
key = "<leader>d";
action = "+debug";
}
{
mode = ["n" "v"];
key = "<leader>c";
action = "+code";
}
{
mode = ["n" "v"];
key = "<leader>t";
action = "+test";
}
# Tabs
{
mode = "n";
key = "<leader><tab>l";
action = "<cmd>tablast<cr>";
options = {
silent = true;
desc = "Last tab";
};
}
{
mode = "n";
key = "<leader><tab>f";
action = "<cmd>tabfirst<cr>";
options = {
silent = true;
desc = "First Tab";
};
}
{
mode = "n";
key = "<leader><tab><tab>";
action = "<cmd>tabnew<cr>";
options = {
silent = true;
desc = "New Tab";
};
}
{
mode = "n";
key = "<leader><tab>]";
action = "<cmd>tabnext<cr>";
options = {
silent = true;
desc = "Next Tab";
};
}
{
mode = "n";
key = "<leader><tab>d";
action = "<cmd>tabclose<cr>";
options = {
silent = true;
desc = "Close tab";
};
}
{
mode = "n";
key = "<leader><tab>[";
action = "<cmd>tabprevious<cr>";
options = {
silent = true;
desc = "Previous Tab";
};
}
# Windows
{
mode = "n";
key = "<leader>ww";
action = "<C-W>p";
options = {
silent = true;
desc = "Other window";
};
}
{
mode = "n";
key = "<leader>wd";
action = "<C-W>c";
options = {
silent = true;
desc = "Delete window";
};
}
{
mode = "n";
key = "<leader>w-";
action = "<C-W>s";
options = {
silent = true;
desc = "Split window below";
};
}
{
mode = "n";
key = "<leader>w|";
action = "<C-W>v";
options = {
silent = true;
desc = "Split window right";
};
}
# {
# mode = "n";
# key = "<leader>-";
# action = "<C-W>s";
# options = {
# silent = true;
# desc = "Split window below";
# };
# }
# {
# mode = "n";
# key = "<leader>|";
# action = "<C-W>v";
# options = {
# silent = true;
# desc = "Split window right";
# };
# }
{
mode = "n";
key = "<C-s>";
action = "<cmd>w<cr><esc>";
options = {
silent = true;
desc = "Save file";
};
}
# Quit/Session
{
mode = "n";
key = "<leader>qq";
action = "<cmd>quitall<cr><esc>";
options = {
silent = true;
desc = "Quit all";
};
}
{
mode = "n";
key = "<leader>qs";
action = ":lua require('persistence').load()<cr>";
options = {
silent = true;
desc = "Restore session";
};
}
{
mode = "n";
key = "<leader>ql";
action = "<cmd>lua require('persistence').load({ last = true })<cr>";
options = {
silent = true;
desc = "Restore last session";
};
}
{
mode = "n";
key = "<leader>qd";
action = "<cmd>lua require('persistence').stop()<cr>";
options = {
silent = true;
desc = "Don't save current session";
};
}
{
mode = "n";
key = "<leader>ul";
action = ":lua ToggleLineNumber()<cr>";
options = {
silent = true;
desc = "Toggle Line Numbers";
};
}
{
mode = "n";
key = "<leader>uL";
action = ":lua ToggleRelativeLineNumber()<cr>";
options = {
silent = true;
desc = "Toggle Relative Line Numbers";
};
}
{
mode = "n";
key = "<leader>uw";
action = ":lua ToggleWrap()<cr>";
options = {
silent = true;
desc = "Toggle Line Wrap";
};
}
{
mode = "v";
key = "J";
action = ":m '>+1<CR>gv=gv";
options = {
silent = true;
desc = "Move up when line is highlighted";
};
}
{
mode = "v";
key = "K";
action = ":m '<-2<CR>gv=gv";
options = {
silent = true;
desc = "Move down when line is highlighted";
};
}
{
mode = "n";
key = "J";
action = "mzJ`z";
options = {
silent = true;
desc = "Allow cursor to stay in the same place after appeding to current line";
};
}
{
mode = "v";
key = "<";
action = "<gv";
options = {
silent = true;
desc = "Indent while remaining in visual mode.";
};
}
{
mode = "v";
key = ">";
action = ">gv";
options = {
silent = true;
desc = "Indent while remaining in visual mode.";
};
}
{
mode = "n";
key = "<C-d>";
action = "<C-d>zz";
options = {
silent = true;
desc = "Allow <C-d> and <C-u> to keep the cursor in the middle";
};
}
{
mode = "n";
key = "<C-u>";
action = "<C-u>zz";
options = {
desc = "Allow C-d and C-u to keep the cursor in the middle";
};
}
# Remap for dealing with word wrap and adding jumps to the jumplist.
{
mode = "n";
key = "j";
action.__raw = "
[[(v:count > 1 ? 'm`' . v:count : 'g') . 'j']]
";
options = {
expr = true;
desc = "Remap for dealing with word wrap and adding jumps to the jumplist.";
};
}
{
mode = "n";
key = "k";
action.__raw = "
[[(v:count > 1 ? 'm`' . v:count : 'g') . 'k']]
";
options = {
expr = true;
desc = "Remap for dealing with word wrap and adding jumps to the jumplist.";
};
}
{
mode = "n";
key = "n";
action = "nzzzv";
options = {
desc = "Allow search terms to stay in the middle";
};
}
{
mode = "n";
key = "N";
action = "Nzzzv";
options = {
desc = "Allow search terms to stay in the middle";
};
}
# Paste stuff without saving the deleted word into the buffer
{
mode = "x";
key = "<leader>p";
action = "\"_dP";
options = {
desc = "Deletes to void register and paste over";
};
}
# Copy stuff to system clipboard with <leader> + y or just y to have it just in vim
{
mode = ["n" "v"];
key = "<leader>y";
action = "\"+y";
options = {
desc = "Copy to system clipboard";
};
}
{
mode = ["n" "v"];
key = "<leader>Y";
action = "\"+Y";
options = {
desc = "Copy to system clipboard";
};
}
# Delete to void register
{
mode = ["n" "v"];
key = "<leader>D";
action = "\"_d";
options = {
desc = "Delete to void register";
};
}
# <C-c> instead of pressing esc just because
{
mode = "i";
key = "<C-c>";
action = "<Esc>";
}
{
mode = "n";
key = "<C-f>";
action = "!tmux new tmux-sessionizer<CR>";
options = {
desc = "Switch between projects";
};
}
];
extraConfigLua = ''
local notify = require("notify")
local function show_notification(message, level)
notify(message, level, { title = "conform.nvim" })
end
function ToggleLineNumber()
if vim.wo.number then
vim.wo.number = false
show_notification("Line numbers disabled", "info")
else
vim.wo.number = true
vim.wo.relativenumber = false
show_notification("Line numbers enabled", "info")
end
end
function ToggleRelativeLineNumber()
if vim.wo.relativenumber then
vim.wo.relativenumber = false
show_notification("Relative line numbers disabled", "info")
else
vim.wo.relativenumber = true
vim.wo.number = false
show_notification("Relative line numbers enabled", "info")
end
end
function ToggleWrap()
if vim.wo.wrap then
vim.wo.wrap = false
show_notification("Wrap disabled", "info")
else
vim.wo.wrap = true
vim.wo.number = false
show_notification("Wrap enabled", "info")
end
end
if vim.lsp.inlay_hint then
vim.keymap.set('n', '<leader>uh', function()
vim.lsp.inlay_hint(0, nil)
end, { desc = 'Toggle Inlay Hints' })
end
'';
}

View File

@ -0,0 +1,81 @@
let
javaTestPath = "/nix/store/j3nvmhvj2pmnykw5pbm51dn0bz4cv6j3-vscode-extension-vscjava-vscode-java-test-0.38.2023032402/share/vscode/extensions/vscjava.vscode-java-test/server/com.microsoft.java.test.plugin-0.38.2.jar
";
in {
plugins.nvim-jdtls = {
enable = true;
cmd = [
"/nix/store/20h2hjjm94gbskqhbwikbgxbblv1xpf2-jdt-language-server-1.31.0/bin/jdtls"
];
# configuration = "/path/to/configuration";
data = "~/.cache/jdtls/workspace";
settings = {
java = {
signatureHelp = true;
completion = true;
};
};
initOptions = {
bundles = [
"/nix/store/b9ib40q36wxjl4xs5lng263lflz1fsi7-vscode-extension-vscjava-vscode-java-debug-0.49.2023032407/share/vscode/extensions/vscjava.vscode-java-debug/server/com.microsoft.java.debug.plugin-0.44.0.jar"
"${javaTestPath}"
];
};
};
}
#
# extraConfigLua = ''
# local jdtls = require("jdtls")
# local cmp_nvim_lsp = require("cmp_nvim_lsp")
#
# local root_dir = require("jdtls.setup").find_root({ "packageInfo" }, "Config")
# local home = os.getenv("HOME")
# local eclipse_workspace = home .. "/.local/share/eclipse/" .. vim.fn.fnamemodify(root_dir, ":p:h:t")
#
# local ws_folders_jdtls = {}
# if root_dir then
# local file = io.open(root_dir .. "/.bemol/ws_root_folders")
# if file then
# for line in file:lines() do
# table.insert(ws_folders_jdtls, "file://" .. line)
# end
# file:close()
# end
# end
#
# -- for completions
# local client_capabilities = vim.lsp.protocol.make_client_capabilities()
# local capabilities = cmp_nvim_lsp.default_capabilities(client_capabilities)
#
# local config = {
# capabilities = capabilities,
# cmd = {
# "${pkgs.jdt-language-server}/bin/jdt-language-server",
# "--jvm-arg=-javaagent:" .. home .. "/Developer/lombok.jar",
# "-data",
# eclipse_workspace,
# "--add-modules=ALL-SYSTEM",
# },
# root_dir = root_dir,
# init_options = {
# workspaceFolders = ws_folders_jdtls,
# },
# settings = {
# java = {
# signatureHelp = { enabled = true},
# completion = { enabled = true },
# },
# },
# on_attach = function(client, bufnr)
# local opts = { silent = true, buffer = bufnr }
# vim.keymap.set('n', "<leader>lo", jdtls.organize_imports, { desc = 'Organize imports', buffer = bufnr })
# vim.keymap.set('n', "<leader>df", jdtls.test_class, opts)
# vim.keymap.set('n', "<leader>dn", jdtls.test_nearest_method, opts)
# vim.keymap.set('n', '<leader>rv', jdtls.extract_variable_all, { desc = 'Extract variable', buffer = bufnr })
# vim.keymap.set('n', '<leader>rc', jdtls.extract_constant, { desc = 'Extract constant', buffer = bufnr })
# end
# }
#
# jdtls.start_or_attach(config)
# '';

View File

@ -0,0 +1,16 @@
{
plugins.lint = {
enable = true;
lintersByFt = {
nix = ["statix"];
lua = ["selene"];
python = ["flake8"];
javascript = ["eslint_d"];
javascriptreact = ["eslint_d"];
typescript = ["eslint_d"];
typescriptreact = ["eslint_d"];
json = ["jsonlint"];
java = ["checkstyle"];
};
};
}

View File

@ -0,0 +1,5 @@
{
plugins.treesitter-context = {
enable = true;
};
}

View File

@ -0,0 +1,50 @@
{
plugins.treesitter-textobjects = {
enable = false;
select = {
enable = true;
lookahead = true;
keymaps = {
"aa" = "@parameter.outer";
"ia" = "@parameter.inner";
"af" = "@function.outer";
"if" = "@function.inner";
"ac" = "@class.outer";
"ic" = "@class.inner";
"ii" = "@conditional.inner";
"ai" = "@conditional.outer";
"il" = "@loop.inner";
"al" = "@loop.outer";
"at" = "@comment.outer";
};
};
move = {
enable = true;
gotoNextStart = {
"]m" = "@function.outer";
"]]" = "@class.outer";
};
gotoNextEnd = {
"]M" = "@function.outer";
"][" = "@class.outer";
};
gotoPreviousStart = {
"[m" = "@function.outer";
"[[" = "@class.outer";
};
gotoPreviousEnd = {
"[M" = "@function.outer";
"[]" = "@class.outer";
};
};
swap = {
enable = true;
swapNext = {
"<leader>a" = "@parameters.inner";
};
swapPrevious = {
"<leader>A" = "@parameter.outer";
};
};
};
}

View File

@ -0,0 +1,8 @@
{
plugins.treesitter = {
enable = true;
indent = true;
folding = true;
nixvimInjections = true;
};
}

View File

@ -0,0 +1,5 @@
{
plugins.ts-autotag = {
enable = true;
};
}

View File

@ -0,0 +1,6 @@
{
plugins.ts-context-commentstring = {
enable = true;
disableAutoInitialization = false;
};
}

View File

@ -0,0 +1,47 @@
{
plugins.typescript-tools = {
enable = true;
onAttach = ''
function(client, bufnr)
client.server_capabilities.documentFormattingProvider = false
client.server_capabilities.documentRangeFormattingProvider = false
if vim.lsp.inlay_hint then
vim.lsp.inlay_hint(bufnr, true)
end
end
'';
settings = {
tsserverFilePreferences = {
# Inlay Hints
includeInlayParameterNameHints = "all";
includeInlayParameterNameHintsWhenArgumentMatchesName = true;
includeInlayFunctionParameterTypeHints = true;
includeInlayVariableTypeHints = true;
includeInlayVariableTypeHintsWhenTypeMatchesName = true;
includeInlayPropertyDeclarationTypeHints = true;
includeInlayFunctionLikeReturnTypeHints = true;
includeInlayEnumMemberValueHints = true;
};
};
};
keymaps = [
{
mode = "n";
key = "<leader>co";
action = "<cmd>TSToolsOrganizeImports<cr>";
options = {
desc = "Organize Imports";
};
}
{
mode = "n";
key = "<leader>cR";
action = "<cmd>TSToolsRemoveUnusedImports<cr>";
options = {
desc = "Remove Unused Imports";
};
}
];
}

View File

@ -0,0 +1,92 @@
{
plugins.conform-nvim = {
enable = true;
notifyOnError = true;
formattersByFt = {
html = [["prettierd" "prettier"]];
css = [["prettierd" "prettier"]];
javascript = [["prettierd" "prettier"]];
javascriptreact = [["prettierd" "prettier"]];
typescript = [["prettierd" "prettier"]];
typescriptreact = [["prettierd" "prettier"]];
java = ["google-java-format"];
python = ["black"];
lua = ["stylua"];
nix = ["alejandra"];
markdown = [["prettierd" "prettier"]];
rust = ["rustfmt"];
};
};
keymaps = [
{
mode = "n";
key = "<leader>uf";
action = ":FormatToggle<CR>";
options = {
desc = "Toggle Format";
silent = true;
};
}
{
mode = "n";
key = "<leader>cf";
action = "<cmd>lua require('conform').format()<cr>";
options = {
silent = true;
desc = "Format Buffer";
};
}
{
mode = "v";
key = "<leader>cF";
action = "<cmd>lua require('conform').format()<cr>";
options = {
silent = true;
desc = "Format Lines";
};
}
];
extraConfigLua = ''
local conform = require("conform")
local notify = require("notify")
conform.setup({
format_on_save = function(bufnr)
-- Disable with a global or buffer-local variable
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
return
end
return { timeout_ms = 500, lsp_fallback = true }
end,
})
local function show_notification(message, level)
notify(message, level, { title = "conform.nvim" })
end
vim.api.nvim_create_user_command("FormatToggle", function(args)
local is_global = not args.bang
if is_global then
vim.g.disable_autoformat = not vim.g.disable_autoformat
if vim.g.disable_autoformat then
show_notification("Autoformat-on-save disabled globally", "info")
else
show_notification("Autoformat-on-save enabled globally", "info")
end
else
vim.b.disable_autoformat = not vim.b.disable_autoformat
if vim.b.disable_autoformat then
show_notification("Autoformat-on-save disabled for this buffer", "info")
else
show_notification("Autoformat-on-save enabled for this buffer", "info")
end
end
end, {
desc = "Toggle autoformat-on-save",
bang = true,
})
'';
}

View File

@ -0,0 +1,99 @@
{
plugins.fidget = {
enable = true;
logger = {
level = "warn"; # “off”, “error”, “warn”, “info”, “debug”, “trace”
floatPrecision = 0.01; # Limit the number of decimals displayed for floats
};
progress = {
pollRate = 0; # How and when to poll for progress messages
suppressOnInsert = true; # Suppress new messages while in insert mode
ignoreDoneAlready = false; # Ignore new tasks that are already complete
ignoreEmptyMessage = false; # Ignore new tasks that don't contain a message
clearOnDetach =
# Clear notification group when LSP server detaches
''
function(client_id)
local client = vim.lsp.get_client_by_id(client_id)
return client and client.name or nil
end
'';
notificationGroup =
# How to get a progress message's notification group key
''
function(msg) return msg.lsp_client.name end
'';
ignore = []; # List of LSP servers to ignore
lsp = {
progressRingbufSize = 0; # Configure the nvim's LSP progress ring buffer size
};
display = {
renderLimit = 16; # How many LSP messages to show at once
doneTtl = 3; # How long a message should persist after completion
doneIcon = ""; # Icon shown when all LSP progress tasks are complete
doneStyle = "Constant"; # Highlight group for completed LSP tasks
progressTtl = "math.huge"; # How long a message should persist when in progress
progressIcon = {
pattern = "dots";
period = 1;
}; # Icon shown when LSP progress tasks are in progress
progressStyle = "WarningMsg"; # Highlight group for in-progress LSP tasks
groupStyle = "Title"; # Highlight group for group name (LSP server name)
iconStyle = "Question"; # Highlight group for group icons
priority = 30; # Ordering priority for LSP notification group
skipHistory = true; # Whether progress notifications should be omitted from history
formatMessage = ''
require ("fidget.progress.display").default_format_message
''; # How to format a progress message
formatAnnote = ''
function (msg) return msg.title end
''; # How to format a progress annotation
formatGroupName = ''
function (group) return tostring (group) end
''; # How to format a progress notification group's name
overrides = {
rust_analyzer = {
name = "rust-analyzer";
};
}; # Override options from the default notification config
};
};
notification = {
pollRate = 10; # How frequently to update and render notifications
filter = "info"; # “off”, “error”, “warn”, “info”, “debug”, “trace”
historySize = 128; # Number of removed messages to retain in history
overrideVimNotify = true;
redirect = ''
function(msg, level, opts)
if opts and opts.on_open then
return require("fidget.integration.nvim-notify").delegate(msg, level, opts)
end
end
'';
configs = {
default = "require('fidget.notification').default_config";
};
window = {
normalHl = "Comment";
winblend = 0;
border = "none"; # none, single, double, rounded, solid, shadow
zindex = 45;
maxWidth = 0;
maxHeight = 0;
xPadding = 1;
yPadding = 0;
align = "bottom";
relative = "editor";
};
view = {
stackUpwards = true; # Display notification items from bottom to top
iconSeparator = " "; # Separator between group name and icon
groupSeparator = "---"; # Separator between notification groups
groupSeparatorHl =
# Highlight group used for group separator
"Comment";
};
};
};
}

View File

@ -0,0 +1,167 @@
{
plugins = {
lsp-format = {
enable = false; # Enable it if you want lsp-format integration for none-ls
};
lsp = {
enable = true;
capabilities = "offsetEncoding = 'utf-16'";
servers = {
clangd = {enable = true;};
lua-ls = {
enable = true;
extraOptions = {
settings = {
Lua = {
completion = {
callSnippet = "Replace";
};
telemetry = {
enabled = false;
};
hint = {enable = true;};
};
};
};
};
nil_ls = {enable = true;};
tsserver = {
enable = false;
filetypes = ["javascript" "javascriptreact" "typescript" "typescriptreact"];
extraOptions = {
settings = {
javascript = {
inlayHints = {
includeInlayEnumMemberValueHints = true;
includeInlayFunctionLikeReturnTypeHints = true;
includeInlayFunctionParameterTypeHints = true;
includeInlayParameterNameHints = "all";
includeInlayParameterNameHintsWhenArgumentMatchesName = true;
includeInlayPropertyDeclarationTypeHints = true;
includeInlayVariableTypeHints = true;
};
};
typescript = {
inlayHints = {
includeInlayEnumMemberValueHints = true;
includeInlayFunctionLikeReturnTypeHints = true;
includeInlayFunctionParameterTypeHints = true;
includeInlayParameterNameHints = "all";
includeInlayParameterNameHintsWhenArgumentMatchesName = true;
includeInlayPropertyDeclarationTypeHints = true;
includeInlayVariableTypeHints = true;
};
};
};
};
};
eslint = {enable = true;};
pyright = {enable = true;};
ruff-lsp = {enable = true;};
rust-analyzer = {
enable = true;
installCargo = true;
installRustc = true;
settings = {
checkOnSave = true;
check = {
command = "clippy";
};
# inlayHints = {
# enable = true;
# showParameterNames = true;
# parameterHintsPrefix = "<- ";
# otherHintsPrefix = "=> ";
# };
procMacro = {
enable = true;
};
};
};
};
# keymaps = {
# silent = true;
# lspBuf = {
# gd = {
# action = "definition";
# desc = "Goto Definition";
# };
# gr = {
# action = "references";
# desc = "Goto References";
# };
# gD = {
# action = "declaration";
# desc = "Goto Declaration";
# };
# gI = {
# action = "implementation";
# desc = "Goto Implementation";
# };
# gT = {
# action = "type_definition";
# desc = "Type Definition";
# };
# K = {
# action = "hover";
# desc = "Hover";
# };
# "<leader>cw" = {
# action = "workspace_symbol";
# desc = "Workspace Symbol";
# };
# "<leader>cr" = {
# action = "rename";
# desc = "Rename";
# };
# "<leader>ca" = {
# action = "code_action";
# desc = "Code Action";
# };
# "<C-k>" = {
# action = "signature_help";
# desc = "Signature Help";
# };
# };
# diagnostic = {
# "<leader>cd" = {
# action = "open_float";
# desc = "Line Diagnostics";
# };
# "[d" = {
# action = "goto_next";
# desc = "Next Diagnostic";
# };
# "]d" = {
# action = "goto_prev";
# desc = "Previous Diagnostic";
# };
# };
# };
};
};
extraConfigLua = ''
local _border = "rounded"
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(
vim.lsp.handlers.hover, {
border = _border
}
)
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(
vim.lsp.handlers.signature_help, {
border = _border
}
)
vim.diagnostic.config{
float={border=_border}
};
require('lspconfig.ui.windows').default_options = {
border = _border
}
'';
}

View File

@ -0,0 +1,186 @@
{
plugins.lspsaga = {
enable = true;
beacon = {
enable = true;
};
ui = {
border = "rounded"; # One of none, single, double, rounded, solid, shadow
codeAction = "💡"; # Can be any symbol you want 💡
};
hover = {
openCmd = "!floorp"; # Choose your browser
openLink = "gx";
};
diagnostic = {
borderFollow = true;
diagnosticOnlyCurrent = false;
showCodeAction = true;
};
symbolInWinbar = {
enable = true; # Breadcrumbs
};
codeAction = {
extendGitSigns = false;
showServerName = true;
onlyInCursor = true;
numShortcut = true;
keys = {
exec = "<CR>";
quit = ["<Esc>" "q"];
};
};
lightbulb = {
enable = false;
sign = false;
virtualText = true;
};
implement = {
enable = false;
};
rename = {
autoSave = false;
keys = {
exec = "<CR>";
quit = ["<C-k>" "<Esc>"];
select = "x";
};
};
outline = {
autoClose = true;
autoPreview = true;
closeAfterJump = true;
layout = "normal"; # normal or float
winPosition = "right"; # left or right
keys = {
jump = "e";
quit = "q";
toggleOrJump = "o";
};
};
scrollPreview = {
scrollDown = "<C-f>";
scrollUp = "<C-b>";
};
};
keymaps = [
{
mode = "n";
key = "gd";
action = "<cmd>Lspsaga finder def<CR>";
options = {
desc = "Goto Definition";
silent = true;
};
}
{
mode = "n";
key = "gr";
action = "<cmd>Lspsaga finder ref<CR>";
options = {
desc = "Goto References";
silent = true;
};
}
# {
# mode = "n";
# key = "gD";
# action = "<cmd>Lspsaga show_line_diagnostics<CR>";
# options = {
# desc = "Goto Declaration";
# silent = true;
# };
# }
{
mode = "n";
key = "gI";
action = "<cmd>Lspsaga finder imp<CR>";
options = {
desc = "Goto Implementation";
silent = true;
};
}
{
mode = "n";
key = "gT";
action = "<cmd>Lspsaga peek_type_definition<CR>";
options = {
desc = "Type Definition";
silent = true;
};
}
{
mode = "n";
key = "K";
action = "<cmd>Lspsaga hover_doc<CR>";
options = {
desc = "Hover";
silent = true;
};
}
{
mode = "n";
key = "<leader>cw";
action = "<cmd>Lspsaga outline<CR>";
options = {
desc = "Outline";
silent = true;
};
}
{
mode = "n";
key = "<leader>cr";
action = "<cmd>Lspsaga rename<CR>";
options = {
desc = "Rename";
silent = true;
};
}
{
mode = "n";
key = "<leader>ca";
action = "<cmd>Lspsaga code_action<CR>";
options = {
desc = "Code Action";
silent = true;
};
}
{
mode = "n";
key = "<leader>cd";
action = "<cmd>Lspsaga show_line_diagnostics<CR>";
options = {
desc = "Line Diagnostics";
silent = true;
};
}
{
mode = "n";
key = "[d";
action = "<cmd>Lspsaga diagnostic_jump_next<CR>";
options = {
desc = "Next Diagnostic";
silent = true;
};
}
{
mode = "n";
key = "]d";
action = "<cmd>Lspsaga diagnostic_jump_prev<CR>";
options = {
desc = "Previous Diagnostic";
silent = true;
};
}
];
}

View File

@ -0,0 +1,52 @@
{
plugins.trouble = {
enable = true;
settings = {
auto_close = true;
};
};
# TODO: Add keybinds to close trouble (q would be nice), rn I need to use :x to close it...
keymaps = [
{
mode = "n";
key = "<leader>x";
action = "+diagnostics/quickfix";
}
{
mode = "n";
key = "<leader>xx";
action = "<cmd>TroubleToggle<cr>";
options = {
silent = true;
desc = "Document Diagnostics (Trouble)";
};
}
{
mode = "n";
key = "<leader>xX";
action = "<cmd>TroubleToggle workspace_diagnostics<cr>";
options = {
silent = true;
desc = "Workspace Diagnostics (Trouble)";
};
}
{
mode = "n";
key = "<leader>xt";
action = "<cmd>TroubleToggle todo<cr>";
options = {
silent = true;
desc = "Todo (Trouble)";
};
}
{
mode = "n";
key = "<leader>xQ";
action = "<cmd>TodoQuickFix<cr>";
options = {
silent = true;
desc = "Quickfix List (Trouble)";
};
}
];
}

View File

@ -0,0 +1,73 @@
{
plugins.none-ls = {
enable = false;
enableLspFormat = false;
updateInInsert = false;
onAttach = ''
function(client, bufnr)
if client.supports_method "textDocument/formatting" then
vim.api.nvim_clear_autocmds { group = augroup, buffer = bufnr }
vim.api.nvim_create_autocmd("BufWritePre", {
group = augroup,
buffer = bufnr,
callback = function()
vim.lsp.buf.format { bufnr = bufnr }
end,
})
end
end
'';
sources = {
code_actions = {
gitsigns.enable = true;
statix.enable = true;
};
diagnostics = {
checkstyle = {
enable = true;
};
statix = {
enable = true;
};
};
formatting = {
alejandra = {
enable = true;
};
prettier = {
enable = true;
withArgs = ''
{
extra_args = { "--no-semi", "--single-quote" },
}
'';
};
google_java_format = {
enable = true;
};
stylua = {
enable = true;
};
black = {
enable = true;
withArgs = ''
{
extra_args = { "--fast" },
}
'';
};
};
};
};
# keymaps = [
# {
# mode = [ "n" "v" ];
# key = "<leader>cf";
# action = "<cmd>lua vim.lsp.buf.format()<cr>";
# options = {
# silent = true;
# desc = "Format";
# };
# }
# ];
}

145
pkgs/nvim/config/sets.nix Normal file
View File

@ -0,0 +1,145 @@
{
pkgs,
lib,
config,
...
}: {
config = {
opts = {
# Enable relative line numbers
number = true;
relativenumber = true;
# Set tabs to 2 spaces
tabstop = 2;
softtabstop = 2;
showtabline = 2;
expandtab = true;
# Enable auto indenting and set it to spaces
smartindent = true;
shiftwidth = 2;
# Enable smart indenting (see https://stackoverflow.com/questions/1204149/smart-wrap-in-vim)
breakindent = true;
# Enable incremental searching
hlsearch = true;
incsearch = true;
# Enable text wrap
wrap = true;
# Better splitting
splitbelow = true;
splitright = true;
# Enable mouse mode
mouse = "a"; # Mouse
# Enable ignorecase + smartcase for better searching
ignorecase = true;
smartcase = true; # Don't ignore case with capitals
grepprg = "rg --vimgrep";
grepformat = "%f:%l:%c:%m";
# Decrease updatetime
updatetime = 50; # faster completion (4000ms default)
# Set completeopt to have a better completion experience
completeopt = ["menuone" "noselect" "noinsert"]; # mostly just for cmp
# Enable persistent undo history
swapfile = false;
backup = false;
undofile = true;
# Enable 24-bit colors
termguicolors = true;
# Enable the sign column to prevent the screen from jumping
signcolumn = "yes";
# Enable cursor line highlight
cursorline = true; # Highlight the line where the cursor is located
# Set fold settings
# These options were reccommended by nvim-ufo
# See: https://github.com/kevinhwang91/nvim-ufo#minimal-configuration
foldcolumn = "0";
foldlevel = 99;
foldlevelstart = 99;
foldenable = true;
# Always keep 8 lines above/below cursor unless at start/end of file
scrolloff = 8;
# Place a column line
colorcolumn = "80";
# Reduce which-key timeout to 10ms
timeoutlen = 10;
# Set encoding type
encoding = "utf-8";
fileencoding = "utf-8";
# Change cursor options
guicursor = [
"n-v-c:block" # Normal, visual, command-line: block cursor
"i-ci-ve:block" # Insert, command-line insert, visual-exclude: vertical bar cursor with block cursor, use "ver25" for 25% width
"r-cr:hor20" # Replace, command-line replace: horizontal bar cursor with 20% height
"o:hor50" # Operator-pending: horizontal bar cursor with 50% height
"a:blinkwait700-blinkoff400-blinkon250-Cursor/lCursor" # All modes: blinking settings
"sm:block-blinkwait175-blinkoff150-blinkon175" # Showmatch: block cursor with specific blinking settings
];
# Enable chars list
list = true; # Show invisible characters (tabs, eol, ...)
listchars = "eol:,tab:|->,lead:·,space: ,trail:,extends:,precedes:,nbsp:";
# More space in the neovim command line for displaying messages
cmdheight = 2;
# We don't need to see things like INSERT anymore
showmode = false;
# Maximum number of items to show in the popup menu (0 means "use available screen space")
pumheight = 0;
# Use conform-nvim for gq formatting. ('formatexpr' is set to vim.lsp.formatexpr(), so you can format lines via gq if the language server supports it)
formatexpr = "v:lua.require'conform'.formatexpr()";
laststatus = 3; # (https://neovim.io/doc/user/options.html#'laststatus')
};
extraConfigLua = ''
local opt = vim.opt
local g = vim.g
local o = vim.o
-- Neovide
if g.neovide then
-- Neovide options
g.neovide_fullscreen = false
g.neovide_hide_mouse_when_typing = false
g.neovide_refresh_rate = 165
g.neovide_cursor_vfx_mode = "ripple"
g.neovide_cursor_animate_command_line = true
g.neovide_cursor_animate_in_insert_mode = true
g.neovide_cursor_vfx_particle_lifetime = 5.0
g.neovide_cursor_vfx_particle_density = 14.0
g.neovide_cursor_vfx_particle_speed = 12.0
g.neovide_transparency = 0.8
-- Neovide Fonts
o.guifont = "MonoLisa Trial:Medium:h15"
-- o.guifont = "CommitMono:Medium:h15"
-- o.guifont = "JetBrainsMono Nerd Font:h14:Medium:i"
-- o.guifont = "FiraMono Nerd Font:Medium:h14"
-- o.guifont = "CaskaydiaCove Nerd Font:h14:b:i"
-- o.guifont = "BlexMono Nerd Font Mono:h14:Medium:i"
-- o.guifont = "Liga SFMono Nerd Font:b:h15"
end
'';
};
}

View File

@ -0,0 +1,19 @@
{
pkgs,
config,
...
}: {
plugins.luasnip = {
enable = true;
extraConfig = {
enable_autosnippets = true;
store_selection_keys = "<Tab>";
};
fromVscode = [
{
lazyLoad = true;
paths = "${pkgs.vimPlugins.friendly-snippets}";
}
];
};
}

View File

@ -0,0 +1,33 @@
{
plugins.lualine = {
enable = false;
alwaysDivideMiddle = true;
globalstatus = true;
ignoreFocus = ["neo-tree"];
extensions = ["fzf"];
theme = "auto";
componentSeparators = {
left = "|";
right = "|";
};
sectionSeparators = {
left = ""; # 
right = ""; # 
};
sections = {
lualine_a = ["mode"];
lualine_b = [
{
name = "branch";
icon = "";
}
"diff"
"diagnostics"
];
lualine_c = ["filename"];
lualine_x = ["filetype"];
lualine_y = ["progress"];
lualine_z = [''" " .. os.date("%R")''];
};
};
}

View File

@ -0,0 +1,65 @@
{pkgs, ...}: {
extraPlugins = with pkgs.vimUtils; [
(buildVimPlugin {
pname = "staline.nvim";
version = "2024-02-05";
src = pkgs.fetchFromGitHub {
owner = "tamton-aquib";
repo = "staline.nvim";
rev = "a53f869278b8b186a5afd6f21680cd103c381599";
hash = "sha256-GDMKzxFDtQk5LL+rMsxTGTyLv69w5NUd+u19noeO5ws=";
};
})
];
extraConfigLua = ''
require("staline").setup({
sections = {
left = { "-mode", " ", "branch" },
mid = { "lsp_name" },
right = { "file_name", "line_column" },
},
inactive_sections = {
left = { "-mode", " ", "branch" },
mid = { "lsp_name" },
right = { "file_name", "line_column" },
},
defaults = {
left_separator = " ",
right_separator = " ",
branch_symbol = " ",
mod_symbol = "",
line_column = "[%l/%L]",
inactive_color = "#80a6f2", --#303030 is the default
inactive_bgcolor = "none",
},
special_table = {
lazy = { "Plugins", "💤 " },
TelescopePrompt = { "Telescope", " " },
oil = { "Oil", "󰏇 " },
lazygit = { "LazyGit", " " },
},
mode_icons = {
["n"] = "NORMAL",
["no"] = "NORMAL",
["nov"] = "NORMAL",
["noV"] = "NORMAL",
["niI"] = "NORMAL",
["niR"] = "NORMAL",
["niV"] = "NORMAL",
["i"] = "INSERT",
["ic"] = "INSERT",
["ix"] = "INSERT",
["s"] = "INSERT",
["S"] = "INSERT",
["v"] = "VISUAL",
["V"] = "VISUAL",
[""] = "VISUAL",
["r"] = "REPLACE",
["r?"] = "REPLACE",
["R"] = "REPLACE",
["c"] = "COMMAND",
["t"] = "TERMINAL",
},
})
'';
}

View File

@ -0,0 +1,178 @@
{
plugins.telescope = {
enable = true;
extensions = {
fzf-native = {
enable = true;
};
ui-select = {
settings = {
specific_opts = {
codeactions = true;
};
};
};
undo = {
enable = true;
};
};
# If you'd prefer Telescope not to enter a normal-like mode when hitting escape (and instead exiting), you can map <Esc> to do so via:
settings = {
defaults = {
mappings = {
i = {
"<esc>" = {
__raw = ''
function(...)
return require("telescope.actions").close(...)
end'';
};
};
};
};
};
keymaps = {
"<leader><space>" = {
action = "find_files, {}";
options.desc = "Find project files";
};
"<leader>/" = {
action = "live_grep";
options.desc = "Grep (root dir)";
};
"<leader>:" = {
action = "command_history, {}";
options.desc = "Command History";
};
"<leader>b" = {
action = "buffers, {}";
options.desc = "+buffer";
};
"<leader>ff" = {
action = "find_files, {}";
options.desc = "Find project files";
};
"<leader>fr" = {
action = "oldfiles, {}";
options.desc = "Recent";
};
"<leader>fb" = {
action = "buffers, {}";
options.desc = "Buffers";
};
"<C-p>" = {
action = "git_files, {}";
options.desc = "Search git files";
};
"<leader>gc" = {
action = "git_commits, {}";
options.desc = "Commits";
};
"<leader>gs" = {
action = "git_status, {}";
options.desc = "Status";
};
"<leader>sa" = {
action = "autocommands, {}";
options.desc = "Auto Commands";
};
"<leader>sb" = {
action = "current_buffer_fuzzy_find, {}";
options.desc = "Buffer";
};
"<leader>sc" = {
action = "command_history, {}";
options.desc = "Command History";
};
"<leader>sC" = {
action = "commands, {}";
options.desc = "Commands";
};
"<leader>sD" = {
action = "diagnostics, {}";
options.desc = "Workspace diagnostics";
};
"<leader>sh" = {
action = "help_tags, {}";
options.desc = "Help pages";
};
"<leader>sH" = {
action = "highlights, {}";
options.desc = "Search Highlight Groups";
};
"<leader>sk" = {
action = "keymaps, {}";
options.desc = "Keymaps";
};
"<leader>sM" = {
action = "man_pages, {}";
options.desc = "Man pages";
};
"<leader>sm" = {
action = "marks, {}";
options.desc = "Jump to Mark";
};
"<leader>so" = {
action = "vim_options, {}";
options.desc = "Options";
};
"<leader>sR" = {
action = "resume, {}";
options.desc = "Resume";
};
"<leader>uC" = {
action = "colorscheme, {}";
options.desc = "Colorscheme preview";
};
};
};
keymaps = [
{
mode = "n";
key = "<leader>fp";
action = "<cmd>Telescope projects<CR>";
options = {
desc = "Projects";
};
}
{
mode = "n";
key = "<leader>sd";
action = "<cmd>Telescope diagnostics bufnr=0<cr>";
options = {
desc = "Document diagnostics";
};
}
{
mode = "n";
key = "<leader>st";
action = "<cmd>TodoTelescope<cr>";
options = {
silent = true;
desc = "Todo (Telescope)";
};
}
# {
# mode = "n";
# key = "<leader>,";
# action = "<cmd>Telescope buffers sort_mru=true sort_lastused=true<cr>";
# options = {
# desc = "Switch Buffer";
# };
# }
];
extraConfigLua = ''
local telescope = require('telescope')
telescope.setup{
pickers = {
colorscheme = {
enable_preview = true
}
}
}
'';
}

View File

@ -0,0 +1,191 @@
{
plugins.alpha = {
enable = true;
theme = null;
iconsEnabled = true;
layout = let
padding = val: {
type = "padding";
inherit val;
};
in [
(padding 4)
{
opts = {
hl = "AlphaHeader";
position = "center";
};
type = "text";
val = [
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" git@github.com:redyf "
];
}
(padding 2)
{
type = "button";
val = " Find File";
on_press.raw = "require('telescope.builtin').find_files";
opts = {
# hl = "comment";
keymap = [
"n"
"f"
":Telescope find_files <CR>"
{
noremap = true;
silent = true;
nowait = true;
}
];
shortcut = "f";
position = "center";
cursor = 3;
width = 38;
align_shortcut = "right";
hl_shortcut = "Keyword";
};
}
(padding 1)
{
type = "button";
val = " New File";
on_press.__raw = "function() vim.cmd[[ene]] end";
opts = {
# hl = "comment";
keymap = [
"n"
"n"
":ene <BAR> startinsert <CR>"
{
noremap = true;
silent = true;
nowait = true;
}
];
shortcut = "n";
position = "center";
cursor = 3;
width = 38;
align_shortcut = "right";
hl_shortcut = "Keyword";
};
}
(padding 1)
{
type = "button";
val = "󰈚 Recent Files";
on_press.raw = "require('telescope.builtin').oldfiles";
opts = {
# hl = "comment";
keymap = [
"n"
"r"
":Telescope oldfiles <CR>"
{
noremap = true;
silent = true;
nowait = true;
}
];
shortcut = "r";
position = "center";
cursor = 3;
width = 38;
align_shortcut = "right";
hl_shortcut = "Keyword";
};
}
(padding 1)
{
type = "button";
val = "󰈭 Find Word";
on_press.raw = "require('telescope.builtin').live_grep";
opts = {
# hl = "comment";
keymap = [
"n"
"g"
":Telescope live_grep <CR>"
{
noremap = true;
silent = true;
nowait = true;
}
];
shortcut = "g";
position = "center";
cursor = 3;
width = 38;
align_shortcut = "right";
hl_shortcut = "Keyword";
};
}
(padding 1)
{
type = "button";
val = " Restore Session";
on_press.raw = "require('persistence').load()";
opts = {
# hl = "comment";
keymap = [
"n"
"s"
":lua require('persistence').load()<cr>"
{
noremap = true;
silent = true;
nowait = true;
}
];
shortcut = "s";
position = "center";
cursor = 3;
width = 38;
align_shortcut = "right";
hl_shortcut = "Keyword";
};
}
(padding 1)
{
type = "button";
val = " Quit Neovim";
on_press.__raw = "function() vim.cmd[[qa]] end";
opts = {
# hl = "comment";
keymap = [
"n"
"q"
":qa<CR>"
{
noremap = true;
silent = true;
nowait = true;
}
];
shortcut = "q";
position = "center";
cursor = 3;
width = 38;
align_shortcut = "right";
hl_shortcut = "Keyword";
};
}
];
};
}

View File

@ -0,0 +1,171 @@
{pkgs, ...}: {
extraPlugins = with pkgs.vimPlugins; [
dressing-nvim
];
extraConfigLua = ''
require("dressing").setup({
input = {
-- Set to false to disable the vim.ui.input implementation
enabled = true,
-- Default prompt string
default_prompt = "Input",
-- Trim trailing `:` from prompt
trim_prompt = true,
-- Can be 'left', 'right', or 'center'
title_pos = "left",
-- When true, <Esc> will close the modal
insert_only = true,
-- When true, input will start in insert mode.
start_in_insert = true,
-- These are passed to nvim_open_win
border = "rounded",
-- 'editor' and 'win' will default to being centered
relative = "cursor",
-- These can be integers or a float between 0 and 1 (e.g. 0.4 for 40%)
prefer_width = 40,
width = nil,
-- min_width and max_width can be a list of mixed types.
-- min_width = {20, 0.2} means "the greater of 20 columns or 20% of total"
max_width = { 140, 0.9 },
min_width = { 20, 0.2 },
buf_options = {},
win_options = {
-- Disable line wrapping
wrap = false,
-- Indicator for when text exceeds window
list = true,
listchars = "precedes:,extends:",
-- Increase this for more context when text scrolls off the window
sidescrolloff = 0,
},
-- Set to `false` to disable
mappings = {
n = {
["<Esc>"] = "Close",
["<CR>"] = "Confirm",
},
i = {
["<C-c>"] = "Close",
["<CR>"] = "Confirm",
["<Up>"] = "HistoryPrev",
["<Down>"] = "HistoryNext",
},
},
override = function(conf)
-- This is the config that will be passed to nvim_open_win.
-- Change values here to customize the layout
return conf
end,
-- see :help dressing_get_config
get_config = nil,
},
select = {
-- Set to false to disable the vim.ui.select implementation
enabled = true,
-- Priority list of preferred vim.select implementations
backend = { "telescope", "fzf_lua", "fzf", "builtin", "nui" },
-- Trim trailing `:` from prompt
trim_prompt = true,
-- Options for telescope selector
-- These are passed into the telescope picker directly. Can be used like:
-- telescope = require('telescope.themes').get_ivy({...})
telescope = nil,
-- Options for fzf selector
fzf = {
window = {
width = 0.5,
height = 0.4,
},
},
-- Options for fzf-lua
fzf_lua = {
-- winopts = {
-- height = 0.5,
-- width = 0.5,
-- },
},
-- Options for nui Menu
nui = {
position = "50%",
size = nil,
relative = "editor",
border = {
style = "rounded",
},
buf_options = {
swapfile = false,
filetype = "DressingSelect",
},
win_options = {
winblend = 0,
},
max_width = 80,
max_height = 40,
min_width = 40,
min_height = 10,
},
-- Options for built-in selector
builtin = {
-- Display numbers for options and set up keymaps
show_numbers = true,
-- These are passed to nvim_open_win
border = "rounded",
-- 'editor' and 'win' will default to being centered
relative = "editor",
buf_options = {},
win_options = {
cursorline = true,
cursorlineopt = "both",
},
-- These can be integers or a float between 0 and 1 (e.g. 0.4 for 40%)
-- the min_ and max_ options can be a list of mixed types.
-- max_width = {140, 0.8} means "the lesser of 140 columns or 80% of total"
width = nil,
max_width = { 140, 0.8 },
min_width = { 40, 0.2 },
height = nil,
max_height = 0.9,
min_height = { 10, 0.2 },
-- Set to `false` to disable
mappings = {
["<Esc>"] = "Close",
["<C-c>"] = "Close",
["<CR>"] = "Confirm",
},
override = function(conf)
-- This is the config that will be passed to nvim_open_win.
-- Change values here to customize the layout
return conf
end,
},
-- Used to override format_item. See :help dressing-format
format_item_override = {},
-- see :help dressing_get_config
get_config = nil,
},
}) '';
}

View File

@ -0,0 +1,32 @@
{
plugins = {
indent-blankline = {
enable = true;
settings = {
indent = {
char = ""; # "│" or "▎"
};
scope = {
enabled = true;
show_start = true;
};
exclude = {
buftypes = ["terminal" "nofile"];
filetypes = [
"help"
"alpha"
"dashboard"
"neo-tree"
"Trouble"
"trouble"
"lazy"
"mason"
"notify"
"toggleterm"
"lazyterm"
];
};
};
};
};
}

View File

@ -0,0 +1,36 @@
{
plugins.noice = {
enable = true;
notify = {
enabled = false;
};
messages = {
enabled = true; # Adds a padding-bottom to neovim statusline when set to false for some reason
};
lsp = {
message = {
enabled = true;
};
progress = {
enabled = false;
view = "mini";
};
};
popupmenu = {
enabled = true;
backend = "nui";
};
format = {
filter = {
pattern = [":%s*%%s*s:%s*" ":%s*%%s*s!%s*" ":%s*%%s*s/%s*" "%s*s:%s*" ":%s*s!%s*" ":%s*s/%s*"];
icon = "";
lang = "regex";
};
replace = {
pattern = [":%s*%%s*s:%w*:%s*" ":%s*%%s*s!%w*!%s*" ":%s*%%s*s/%w*/%s*" "%s*s:%w*:%s*" ":%s*s!%w*!%s*" ":%s*s/%w*/%s*"];
icon = "󱞪";
lang = "regex";
};
};
};
}

View File

@ -0,0 +1,3 @@
{pkgs, ...}: {
extraPlugins = with pkgs.vimPlugins; [nui-nvim];
}

View File

@ -0,0 +1,44 @@
{
plugins.notify = {
enable = true;
backgroundColour = "#000000";
fps = 60;
render = "default";
timeout = 500;
topDown = true;
};
keymaps = [
{
mode = "n";
key = "<leader>un";
action = ''
<cmd>lua require("notify").dismiss({ silent = true, pending = true })<cr>
'';
options = {
desc = "Dismiss All Notifications";
};
}
];
extraConfigLua = ''
local notify = require("notify")
local filtered_message = { "No information available" }
-- Override notify function to filter out messages
---@diagnostic disable-next-line: duplicate-set-field
vim.notify = function(message, level, opts)
local merged_opts = vim.tbl_extend("force", {
on_open = function(win)
local buf = vim.api.nvim_win_get_buf(win)
vim.api.nvim_buf_set_option(buf, "filetype", "markdown")
end,
}, opts or {})
for _, msg in ipairs(filtered_message) do
if message == msg then
return
end
end
return notify(message, level, merged_opts)
end
'';
}

View File

@ -0,0 +1,7 @@
{
plugins.better-escape = {
enable = true;
clearEmptyLines = true;
timeout = 200;
};
}

View File

@ -0,0 +1,56 @@
{
plugins.flash = {
enable = false;
labels = "asdfghjklqwertyuiopzxcvbnm";
search = {
mode = "fuzzy";
};
jump = {
autojump = true;
};
label = {
uppercase = false;
rainbow = {
enabled = false;
shade = 5;
};
};
};
# keymaps = [
# {
# mode = [ "n" "x" "o" ];
# key = "s";
# action = "<cmd>lua require('flash').jump()<cr>";
# options = {
# desc = "Flash";
# };
# }
#
# {
# mode = [ "n" "x" "o" ];
# key = "S";
# action = "<cmd>lua require('flash').treesitter()<cr>";
# options = {
# desc = "Flash Treesitter";
# };
# }
#
# {
# mode = "o";
# key = "r";
# action = "<cmd>lua require('flash').remote()<cr>";
# options = {
# desc = "Remote Flash";
# };
# }
#
# {
# mode = [ "x" "o" ];
# key = "R";
# action = "<cmd>lua require('flash').treesitter_search()<cr>";
# options = {
# desc = "Treesitter Search";
# };
# }
# ];
}

View File

@ -0,0 +1,26 @@
{
plugins.hardtime = {
enable = true;
enabled = false;
disableMouse = true;
disabledFiletypes = ["neo-tree" "qf" "netrw" "NvimTree"];
hint = true;
maxCount = 4;
maxTime = 1000;
restrictionMode = "hint";
restrictedKeys = {
"h" = ["n" "x"];
"j" = ["n" "x"];
"k" = ["n" "x"];
"l" = ["n" "x"];
"-" = ["n" "x"];
"+" = ["n" "x"];
"gj" = ["n" "x"];
"gk" = ["n" "x"];
"<CR>" = ["n" "x"];
"<C-M>" = ["n" "x"];
"<C-N>" = ["n" "x"];
"<C-P>" = ["n" "x"];
};
};
}

View File

@ -0,0 +1,17 @@
{
plugins.harpoon = {
enable = true;
enableTelescope = true;
keymapsSilent = true;
keymaps = {
addFile = "<leader>ha";
toggleQuickMenu = "<C-e>";
navFile = {
"1" = "<leader>hj";
"2" = "<leader>hk";
"3" = "<leader>hl";
"4" = "<leader>hm";
};
};
};
}

View File

@ -0,0 +1,17 @@
{
plugins.illuminate = {
enable = false;
underCursor = false;
filetypesDenylist = [
"DressingSelect"
"Outline"
"TelescopePrompt"
"alpha"
"harpoon"
"toggleterm"
"neo-tree"
"Spectre"
"reason"
];
};
}

View File

@ -0,0 +1,19 @@
{
plugins.markdown-preview = {
enable = true;
settings = {
browser = "floorp";
theme = "dark";
};
};
keymaps = [
{
mode = "n";
key = "<leader>cp";
action = "<cmd>MarkdownPreview<cr>";
options = {
desc = "Markdown Preview";
};
}
];
}

View File

@ -0,0 +1,15 @@
{
plugins.mini = {
enable = true;
modules = {
comment = {
options = {
customCommentString = ''
<cmd>lua require("ts_context_commentstring.internal").calculate_commentstring() or vim.bo.commentstring<cr>
'';
};
};
cursorword = {};
};
};
}

View File

@ -0,0 +1,27 @@
{
plugins.neocord = {
enable = true;
settings = {
auto_update = true;
blacklist = [];
client_id = "1157438221865717891";
debounce_timeout = 10;
editing_text = "Editing...";
enable_line_number = true;
logo = "https://repository-images.githubusercontent.com/325421844/ecb73f47-cb89-4ee0-a0fd-9743c2f3569a";
logo_tooltip = "NixVim";
file_assets = null;
file_explorer_text = "Browsing...";
git_commit_text = "Committing changes...";
global_timer = true;
line_number_text = "Line %s out of %s";
log_level = null;
main_image = "logo";
plugin_manager_text = "Managing plugins...";
reading_text = "Reading...";
show_time = true;
terminal_text = "Using Terminal...";
workspace_text = "Working on %s";
};
};
}

View File

@ -0,0 +1,11 @@
{pkgs, ...}: {
extraPlugins = with pkgs.vimPlugins; [
neodev-nvim
];
extraConfigLua = ''
require("neodev").setup({
library = { plugins = {"neotest"}, types = true},
})
'';
}

View File

@ -0,0 +1,133 @@
{pkgs, ...}: {
extraPlugins = with pkgs.vimPlugins; [
(pkgs.vimUtils.buildVimPlugin {
pname = "neotest-java";
version = "v0.9.0";
src = pkgs.fetchFromGitHub {
owner = "rcasia";
repo = "neotest-java";
rev = "2234bfa8044dc39a8baf90470747c65e4623a222";
sha256 = "0w5fvqic3qapi9ggfb81nqa9fl6jv831s91r0wgn4d7c35h0340r";
};
})
(pkgs.vimUtils.buildVimPlugin {
pname = "neotest-vim-test";
version = "2023-04-17";
src = pkgs.fetchFromGitHub {
owner = "nvim-neotest";
repo = "neotest-vim-test";
rev = "75c4228882ae4883b11bfce9b8383e637eb44192";
sha256 = "12ix1lzmqlk3iyngaafby9c02fcl9d5iva965miwxfljvmibjnbw";
};
})
neotest
FixCursorHold-nvim
neotest-plenary
vim-test
neotest-python
neotest-vitest
];
extraConfigLua = ''
require("neotest").setup({
adapters = {
require("neotest-java")({
ignore_wrapper = false,
-- function to determine which runner to use based on project path
determine_runner = function(project_root_path)
-- return should be "maven" or "gradle"
return "maven"
end,
-- override the builtin runner discovery behaviour to always use given
-- tool. Default is "nil", so no override
force_runner = nil,
-- if the automatic runner discovery can't uniquely determine whether
-- to use Gradle or Maven, fallback to using this runner. Default is
-- "maven"
fallback_runner = "gradle"
}),
require("neotest-python")({
dap = { justMyCode = false },
}),
require "neotest-vim-test" {
ignore_file_types = { "python", "java", "vim", "lua", "javascript", "typescript" },
},
},
output = { enabled = true, open_on_run = true },
summary = { enabled = true, },
})
'';
keymaps = [
{
mode = "n";
key = "<leader>tt";
action = "<cmd>lua require('neotest').run.run(vim.fn.expand '%')<CR>";
options = {
desc = "Run File";
silent = true;
};
}
{
mode = "n";
key = "<leader>tT";
action = "<cmd>lua require('neotest').run.run(vim.loop.cwd())<CR>";
options = {
desc = "Run All Test Files";
silent = true;
};
}
{
mode = "n";
key = "<leader>tr";
action = "<cmd>lua require('neotest').run.run()<CR>";
options = {
desc = "Run Nearest";
silent = true;
};
}
{
mode = "n";
key = "<leader>td";
action = "<cmd>lua require('neotest').run.run({strategy = 'dap'})<CR>";
options = {
desc = "Run Nearest with debugger";
silent = true;
};
}
{
mode = "n";
key = "<leader>ts";
action = "<cmd>lua require('neotest').summary.toggle()<CR>";
options = {
desc = "Toggle Summary";
silent = true;
};
}
{
mode = "n";
key = "<leader>to";
action = "<cmd>lua require('neotest').output.open{ enter = true, auto_close = true }<CR>";
options = {
desc = "Show Output";
silent = true;
};
}
{
mode = "n";
key = "<leader>tO";
action = "<cmd>lua require('neotest').output_panel.toggle()<CR>";
options = {
desc = "Toggle Output Panel";
silent = true;
};
}
{
mode = "n";
key = "<leader>tS";
action = "<cmd>lua require('neotest').run.stop()<CR>";
options = {
desc = "Stop";
silent = true;
};
}
];
}

View File

@ -0,0 +1,5 @@
{
plugins.nvim-autopairs = {
enable = false;
};
}

View File

@ -0,0 +1,5 @@
{
plugins.nvim-colorizer = {
enable = true;
};
}

View File

@ -0,0 +1,9 @@
{pkgs, ...}: {
extraPlugins = with pkgs.vimPlugins; [
nvim-surround
];
extraConfigLua = ''
require("nvim-surround").setup()
'';
}

View File

@ -0,0 +1,54 @@
{
plugins.oil = {
enable = true;
settings = {
useDefaultKeymaps = true;
deleteToTrash = true;
viewOptions = {
showHidden = true;
};
preview = {
border = "rounded";
};
float = {
padding = 2;
maxWidth = 0; # ''math.ceil(vim.o.lines * 0.8 - 4)'';
maxHeight = 0; # ''math.ceil(vim.o.columns * 0.8)'';
border = "rounded"; # 'single' | 'double' | 'shadow' | 'curved' | ... other options supported by win open
winOptions = {
winblend = 0;
};
};
keymaps = {
"g?" = "actions.show_help";
"<CR>" = "actions.select";
"<C-\\>" = "actions.select_vsplit";
"<C-enter>" = "actions.select_split"; # this is used to navigate left
"<C-t>" = "actions.select_tab";
"<C-p>" = "actions.preview";
"<C-c>" = "actions.close";
"<C-r>" = "actions.refresh";
"-" = "actions.parent";
"_" = "actions.open_cwd";
"`" = "actions.cd";
"~" = "actions.tcd";
"gs" = "actions.change_sort";
"gx" = "actions.open_external";
"g." = "actions.toggle_hidden";
"q" = "actions.close";
};
};
};
keymaps = [
{
mode = "n";
key = "<leader>o";
action = ":Oil --float<CR>";
options = {
desc = "Open parent directory";
silent = true;
};
}
];
}

View File

@ -0,0 +1,5 @@
{
plugins.persistence = {
enable = true;
};
}

View File

@ -0,0 +1,5 @@
{pkgs, ...}: {
extraPlugins = with pkgs.vimPlugins; [
plenary-nvim
];
}

View File

@ -0,0 +1,6 @@
{
plugins.project-nvim = {
enable = true;
enableTelescope = true;
};
}

View File

@ -0,0 +1,55 @@
{pkgs, ...}: {
extraPlugins = with pkgs.vimUtils; [
(buildVimPlugin {
pname = "sidebar.nvim";
version = "2024-02-07";
src = pkgs.fetchFromGitHub {
owner = "sidebar-nvim";
repo = "sidebar.nvim";
rev = "5695712eef6288fff667343c4ae77c54911bdb1b";
sha256 = "1p12189367x0x26cys9wxipzwr3i0bmz4lb0s79ki0a49d6zja2c";
};
})
];
extraConfigLua = ''
local sidebar = require("sidebar-nvim")
sidebar.setup({
disable_default_keybindings = 0,
bindings = nil,
open = false,
side = "left",
initial_width = 32,
hide_statusline = false,
update_interval = 1000,
sections = { "git", "containers" },
section_separator = {"", "-----", ""},
section_title_separator = {""},
containers = {
attach_shell = "/bin/sh", show_all = true, interval = 5000,
},
datetime = { format = "%a %b %d, %H:%M", clocks = { { name = "local" } } },
todos = { ignored_paths = {} },
["git"] = {
icon = "", --
},
})
cmd = {
"SidebarNvimToggle",
"SidebarNvimOpen",
"SidebarNvimFocus",
"SidebarNvimUpdate",
},
'';
keymaps = [
{
mode = "n";
key = "<leader>e";
action = ":SidebarNvimToggle<CR>";
options = {
desc = "Toggle Explorer";
silent = true;
};
}
];
}

View File

@ -0,0 +1,5 @@
{
plugins.tmux-navigator = {
enable = true;
};
}

View File

@ -0,0 +1,5 @@
{
plugins.todo-comments = {
enable = true;
};
}

View File

@ -0,0 +1,57 @@
{
plugins.toggleterm = {
enable = true;
settings = {
size = ''
function(term)
if term.direction == "horizontal" then
return 15
elseif term.direction == "vertical" then
return vim.o.columns * 0.4
end
end
'';
open_mapping = "[[<A-i>]]";
hide_numbers = true;
shade_terminals = true;
start_in_insert = true;
terminal_mappings = true;
persist_mode = true;
insert_mappings = true;
close_on_exit = true;
shell = "zsh";
direction = "horizontal"; # 'vertical' | 'horizontal' | 'window' | 'float'
auto_scroll = true;
float_opts = {
border = "single"; # 'single' | 'double' | 'shadow' | 'curved' | ... other options supported by win open
width = 80;
height = 20;
winblend = 0;
};
winbar = {
enabled = true;
name_formatter = ''
function(term)
return term.name
end
'';
};
};
};
# extraConfigLua = ''
# function _G.set_terminal_keymaps()
# local opts = { buffer = 0 }
# vim.keymap.set("t", "<esc>", [[<C-\><C-n>]], opts)
# vim.keymap.set("t", "jk", [[<C-\><C-n>]], opts)
# vim.keymap.set("t", "<C-h>", [[<Cmd>wincmd h<CR>]], opts)
# vim.keymap.set("t", "<C-j>", [[<Cmd>wincmd j<CR>]], opts)
# vim.keymap.set("t", "<C-k>", [[<Cmd>wincmd k<CR>]], opts)
# vim.keymap.set("t", "<C-l>", [[<Cmd>wincmd l<CR>]], opts)
# vim.keymap.set("t", "<C-w>", [[<C-\><C-n><C-w>]], opts)
# end
#
# -- if you only want these mappings for toggle term use term://*toggleterm#* instead
# -- vim.cmd("autocmd! TermOpen term://*toggleterm#* lua set_terminal_keymaps()")
# '';
}

View File

@ -0,0 +1,17 @@
{pkgs, ...}: {
extraPlugins = with pkgs.vimUtils; [
(buildVimPlugin {
pname = "ultimate-autopair.nvim";
version = "2024-02-05";
src = pkgs.fetchFromGitHub {
owner = "altermo";
repo = "ultimate-autopair.nvim";
rev = "25c13e0ce167db0255456cac10158b27d2be30c0";
sha256 = "0bsxfj6g8fii9nn92vl15hdhafx3fikgiz4srr7y10pxz01c5s4c";
};
})
];
extraConfigLua = ''
require('ultimate-autopair').setup()
'';
}

View File

@ -0,0 +1,26 @@
{
config,
pkgs,
host,
user,
...
}: {
plugins.undotree = {
enable = true;
settings = {
autoOpenDiff = true;
focusOnToggle = true;
};
};
keymaps = [
{
mode = "n";
key = "<leader>ut";
action = "<cmd>UndotreeToggle<CR>";
options = {
silent = true;
desc = "Undotree";
};
}
];
}

View File

@ -0,0 +1,5 @@
{pkgs, ...}: {
extraPlugins = with pkgs.vimPlugins; [
vim-be-good
];
}

View File

@ -0,0 +1,5 @@
{pkgs, ...}: {
extraPlugins = with pkgs.vimPlugins; [
vim-wakatime
];
}

View File

@ -0,0 +1,19 @@
{
# TODO: Implement general mappings
plugins.which-key = {
enable = true;
ignoreMissing = false;
icons = {
breadcrumb = "»";
group = "+";
separator = ""; # ➜
};
# registrations = {
# "<leader>t" = " Terminal";
# };
window = {
border = "none";
winblend = 0;
};
};
}

View File

@ -0,0 +1,43 @@
{
plugins.wilder = {
enable = true;
modes = [":" "/" "?"];
pipeline = [
''
wilder.branch(
wilder.python_file_finder_pipeline({
file_command = function(ctx, arg)
if string.find(arg, '.') ~= nil then
return {'fd', '-tf', '-H'}
else
return {'fd', '-tf'}
end
end,
dir_command = {'fd', '-td'},
filters = {'cpsm_filter'},
}),
wilder.substitute_pipeline({
pipeline = wilder.python_search_pipeline({
skip_cmdtype_check = 1,
pattern = wilder.python_fuzzy_pattern({
start_at_boundary = 0,
}),
}),
}),
wilder.cmdline_pipeline({
language = 'python',
fuzzy = 1,
}),
{
wilder.check(function(ctx, x) return x == "" end),
wilder.history(),
},
wilder.python_search_pipeline({
pattern = wilder.python_fuzzy_pattern({
start_at_boundary = 0,
}),
})
) ''
];
};
}

13
pkgs/nvim/default.nix Normal file
View File

@ -0,0 +1,13 @@
{
pkgs,
inputs,
...
}: let
system = pkgs.system;
nixvim = inputs.nixvim.legacyPackages.${system};
nixvimModule = {
inherit pkgs;
module = import ./config;
extraSpecialArgs = {};
};
in (nixvim.makeNixvimWithModule nixvimModule)