From 6b8fec654c205f5085a3716ee83d99ce5f64aa5a Mon Sep 17 00:00:00 2001 From: newbie Date: Tue, 19 Dec 2023 12:02:11 +0800 Subject: [PATCH] update --- lua/lsp/yaml.lua | 0 lua/plugs/nvim-lspconfig.lua | 20 +++++++++++++------- lua/plugs/yaml.lua | 11 +++++++++++ 3 files changed, 24 insertions(+), 7 deletions(-) create mode 100644 lua/lsp/yaml.lua create mode 100644 lua/plugs/yaml.lua diff --git a/lua/lsp/yaml.lua b/lua/lsp/yaml.lua new file mode 100644 index 0000000..e69de29 diff --git a/lua/plugs/nvim-lspconfig.lua b/lua/plugs/nvim-lspconfig.lua index 1dcd4fc..60e0243 100644 --- a/lua/plugs/nvim-lspconfig.lua +++ b/lua/plugs/nvim-lspconfig.lua @@ -26,6 +26,7 @@ local kind_icons = { TypeParameter = "󰅲", } + local has_words_before = function() unpack = unpack or table.unpack local line, col = unpack(G.api.nvim_win_get_cursor(0)) @@ -45,6 +46,8 @@ return { require 'lspconfig'.clangd.setup(require('lsp.c')) require 'lspconfig'.bashls.setup(require('lsp.bash')) require 'lspconfig'.pyright.setup(require('lsp.pyright')) + require 'lspconfig'.jsonls.setup({}) + require('lspconfig').yamlls.setup(require("lsp.yaml")) G.map({ { 'n', 'rn', 'lua vim.lsp.buf.rename()' }, @@ -69,7 +72,9 @@ return { "clangd", "bashls", "pyright", - "lua_ls" + "lua_ls", + "jsonls", + "yamlls" } }) @@ -278,7 +283,7 @@ return { }), mapping = cmp.mapping.preset.insert({ [''] = cmp.mapping.confirm({ select = false }), - [""] = cmp.mapping(function(fallback) + [""] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_next_item() elseif vim.fn["vsnip#available"](1) == 1 then @@ -290,7 +295,7 @@ return { end end, { "i", "s" }), - [""] = cmp.mapping(function() + [""] = cmp.mapping(function() if cmp.visible() then cmp.select_prev_item() elseif vim.fn["vsnip#jumpable"](-1) == 1 then @@ -304,13 +309,14 @@ return { entries = { name = 'wildmenu', separator = '|' } }, sources = cmp.config.sources({ - { name = 'buffer' }, + -- { name = 'buffer' }, + { name = 'cmdline' } }), mapping = cmp.mapping.preset.insert({ - [''] = cmp.mapping.confirm({ select = false }), + -- [''] = cmp.mapping.confirm({ select = false }), - [""] = cmp.mapping(function(fallback) + [""] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_next_item() elseif vim.fn["vsnip#available"](1) == 1 then @@ -322,7 +328,7 @@ return { end end, { "i", "s" }), - [""] = cmp.mapping(function() + [""] = cmp.mapping(function() if cmp.visible() then cmp.select_prev_item() elseif vim.fn["vsnip#jumpable"](-1) == 1 then diff --git a/lua/plugs/yaml.lua b/lua/plugs/yaml.lua new file mode 100644 index 0000000..2bd9f59 --- /dev/null +++ b/lua/plugs/yaml.lua @@ -0,0 +1,11 @@ +return { + settings = { + yaml = { + schemas = { + ["https://json.schemastore.org/github-workflow.json"] = "/.github/workflows/*", + ["../path/relative/to/file.yml"] = "/.github/workflows/*", + ["/path/from/root/of/project"] = "/.github/workflows/*", + }, + }, + } +}