diff options
Diffstat (limited to 'nixvim/plugins')
| -rw-r--r-- | nixvim/plugins/bufferline.nix | 35 | ||||
| -rw-r--r-- | nixvim/plugins/cmp.nix | 47 | ||||
| -rw-r--r-- | nixvim/plugins/crates.nix | 5 | ||||
| -rw-r--r-- | nixvim/plugins/default.nix | 20 | ||||
| -rw-r--r-- | nixvim/plugins/fidget.nix | 5 | ||||
| -rw-r--r-- | nixvim/plugins/flash.nix | 29 | ||||
| -rw-r--r-- | nixvim/plugins/gitsigns.nix | 5 | ||||
| -rw-r--r-- | nixvim/plugins/glow.nix | 5 | ||||
| -rw-r--r-- | nixvim/plugins/ibl.nix | 23 | ||||
| -rw-r--r-- | nixvim/plugins/lint.nix | 27 | ||||
| -rw-r--r-- | nixvim/plugins/lsp-format.nix | 17 | ||||
| -rw-r--r-- | nixvim/plugins/lsp/default.nix | 20 | ||||
| -rw-r--r-- | nixvim/plugins/lsp/keymaps.nix | 16 | ||||
| -rw-r--r-- | nixvim/plugins/lsp/servers.nix | 82 | ||||
| -rw-r--r-- | nixvim/plugins/lualine.nix | 8 | ||||
| -rw-r--r-- | nixvim/plugins/mini.nix | 60 | ||||
| -rw-r--r-- | nixvim/plugins/telescope.nix | 17 | ||||
| -rw-r--r-- | nixvim/plugins/treesitter.nix | 10 | ||||
| -rw-r--r-- | nixvim/plugins/trouble.nix | 17 |
19 files changed, 448 insertions, 0 deletions
diff --git a/nixvim/plugins/bufferline.nix b/nixvim/plugins/bufferline.nix new file mode 100644 index 0000000..85dc127 --- /dev/null +++ b/nixvim/plugins/bufferline.nix @@ -0,0 +1,35 @@ +{ lib, ... }: +let + applyDefaultOpts = map ( + lib.recursiveUpdate { + mode = "n"; + options = { + noremap = true; + silent = true; + }; + } + ); +in +{ + keymaps = + applyDefaultOpts [ + { + action = "BufferLinePickClose"; + key = "<leader>q"; + } + ] + ++ map (i: { + action = "BufferLineGoToBuffer ${toString i}"; + key = "<leader>${toString i}"; + }) (lib.range 1 9); + + plugins.bufferline = { + enable = true; + + alwaysShowBufferline = false; + diagnostics = "nvim_lsp"; + mode = "buffers"; + numbers = "ordinal"; + separatorStyle = "slant"; + }; +} diff --git a/nixvim/plugins/cmp.nix b/nixvim/plugins/cmp.nix new file mode 100644 index 0000000..6793435 --- /dev/null +++ b/nixvim/plugins/cmp.nix @@ -0,0 +1,47 @@ +{ helpers, ... }: +{ + plugins.cmp = { + enable = true; + + settings = { + completion.completeopt = "menu,menuone,insert"; + + snippet.expand = '' + function(args) + require('luasnip').lsp_expand(args.body) + end + ''; + + mapping = { + "<C-n>" = "cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert })"; + "<C-p>" = "cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert })"; + "<C-b>" = "cmp.mapping.scroll_docs(-4)"; + "<C-f>" = "cmp.mapping.scroll_docs(4)"; + "<C-Space>" = "cmp.mapping.complete()"; + "<C-e>" = "cmp.mapping.abort()"; + "<CR>" = helpers.mkRaw '' + cmp.mapping({ + i = function(fallback) + if cmp.visible() and cmp.get_active_entry() then + cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false }) + else + fallback() + end + end, + + s = cmp.mapping.confirm({ select = true }), + c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }), + }) + ''; + }; + + sources = map (name: { inherit name; }) [ + "nvim_lsp" + "luasnip" + "async_path" + "buffer" + "rg" + ]; + }; + }; +} diff --git a/nixvim/plugins/crates.nix b/nixvim/plugins/crates.nix new file mode 100644 index 0000000..fd8cda0 --- /dev/null +++ b/nixvim/plugins/crates.nix @@ -0,0 +1,5 @@ +{ + plugins.crates-nvim = { + enable = true; + }; +} diff --git a/nixvim/plugins/default.nix b/nixvim/plugins/default.nix new file mode 100644 index 0000000..bfbc12c --- /dev/null +++ b/nixvim/plugins/default.nix @@ -0,0 +1,20 @@ +{ + imports = [ + ./bufferline.nix + ./cmp.nix + ./crates.nix + ./fidget.nix + ./flash.nix + ./gitsigns.nix + ./glow.nix + ./ibl.nix + ./lint.nix + ./lsp + ./lsp-format.nix + ./lualine.nix + ./mini.nix + ./telescope.nix + ./treesitter.nix + ./trouble.nix + ]; +} diff --git a/nixvim/plugins/fidget.nix b/nixvim/plugins/fidget.nix new file mode 100644 index 0000000..5d0a033 --- /dev/null +++ b/nixvim/plugins/fidget.nix @@ -0,0 +1,5 @@ +{ + plugins.fidget = { + enable = true; + }; +} diff --git a/nixvim/plugins/flash.nix b/nixvim/plugins/flash.nix new file mode 100644 index 0000000..00f6c05 --- /dev/null +++ b/nixvim/plugins/flash.nix @@ -0,0 +1,29 @@ +{ helpers, ... }: +{ + keymaps = [ + { + action = helpers.mkRaw '' + function() + require("flash").jump() + end + ''; + + key = "s"; + + options = { + noremap = true; + silent = true; + }; + + mode = [ + "n" + "o" + "x" + ]; + } + ]; + + plugins.flash = { + enable = true; + }; +} diff --git a/nixvim/plugins/gitsigns.nix b/nixvim/plugins/gitsigns.nix new file mode 100644 index 0000000..8ba3e72 --- /dev/null +++ b/nixvim/plugins/gitsigns.nix @@ -0,0 +1,5 @@ +{ + plugins.gitsigns = { + enable = true; + }; +} diff --git a/nixvim/plugins/glow.nix b/nixvim/plugins/glow.nix new file mode 100644 index 0000000..de95ddf --- /dev/null +++ b/nixvim/plugins/glow.nix @@ -0,0 +1,5 @@ +{ + plugins.glow = { + enable = true; + }; +} diff --git a/nixvim/plugins/ibl.nix b/nixvim/plugins/ibl.nix new file mode 100644 index 0000000..235b04f --- /dev/null +++ b/nixvim/plugins/ibl.nix @@ -0,0 +1,23 @@ +{ + plugins.indent-blankline = { + enable = true; + + settings = { + exclude = { + filetypes = [ + "help" + "Trouble" + "toggleterm" + ]; + }; + + indent = { + char = "│"; + tab_char = "│"; + }; + + # Let mini.nvim handle this + scope.enabled = false; + }; + }; +} diff --git a/nixvim/plugins/lint.nix b/nixvim/plugins/lint.nix new file mode 100644 index 0000000..ca751fb --- /dev/null +++ b/nixvim/plugins/lint.nix @@ -0,0 +1,27 @@ +{ pkgs, helpers, ... }: +{ + extraPackages = [ + pkgs.actionlint + pkgs.nodePackages.alex + pkgs.statix + ]; + + plugins.lint = { + enable = true; + + # Run linters declared in lintersByFt + # then alex on all files + autoCmd.callback = helpers.mkRaw '' + function() + require("lint").try_lint() + require("lint").try_lint("alex") + end + ''; + + lintersByFt = { + githubaction = [ "actionlint" ]; + lua = [ "selene" ]; + nix = [ "statix" ]; + }; + }; +} diff --git a/nixvim/plugins/lsp-format.nix b/nixvim/plugins/lsp-format.nix new file mode 100644 index 0000000..ac64463 --- /dev/null +++ b/nixvim/plugins/lsp-format.nix @@ -0,0 +1,17 @@ +{ + keymaps = [ + { + action = "FormatToggle"; + key = "<leader>z"; + mode = "n"; + options = { + noremap = true; + silent = true; + }; + } + ]; + + plugins.lsp-format = { + enable = true; + }; +} diff --git a/nixvim/plugins/lsp/default.nix b/nixvim/plugins/lsp/default.nix new file mode 100644 index 0000000..3d5de1b --- /dev/null +++ b/nixvim/plugins/lsp/default.nix @@ -0,0 +1,20 @@ +{ + imports = [ + ./keymaps.nix + ./servers.nix + ]; + + plugins.lsp = { + enable = true; + + capabilities = '' + capabilities = vim.tbl_deep_extend( + "force", + vim.lsp.protocol.make_client_capabilities(), + require("cmp_nvim_lsp").default_capabilities(), + -- for nil_ls + { workspace = { didChangeWatchedFiles = { dynamicRegistration = true } } } + ) + ''; + }; +} diff --git a/nixvim/plugins/lsp/keymaps.nix b/nixvim/plugins/lsp/keymaps.nix new file mode 100644 index 0000000..ee67ab8 --- /dev/null +++ b/nixvim/plugins/lsp/keymaps.nix @@ -0,0 +1,16 @@ +{ + plugins.lsp.keymaps = { + silent = true; + + diagnostic = { + "<leader>e" = "open_float"; + "[d" = "goto_prev"; + "]d" = "goto_next"; + "<leader>u" = "setloclist"; + }; + + lspBuf = { + "<leader>ca" = "code_action"; + }; + }; +} diff --git a/nixvim/plugins/lsp/servers.nix b/nixvim/plugins/lsp/servers.nix new file mode 100644 index 0000000..6334939 --- /dev/null +++ b/nixvim/plugins/lsp/servers.nix @@ -0,0 +1,82 @@ +{ pkgs, helpers, ... }: +{ + extraPackages = [ + # bashls + pkgs.shellcheck + pkgs.shfmt + + # nil-ls + pkgs.nixfmt-rfc-style + ]; + + globals = { + # Required for Deno's LSP + markdown_fenced_languages = [ "ts=typescript" ]; + }; + + plugins.lsp.servers = { + astro.enable = true; + bashls.enable = true; + biome.enable = true; + clangd.enable = true; + denols.enable = true; + eslint.enable = true; + + lua-ls = { + enable = true; + settings = { + diagnostics.globals = [ "vim" ]; + runtime.version = "LuaJIT"; + workspace = { + checkThirdParty = false; + library = [ (helpers.mkRaw "vim.env.VIMRUNTIME") ]; + }; + }; + }; + + nil-ls = { + enable = true; + + settings = { + formatting.command = [ "nixfmt" ]; + }; + }; + + nimls.enable = true; + pyright = { + enable = true; + + settings = { + # Use ruff for imports + pyright = { + disableOrganizeImports = true; + }; + python.ignore = [ "*" ]; + }; + }; + + ruff-lsp = { + enable = true; + + # pyright should handle this + onAttach.function = '' + client.server_capabilities.hoverProvider = false + ''; + }; + + rust-analyzer = { + enable = true; + + installCargo = false; + installRustc = false; + + settings = { + check.command = "clippy"; + }; + }; + + tsserver.enable = true; + typos-lsp.enable = true; + typst-lsp.enable = true; + }; +} diff --git a/nixvim/plugins/lualine.nix b/nixvim/plugins/lualine.nix new file mode 100644 index 0000000..990e495 --- /dev/null +++ b/nixvim/plugins/lualine.nix @@ -0,0 +1,8 @@ +{ + plugins.lualine = { + enable = true; + + theme = "catppuccin"; + extensions = [ "trouble" ]; + }; +} diff --git a/nixvim/plugins/mini.nix b/nixvim/plugins/mini.nix new file mode 100644 index 0000000..0a83bcf --- /dev/null +++ b/nixvim/plugins/mini.nix @@ -0,0 +1,60 @@ +{ helpers, ... }: +{ + autoCmd = [ + # don't use mini.indentscope on some files + { + callback = helpers.mkRaw '' + function() + vim.b.miniindentscope_disable = true + end + ''; + event = "FileType"; + pattern = [ + "help" + "Trouble" + "toggleterm" + ]; + } + ]; + + keymaps = [ + # open mini.files + { + action = helpers.mkRaw '' + function() + local files = require("mini.files") + if not files.close() then + files.open() + end + end + ''; + + key = "<leader>t"; + mode = "n"; + options = { + noremap = true; + silent = true; + }; + } + ]; + + plugins.mini = { + enable = true; + + modules = { + files = { }; + + hipatterns = { + highlighters = { + hex_color = helpers.mkRaw "require('mini.hipatterns').gen_highlighter.hex_color()"; + }; + }; + + indentscope = { + options.try_as_border = false; + }; + + pairs = { }; + }; + }; +} diff --git a/nixvim/plugins/telescope.nix b/nixvim/plugins/telescope.nix new file mode 100644 index 0000000..32528af --- /dev/null +++ b/nixvim/plugins/telescope.nix @@ -0,0 +1,17 @@ +{ + keymaps = [ + { + action = "Telescope"; + key = "<leader>f"; + mode = "n"; + options = { + noremap = true; + silent = true; + }; + } + ]; + + plugins.telescope = { + enable = true; + }; +} diff --git a/nixvim/plugins/treesitter.nix b/nixvim/plugins/treesitter.nix new file mode 100644 index 0000000..ec2316a --- /dev/null +++ b/nixvim/plugins/treesitter.nix @@ -0,0 +1,10 @@ +{ + plugins.treesitter = { + enable = true; + + settings = { + highlight.enable = true; + indent.enable = true; + }; + }; +} diff --git a/nixvim/plugins/trouble.nix b/nixvim/plugins/trouble.nix new file mode 100644 index 0000000..a971991 --- /dev/null +++ b/nixvim/plugins/trouble.nix @@ -0,0 +1,17 @@ +{ + keymaps = [ + { + action = "Trouble diagnostics toggle"; + key = "<leader>p"; + mode = "n"; + options = { + noremap = true; + silent = true; + }; + } + ]; + + plugins.trouble = { + enable = true; + }; +} |
