From 47fc4dfd3952af90548517aead1426916b058666 Mon Sep 17 00:00:00 2001 From: Smaug123 Date: Mon, 25 Mar 2024 23:44:29 +0000 Subject: [PATCH] Use roslyn-nvim, fix some prefixes --- flake.lock | 164 +++++++++++++++++++++++++++- flake.nix | 10 +- home-manager/home.nix | 9 +- home-manager/nvim/init.lua | 10 +- home-manager/nvim/lspconfig.lua | 6 +- home-manager/nvim/nvim-dap.lua | 2 + home-manager/nvim/roslyn-nvim.lua | 4 + home-manager/nvim/venv-selector.lua | 2 + 8 files changed, 192 insertions(+), 15 deletions(-) create mode 100644 home-manager/nvim/roslyn-nvim.lua diff --git a/flake.lock b/flake.lock index 655f315..3db20e4 100644 --- a/flake.lock +++ b/flake.lock @@ -78,6 +78,64 @@ "type": "github" } }, + "flake-compat_2": { + "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": [ + "neovim-nightly", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709336216, + "narHash": "sha256-Dt/wOWeW6Sqm11Yh+2+t0dfEWxoMxGBvv3JpIocFl9E=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "f7b3c975cf067e56e7cda6cb098ebe3fb4d74ca2", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { + "inputs": { + "nixpkgs-lib": [ + "neovim-nightly", + "hercules-ci-effects", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709336216, + "narHash": "sha256-Dt/wOWeW6Sqm11Yh+2+t0dfEWxoMxGBvv3JpIocFl9E=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "f7b3c975cf067e56e7cda6cb098ebe3fb4d74ca2", + "type": "github" + }, + "original": { + "id": "flake-parts", + "type": "indirect" + } + }, "flake-utils": { "inputs": { "systems": "systems" @@ -114,6 +172,46 @@ "type": "github" } }, + "flake-utils_3": { + "inputs": { + "systems": "systems_3" + }, + "locked": { + "lastModified": 1701680307, + "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "hercules-ci-effects": { + "inputs": { + "flake-parts": "flake-parts_2", + "nixpkgs": [ + "neovim-nightly", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1710478346, + "narHash": "sha256-Xjf8BdnQG0tLhPMlqQdwCIjOp7Teox0DP3N/jjyiGM4=", + "owner": "hercules-ci", + "repo": "hercules-ci-effects", + "rev": "64e7763d72c1e4c1e5e6472640615b6ae2d40fbf", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "hercules-ci-effects", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -146,6 +244,54 @@ "url": "https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-large-v3.bin?download=true" } }, + "neovim-flake": { + "inputs": { + "flake-utils": "flake-utils_2", + "nixpkgs": [ + "neovim-nightly", + "nixpkgs" + ] + }, + "locked": { + "dir": "contrib", + "lastModified": 1711323947, + "narHash": "sha256-Vc478rxwJkMuOcgBXm+brraWk9lbFqrGEdXVuST2l/A=", + "owner": "neovim", + "repo": "neovim", + "rev": "02d00cf3eed6681c6dde40585551c8243d7c003f", + "type": "github" + }, + "original": { + "dir": "contrib", + "owner": "neovim", + "repo": "neovim", + "type": "github" + } + }, + "neovim-nightly": { + "inputs": { + "flake-compat": "flake-compat_2", + "flake-parts": "flake-parts", + "hercules-ci-effects": "hercules-ci-effects", + "neovim-flake": "neovim-flake", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1711325009, + "narHash": "sha256-c5OJdyuXYzTP+k+PN73X+0pvgXR1yYMYok+72x4SLVg=", + "owner": "nix-community", + "repo": "neovim-nightly-overlay", + "rev": "119bbc295f56b531cb87502f5d2fff13dcc35a35", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "neovim-nightly-overlay", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1709961763, @@ -215,6 +361,7 @@ "darwin": "darwin", "emacs": "emacs", "home-manager": "home-manager", + "neovim-nightly": "neovim-nightly", "nixpkgs": "nixpkgs_2", "whisper": "whisper" } @@ -265,9 +412,24 @@ "type": "github" } }, + "systems_3": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "whisper": { "inputs": { - "flake-utils": "flake-utils_2", + "flake-utils": "flake-utils_3", "model": "model", "nixpkgs": "nixpkgs_3" }, diff --git a/flake.nix b/flake.nix index 94d112e..ba6ba03 100644 --- a/flake.nix +++ b/flake.nix @@ -24,10 +24,14 @@ whisper = { url = "github:Smaug123/whisper.cpp/nix"; }; + neovim-nightly = { + url = "github:nix-community/neovim-nightly-overlay"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = { - self, + neovim-nightly, darwin, emacs, nixpkgs, @@ -35,14 +39,14 @@ apple-silicon, whisper, ... - } @ inputs: let + }: let config = { # contentAddressedByDefault = true; allowUnfree = true; }; systems = ["aarch64-darwin" "aarch64-linux" "x86_64-linux"]; in let - overlays = [emacs.overlay] ++ import ./overlays.nix; + overlays = [emacs.overlay neovim-nightly.overlay] ++ import ./overlays.nix; recursiveMerge = attrList: let f = attrPath: builtins.zipAttrsWith (n: values: diff --git a/home-manager/home.nix b/home-manager/home.nix index 01ec4f7..f68718f 100644 --- a/home-manager/home.nix +++ b/home-manager/home.nix @@ -190,6 +190,11 @@ nixpkgs.vimPlugins.telescope-nvim nixpkgs.vimPlugins.tagbar nixpkgs.vimPlugins.fzf-vim + { + plugin = nixpkgs.vimPlugins.roslyn-nvim; + config = builtins.readFile ./nvim/roslyn-nvim.lua; + type = "lua"; + } { plugin = let name = "coq.artifacts"; @@ -204,8 +209,6 @@ hash = "sha256-BHm7U3pINtYamY7m26I4lQee7ccJ6AcHmYx7j1MRFDA="; }; }; - config = builtins.readFile ./nvim/venv-selector.lua; - type = "lua"; } { plugin = let @@ -260,6 +263,8 @@ withPython3 = true; extraLuaConfig = builtins.replaceStrings ["%PYTHONENV%"] ["${pythonEnv}"] (builtins.readFile ./nvim/init.lua); + + package = nixpkgs.neovim-nightly; }; programs.direnv = { diff --git a/home-manager/nvim/init.lua b/home-manager/nvim/init.lua index cff4b29..bc4f1a7 100644 --- a/home-manager/nvim/init.lua +++ b/home-manager/nvim/init.lua @@ -230,13 +230,9 @@ if status then DisplayAllMappingsWithTelescope, "View all mappings", }, - ["mp"] = { - MarkdownPreview, - "Preview Markdown in Lynx", - }, - ["md"] = { - RemoveCarriageReturn, - "Delete carriage returns from file", + m = { + p = { MarkdownPreview, "Preview Markdown in Lynx" }, + d = { RemoveCarriageReturn, "Delete carriage returns from file" }, }, ["j"] = { FormatJson, diff --git a/home-manager/nvim/lspconfig.lua b/home-manager/nvim/lspconfig.lua index 01f4f71..e8f1275 100644 --- a/home-manager/nvim/lspconfig.lua +++ b/home-manager/nvim/lspconfig.lua @@ -1,8 +1,8 @@ local coq = require("coq") -- Using rustaceanvim means we shouldn't set up the LSP for Rust manually. - -require("lspconfig")["csharp_ls"].setup({}) +-- Similarly csharp_ls is unnecessary given roslyn.nvim +-- require("lspconfig")["csharp_ls"].setup({}) require("lspconfig")["lua_ls"].setup({ on_init = function(client) @@ -74,6 +74,7 @@ do if whichkey_status then whichkey.register({ l = { + name = "loclist-related commands", p = { vim.diagnostic.goto_prev, "Go to previous entry in loclist" }, n = { vim.diagnostic.goto_next, "Go to next entry in loclist" }, l = { ToggleLocList, "Toggle loclist" }, @@ -103,6 +104,7 @@ vim.api.nvim_create_autocmd("LspAttach", { if whichkey_status then whichkey.register({ g = { + name = "Go-to related commands", D = { vim.lsp.buf.declaration, "Go to declaration" }, d = { vim.lsp.buf.definition, "Go to definition" }, i = { vim.lsp.buf.implementation, "Go to implementation" }, diff --git a/home-manager/nvim/nvim-dap.lua b/home-manager/nvim/nvim-dap.lua index 7fba5cb..e4ab02e 100644 --- a/home-manager/nvim/nvim-dap.lua +++ b/home-manager/nvim/nvim-dap.lua @@ -33,6 +33,7 @@ do if status then whichkey.register({ d = { + name = "Debugger-related commands", o = { dap.step_over, "Step over" }, i = { dap.step_into, "Step into" }, c = { dap.continue, "Continue" }, @@ -40,6 +41,7 @@ do b = { dap.toggle_breakpoint, "Toggle breakpoint" }, r = { dap.repl.open, "Open debug repl" }, v = { + name = "Commands to view debugger state", v = { function() dap_ui.hover() diff --git a/home-manager/nvim/roslyn-nvim.lua b/home-manager/nvim/roslyn-nvim.lua new file mode 100644 index 0000000..7a78a9f --- /dev/null +++ b/home-manager/nvim/roslyn-nvim.lua @@ -0,0 +1,4 @@ +require("roslyn").setup({ + on_attach = function(_, _) end, + capabilities = vim.lsp.protocol.make_client_capabilities(), +}) diff --git a/home-manager/nvim/venv-selector.lua b/home-manager/nvim/venv-selector.lua index aba3eee..84f6cd7 100644 --- a/home-manager/nvim/venv-selector.lua +++ b/home-manager/nvim/venv-selector.lua @@ -177,7 +177,9 @@ do if status then whichkey.register({ p = { + name = "Python-related commands", v = { + name = "Virtual environment-related commands", c = { CreateVenv, "Create virtual environment" }, l = { SelectVenv, "Load virtual environment" }, o = {