summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rwxr-xr-xinstall.sh18
-rw-r--r--nvim/.config/nvim/lua/tobyvin/plugins.lua8
-rw-r--r--nvim/.config/nvim/lua/tobyvin/plugins/mason-update-all.lua15
-rw-r--r--nvim/.config/nvim/lua/tobyvin/plugins/mason.lua7
4 files changed, 44 insertions, 4 deletions
diff --git a/install.sh b/install.sh
index 0ea1259..466469e 100755
--- a/install.sh
+++ b/install.sh
@@ -4,8 +4,8 @@ SCRIPT="$(basename "$0")"
SCRIPT_DIR="$(dirname -- "$(readlink -f -- "$0")")"
INSTALL_DIR="$(dirname "$SCRIPT_DIR")"
-long='clean,clean-only,no,simulate,verbose,help'
-short='cCnvh'
+long='nvim,clean,clean-only,no,simulate,verbose,help'
+short='ecCnvh'
opts="$(getopt -o $short -l $long -n "$SCRIPT" -- "$@")"
@@ -30,6 +30,7 @@ help() {
$SCRIPT [OPTION ...] [PACKAGE ...]
OPTIONS:
+ -e, --nvim Run neovim update commands
-c, --clean Remove broken symlinks found in $INSTALL_DIR for proceeding
-C, --clean-only Like --clean, but will exit after cleaning
-n, --no, --simulate Do not actually make any filesystem changes
@@ -71,6 +72,7 @@ need() {
done
}
+nvim=false
clean=false
clean_only=false
verbose=0
@@ -85,6 +87,10 @@ while true; do
verbose=$((verbose + 1))
shift
;;
+ -e | --nvim)
+ nvim=true
+ shift
+ ;;
-c | --clean)
clean=true
shift
@@ -154,3 +160,11 @@ say_verbose "Installing: $*"
# shellcheck disable=2068,2086
stow $verbose_args $simulate $@
+
+if $nvim; then
+ need nvim
+ # Update Packer plugins
+ nvim --headless -c 'autocmd User PackerComplete quitall' -c 'PackerSync'
+ # Update Mason packages
+ nvim --headless -c 'autocmd User MasonUpdateAllComplete quitall' -c 'MasonUpdateAll'
+fi
diff --git a/nvim/.config/nvim/lua/tobyvin/plugins.lua b/nvim/.config/nvim/lua/tobyvin/plugins.lua
index b5543f9..0776b93 100644
--- a/nvim/.config/nvim/lua/tobyvin/plugins.lua
+++ b/nvim/.config/nvim/lua/tobyvin/plugins.lua
@@ -82,6 +82,14 @@ M.plugins = function(use)
})
use({
+ "RubixDev/mason-update-all",
+ requires = { "williamboman/mason.nvim" },
+ config = function()
+ require("tobyvin.plugins.mason-update-all").setup()
+ end,
+ })
+
+ use({
"jose-elias-alvarez/null-ls.nvim",
requires = {
"nvim-lua/plenary.nvim",
diff --git a/nvim/.config/nvim/lua/tobyvin/plugins/mason-update-all.lua b/nvim/.config/nvim/lua/tobyvin/plugins/mason-update-all.lua
new file mode 100644
index 0000000..a80f27c
--- /dev/null
+++ b/nvim/.config/nvim/lua/tobyvin/plugins/mason-update-all.lua
@@ -0,0 +1,15 @@
+local M = {}
+
+M.setup = function()
+ local status_ok, mason_update_all = pcall(require, "mason-update-all")
+ if not status_ok then
+ vim.notify("Failed to load module 'mason-update-all'", vim.log.levels.ERROR)
+ return
+ end
+
+ mason_update_all.setup()
+
+ vim.keymap.set("n", "<leader>M", mason_update_all.update_all, { desc = "Update All" })
+end
+
+return M
diff --git a/nvim/.config/nvim/lua/tobyvin/plugins/mason.lua b/nvim/.config/nvim/lua/tobyvin/plugins/mason.lua
index 504835b..ce0c52e 100644
--- a/nvim/.config/nvim/lua/tobyvin/plugins/mason.lua
+++ b/nvim/.config/nvim/lua/tobyvin/plugins/mason.lua
@@ -1,5 +1,9 @@
local M = {}
+M.install = function()
+ require("mason.api.command").Mason({})
+end
+
M.setup = function()
local status_ok, mason = pcall(require, "mason")
if not status_ok then
@@ -17,8 +21,7 @@ M.setup = function()
},
})
- vim.keymap.set("n", "<leader>m", "<CMD>Mason<CR>", { desc = "Mason" })
- vim.keymap.set("n", "<leader>M", "<CMD>MasonLog<CR>", { desc = "Mason Log" })
+ vim.keymap.set("n", "<leader>m", M.install, { desc = "Mason" })
end
return M