summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--checks.nix51
-rw-r--r--config/default.nix32
-rw-r--r--config/globals.lua6
-rw-r--r--config/init.lua4
-rw-r--r--config/keymaps.lua48
-rw-r--r--config/keymaps.nix82
-rw-r--r--config/options.lua8
-rw-r--r--config/plugins/bufferline.lua20
-rw-r--r--config/plugins/bufferline.nix19
-rw-r--r--config/plugins/catppuccin.lua29
-rw-r--r--config/plugins/cmp.lua42
-rw-r--r--config/plugins/cmp.nix32
-rw-r--r--config/plugins/default.nix12
-rw-r--r--config/plugins/dressing.lua1
-rw-r--r--config/plugins/efmls.lua59
-rw-r--r--config/plugins/efmls.nix74
-rw-r--r--config/plugins/fidget.lua1
-rw-r--r--config/plugins/fidget.nix5
-rw-r--r--config/plugins/flash.lua1
-rw-r--r--config/plugins/flash.nix5
-rw-r--r--config/plugins/gitsigns.lua1
-rw-r--r--config/plugins/gitsigns.nix5
-rw-r--r--config/plugins/ibl.lua22
-rw-r--r--config/plugins/ibl.nix22
-rw-r--r--config/plugins/init.lua17
-rw-r--r--config/plugins/lsp-format.lua1
-rw-r--r--config/plugins/lsp-format.nix5
-rw-r--r--config/plugins/lsp.lua93
-rw-r--r--config/plugins/lsp.nix72
-rw-r--r--config/plugins/lualine.lua6
-rw-r--r--config/plugins/lualine.nix8
-rw-r--r--config/plugins/mini.lua28
-rw-r--r--config/plugins/mini.nix36
-rw-r--r--config/plugins/neo-tree.lua5
-rw-r--r--config/plugins/neo-tree.nix11
-rw-r--r--config/plugins/telescope.lua1
-rw-r--r--config/plugins/telescope.nix5
-rw-r--r--config/plugins/treesitter.lua11
-rw-r--r--config/plugins/treesitter.nix25
-rw-r--r--config/plugins/trouble.lua1
-rw-r--r--config/plugins/trouble.nix5
-rw-r--r--config/plugins/which-key.lua5
-rw-r--r--config/plugins/which-key.nix9
-rw-r--r--flake.lock59
-rw-r--r--flake.nix120
-rw-r--r--neovim.nix103
46 files changed, 605 insertions, 602 deletions
diff --git a/checks.nix b/checks.nix
new file mode 100644
index 0000000..7773b11
--- /dev/null
+++ b/checks.nix
@@ -0,0 +1,51 @@
+{
+ pkgs,
+ self,
+}: let
+ inherit (pkgs) lib;
+ formatter = self.formatter.${pkgs.system};
+in {
+ check-actionlint =
+ pkgs.runCommand "check-actionlint" {
+ nativeBuildInputs = [pkgs.actionlint];
+ } ''
+ actionlint ${./.}/.github/workflows/*
+ touch $out
+ '';
+
+ "check-${formatter.pname}" =
+ pkgs.runCommand "check-${formatter.pname}" {
+ nativeBuildInputs = [formatter];
+ } ''
+ ${lib.getExe formatter} --check ${./.}
+ touch $out
+ '';
+
+ check-statix =
+ pkgs.runCommand "check-statix" {
+ nativeBuildInputs = [pkgs.statix];
+ }
+ ''
+ statix check ${./.}
+ touch $out
+ '';
+
+ check-nil =
+ pkgs.runCommand "check-nil" {
+ nativeBuildInputs = with pkgs; [fd git nil];
+ }
+ ''
+ cd ${./.}
+ fd . -e 'nix' | while read -r file; do
+ nil diagnostics "$file"
+ done
+
+ touch $out
+ '';
+
+ check-stylua = pkgs.runCommand "check-stylua" {} ''
+ ${lib.getExe pkgs.stylua} --check ${./.}
+
+ touch $out
+ '';
+}
diff --git a/config/default.nix b/config/default.nix
deleted file mode 100644
index 79756d6..0000000
--- a/config/default.nix
+++ /dev/null
@@ -1,32 +0,0 @@
-{pkgs, ...}: {
- imports = [
- ./plugins
- ./keymaps.nix
- ];
-
- config = {
- clipboard.providers.wl-copy.enable = pkgs.stdenv.isLinux;
-
- colorschemes.catppuccin = {
- enable = true;
- flavour = "mocha";
-
- disableItalic = true;
- };
-
- enableMan = false;
-
- globals = {
- mapleader = ",";
- };
-
- options = {
- shiftwidth = 2;
- tabstop = 2;
- smartindent = true;
- wrap = true;
- syntax = "on";
- termguicolors = true;
- };
- };
-}
diff --git a/config/globals.lua b/config/globals.lua
new file mode 100644
index 0000000..ce1cd3b
--- /dev/null
+++ b/config/globals.lua
@@ -0,0 +1,6 @@
+vim.g.mapleader = ","
+
+-- for deno's lsp
+vim.g.markdown_fenced_languages = {
+ "ts=typescript",
+}
diff --git a/config/init.lua b/config/init.lua
new file mode 100644
index 0000000..e7b816f
--- /dev/null
+++ b/config/init.lua
@@ -0,0 +1,4 @@
+require("getchoo.globals")
+require("getchoo.keymaps")
+require("getchoo.options")
+require("getchoo.plugins")
diff --git a/config/keymaps.lua b/config/keymaps.lua
new file mode 100644
index 0000000..b220c77
--- /dev/null
+++ b/config/keymaps.lua
@@ -0,0 +1,48 @@
+local opts = { noremap = true, silent = true }
+local set = function(mode, key, vimcmd)
+ vim.keymap.set(mode, key, vimcmd, opts)
+end
+
+if pcall(require, "neo-tree.command") then
+ set("n", "<leader>t", function()
+ require("neo-tree.command").execute({
+ toggle = true,
+ dir = vim.loop.cwd(),
+ })
+ end)
+end
+
+if pcall(require, "flash") then
+ set({ "n", "o", "x" }, "s", function()
+ require("flash").jump()
+ end)
+end
+
+for i = 1, 9 do
+ set("n", "<leader>" .. i, function()
+ vim.cmd("BufferLineGoToBuffer " .. i)
+ end)
+end
+
+set("n", "<leader>q", function()
+ vim.cmd("BufferLinePickClose")
+end)
+
+local diagnostic = vim.diagnostic
+set("n", "<leader>e", diagnostic.open_float)
+set("n", "[d", diagnostic.goto_prev)
+set("n", "]d", diagnostic.goto_next)
+set("n", "<leader>u", diagnostic.setloclist)
+set("n", "<leader>ca", vim.lsp.buf.code_action)
+
+set("n", "<leader>f", function()
+ vim.cmd("Telescope")
+end)
+
+set("n", "<leader>p", function()
+ vim.cmd("TroubleToggle")
+end)
+
+set("n", "<leader>z", function()
+ vim.cmd("FormatToggle")
+end)
diff --git a/config/keymaps.nix b/config/keymaps.nix
deleted file mode 100644
index 231da71..0000000
--- a/config/keymaps.nix
+++ /dev/null
@@ -1,82 +0,0 @@
-{lib, ...}: let
- setBind = lib.recursiveUpdate {
- mode = "n";
- lua = true;
- options = {
- noremap = true;
- silent = true;
- };
- };
-in {
- keymaps = map setBind (
- [
- {
- key = "<leader>t";
- action = ''
- function()
- require("neo-tree.command").execute({
- toggle = true,
- dir = vim.loop.cwd()
- })
- end
- '';
- }
-
- {
- mode = ["n" "o" "x"];
- key = "s";
- action = ''
- function()
- require("flash").jump()
- end
- '';
- }
-
- {
- key = "<leader>q";
- action = ''
- function()
- vim.cmd("BufferLinePickClose")
- end
- '';
- }
-
- {
- key = "<leader>f";
- action = ''
- function()
- vim.cmd("Telescope")
- end
- '';
- }
-
- {
- key = "<leader>p";
- action = ''
- function()
- vim.cmd("TroubleToggle")
- end
- '';
- }
-
- {
- key = "<leader>z";
- action = ''
- function()
- vim.cmd("FormatToggle")
- end
- '';
- }
- ]
- ++ (
- map (n: {
- key = "<leader>${toString n}";
- action = ''
- function()
- vim.cmd("BufferLineGoToBuffer ${toString n}")
- end
- '';
- }) (lib.range 1 9)
- )
- );
-}
diff --git a/config/options.lua b/config/options.lua
new file mode 100644
index 0000000..294067c
--- /dev/null
+++ b/config/options.lua
@@ -0,0 +1,8 @@
+local opt = vim.opt
+
+opt.shiftwidth = 2
+opt.tabstop = 2
+opt.smartindent = true
+opt.wrap = true
+opt.syntax = "on"
+opt.termguicolors = true
diff --git a/config/plugins/bufferline.lua b/config/plugins/bufferline.lua
new file mode 100644
index 0000000..a74dfa2
--- /dev/null
+++ b/config/plugins/bufferline.lua
@@ -0,0 +1,20 @@
+require("bufferline").setup({
+ options = {
+ always_show_bufferline = false,
+
+ diagnostics = "nvim_lsp",
+
+ mode = "buffers",
+ numbers = "ordinal",
+ separator_style = "slant",
+
+ offsets = {
+ {
+ filetype = "neo-tree",
+ text = "neo-tree",
+ highlight = "Directory",
+ text_align = "left",
+ },
+ },
+ },
+})
diff --git a/config/plugins/bufferline.nix b/config/plugins/bufferline.nix
deleted file mode 100644
index fe1cd17..0000000
--- a/config/plugins/bufferline.nix
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- plugins.bufferline = {
- enable = true;
-
- alwaysShowBufferline = false;
- diagnostics = "nvim_lsp";
- mode = "buffers";
- numbers = "ordinal";
- separatorStyle = "slant";
- offsets = [
- {
- filetype = "neo-tree";
- text = "neo-tree";
- highlight = "Directory";
- text_align = "left";
- }
- ];
- };
-}
diff --git a/config/plugins/catppuccin.lua b/config/plugins/catppuccin.lua
new file mode 100644
index 0000000..6f8c367
--- /dev/null
+++ b/config/plugins/catppuccin.lua
@@ -0,0 +1,29 @@
+local compile_path = vim.fn.stdpath("cache") .. "/catppuccin-nvim"
+vim.fn.mkdir(compile_path, "p")
+vim.opt.runtimepath:append(compile_path)
+
+require("catppuccin").setup({
+ compile_path = compile_path,
+ flavour = "mocha",
+ integrations = {
+ cmp = true,
+ flash = true,
+ gitsigns = true,
+ indent_blankline = {
+ enabled = true,
+ },
+ lsp_trouble = true,
+ native_lsp = {
+ enabled = true,
+ },
+ neotree = true,
+ treesitter_context = true,
+ treesitter = true,
+ telescope = true,
+ which_key = true,
+ },
+
+ no_italic = true,
+})
+
+vim.cmd.colorscheme("catppuccin")
diff --git a/config/plugins/cmp.lua b/config/plugins/cmp.lua
new file mode 100644
index 0000000..eee5eb1
--- /dev/null
+++ b/config/plugins/cmp.lua
@@ -0,0 +1,42 @@
+local cmp = require("cmp")
+
+cmp.setup({
+ completion = {
+ compleopt = "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>"] = 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 = cmp.config.sources({
+ { name = "nvim_lsp" },
+ { name = "luasnip" },
+ { name = "async_path" },
+ { name = "buffer" },
+ { name = "rg" },
+ }),
+})
diff --git a/config/plugins/cmp.nix b/config/plugins/cmp.nix
deleted file mode 100644
index 1bc85f1..0000000
--- a/config/plugins/cmp.nix
+++ /dev/null
@@ -1,32 +0,0 @@
-{
- plugins = {
- nvim-cmp = {
- enable = true;
-
- completion = {
- completeopt = "menu,menuone,noinsert";
- };
-
- 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>" = "cmp.mapping.confirm({ select = true })";
- "<S-CR>" = "cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true})";
- };
-
- snippet.expand = "luasnip";
-
- sources = map (name: {inherit name;}) [
- "nvim_lsp"
- "luasnip"
- "path"
- "buffer"
- "rg"
- ];
- };
- };
-}
diff --git a/config/plugins/default.nix b/config/plugins/default.nix
deleted file mode 100644
index 229942e..0000000
--- a/config/plugins/default.nix
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- # import all files besides those prefixed with `_`
- imports = builtins.map (file: ./${file}) (
- builtins.filter (
- name: name != "default.nix" && (builtins.substring 0 1 name) != "_"
- ) (
- builtins.attrNames (
- builtins.readDir ./.
- )
- )
- );
-}
diff --git a/config/plugins/dressing.lua b/config/plugins/dressing.lua
new file mode 100644
index 0000000..a4fcb44
--- /dev/null
+++ b/config/plugins/dressing.lua
@@ -0,0 +1 @@
+require("dressing")
diff --git a/config/plugins/efmls.lua b/config/plugins/efmls.lua
new file mode 100644
index 0000000..979cafb
--- /dev/null
+++ b/config/plugins/efmls.lua
@@ -0,0 +1,59 @@
+local alex = require("efmls-configs.linters.alex")
+local actionlint = require("efmls-configs.linters.actionlint")
+local beautysh = require("efmls-configs.formatters.beautysh")
+local codespell = require("efmls-configs.linters.codespell")
+local fish_indent = require("efmls-configs.formatters.fish_indent")
+local prettier = require("efmls-configs.formatters.prettier")
+local prettier_eslint = require("efmls-configs.formatters.prettier_eslint")
+local shellcheck = require("efmls-configs.linters.shellcheck")
+local statix = require("efmls-configs.linters.statix")
+local stylua = require("efmls-configs.formatters.stylua")
+
+local languages = {
+ all = { alex, codespell },
+
+ bash = {
+ beautysh,
+ shellcheck,
+ },
+
+ css = { prettier },
+
+ fish = { fish_indent },
+
+ html = { prettier },
+
+ javascript = { prettier_eslint },
+
+ json = { prettier },
+
+ lua = { stylua },
+
+ nix = { statix },
+
+ sass = { prettier },
+
+ scss = { prettier },
+
+ sh = { beautysh, shellcheck },
+
+ typescript = { prettier_eslint },
+
+ yaml = { prettier, actionlint },
+
+ zsh = { beautysh },
+}
+
+return {
+ filetypes = vim.tbl_keys(languages),
+
+ settings = {
+ rootMarkers = { ".git/" },
+ languages = languages,
+ },
+
+ init_options = {
+ documentFormatting = true,
+ documentRangeFormatting = true,
+ },
+}
diff --git a/config/plugins/efmls.nix b/config/plugins/efmls.nix
deleted file mode 100644
index e3cfb07..0000000
--- a/config/plugins/efmls.nix
+++ /dev/null
@@ -1,74 +0,0 @@
-{
- plugins = {
- lsp.servers.efm.extraOptions = {
- init_options = {
- documentFormatting = true;
- documentRangeFormatting = true;
- };
- };
-
- efmls-configs = {
- enable = true;
-
- setup = {
- all = {
- linter = [
- "alex"
- "codespell"
- ];
- };
-
- bash = {
- formatter = "beautysh";
- linter = "shellcheck";
- };
-
- css = {
- formatter = "prettier";
- };
-
- fish = {
- formatter = "fish_indent";
- };
-
- html = {
- formatter = "prettier";
- };
-
- json = {
- formatter = "prettier";
- };
-
- lua = {
- formatter = "stylua";
- };
-
- nix = {
- linter = "statix";
- };
-
- sass = {
- formatter = "prettier";
- };
-
- scss = {
- formatter = "prettier";
- };
-
- sh = {
- formatter = ["beautysh" "shellharden"];
- linter = "shellcheck";
- };
-
- yaml = {
- formatter = "prettier";
- linter = "actionlint";
- };
-
- zsh = {
- formatter = "beautysh";
- };
- };
- };
- };
-}
diff --git a/config/plugins/fidget.lua b/config/plugins/fidget.lua
new file mode 100644
index 0000000..4f1ab35
--- /dev/null
+++ b/config/plugins/fidget.lua
@@ -0,0 +1 @@
+require("fidget").setup()
diff --git a/config/plugins/fidget.nix b/config/plugins/fidget.nix
deleted file mode 100644
index 5d0a033..0000000
--- a/config/plugins/fidget.nix
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- plugins.fidget = {
- enable = true;
- };
-}
diff --git a/config/plugins/flash.lua b/config/plugins/flash.lua
new file mode 100644
index 0000000..9f9c773
--- /dev/null
+++ b/config/plugins/flash.lua
@@ -0,0 +1 @@
+require("flash").setup()
diff --git a/config/plugins/flash.nix b/config/plugins/flash.nix
deleted file mode 100644
index 87446e9..0000000
--- a/config/plugins/flash.nix
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- plugins.flash = {
- enable = true;
- };
-}
diff --git a/config/plugins/gitsigns.lua b/config/plugins/gitsigns.lua
new file mode 100644
index 0000000..d16d238
--- /dev/null
+++ b/config/plugins/gitsigns.lua
@@ -0,0 +1 @@
+require("gitsigns").setup()
diff --git a/config/plugins/gitsigns.nix b/config/plugins/gitsigns.nix
deleted file mode 100644
index 8ba3e72..0000000
--- a/config/plugins/gitsigns.nix
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- plugins.gitsigns = {
- enable = true;
- };
-}
diff --git a/config/plugins/ibl.lua b/config/plugins/ibl.lua
new file mode 100644
index 0000000..b63139b
--- /dev/null
+++ b/config/plugins/ibl.lua
@@ -0,0 +1,22 @@
+require("ibl").setup({
+ exclude = {
+ filetypes = {
+ "help",
+ "neo-tree",
+ "Trouble",
+ "lazy",
+ "mason",
+ "notify",
+ "toggleterm",
+ },
+ },
+
+ indent = {
+ char = "│",
+ tab_char = "│",
+ },
+
+ scope = {
+ enabled = false,
+ },
+})
diff --git a/config/plugins/ibl.nix b/config/plugins/ibl.nix
deleted file mode 100644
index d794a6a..0000000
--- a/config/plugins/ibl.nix
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- plugins.indent-blankline = {
- enable = true;
-
- exclude.filetypes = [
- "help"
- "neo-tree"
- "Trouble"
- "lazy"
- "mason"
- "notify"
- "toggleterm"
- ];
-
- indent = {
- char = "│";
- tabChar = "│";
- };
-
- scope.enabled = false;
- };
-}
diff --git a/config/plugins/init.lua b/config/plugins/init.lua
new file mode 100644
index 0000000..7b78aa2
--- /dev/null
+++ b/config/plugins/init.lua
@@ -0,0 +1,17 @@
+require("getchoo.plugins.bufferline")
+require("getchoo.plugins.catppuccin")
+require("getchoo.plugins.cmp")
+require("getchoo.plugins.dressing")
+require("getchoo.plugins.fidget")
+require("getchoo.plugins.flash")
+require("getchoo.plugins.gitsigns")
+require("getchoo.plugins.ibl")
+require("getchoo.plugins.lsp-format")
+require("getchoo.plugins.lsp")
+require("getchoo.plugins.lualine")
+require("getchoo.plugins.mini")
+require("getchoo.plugins.neo-tree")
+require("getchoo.plugins.telescope")
+require("getchoo.plugins.treesitter")
+require("getchoo.plugins.trouble")
+require("getchoo.plugins.which-key")
diff --git a/config/plugins/lsp-format.lua b/config/plugins/lsp-format.lua
new file mode 100644
index 0000000..6b57642
--- /dev/null
+++ b/config/plugins/lsp-format.lua
@@ -0,0 +1 @@
+require("lsp-format").setup()
diff --git a/config/plugins/lsp-format.nix b/config/plugins/lsp-format.nix
deleted file mode 100644
index af2ab05..0000000
--- a/config/plugins/lsp-format.nix
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- plugins.lsp-format = {
- enable = true;
- };
-}
diff --git a/config/plugins/lsp.lua b/config/plugins/lsp.lua
new file mode 100644
index 0000000..9492df1
--- /dev/null
+++ b/config/plugins/lsp.lua
@@ -0,0 +1,93 @@
+local lsp_servers = {
+ bashls = {
+ binary = "bash-language-server",
+ },
+
+ clangd = {},
+
+ eslint = {},
+
+ efm = {
+ binary = "true",
+ extraOptions = require("getchoo.plugins.efmls"),
+ },
+
+ lua_ls = {
+ binary = "lua-language-server",
+ extraOptions = {
+ settings = {
+ Lua = {
+ runtime = { version = "LuaJIT" },
+ diagnostics = { globals = "vim" },
+ workspace = { library = vim.api.nvim_get_runtime_file("", true) },
+ },
+ },
+ },
+ },
+
+ nil_ls = {
+ binary = "nil",
+ extraOptions = {
+ settings = {
+ ["nil"] = {
+ formatting = { command = { "alejandra" } },
+ },
+ },
+ },
+ },
+
+ pyright = {},
+ ruff_lsp = {
+ binary = "ruff-lsp",
+ extraOptions = {
+ on_attach = function(client, _)
+ require("lsp-format").on_attach(client)
+ -- pyright should handle this
+ client.server_capabilities.hoverProvider = false
+ end,
+ },
+ },
+
+ rust_analyzer = {
+ binary = "rust-analyzer",
+ extraOptions = {
+ settings = {
+ checkOnSave = { command = "clippy" },
+ },
+ },
+ },
+
+ denols = {
+ binary = "deno",
+ },
+
+ tsserver = {
+ binary = "typescript-language-server",
+ },
+}
+
+local caps = vim.tbl_deep_extend(
+ "force",
+ vim.lsp.protocol.make_client_capabilities(),
+ require("cmp_nvim_lsp").default_capabilities(),
+ -- for nil_ls
+ { workspace = { didChangeWatchedFiles = { dynamicRegistration = true } } }
+)
+
+local setup = {
+ on_attach = function(client, _)
+ require("lsp-format").on_attach(client)
+ end,
+
+ capabilities = caps,
+}
+
+for server, config in pairs(lsp_servers) do
+ local binary = config.binary or server
+
+ local options = (config.extraOptions == nil) and setup or vim.tbl_extend("keep", config.extraOptions, setup)
+
+ if vim.fn.executable(binary) == 1 then
+ require("lspconfig")[server].setup(options)
+ end
+end
diff --git a/config/plugins/lsp.nix b/config/plugins/lsp.nix
deleted file mode 100644
index 0b8e3cd..0000000
--- a/config/plugins/lsp.nix
+++ /dev/null
@@ -1,72 +0,0 @@
-{
- plugins.lsp = {
- enable = true;
-
- # nil-ls wants dynamicRegistration
- capabilities = ''
- capabilities = vim.tbl_deep_extend(
- "force",
- vim.lsp.protocol.make_client_capabilities(),
- require("cmp_nvim_lsp").default_capabilities(),
- { workspace = { didChangeWatchedFiles = { dynamicRegistration = true } } }
- )
- '';
-
- keymaps = {
- diagnostic = {
- "<leader>e" = "open_float";
- "[d" = "goto_prev";
- "]d" = "goto_next";
- "<leader>u" = "setloclist";
- };
-
- lspBuf = {
- "<leader>ca" = "code_action";
- };
- };
-
- servers = let
- enable = {enable = true;};
-
- optional =
- enable
- // {
- installLanguageServer = false;
- autostart = false;
- };
- in {
- bashls = enable;
- clangd = optional;
- denols = optional;
- eslint = optional;
-
- lua-ls = enable;
-
- nil_ls =
- enable
- // {
- settings.formatting.command = ["alejandra"];
- };
-
- pyright = optional;
- ruff-lsp =
- optional
- // {
- # let pyright handle it
- onAttach.function = ''
- client.server_capabilities.hoverProvider = false
- '';
- };
-
- rust-analyzer =
- optional
- // {
- installRustc = false;
- installCargo = false;
- settings.check.command = "clippy";
- };
-
- tsserver = optional;
- };
- };
-}
diff --git a/config/plugins/lualine.lua b/config/plugins/lualine.lua
new file mode 100644
index 0000000..2727d75
--- /dev/null
+++ b/config/plugins/lualine.lua
@@ -0,0 +1,6 @@
+require("lualine").setup({
+ options = {
+ theme = "catppuccin",
+ },
+ extensions = { "neo-tree", "trouble" },
+})
diff --git a/config/plugins/lualine.nix b/config/plugins/lualine.nix
deleted file mode 100644
index 43e2128..0000000
--- a/config/plugins/lualine.nix
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- plugins.lualine = {
- enable = true;
-
- theme = "catppuccin";
- extensions = ["neo-tree" "trouble"];
- };
-}
diff --git a/config/plugins/mini.lua b/config/plugins/mini.lua
new file mode 100644
index 0000000..075b2bd
--- /dev/null
+++ b/config/plugins/mini.lua
@@ -0,0 +1,28 @@
+require("mini.comment").setup({
+ options = {
+ custom_commentstring = function()
+ return require("ts_context_commentstring.internal").calculate_commentstring()
+ or vim.bo.context_commentstring
+ end,
+ },
+})
+
+require("mini.pairs").setup()
+require("mini.indentscope").setup({
+ options = { try_as_border = true },
+})
+
+vim.api.nvim_create_autocmd("FileType", {
+ pattern = {
+ "help",
+ "neo-tree",
+ "Trouble",
+ "lazy",
+ "mason",
+ "notify",
+ "toggleterm",
+ },
+ callback = function()
+ vim.b.miniindentscope_disable = true
+ end,
+})
diff --git a/config/plugins/mini.nix b/config/plugins/mini.nix
deleted file mode 100644
index 48bb0ed..0000000
--- a/config/plugins/mini.nix
+++ /dev/null
@@ -1,36 +0,0 @@
-{
- plugins.mini = {
- enable = true;
-
- modules = {
- comment = {};
- pairs = {};
- indentscope = {
- options.try_as_border = true;
- };
- };
- };
-
- autoCmd = [
- {
- event = ["FileType"];
- pattern = [
- "help"
- "neo-tree"
- "Trouble"
- "lazy"
- "mason"
- "notify"
- "toggleterm"
- ];
-
- callback = {
- __raw = ''
- function()
- vim.b.miniindentscope_disable = true
- end
- '';
- };
- }
- ];
-}
diff --git a/config/plugins/neo-tree.lua b/config/plugins/neo-tree.lua
new file mode 100644
index 0000000..1d6f7f5
--- /dev/null
+++ b/config/plugins/neo-tree.lua
@@ -0,0 +1,5 @@
+require("neo-tree").setup({
+ filetype_exclude = { "help", "neo-tree", "Trouble", "lazy", "mason", "notify", "toggleterm" },
+ show_current_context = false,
+ show_trailing_blankline_indent = false,
+})
diff --git a/config/plugins/neo-tree.nix b/config/plugins/neo-tree.nix
deleted file mode 100644
index f99df9e..0000000
--- a/config/plugins/neo-tree.nix
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- plugins.neo-tree = {
- enable = true;
-
- extraOptions = {
- filetype_exclude = ["help" "neo-tree" "Trouble" "lazy" "mason" "notify" "toggleterm"];
- show_current_context = false;
- show_trailing_blankline_indent = false;
- };
- };
-}
diff --git a/config/plugins/telescope.lua b/config/plugins/telescope.lua
new file mode 100644
index 0000000..be3366b
--- /dev/null
+++ b/config/plugins/telescope.lua
@@ -0,0 +1 @@
+require("telescope").setup()
diff --git a/config/plugins/telescope.nix b/config/plugins/telescope.nix
deleted file mode 100644
index 68a5112..0000000
--- a/config/plugins/telescope.nix
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- plugins.telescope = {
- enable = true;
- };
-}
diff --git a/config/plugins/treesitter.lua b/config/plugins/treesitter.lua
new file mode 100644
index 0000000..e9b88f2
--- /dev/null
+++ b/config/plugins/treesitter.lua
@@ -0,0 +1,11 @@
+require("nvim-treesitter.configs").setup({
+ auto_install = false,
+
+ highlight = { enable = true },
+ indent = { enable = true },
+
+ -- nvim-ts-autotag
+ autotag = { enable = true },
+})
+
+vim.g.skip_ts_context_commentstring_module = true
diff --git a/config/plugins/treesitter.nix b/config/plugins/treesitter.nix
deleted file mode 100644
index 047bd17..0000000
--- a/config/plugins/treesitter.nix
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- pkgs,
- self,
- ...
-}: {
- extraPlugins = [pkgs.vimPlugins.vim-just];
-
- plugins = {
- treesitter = {
- enable = true;
-
- grammarPackages = pkgs.vimPlugins.nvim-treesitter.allGrammars ++ [self.tree-sitter-just];
-
- indent = true;
- nixvimInjections = true;
- };
-
- ts-context-commentstring = {
- enable = true;
- disableAutoInitialization = true;
- };
-
- ts-autotag.enable = true;
- };
-}
diff --git a/config/plugins/trouble.lua b/config/plugins/trouble.lua
new file mode 100644
index 0000000..38ef1e9
--- /dev/null
+++ b/config/plugins/trouble.lua
@@ -0,0 +1 @@
+require("trouble").setup()
diff --git a/config/plugins/trouble.nix b/config/plugins/trouble.nix
deleted file mode 100644
index 343c92f..0000000
--- a/config/plugins/trouble.nix
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- plugins.trouble = {
- enable = true;
- };
-}
diff --git a/config/plugins/which-key.lua b/config/plugins/which-key.lua
new file mode 100644
index 0000000..32ca2ff
--- /dev/null
+++ b/config/plugins/which-key.lua
@@ -0,0 +1,5 @@
+require("which-key").setup({
+ plugins = {
+ spelling = { enable = true },
+ },
+})
diff --git a/config/plugins/which-key.nix b/config/plugins/which-key.nix
deleted file mode 100644
index ef43fc4..0000000
--- a/config/plugins/which-key.nix
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- plugins.which-key = {
- enable = true;
-
- plugins = {
- spelling.enabled = true;
- };
- };
-}
diff --git a/flake.lock b/flake.lock
index 4f488cf..ccea2ca 100644
--- a/flake.lock
+++ b/flake.lock
@@ -14,50 +14,10 @@
"url": "https://flakehub.com/f/NixOS/nixpkgs/0.1.0.tar.gz"
}
},
- "nixvim": {
- "inputs": {
- "flake-utils": [
- "utils"
- ],
- "nixpkgs": [
- "nixpkgs"
- ],
- "pre-commit-hooks": []
- },
- "locked": {
- "lastModified": 1703859882,
- "narHash": "sha256-wRXgap0eEuswF9xXUKDiWBh0tKuJ9vtmlJZ4iAX3K/E=",
- "rev": "1d8e7906c9606c956c6b40d8d088c8d2110dc0c0",
- "revCount": 865,
- "type": "tarball",
- "url": "https://api.flakehub.com/f/pinned/nix-community/nixvim/0.1.865%2Brev-1d8e7906c9606c956c6b40d8d088c8d2110dc0c0/018cb5f7-3a9f-7ad1-99f0-3e1da8634bb8/source.tar.gz"
- },
- "original": {
- "type": "tarball",
- "url": "https://flakehub.com/f/nix-community/nixvim/0.1.%2A.tar.gz"
- }
- },
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
- "nixvim": "nixvim",
- "tree-sitter-just": "tree-sitter-just",
- "utils": "utils"
- }
- },
- "systems": {
- "locked": {
- "lastModified": 1681028828,
- "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
- "owner": "nix-systems",
- "repo": "default",
- "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
- "type": "github"
- },
- "original": {
- "owner": "nix-systems",
- "repo": "default",
- "type": "github"
+ "tree-sitter-just": "tree-sitter-just"
}
},
"tree-sitter-just": {
@@ -75,23 +35,6 @@
"repo": "tree-sitter-just",
"type": "github"
}
- },
- "utils": {
- "inputs": {
- "systems": "systems"
- },
- "locked": {
- "lastModified": 1701680307,
- "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
- "rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
- "revCount": 88,
- "type": "tarball",
- "url": "https://api.flakehub.com/f/pinned/numtide/flake-utils/0.1.88%2Brev-4022d587cbbfd70fe950c1e2083a02621806a725/018c340d-3287-7c66-818b-f2f646a808e3/source.tar.gz"
- },
- "original": {
- "type": "tarball",
- "url": "https://flakehub.com/f/numtide/flake-utils/0.1.88.tar.gz"
- }
}
},
"root": "root",
diff --git a/flake.nix b/flake.nix
index 6967818..41c6b86 100644
--- a/flake.nix
+++ b/flake.nix
@@ -3,16 +3,6 @@
inputs = {
nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.0.tar.gz";
- utils.url = "https://flakehub.com/f/numtide/flake-utils/0.1.88.tar.gz";
-
- nixvim = {
- url = "https://flakehub.com/f/nix-community/nixvim/0.1.*.tar.gz";
- inputs = {
- nixpkgs.follows = "nixpkgs";
- flake-utils.follows = "utils";
- pre-commit-hooks.follows = "";
- };
- };
tree-sitter-just = {
url = "github:IndianBoy42/tree-sitter-just";
@@ -21,83 +11,53 @@
};
outputs = {
+ self,
nixpkgs,
- utils,
- nixvim,
- tree-sitter-just,
...
- }:
- utils.lib.eachDefaultSystem (system: let
- pkgs = nixpkgs.legacyPackages.${system};
- inherit (pkgs) lib;
- in rec {
- checks = {
- check-actionlint =
- pkgs.runCommand "check-actionlint" {
- nativeBuildInputs = [pkgs.actionlint];
- } ''
- actionlint ${./.}/.github/workflows/*
- touch $out
- '';
-
- "check-${formatter.pname}" =
- pkgs.runCommand "check-${formatter.pname}" {
- nativeBuildInputs = [formatter];
- } ''
- ${lib.getExe formatter} --check ${./.}
- touch $out
- '';
-
- check-statix =
- pkgs.runCommand "check-statix" {
- nativeBuildInputs = [pkgs.statix];
- }
- ''
- statix check ${./.}
- touch $out
- '';
-
- check-nil =
- pkgs.runCommand "check-nil" {
- nativeBuildInputs = with pkgs; [fd git nil];
- }
- ''
- cd ${./.}
- fd . -e 'nix' | while read -r file; do
- nil diagnostics "$file"
- done
-
- touch $out
- '';
- };
-
- devShells = {
- default = pkgs.mkShell {
- packages = with pkgs; [
- actionlint
- formatter
- deadnix
- nil
- statix
- ];
- };
+ } @ inputs: let
+ systems = [
+ "x86_64-linux"
+ "aarch64-linux"
+ "x86_64-darwin"
+ "aarch64-darwin"
+ ];
+
+ forSystem = system: fn: fn nixpkgs.legacyPackages.${system};
+ forAllSystems = fn: nixpkgs.lib.genAttrs systems (system: forSystem system fn);
+ in {
+ checks = forAllSystems (pkgs: import ./checks.nix {inherit pkgs self;});
+
+ devShells = forAllSystems (pkgs: {
+ default = pkgs.mkShell {
+ packages = with pkgs; [
+ actionlint
+
+ # lua
+ lua-language-server
+ stylua
+
+ # nix
+ self.formatter.${pkgs.system}
+ deadnix
+ nil
+ statix
+ ];
};
+ });
- formatter = pkgs.alejandra;
+ formatter = forAllSystems (pkgs: pkgs.alejandra);
- packages = {
- nvim = nixvim.legacyPackages.${system}.makeNixvimWithModule {
- module = ./config;
- extraSpecialArgs = {self = packages;};
- };
+ packages = forAllSystems (pkgs: rec {
+ getchvim = import ./neovim.nix self pkgs;
- tree-sitter-just = pkgs.tree-sitter.buildGrammar {
- language = "just";
- version = builtins.substring 0 8 tree-sitter-just.lastModifiedDate;
- src = tree-sitter-just;
- };
+ tree-sitter-just = pkgs.tree-sitter.buildGrammar {
+ language = "just";
+ version = builtins.substring 0 8 inputs.tree-sitter-just.lastModifiedDate;
- default = packages.nvim;
+ src = inputs.tree-sitter-just;
};
+
+ default = getchvim;
});
+ };
}
diff --git a/neovim.nix b/neovim.nix
new file mode 100644
index 0000000..70727cd
--- /dev/null
+++ b/neovim.nix
@@ -0,0 +1,103 @@
+self: {
+ lib,
+ pkgs,
+ ...
+}: let
+ config = pkgs.vimUtils.buildVimPlugin {
+ pname = "neovim-config";
+ version = builtins.substring 0 8 self.lastModifiedDate or "dirty";
+
+ src = null;
+
+ dontUnpack = true;
+
+ buildPhase = ''
+ mkdir -p lua
+ cp -r ${./config} lua/getchoo
+ '';
+ };
+
+ plugins = with pkgs.vimPlugins; [
+ bufferline-nvim
+ # dependent on >
+ nvim-web-devicons
+ catppuccin-nvim
+
+ nvim-cmp
+ luasnip
+ cmp-async-path
+ cmp-buffer
+ cmp_luasnip
+ cmp-nvim-lsp
+ cmp-rg
+
+ dressing-nvim
+
+ efmls-configs-nvim
+
+ fidget-nvim
+ flash-nvim
+ gitsigns-nvim
+
+ indent-blankline-nvim
+
+ lsp-format-nvim
+ nvim-lspconfig
+
+ lualine-nvim
+
+ mini-nvim
+ neo-tree-nvim
+
+ telescope-nvim
+ # dependent on >
+ plenary-nvim
+
+ (
+ nvim-treesitter.withPlugins (_:
+ nvim-treesitter.allGrammars ++ [self.packages.${pkgs.system}.tree-sitter-just])
+ )
+ nvim-ts-context-commentstring
+ nvim-ts-autotag
+ vim-just
+
+ trouble-nvim
+ which-key-nvim
+ ];
+
+ extraPackages = with pkgs; [
+ # cmp
+ ripgrep
+
+ # efmls-configs
+ efm-langserver
+ nodePackages.alex
+ actionlint
+ beautysh
+ codespell
+ shellcheck
+ statix
+
+ # lspconfig
+ nodePackages.bash-language-server
+ nil
+ alejandra
+ ];
+
+ neovimConfig = pkgs.neovimUtils.makeNeovimConfig {
+ withPython3 = true;
+ withRuby = false;
+ plugins = plugins ++ [config];
+ customRC = ''
+ lua require("getchoo")
+ '';
+ };
+in
+ pkgs.wrapNeovimUnstable pkgs.neovim-unwrapped (lib.recursiveUpdate
+ neovimConfig
+ {
+ wrapperArgs =
+ lib.escapeShellArgs neovimConfig.wrapperArgs
+ + " "
+ + ''--suffix PATH : "${lib.makeBinPath extraPackages}"'';
+ })