From a07446db2a47f41d7df88a2d5a2c6f9f4ec0c1d7 Mon Sep 17 00:00:00 2001 From: MasterGordon Date: Sun, 10 Nov 2024 04:14:27 +0100 Subject: [PATCH 1/2] added snacks --- lazy-lock.json | 35 ++++++++++++++++++----------------- lua/plugins.lua | 9 +++++++++ 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index 5e43865..8f02886 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -9,20 +9,20 @@ "cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "031e6ba70b0ad5eee49fd2120ff7a2e325b17fa7" }, "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, - "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, + "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, "crates.nvim": { "branch": "main", "commit": "8bf8358ee326d5d8c11dcd7ac0bcc9ff97dbc785" }, "cspell.nvim": { "branch": "main", "commit": "2c29bf573292c8f5053383d1be4ab908f4ecfc47" }, - "editorconfig-vim": { "branch": "master", "commit": "ba2ce027c5b0e523e658d24657ce3ae3306c9fe0" }, - "fidget.nvim": { "branch": "main", "commit": "d855eed8a06531a7e8fd0684889b2943f373c469" }, - "formatter.nvim": { "branch": "master", "commit": "04547bdfe89035731a2815a3875b87f77d43e36d" }, - "gitsigns.nvim": { "branch": "main", "commit": "863903631e676b33e8be2acb17512fdc1b80b4fb" }, + "editorconfig-vim": { "branch": "master", "commit": "3c2813f2566d9392ff3614248c5db43c3fda9d5f" }, + "fidget.nvim": { "branch": "main", "commit": "e2a175c2abe2d4f65357da1c98c59a5cfb2b543f" }, + "formatter.nvim": { "branch": "master", "commit": "eb89a1f3e079f1b9680bc7293b75fffccb5e1598" }, + "gitsigns.nvim": { "branch": "main", "commit": "4daf7022f1481edf1e8fb9947df13bb07c18e89a" }, "heirline.nvim": { "branch": "master", "commit": "7a79753c1a42c3f52e89a6c42429e7f871e560cd" }, - "lazy.nvim": { "branch": "main", "commit": "1159bdccd8910a0fd0914b24d6c3d186689023d9" }, + "lazy.nvim": { "branch": "main", "commit": "b1134ab82ee4279e31f7ddf7e34b2a99eb9b7bc9" }, "lightspeed.nvim": { "branch": "main", "commit": "fcc72d8a4d5f4ebba62d8a3a0660f88f1b5c3b05" }, "lsp_signature.nvim": { "branch": "master", "commit": "fc38521ea4d9ec8dbd4c2819ba8126cea743943b" }, - "lspkind-nvim": { "branch": "master", "commit": "59c3f419af48a2ffb2320cea85e44e5a95f71664" }, + "lspkind-nvim": { "branch": "master", "commit": "a700f1436d4a938b1a1a93c9962dc796afbaef4d" }, "markview.nvim": { "branch": "main", "commit": "67b69cdaf9055bebac3682a070d7e5c8eecba29c" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "25c11854aa25558ee6c03432edfa0df0217324be" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "4d0e5b49363cac187326998b96aa6a2884e0e89b" }, "mason-null-ls.nvim": { "branch": "main", "commit": "de19726de7260c68d94691afb057fa73d3cc53e7" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, "mkdir.nvim": { "branch": "main", "commit": "c55d1dee4f099528a1853b28bb28caa802eba217" }, @@ -30,17 +30,17 @@ "neo-tree.nvim": { "branch": "main", "commit": "a77af2e764c5ed4038d27d1c463fa49cd4794e07" }, "neotest": { "branch": "master", "commit": "6d3d22cdad49999ef774ebe1bc250a4994038964" }, "neotest-jest": { "branch": "main", "commit": "514fd4eae7da15fd409133086bb8e029b65ac43f" }, - "neotest-zig": { "branch": "main", "commit": "a94b38aa5914993cfc8c5c9b341ff47f28c158e3" }, + "neotest-zig": { "branch": "main", "commit": "b0e72626135b703fe186a062f38a47ac739f1cdd" }, "none-ls.nvim": { "branch": "main", "commit": "dcc8cd4efdcb29275681a3c95786a816330dbca6" }, "nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" }, "nvim-autopairs": { "branch": "master", "commit": "ee297f215e95a60b01fde33275cc3c820eddeebe" }, - "nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" }, + "nvim-cmp": { "branch": "main", "commit": "f17d9b4394027ff4442b298398dfcaab97e40c4f" }, "nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" }, - "nvim-dap": { "branch": "master", "commit": "7ff6936010b7222fea2caea0f67ed77f1b7c60dd" }, + "nvim-dap": { "branch": "master", "commit": "8517126e9323e346f6a99b3b594c5a940b914dcd" }, "nvim-dap-ui": { "branch": "master", "commit": "ffa89839f97bad360e78428d5c740fdad9a0ff02" }, - "nvim-lspconfig": { "branch": "master", "commit": "541f3a2781de481bb84883889e4d9f0904250a56" }, + "nvim-lspconfig": { "branch": "master", "commit": "d01864641c6e43c681c3e9f6cf4745c75fdd9dcc" }, "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" }, - "nvim-treesitter": { "branch": "master", "commit": "03452942dfbd998701d4123ccad2090e1bc7e9f1" }, + "nvim-treesitter": { "branch": "master", "commit": "0603b3e3d21ebe2fa82dc5361a3d500e0d3ad3a8" }, "nvim-ts-autotag": { "branch": "main", "commit": "e239a560f338be31337e7abc3ee42515daf23f5e" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "9c74db656c3d0b1c4392fc89a016b1910539e7c0" }, "nvim-vtsls": { "branch": "main", "commit": "45c6dfea9f83a126e9bfc5dd63430562b3f8af16" }, @@ -56,12 +56,13 @@ "popui.nvim": { "branch": "master", "commit": "4d903e46fdb5eef25fa79ef1b598f5340a2674b0" }, "popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" }, "presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" }, - "roslyn.nvim": { "branch": "main", "commit": "0cb7527d951237bd23e30c461e8f7e2d615830fd" }, - "statuscol.nvim": { "branch": "main", "commit": "5998d16044159ad3779f62c45e756c555e3051f0" }, + "roslyn.nvim": { "branch": "main", "commit": "27afc7fcfec623ef06f1f49ed0c821d1e9027197" }, + "snacks.nvim": { "branch": "main", "commit": "aa1c2477eb995cf525ddee8815edce1952026455" }, + "statuscol.nvim": { "branch": "main", "commit": "8822f76e105549620ef9c0d96e7b95aedf14c490" }, "supermaven-nvim": { "branch": "main", "commit": "07d20fce48a5629686aefb0a7cd4b25e33947d50" }, - "tailwind-tools.nvim": { "branch": "master", "commit": "89e560705ecd49607c63c277935c5264bb770d57" }, + "tailwind-tools.nvim": { "branch": "master", "commit": "cfd8275caa16749b130c0eae2f737c5f66620efc" }, "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, - "telescope.nvim": { "branch": "master", "commit": "df534c3042572fb958586facd02841e10186707c" }, + "telescope.nvim": { "branch": "master", "commit": "85922dde3767e01d42a08e750a773effbffaea3e" }, "template-string.nvim": { "branch": "main", "commit": "419bfb2e4d5f0e6ddd0d4435f85b69da0d88d524" }, "todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" }, "typescript.nvim": { "branch": "main", "commit": "4de85ef699d7e6010528dcfbddc2ed4c2c421467" }, diff --git a/lua/plugins.lua b/lua/plugins.lua index d11ea64..2f89bc6 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -56,6 +56,15 @@ require("lazy").setup( } end }, + { + "folke/snacks.nvim", + priority = 1000, + lazy = false, + ---@type snacks.Config + opts = { + bigfile = {enabled = true} + } + }, { "mhartington/formatter.nvim", config = function() From 0b40d67ae7f9afe231adf3bc3b7810ea745a9b82 Mon Sep 17 00:00:00 2001 From: MasterGordon Date: Mon, 11 Nov 2024 07:40:44 +0100 Subject: [PATCH 2/2] added blink completion --- lazy-lock.json | 10 +---- lua/keys.lua | 19 ++++++++++ lua/plugins.lua | 84 +++++++++++++++++++++++++++++++++-------- lua/plugins/lsp.lua | 91 +-------------------------------------------- 4 files changed, 91 insertions(+), 113 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index 8f02886..fb973ed 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -2,19 +2,14 @@ "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, "LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" }, - "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, - "cmp-emoji": { "branch": "main", "commit": "e8398e2adf512a03bb4e1728ca017ffeac670a9f" }, + "blink.cmp": { "branch": "main", "commit": "75cadbcd2657ed01326ca2b0e5e4d78a77127ca3" }, "cmp-npm": { "branch": "main", "commit": "2337f109f51a09297596dd6b538b70ccba92b4e4" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, - "cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "031e6ba70b0ad5eee49fd2120ff7a2e325b17fa7" }, - "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, - "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, - "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, "crates.nvim": { "branch": "main", "commit": "8bf8358ee326d5d8c11dcd7ac0bcc9ff97dbc785" }, "cspell.nvim": { "branch": "main", "commit": "2c29bf573292c8f5053383d1be4ab908f4ecfc47" }, "editorconfig-vim": { "branch": "master", "commit": "3c2813f2566d9392ff3614248c5db43c3fda9d5f" }, "fidget.nvim": { "branch": "main", "commit": "e2a175c2abe2d4f65357da1c98c59a5cfb2b543f" }, "formatter.nvim": { "branch": "master", "commit": "eb89a1f3e079f1b9680bc7293b75fffccb5e1598" }, + "friendly-snippets": { "branch": "main", "commit": "de8fce94985873666bd9712ea3e49ee17aadb1ed" }, "gitsigns.nvim": { "branch": "main", "commit": "4daf7022f1481edf1e8fb9947df13bb07c18e89a" }, "heirline.nvim": { "branch": "master", "commit": "7a79753c1a42c3f52e89a6c42429e7f871e560cd" }, "lazy.nvim": { "branch": "main", "commit": "b1134ab82ee4279e31f7ddf7e34b2a99eb9b7bc9" }, @@ -34,7 +29,6 @@ "none-ls.nvim": { "branch": "main", "commit": "dcc8cd4efdcb29275681a3c95786a816330dbca6" }, "nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" }, "nvim-autopairs": { "branch": "master", "commit": "ee297f215e95a60b01fde33275cc3c820eddeebe" }, - "nvim-cmp": { "branch": "main", "commit": "f17d9b4394027ff4442b298398dfcaab97e40c4f" }, "nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" }, "nvim-dap": { "branch": "master", "commit": "8517126e9323e346f6a99b3b594c5a940b914dcd" }, "nvim-dap-ui": { "branch": "master", "commit": "ffa89839f97bad360e78428d5c740fdad9a0ff02" }, diff --git a/lua/keys.lua b/lua/keys.lua index a7c4424..6fac092 100644 --- a/lua/keys.lua +++ b/lua/keys.lua @@ -57,3 +57,22 @@ end vim.keymap.set("n", "u", insert_random_uuid, {noremap = true, silent = true}) vim.keymap.set("n", "U", insert_random_uuid_dashed, {noremap = true, silent = true}) + +local print_namespace = function() + local cmd = 'bash -c "xq *.csproj -q RootNamespace"' + -- insert namespace NAMESPACE.PATH.TO.FILE; at the start of the file + local output = vim.fn.system(cmd):gsub("\n", "") + local relative_path = vim.fn.expand("%:h") + local short_path = relative_path:gsub("/", ".") + local namespace = output .. "." .. short_path + if relative_path == "." then + namespace = output + end + vim.cmd [[normal! gg]] + vim.cmd [[normal! }]] + vim.cmd [[normal! o]] + vim.api.nvim_put({"namespace " .. namespace .. ";"}, "c", true, true) + vim.cmd [[normal! o]] +end + +vim.keymap.set("n", "n", print_namespace, {silent = true}) diff --git a/lua/plugins.lua b/lua/plugins.lua index 2f89bc6..db8b7fd 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -88,9 +88,9 @@ require("lazy").setup( "yioneko/nvim-vtsls", "williamboman/mason.nvim", "williamboman/mason-lspconfig.nvim", - "neovim/nvim-lspconfig", "jay-babu/mason-null-ls.nvim", - "seblj/roslyn.nvim" + "seblj/roslyn.nvim", + "blink.cmp" } }, { @@ -169,21 +169,73 @@ require("lazy").setup( end }, "editorconfig/editorconfig-vim", + -- { + -- "hrsh7th/nvim-cmp", + -- config = function() + -- require("plugins/cmp") + -- end, + -- dependencies = { + -- "hrsh7th/cmp-buffer", + -- "hrsh7th/cmp-nvim-lsp", + -- "hrsh7th/cmp-path", + -- "hrsh7th/cmp-nvim-lua", + -- "hrsh7th/cmp-emoji", + -- "David-Kunz/cmp-npm", + -- "hrsh7th/cmp-nvim-lsp-signature-help", + -- "saadparwaiz1/cmp_luasnip" + -- } + -- }, { - "hrsh7th/nvim-cmp", - config = function() - require("plugins/cmp") - end, - dependencies = { - "hrsh7th/cmp-buffer", - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-path", - "hrsh7th/cmp-nvim-lua", - "hrsh7th/cmp-emoji", - "David-Kunz/cmp-npm", - "hrsh7th/cmp-nvim-lsp-signature-help", - "saadparwaiz1/cmp_luasnip" - } + "saghen/blink.cmp", + lazy = false, -- lazy loading handled internally + -- optional: provides snippets for the snippet source + dependencies = "rafamadriz/friendly-snippets", + -- use a release tag to download pre-built binaries + version = "v0.*", + -- OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust + -- build = 'cargo build --release', + -- If you use nix, you can build from source using latest nightly rust with: + -- build = 'nix run .#build-plugin', + + ---@module 'blink.cmp' + ---@type blink.cmp.Config + opts = { + -- 'default' for mappings similar to built-in completion + -- 'super-tab' for mappings similar to vscode (tab to accept, arrow keys to navigate) + -- 'enter' for mappings similar to 'super-tab' but with 'enter' to accept + -- see the "default configuration" section below for full documentation on how to define + -- your own keymap. + keymap = { + preset = "enter", + [""] = {"show", "show_documentation", "hide_documentation"} + }, + highlight = { + -- sets the fallback highlight groups to nvim-cmp's highlight groups + -- useful for when your theme doesn't support blink.cmp + -- will be removed in a future release, assuming themes add support + use_nvim_cmp_as_default = true + }, + -- set to 'mono' for 'Nerd Font Mono' or 'normal' for 'Nerd Font' + -- adjusts spacing to ensure icons are aligned + nerd_font_variant = "mono", + windows = { + autocomplete = { + max_height = 20 + }, + documentation = { + auto_show = true + } + } + + -- experimental auto-brackets support + -- accept = { auto_brackets = { enabled = true } } + + -- experimental signature help support + -- trigger = { signature_help = { enabled = true } } + }, + -- allows extending the enabled_providers array elsewhere in your config + -- without having to redefining it + opts_extend = {"sources.completion.enabled_providers"} }, { "L3MON4D3/LuaSnip", diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 858dc23..8dd4404 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -122,7 +122,8 @@ local on_attach = function(client, bufnr) vim.api.nvim_buf_set_option(bufnr, ...) end end -local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities()) +-- local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities()) +local capabilities = require("blink.cmp").get_lsp_capabilities(vim.lsp.protocol.make_client_capabilities()) require "lspconfig".jsonls.setup { on_attach = on_attach, @@ -254,94 +255,6 @@ require("roslyn").setup( } ) --- nvim_lsp.omnisharp.setup { --- cmd = {"OmniSharp"}, --- enable_editorconfig_support = true, --- enable_roslyn_analyzers = true, --- enable_import_completion = true, --- on_attach = function(client, bufnr) --- client.server_capabilities.semanticTokensProvider = { --- full = vim.empty_dict(), --- legend = { --- tokenModifiers = {"static_symbol"}, --- tokenTypes = { --- "comment", --- "excluded_code", --- "identifier", --- "keyword", --- "keyword_control", --- "number", --- "operator", --- "operator_overloaded", --- "preprocessor_keyword", --- "string", --- "whitespace", --- "text", --- "static_symbol", --- "preprocessor_text", --- "punctuation", --- "string_verbatim", --- "string_escape_character", --- "class_name", --- "delegate_name", --- "enum_name", --- "interface_name", --- "module_name", --- "struct_name", --- "type_parameter_name", --- "field_name", --- "enum_member_name", --- "constant_name", --- "local_name", --- "parameter_name", --- "method_name", --- "extension_method_name", --- "property_name", --- "event_name", --- "namespace_name", --- "label_name", --- "xml_doc_comment_attribute_name", --- "xml_doc_comment_attribute_quotes", --- "xml_doc_comment_attribute_value", --- "xml_doc_comment_cdata_section", --- "xml_doc_comment_comment", --- "xml_doc_comment_delimiter", --- "xml_doc_comment_entity_reference", --- "xml_doc_comment_name", --- "xml_doc_comment_processing_instruction", --- "xml_doc_comment_text", --- "xml_literal_attribute_name", --- "xml_literal_attribute_quotes", --- "xml_literal_attribute_value", --- "xml_literal_cdata_section", --- "xml_literal_comment", --- "xml_literal_delimiter", --- "xml_literal_embedded_expression", --- "xml_literal_entity_reference", --- "xml_literal_name", --- "xml_literal_processing_instruction", --- "xml_literal_text", --- "regex_comment", --- "regex_character_class", --- "regex_anchor", --- "regex_quantifier", --- "regex_grouping", --- "regex_alternation", --- "regex_text", --- "regex_self_escaped_character", --- "regex_other_escape" --- } --- }, --- range = true --- } --- on_attach(client, bufnr) --- end, --- flags = { --- debounce_text_changes = 150 --- }, --- capabilities = capabilities --- } - nvim_lsp.rust_analyzer.setup { on_attach = on_attach, flags = {