35 lines
1.4 KiB
Lua
35 lines
1.4 KiB
Lua
-- Bootstrap 'mini.nvim' manually in a way that it gets managed by 'mini.deps'
|
|
local mini_path = vim.fn.stdpath('data') .. '/site/pack/deps/start/mini.nvim'
|
|
if not vim.loop.fs_stat(mini_path) then
|
|
vim.cmd('echo "Installing `mini.nvim`" | redraw')
|
|
local origin = 'https://github.com/nvim-mini/mini.nvim'
|
|
local clone_cmd = { 'git', 'clone', '--filter=blob:none', origin, mini_path }
|
|
vim.fn.system(clone_cmd)
|
|
vim.cmd('packadd mini.nvim | helptags ALL')
|
|
vim.cmd('echo "Installed `mini.nvim`" | redraw')
|
|
end
|
|
|
|
-- Plugin manager
|
|
require('mini.deps').setup()
|
|
|
|
-- Shared config table
|
|
_G.Config = {}
|
|
|
|
-- Define custom autocommand group and helper to create an autocommand.
|
|
-- Autocommands are Neovim's way to define actions that are executed on events
|
|
-- (like creating a buffer, setting an option, etc.).
|
|
--
|
|
-- See also:
|
|
-- - `:h autocommand`
|
|
-- - `:h nvim_create_augroup()`
|
|
-- - `:h nvim_create_autocmd()`
|
|
local gr = vim.api.nvim_create_augroup('custom-config', {})
|
|
_G.Config.new_autocmd = function(event, pattern, callback, desc)
|
|
local opts = { group = gr, pattern = pattern, callback = callback, desc = desc }
|
|
vim.api.nvim_create_autocmd(event, opts)
|
|
end
|
|
|
|
-- Some plugins and 'mini.nvim' modules only need setup during startup if Neovim
|
|
-- is started like `nvim -- path/to/file`, otherwise delaying setup is fine
|
|
_G.Config.now_if_args = vim.fn.argc(-1) > 0 and MiniDeps.now or MiniDeps.later
|