nvgoog stuff?
This commit is contained in:
@ -19,6 +19,7 @@ M.convertLuaToVim = function(value)
|
||||
end
|
||||
error("unsupported type for value: " .. type(value))
|
||||
end
|
||||
|
||||
-- Allow glugin options to be set by `spec.opts`
|
||||
-- This makes configuring options locally easier
|
||||
M.glugOpts = function(name, spec)
|
||||
@ -38,6 +39,7 @@ M.glugOpts = function(name, spec)
|
||||
end
|
||||
return spec
|
||||
end
|
||||
|
||||
M.glug = function(name, spec)
|
||||
return M.glugOpts(
|
||||
name,
|
||||
@ -54,8 +56,10 @@ end
|
||||
-- come before `VeryLazy`, such as `FileType` and `BufRead`.
|
||||
-- The `VeryLazy` command is fired after the UI is first loaded, using
|
||||
-- this helps improve app start when nvim is opened with a file.
|
||||
|
||||
-- Events to check autocmds for. We target events that could fire before vim fully loads.
|
||||
local events = { "BufEnter", "BufRead", "BufReadPost", "BufReadPre", "BufWinEnter", "FileType" }
|
||||
|
||||
-- A unique key to help identify autocmds.
|
||||
local getAutocmdKey = function(autocmd)
|
||||
return table.concat({
|
||||
@ -66,6 +70,7 @@ local getAutocmdKey = function(autocmd)
|
||||
autocmd.buffer or "",
|
||||
}, "-")
|
||||
end
|
||||
|
||||
-- Take note of which autocmds exist before any plugins are loaded.
|
||||
local existingAutocmds = {}
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
@ -80,14 +85,17 @@ vim.api.nvim_create_autocmd("User", {
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
M.veryLazy = function(spec)
|
||||
local originalConfig = spec.config
|
||||
|
||||
return vim.tbl_extend("force", spec, {
|
||||
event = "VeryLazy",
|
||||
config = function(plugin, opts)
|
||||
if type(originalConfig) == "function" then
|
||||
originalConfig(plugin, opts)
|
||||
end
|
||||
|
||||
-- Execute any missed autocmd events that fired before the plugin was loaded,
|
||||
-- and only for autocmds that were set by this plugin.
|
||||
for _, autocmd in pairs(vim.api.nvim_get_autocmds({ event = events })) do
|
||||
@ -104,6 +112,7 @@ M.veryLazy = function(spec)
|
||||
vim.api.nvim_exec_autocmds(autocmd.event, { group = autocmd.group, buffer = autocmd.buffer })
|
||||
end
|
||||
end
|
||||
|
||||
-- Source any ftplugin files for opened buffers.
|
||||
for _, bufnr in pairs(vim.api.nvim_list_bufs()) do
|
||||
vim.api.nvim_buf_call(bufnr, function()
|
||||
@ -116,4 +125,5 @@ M.veryLazy = function(spec)
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
||||
|
@ -1,25 +1,29 @@
|
||||
local use_google = require("utils").use_google
|
||||
local glug = require("glug").glug
|
||||
local glugOpts = require("glug").glugOpts
|
||||
local veryLazy = require("glug").veryLazy
|
||||
|
||||
if not use_google() then
|
||||
return {}
|
||||
end
|
||||
|
||||
vim.opt.rtp:append("/google/src/head/depot/google3/experimental/users/fentanes/nvgoog")
|
||||
|
||||
local glug = require("nvgoog.google.util.glug").glug
|
||||
local glugOpts = require("nvgoog.google.util.glug").glugOpts
|
||||
local veryLazy = require("nvgoog.util").veryLazy
|
||||
|
||||
return {
|
||||
{ url = "sso://user/fentanes/nvgoog" },
|
||||
-- Prevent long sessions from losing cwd
|
||||
-- Load google paths like //google/* with `gf`
|
||||
{ import = "nvgoog.google.misc" },
|
||||
-- maktaba is required by all google plugins
|
||||
{
|
||||
name = "maktaba",
|
||||
dir = "/usr/share/vim/google/maktaba",
|
||||
init = function()
|
||||
-- maktaba is required by all google plugins
|
||||
glug("maktaba", {
|
||||
lazy = true,
|
||||
dependencies = {},
|
||||
config = function() -- init?
|
||||
vim.cmd("source /usr/share/vim/google/glug/bootstrap.vim")
|
||||
end,
|
||||
},
|
||||
}),
|
||||
glug("core"),
|
||||
glug("glaive"),
|
||||
glug("alert"),
|
||||
@ -57,10 +61,6 @@ return {
|
||||
event = "BufNewFile",
|
||||
}),
|
||||
-- Adds G4 support to the vcscommand plugin
|
||||
glug("vcscommand-g4", {
|
||||
optional = true,
|
||||
lazy = true,
|
||||
}),
|
||||
glug("googlepaths"),
|
||||
glug("ft-soy"),
|
||||
glug("ft-gss"),
|
||||
|
Reference in New Issue
Block a user