|
|
|
vim.defer_fn(function()
|
|
|
|
pcall(require, "impatient")
|
|
|
|
-- vim.loader.enable()
|
|
|
|
end, 0)
|
|
|
|
|
|
|
|
require "spike.globals"
|
|
|
|
require "core"
|
|
|
|
require "core.options"
|
|
|
|
|
|
|
|
require("core.utils").load_mappings()
|
|
|
|
|
|
|
|
-- setup packer + plugins
|
|
|
|
local fn = vim.fn
|
|
|
|
local install_path = fn.stdpath "data" .. "/site/pack/packer/opt/packer.nvim"
|
|
|
|
|
|
|
|
|
|
|
|
if fn.empty(fn.glob(install_path)) > 0 then
|
|
|
|
vim.api.nvim_set_hl(0, "NormalFloat", { bg = "#1e222a" })
|
|
|
|
print "Cloning packer .."
|
|
|
|
fn.system { "git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path }
|
|
|
|
|
|
|
|
-- install plugins + compile their configs
|
|
|
|
vim.cmd "packadd packer.nvim"
|
|
|
|
require "plugins"
|
|
|
|
vim.cmd "PackerSync"
|
|
|
|
end
|
|
|
|
|
|
|
|
pcall(require, "custom")
|
|
|
|
|
|
|
|
local xdg_config = vim.env["XDG_CONFIG_HOME"] or '~/.config'
|
|
|
|
local vimscriptsfolder = xdg_config .. "/nvim/myvimscript" -- relative to .config/nvim dir
|
|
|
|
vim.opt.runtimepath:prepend(vimscriptsfolder)
|
|
|
|
|
|
|
|
local should_profile = os.getenv("NVIM_PROFILE")
|
|
|
|
if should_profile then
|
|
|
|
require("profile").instrument_autocmds()
|
|
|
|
if should_profile:lower():match("^start") then
|
|
|
|
require("profile").start("*")
|
|
|
|
else
|
|
|
|
require("profile").instrument("*")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
local function toggle_profile()
|
|
|
|
local prof = require("profile")
|
|
|
|
if prof.is_recording() then
|
|
|
|
prof.stop()
|
|
|
|
vim.ui.input({ prompt = "Save profile to:", completion = "file", default = "profile.json" }, function(filename)
|
|
|
|
if filename then
|
|
|
|
prof.export(filename)
|
|
|
|
vim.notify(string.format("Wrote %s", filename))
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
else
|
|
|
|
prof.start("*")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
vim.keymap.set("", "<f1>", toggle_profile)
|