From fd5add50ee270c0adec9088a1978a96b1e649f6d Mon Sep 17 00:00:00 2001 From: Oscar Wallberg Date: Mon, 4 Sep 2023 03:44:07 +0200 Subject: [PATCH] Add user command for updating everything --- init.lua | 2 +- lua/core/user_commands.lua | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 lua/core/user_commands.lua diff --git a/init.lua b/init.lua index 8c3a0c8..fced91f 100644 --- a/init.lua +++ b/init.lua @@ -18,7 +18,7 @@ local module_name = "base" local utils = require("utils") -local files = { "globals", "options", "autocommands", "mappings", } +local files = { "globals", "options", "autocommands", "mappings", "user_commands", } for _, file in ipairs(files) do local pkg = "core." .. file diff --git a/lua/core/user_commands.lua b/lua/core/user_commands.lua new file mode 100644 index 0000000..30a6cf6 --- /dev/null +++ b/lua/core/user_commands.lua @@ -0,0 +1,29 @@ +--[[ + Copyright 2023 Oscar Wallberg + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +]] + +vim.api.nvim_create_user_command( + "Update", + function (_) + require("lazy").update() + vim.fn.execute(":TSUpdateSync") + vim.fn.execute(":Neorg sync-parsers") + vim.fn.execute(":MasonUpdateAll") + end, + { + desc = "Update lazy plugins, treesitter parsers and mason language servers", + force = false, + } +)