From 47a9afae4b9f35f081a2dd43f7c60730beed030a Mon Sep 17 00:00:00 2001 From: Daniel Carrillo Date: Wed, 15 Feb 2023 20:19:53 +0100 Subject: [PATCH] [neovim] Add yaml-companion module and update plugins --- .config/nvim/lazy-lock.json | 24 +++++++++---------- .config/nvim/lua/core/plugins.lua | 6 +++++ .config/nvim/lua/plugins/lsp/init.lua | 1 + .../nvim/lua/plugins/lsp/yaml-companion.lua | 2 ++ .config/nvim/lua/plugins/lualine.lua | 17 +++++++++++++ 5 files changed, 38 insertions(+), 12 deletions(-) create mode 100644 .config/nvim/lua/plugins/lsp/yaml-companion.lua diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index 123d137..6f59885 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -15,28 +15,28 @@ "git-blame.nvim": { "branch": "master", "commit": "17840d01f42ee308e1dbbcc2cde991297aee36c9" }, "gitsigns.nvim": { "branch": "main", "commit": "bb808fc7376ed7bac0fbe8f47b83d4bf01738167" }, "go.nvim": { "branch": "master", "commit": "4977d3165d6ee8a06781f7b3443484fe7e91c9a3" }, - "guihua.lua": { "branch": "master", "commit": "5cebe5bd6ce1820cab526f4ba5876d441a752460" }, + "guihua.lua": { "branch": "master", "commit": "ca33e21520da255dc97ecd40cdd7c3c454068979" }, "indent-blankline.nvim": { "branch": "master", "commit": "8299fe7703dfff4b1752aeed271c3b95281a952d" }, - "lazy.nvim": { "branch": "main", "commit": "c778b7aa04c484e1536ba219e71f2fd0f05302aa" }, - "lspsaga.nvim": { "branch": "main", "commit": "7a254466aae810b4be77c5be8e63c5483e309273" }, + "lazy.nvim": { "branch": "main", "commit": "e916f41df26e33b01f1b3ebe28881090da3a7281" }, + "lspsaga.nvim": { "branch": "main", "commit": "397201abffa681419a610ecbfd5d3c0fed45d20a" }, "lualine-lsp-progress": { "branch": "master", "commit": "56842d097245a08d77912edf5f2a69ba29f275d7" }, - "lualine.nvim": { "branch": "master", "commit": "0050b308552e45f7128f399886c86afefc3eb988" }, + "lualine.nvim": { "branch": "master", "commit": "e99d733e0213ceb8f548ae6551b04ae32e590c80" }, "markdown-preview.nvim": { "branch": "master", "commit": "02cc3874738bc0f86e4b91f09b8a0ac88aef8e96" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "e2b82cf4c68b453eeab5833d90c042ed4b49d0e1" }, - "mason.nvim": { "branch": "main", "commit": "a35f3c44381c8ce37faefd427b474ea5ef72d37d" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "93e58e100f37ef4fb0f897deeed20599dae9d128" }, + "mason.nvim": { "branch": "main", "commit": "63ccfe5dd1a9afd16d9d3cdcf0aa59403eef5ef7" }, "mini.starter": { "branch": "main", "commit": "8cc5890e504a3fe8ac78e9db8e0a5aea49a24df2" }, "neo-tree.nvim": { "branch": "v2.x", "commit": "245cf1e68840defcc75a16297740f6203f5a045d" }, "nui.nvim": { "branch": "main", "commit": "d147222a1300901656f3ebd5b95f91732785a329" }, - "null-ls.nvim": { "branch": "main", "commit": "9d811bb6ed44cf766f4bda8a47fd65fdfbdcaa7d" }, + "null-ls.nvim": { "branch": "main", "commit": "a75bba0ae5e89df03f01c17a1d913884eeebcc2e" }, "nvim-autopairs": { "branch": "master", "commit": "45ae3122a4c7744db41298b41f9f5a3f092123e6" }, - "nvim-cmp": { "branch": "main", "commit": "aae0c3e4e778ca4be6fabc52e388cbd5b844b7a5" }, + "nvim-cmp": { "branch": "main", "commit": "208d69f233d65526a22c6497ed57d0c80d99fa5f" }, "nvim-dap": { "branch": "master", "commit": "700a3c7d6fbe5b07bee74e9952b456120d355c47" }, "nvim-dap-ui": { "branch": "master", "commit": "1e21b3b50e67700e32285b5a74e645311fd8bbea" }, - "nvim-dap-virtual-text": { "branch": "master", "commit": "7f7f2af549e72a0b7bddc3b4f827beb027ea8ce3" }, - "nvim-lspconfig": { "branch": "master", "commit": "1712672e4da3003a0dd9f771d30389600b360f42" }, - "nvim-treesitter": { "branch": "master", "commit": "ad9ae9e7def54fee446c3e186ed0a0d44cca7b90" }, + "nvim-dap-virtual-text": { "branch": "master", "commit": "8db23ea51203b5f00ad107a0cef7e0b2d7a0476c" }, + "nvim-lspconfig": { "branch": "master", "commit": "649137cbc53a044bffde36294ce3160cb18f32c7" }, + "nvim-treesitter": { "branch": "master", "commit": "b44871afb59e456bbff4113e416405c06c991cf5" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "a0f89563ba36b3bacd62cf967b46beb4c2c29e52" }, - "nvim-web-devicons": { "branch": "master", "commit": "bd7a222287c5828cd0607cd0a5605e52f0460074" }, + "nvim-web-devicons": { "branch": "master", "commit": "bb6d4fd1e010300510172b173ab5205d37af084f" }, "plenary.nvim": { "branch": "master", "commit": "9a0d3bf7b832818c042aaf30f692b081ddd58bd9" }, "projections.nvim": { "branch": "main", "commit": "6820ad90343b5ec78f236bbe0e13d9c8078a0c48" }, "sad.nvim": { "branch": "master", "commit": "1cdf3f25589dc92854913004443ba0e53bd103ad" }, diff --git a/.config/nvim/lua/core/plugins.lua b/.config/nvim/lua/core/plugins.lua index c949313..27d862d 100644 --- a/.config/nvim/lua/core/plugins.lua +++ b/.config/nvim/lua/core/plugins.lua @@ -95,6 +95,12 @@ lazy.setup({ { "folke/trouble.nvim", cmd = { "TroubleToggle", "Trouble" } }, { "glepnir/lspsaga.nvim", event = "BufRead" }, { "arkav/lualine-lsp-progress" }, + { + "someone-stole-my-name/yaml-companion.nvim", + config = function() + require("telescope").load_extension("yaml_schema") + end, + }, -- Telescope { "nvim-telescope/telescope.nvim", cmd = "Telescope" }, diff --git a/.config/nvim/lua/plugins/lsp/init.lua b/.config/nvim/lua/plugins/lsp/init.lua index a3385e1..334e096 100644 --- a/.config/nvim/lua/plugins/lsp/init.lua +++ b/.config/nvim/lua/plugins/lsp/init.lua @@ -7,5 +7,6 @@ require("plugins.lsp.mason") require("plugins.lsp.handlers").setup() require("plugins.lsp.null-ls") require("plugins.lsp.lsp-saga") +require("plugins.lsp.yaml-companion") win.default_options.border = "rounded" diff --git a/.config/nvim/lua/plugins/lsp/yaml-companion.lua b/.config/nvim/lua/plugins/lsp/yaml-companion.lua new file mode 100644 index 0000000..9662709 --- /dev/null +++ b/.config/nvim/lua/plugins/lsp/yaml-companion.lua @@ -0,0 +1,2 @@ +local cfg = require("yaml-companion").setup({}) +require("lspconfig")["yamlls"].setup(cfg) diff --git a/.config/nvim/lua/plugins/lualine.lua b/.config/nvim/lua/plugins/lualine.lua index afb7d3c..ccedbd8 100644 --- a/.config/nvim/lua/plugins/lualine.lua +++ b/.config/nvim/lua/plugins/lualine.lua @@ -26,6 +26,7 @@ local diff = { local filetype = { "filetype", colored = false, + separator = "", } local lsp_progress = { @@ -54,6 +55,21 @@ local venv = function() return "" end +local get_schema = function() + local ft = vim.bo.filetype or "" + + if ft == "yaml" then + local schema = require("yaml-companion").get_buf_schema(0) + if schema.result[1].name == "none" then + return "" + end + + return "(" .. schema.result[1].name .. ")" + else + return "" + end +end + local gitblame_status_ok, gitblame = pcall(require, "gitblame") if not gitblame_status_ok then return @@ -77,6 +93,7 @@ lualine.setup({ spaces, "encoding", filetype, + { get_schema, separator = "" }, }, lualine_y = { "progress" }, lualine_z = { "location" },