From 7a2679afdd66111dd256f6728575770e0fe1561a Mon Sep 17 00:00:00 2001 From: DACHXY Date: Sun, 26 Jan 2025 22:12:10 +0800 Subject: [PATCH] style: nvim lsp border --- flake.lock | 225 +++++++++++++++++++++- flake.nix | 2 + home/config/nvim/lua/plugins/hover.lua | 71 ------- home/config/nvim/lua/plugins/lsp.lua | 8 +- home/config/nvim/lua/plugins/neo-tree.lua | 32 +++ home/config/nvim/lua/plugins/noice.lua | 8 + home/user/nvim.nix | 13 +- system/modules/packages.nix | 1 + 8 files changed, 282 insertions(+), 78 deletions(-) delete mode 100644 home/config/nvim/lua/plugins/hover.lua create mode 100644 home/config/nvim/lua/plugins/neo-tree.lua create mode 100644 home/config/nvim/lua/plugins/noice.lua diff --git a/flake.lock b/flake.lock index 7d46575..fc3c27b 100644 --- a/flake.lock +++ b/flake.lock @@ -141,6 +141,80 @@ "type": "github" } }, + "flake-compat_4": { + "flake": false, + "locked": { + "lastModified": 1733328505, + "narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_5": { + "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-overlay", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1736143030, + "narHash": "sha256-+hu54pAoLDEZT9pjHlqL9DNzWz0NbUn8NEAHP7PQPzU=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "b905f6fc23a9051a6e1b741e1438dbfc0634c6de", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { + "inputs": { + "nixpkgs-lib": [ + "neovim-nightly-overlay", + "hercules-ci-effects", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1736143030, + "narHash": "sha256-+hu54pAoLDEZT9pjHlqL9DNzWz0NbUn8NEAHP7PQPzU=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "b905f6fc23a9051a6e1b741e1438dbfc0634c6de", + "type": "github" + }, + "original": { + "id": "flake-parts", + "type": "indirect" + } + }, "flake-utils": { "inputs": { "systems": "systems_2" @@ -216,6 +290,29 @@ "type": "github" } }, + "git-hooks": { + "inputs": { + "flake-compat": "flake-compat_5", + "gitignore": "gitignore_2", + "nixpkgs": [ + "neovim-nightly-overlay", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1737465171, + "narHash": "sha256-R10v2hoJRLq8jcL4syVFag7nIGE7m13qO48wRIukWNg=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "9364dc02281ce2d37a1f55b6e51f7c0f65a75f17", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, "gitignore": { "inputs": { "nixpkgs": [ @@ -238,6 +335,50 @@ "type": "github" } }, + "gitignore_2": { + "inputs": { + "nixpkgs": [ + "neovim-nightly-overlay", + "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" + } + }, + "hercules-ci-effects": { + "inputs": { + "flake-parts": "flake-parts_2", + "nixpkgs": [ + "neovim-nightly-overlay", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1736917206, + "narHash": "sha256-JTBWmyGf8K1Rwb+gviHIUzRJk/sITtT+72HXFkTZUjo=", + "owner": "hercules-ci", + "repo": "hercules-ci-effects", + "rev": "afd0a42e8c61ebb56899315ee4084a8b2e4ff425", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "hercules-ci-effects", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -565,6 +706,46 @@ "type": "github" } }, + "neovim-nightly-overlay": { + "inputs": { + "flake-compat": "flake-compat_4", + "flake-parts": "flake-parts", + "git-hooks": "git-hooks", + "hercules-ci-effects": "hercules-ci-effects", + "neovim-src": "neovim-src", + "nixpkgs": "nixpkgs_2", + "treefmt-nix": "treefmt-nix" + }, + "locked": { + "lastModified": 1737763478, + "narHash": "sha256-fohNScp0mg8eUugIoqcLhy7tnUJ7CxhcVomizNqj5b8=", + "owner": "nix-community", + "repo": "neovim-nightly-overlay", + "rev": "8a11d160b76ea8dc76ac3356140010e38fef0ab5", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "neovim-nightly-overlay", + "type": "github" + } + }, + "neovim-src": { + "flake": false, + "locked": { + "lastModified": 1737716271, + "narHash": "sha256-7bgefXUOc5AVXSZ4E+0YzJKW4c+tDj1ttmDoZN1BhPs=", + "owner": "neovim", + "repo": "neovim", + "rev": "c6d2cbf8f51abfa0c9d244ef384a15b0b69e16c6", + "type": "github" + }, + "original": { + "owner": "neovim", + "repo": "neovim", + "type": "github" + } + }, "nix-index-database": { "inputs": { "nixpkgs": [ @@ -649,6 +830,22 @@ } }, "nixpkgs_2": { + "locked": { + "lastModified": 1737717945, + "narHash": "sha256-ET91TMkab3PmOZnqiJQYOtSGvSTvGeHoegAv4zcTefM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "ecd26a469ac56357fd333946a99086e992452b6a", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { "locked": { "lastModified": 1736883708, "narHash": "sha256-uQ+NQ0/xYU0N1CnXsa2zghgNaOPxWpMJXSUJJ9W7140=", @@ -664,7 +861,7 @@ "type": "github" } }, - "nixpkgs_3": { + "nixpkgs_4": { "locked": { "lastModified": 1729265718, "narHash": "sha256-4HQI+6LsO3kpWTYuVGIzhJs1cetFcwT7quWCk/6rqeo=", @@ -712,8 +909,9 @@ "hyprgrass": "hyprgrass", "hyprland": "hyprland", "hyprland-plugins": "hyprland-plugins", + "neovim-nightly-overlay": "neovim-nightly-overlay", "nix-index-database": "nix-index-database", - "nixpkgs": "nixpkgs_2", + "nixpkgs": "nixpkgs_3", "yazi": "yazi" } }, @@ -813,6 +1011,27 @@ "type": "github" } }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "neovim-nightly-overlay", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1737483750, + "narHash": "sha256-5An1wq5U8sNycOBBg3nsDDgpwBmR9liOpDGlhliA6Xo=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "f2cc121df15418d028a59c9737d38e3a90fbaf8f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + }, "xdph": { "inputs": { "hyprland-protocols": [ @@ -857,7 +1076,7 @@ "yazi": { "inputs": { "flake-utils": "flake-utils_3", - "nixpkgs": "nixpkgs_3", + "nixpkgs": "nixpkgs_4", "rust-overlay": "rust-overlay" }, "locked": { diff --git a/flake.nix b/flake.nix index be2df74..f477cb1 100644 --- a/flake.nix +++ b/flake.nix @@ -43,6 +43,8 @@ url = "github:KZDKM/Hyprspace"; inputs.hyprland.follows = "hyprland"; }; + + neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay"; }; outputs = diff --git a/home/config/nvim/lua/plugins/hover.lua b/home/config/nvim/lua/plugins/hover.lua deleted file mode 100644 index 18a17f4..0000000 --- a/home/config/nvim/lua/plugins/hover.lua +++ /dev/null @@ -1,71 +0,0 @@ -return { - { - "lewis6991/hover.nvim", - opts = { - init = function() - -- Require providers - require("hover.providers.lsp") - -- require('hover.providers.gh') - -- require('hover.providers.gh_user') - -- require('hover.providers.jira') - -- require('hover.providers.dap') - -- require("hover.providers.fold_preview") - require("hover.providers.diagnostic") - -- require('hover.providers.man') - -- require('hover.providers.dictionary') - end, - preview_opts = { - border = "single", - }, - -- Whether the contents of a currently open hover window should be moved - -- to a :h preview-window when pressing the hover keymap. - preview_window = false, - title = true, - mouse_providers = { - "LSP", - }, - mouse_delay = 1000, - }, - keys = { - { - "K", - mode = { "n" }, - function() - require("hover").hover() - end, - desc = "hover.nvim", - }, - { - "gK", - mode = { "n" }, - function() - require("hover").hover_select() - end, - desc = "hover.nvim (select)", - }, - { - "", - mode = { "n" }, - function() - require("hover").hover_switch("previous") - end, - desc = "hover.nvim (previous source)", - }, - { - "", - mode = { "n" }, - function() - require("hover").hover_switch("next") - end, - desc = "hover.nvim (next source)", - }, - { - "", - function() - require("hover").hover_mouse() - end, - desc = "hover.nvim (mouse)", - }, - }, - }, -} diff --git a/home/config/nvim/lua/plugins/lsp.lua b/home/config/nvim/lua/plugins/lsp.lua index e629504..40f242b 100644 --- a/home/config/nvim/lua/plugins/lsp.lua +++ b/home/config/nvim/lua/plugins/lsp.lua @@ -29,6 +29,13 @@ return { }, }) end, + ui = { + windows = { + default_options = { + border = "rounded", + }, + }, + }, servers = { -- biome = { -- root_dir = function(fname) @@ -90,7 +97,6 @@ return { end, }, }, - setup = {}, }, }, } diff --git a/home/config/nvim/lua/plugins/neo-tree.lua b/home/config/nvim/lua/plugins/neo-tree.lua new file mode 100644 index 0000000..2144b41 --- /dev/null +++ b/home/config/nvim/lua/plugins/neo-tree.lua @@ -0,0 +1,32 @@ +return { + { + "nvim-neo-tree/neo-tree.nvim", + branch = "v3.x", + dependencies = { + { + "s1n7ax/nvim-window-picker", -- for open_with_window_picker keymaps + version = "2.*", + config = function() + require("window-picker").setup({ + filter_rules = { + include_current_win = false, + autoselect_one = true, + -- filter using buffer options + bo = { + -- if the file type is one of following, the window will be ignored + filetype = { "neo-tree", "neo-tree-popup", "notify" }, + -- if the buffer type is one of following, the window will be ignored + buftype = { "terminal", "quickfix" }, + }, + }, + }) + end, + }, + }, + opts = { + window = { + position = "right", + }, + }, + }, +} diff --git a/home/config/nvim/lua/plugins/noice.lua b/home/config/nvim/lua/plugins/noice.lua new file mode 100644 index 0000000..87c46e9 --- /dev/null +++ b/home/config/nvim/lua/plugins/noice.lua @@ -0,0 +1,8 @@ +return { { + "folke/noice.nvim", + opts = { + presets = { + lsp_doc_border = true, + }, + }, +} } diff --git a/home/user/nvim.nix b/home/user/nvim.nix index 1acd247..851346d 100644 --- a/home/user/nvim.nix +++ b/home/user/nvim.nix @@ -3,6 +3,7 @@ pkgs, device-name, username, + inputs, ... }: { @@ -12,6 +13,7 @@ programs.neovim = { enable = true; + package = inputs.neovim-nightly-overlay.packages.${pkgs.system}.default; withPython3 = true; extraPython3Packages = ( plugins: with plugins; [ @@ -48,6 +50,7 @@ stylelint clang-tools taplo + zls ]; plugins = with pkgs.vimPlugins; [ @@ -193,6 +196,7 @@ { import = "lazyvim.plugins.extras.coding.luasnip" }, { import = "lazyvim.plugins.extras.coding.mini-surround" }, { import = "lazyvim.plugins.extras.coding.yanky" }, + { import = "lazyvim.plugins.extras.coding.neogen" }, { import = "lazyvim.plugins.extras.dap.core" }, { import = "lazyvim.plugins.extras.dap.nlua" }, { import = "lazyvim.plugins.extras.editor.dial" }, @@ -226,8 +230,11 @@ { import = "lazyvim.plugins.extras.ui.treesitter-context" }, { import = "lazyvim.plugins.extras.util.dot" }, { import = "lazyvim.plugins.extras.util.mini-hipatterns" }, + { import = "lazyvim.plugins.extras.util.project" }, + { import = "lazyvim.plugins.extras.util.rest" }, { import = "lazyvim.plugins.extras.editor.telescope" }, { import = "lazyvim.plugins.extras.editor.refactoring" }, + { import = "lazyvim.plugins.extras.editor.harpoon2" }, -- uncomment to import/override with your plugins { import = "plugins" }, @@ -271,9 +278,9 @@ command = { "nixfmt" }, }, options = { - -- nixos = { - -- expr = '(builtins.getFlake ("git+file://" + toString ./.)).nixosConfigurations.${device-name}.options', - -- }, + nixos = { + expr = '(builtins.getFlake ("git+file://" + toString ./.)).nixosConfigurations.${device-name}.options', + }, home_manager = { expr = '(builtins.getFlake ("git+file://" + toString ./.)).homeConfigurations."${username}@${device-name}".options', } diff --git a/system/modules/packages.nix b/system/modules/packages.nix index f9fc6e4..4a9af14 100644 --- a/system/modules/packages.nix +++ b/system/modules/packages.nix @@ -59,6 +59,7 @@ dotnetCorePackages.dotnet_9.aspnetcore rustup gcc + zig # Editor vim