From d6b3f9aaf670eec24ba008e9113839b308666f01 Mon Sep 17 00:00:00 2001 From: pml68 Date: Wed, 1 Jan 2025 01:19:19 +0100 Subject: fix: revert to rust.vim, fix weird cmp behavior --- lua/pml68/configs/cmp.lua | 7 +------ lua/pml68/configs/lspconfig.lua | 7 +++++-- lua/pml68/plugins/completion.lua | 1 - lua/pml68/plugins/guard.lua | 3 +-- lua/pml68/plugins/lang-specific.lua | 13 ++++++++++++- 5 files changed, 19 insertions(+), 12 deletions(-) diff --git a/lua/pml68/configs/cmp.lua b/lua/pml68/configs/cmp.lua index 12383bb..c69110d 100644 --- a/lua/pml68/configs/cmp.lua +++ b/lua/pml68/configs/cmp.lua @@ -6,12 +6,11 @@ cmp.setup({ { name = 'path' }, { name = 'vimtex' }, { name = 'crates' }, - { name = 'emoji' }, }, { { name = 'buffer' }, }), snippet = { - expand = function (args) + expand = function(args) vim.snippet.expand(args.body) end, }, @@ -25,10 +24,6 @@ cmp.setup({ scrollbar = false, }, }, - preselect = 'item', - completion = { - completeopt = 'menu,menuone,noinsert' - }, mapping = cmp.mapping.preset.insert({ [''] = cmp.mapping.confirm({ select = true }), [''] = cmp.mapping.select_prev_item({ behavior = 'select' }), diff --git a/lua/pml68/configs/lspconfig.lua b/lua/pml68/configs/lspconfig.lua index 55f2d6f..075deb7 100644 --- a/lua/pml68/configs/lspconfig.lua +++ b/lua/pml68/configs/lspconfig.lua @@ -1,4 +1,7 @@ -local capabilities = require("cmp_nvim_lsp").default_capabilities() +local capabilities = vim.tbl_deep_extend("force", + vim.lsp.protocol.make_client_capabilities(), + require('cmp_nvim_lsp').default_capabilities() +) local lspconfig = require("lspconfig") vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { @@ -45,7 +48,7 @@ for _, server in pairs(servers) do local require_ok, conf_opts = pcall(require, "pml68.configs.settings." .. server) if require_ok then - opts = vim.tbl_deep_extend("force", conf_opts, opts) + opts = vim.tbl_deep_extend("force", opts, conf_opts) end lspconfig[server].setup(opts) diff --git a/lua/pml68/plugins/completion.lua b/lua/pml68/plugins/completion.lua index 82f275e..561ab22 100644 --- a/lua/pml68/plugins/completion.lua +++ b/lua/pml68/plugins/completion.lua @@ -18,7 +18,6 @@ return { "hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-buffer", "hrsh7th/cmp-path", - "hrsh7th/cmp-emoji" }, config = function() require("pml68.configs.cmp") diff --git a/lua/pml68/plugins/guard.lua b/lua/pml68/plugins/guard.lua index 8f0ddd0..bfae097 100644 --- a/lua/pml68/plugins/guard.lua +++ b/lua/pml68/plugins/guard.lua @@ -3,12 +3,11 @@ return { dependencies = { "nvimdev/guard-collection" }, - event = { "BufReadPost", "BufNewFile" }, + ft = { "c", "cpp", "h", "json", "go", "lua" }, config = function() local ft = require("guard.filetype") ft("c,cpp,h"):fmt("clang-format") - ft("rust"):fmt("lsp") ft("json"):fmt({ cmd = "jq", stdin = true diff --git a/lua/pml68/plugins/lang-specific.lua b/lua/pml68/plugins/lang-specific.lua index 782e207..8b664e3 100644 --- a/lua/pml68/plugins/lang-specific.lua +++ b/lua/pml68/plugins/lang-specific.lua @@ -14,6 +14,17 @@ return { build = ":GoInstallDeps", }, -- Rust + { + "rust-lang/rust.vim", + ft = "rust", + init = function() + vim.g.rustfmt_autosave = 1 + end, + config = function() + vim.keymap.set("n", "rts", "RustTest") + vim.keymap.set("n", "rta", "RustTest!") + end + }, { "saecki/crates.nvim", tag = "stable", @@ -35,6 +46,6 @@ return { ft = "tex", init = function() vim.g.vimtex_view_method = 'mupdf' - end + end, }, } -- cgit v1.2.3