Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

Commit

Permalink
merge from upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
tuanbass committed Apr 15, 2023
2 parents 87c99b1 + 3571525 commit 9d647d2
Show file tree
Hide file tree
Showing 57 changed files with 347 additions and 370 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Some of the defining features that make this project unique are:
### Mac OS / Linux

```bash
bash <(curl -s https://raw.githubusercontent.com/doom-neovim/doom-nvim/main/tools/install.sh)
curl -s https://raw.githubusercontent.com/doom-neovim/doom-nvim/main/tools/install.sh | sh
```

### Manual (Mac OS / Linux)
Expand Down
14 changes: 14 additions & 0 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@ end
local profiler = require("doom.services.profiler")
profiler.start("framework|init.lua")

-- Preload lazy nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
print("Bootstrapping lazy.nvim, please wait...")
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)

-- Makes sure ~/.local/share/nvim exists, to prevent problems with logging
vim.fn.mkdir(vim.fn.stdpath("data"), "p")
Expand Down
47 changes: 47 additions & 0 deletions lazy-lock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"Comment.nvim": { "branch": "master", "commit": "e89df176e8b38e931b7e71a470f923a317976d86" },
"LuaSnip": { "branch": "master", "commit": "53e812a6f51c9d567c98215733100f0169bcc20a" },
"bufferline.nvim": { "branch": "main", "commit": "2d5266d14b7b5dbc54923469b4599f0349f7cedc" },
"cmd-parser.nvim": { "branch": "master", "commit": "6363b8bddef968c3ec51a38172af44f675f01ef3" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-nvim-lsp": { "branch": "main", "commit": "59224771f91b86d1de12570b4070fe4ad7cd1eeb" },
"cmp-nvim-lua": { "branch": "main", "commit": "f3491638d123cfd2c8048aefaf66d246ff250ca6" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
"dashboard-nvim": { "branch": "master", "commit": "f7d623457d6621b25a1292b24e366fae40cb79ab" },
"editorconfig-vim": { "branch": "master", "commit": "30ddc057f71287c3ac2beca876e7ae6d5abe26a0" },
"fidget.nvim": { "branch": "main", "commit": "44585a0c0085765195e6961c15529ba6c5a2a13b" },
"friendly-snippets": { "branch": "main", "commit": "45698b3d193fff404c3c9c30d25dc138a729d64b" },
"gitsigns.nvim": { "branch": "main", "commit": "addd6e174a85fc1c4007ab0b65d77e6555b417bf" },
"heirline.nvim": { "branch": "master", "commit": "19cab76f52710ec67bd8829cbc96d0c322963090" },
"indent-blankline.nvim": { "branch": "master", "commit": "c4c203c3e8a595bc333abaf168fcb10c13ed5fb7" },
"iron.nvim": { "branch": "master", "commit": "f4131638454aeb96cbd92652dd8c396e48eb4118" },
"lazy.nvim": { "branch": "main", "commit": "666ed7bf73eb5895253c1155bd29270b066cbdac" },
"lazygit.nvim": { "branch": "main", "commit": "32bffdebe273e571588f25c8a708ca7297928617" },
"lsp_signature.nvim": { "branch": "master", "commit": "1979f1118e2b38084e7c148f279eed6e9300a342" },
"mason-lspconfig": { "branch": "main", "commit": "43c7f402cb9822b61b5dc05bf0b385928df256a6" },
"mason.nvim": { "branch": "main", "commit": "5ab101aa11849c2424d5b87726105daae8cb49e8" },
"mini.cursorword": { "branch": "main", "commit": "21af5679b39cf1a6bc6bf4eeaabc35e1b5ee7110" },
"neodev.nvim": { "branch": "main", "commit": "0e3f5e763639951f96f9acbdc9f52a9fedf91b46" },
"neogen": { "branch": "main", "commit": "0958aeffcddf46e57785c3026be934816b4f39d2" },
"neorg": { "branch": "main", "commit": "aa613122f82ca7485b7055937a742b709ed3c576" },
"null-ls.nvim": { "branch": "main", "commit": "915558963709ea17c5aa246ca1c9786bfee6ddb4" },
"nvim-autopairs": { "branch": "master", "commit": "f00eb3b766c370cb34fdabc29c760338ba9e4c6c" },
"nvim-cmp": { "branch": "main", "commit": "11a95792a5be0f5a40bab5fc5b670e5b1399a939" },
"nvim-colorizer.lua": { "branch": "master", "commit": "36c610a9717cc9ec426a07c8e6bf3b3abcb139d6" },
"nvim-lspconfig": { "branch": "master", "commit": "ed88435764d8b00442e66d39ec3d9c360e560783" },
"nvim-mapper": { "branch": "main", "commit": "7585479199ad7c3fdfed47ae79d26198f948cfc5" },
"nvim-tree.lua": { "branch": "master", "commit": "3ce0a8e770f70a135ef969e0a640bd8d05baf42c" },
"nvim-treesitter": { "branch": "master", "commit": "51d220e0bd8922caabcb3e5de936fc599a1bd210" },
"nvim-ts-autotag": { "branch": "main", "commit": "fdefe46c6807441460f11f11a167a2baf8e4534b" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "4a42b30376c1bd625ab5016c2079631d531d797a" },
"nvim-web-devicons": { "branch": "master", "commit": "a8cf88cbdb5c58e2b658e179c4b2aa997479b3da" },
"persistence.nvim": { "branch": "main", "commit": "8484fdaa284207f77ec69b9627316bf334ad653f" },
"plenary.nvim": { "branch": "master", "commit": "1c7e3e6b0f4dd5a174fcea9fda8a4d7de593b826" },
"project.nvim": { "branch": "main", "commit": "685bc8e3890d2feb07ccf919522c97f7d33b94e4" },
"range-highlight.nvim": { "branch": "master", "commit": "8b5e8ccb3460b2c3675f4639b9f54e64eaab36d9" },
"telescope-file-browser.nvim": { "branch": "master", "commit": "304508fb7bea78e3c0eeddd88c4837501e403ae8" },
"telescope.nvim": { "branch": "master", "commit": "1ba7278cf08da8048e7f589ef6b65a39fd3e4dbf" },
"todo-comments.nvim": { "branch": "main", "commit": "077c59586d9d0726b0696dc5680eb863f4e04bc5" },
"which-key.nvim": { "branch": "main", "commit": "e4fa445065a2bb0bbc3cca85346b67817f28e83e" }
}
1 change: 0 additions & 1 deletion lua/colors/doom-one/config/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ local configuration = {
startify = true,
whichkey = true,
indent_blankline = true,
vim_illuminate = true,
lspsaga = false,
},
}
Expand Down
5 changes: 0 additions & 5 deletions lua/doom/core/doom_global.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,6 @@ doom = {
-- @default = true
freeze_dependencies = true,

-- Enables impatent.nvim caching to speed up start time.
-- Can cause more issues so disabled by default
-- @default false
impatient_enabled = false,

-- Autosave
-- false : Disable autosave
-- true : Enable autosave
Expand Down
14 changes: 6 additions & 8 deletions lua/doom/core/functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -257,29 +257,27 @@ end
functions.nuke = function(target)
if target == nil or #target == 0 then
vim.notify(
"Warning, this command deletes packer caches and causes a re-install of doom-nvim on next launch.\n\n :DoomNuke plugins|cache|mason|all. \n\t `cache` - Clear packer_compiled.lua\n\t `plugins` - Clear all installed plugins\n\t `mason` - Clear all Mason.nvim packages\n\t `all` - Delete all of the above."
"Warning, this command deletes lazy caches and causes a re-install of doom-nvim on next launch.\n\n :DoomNuke plugins|cache|mason|all. \n\t `cache` - Clear lazy.lua\n\t `plugins` - Clear all installed plugins\n\t `mason` - Clear all Mason.nvim packages\n\t `all` - Delete all of the above."
)
return
end

local log = require("doom.utils.logging")
-- Delete packer compiled
-- Delete lazy compiled
if target == "all" or target == "cache" then
os.remove(system.doom_compile_path)
log.info("DoomNuke: Deleting packer compiled.")
log.info("DoomNuke: Deleting lazy compiled.")
end

if target == "all" or target == "plugins" then
-- Delete all plugins
local util = require("packer.util")
local plugin_dir = util.join_paths(vim.fn.stdpath("data"), "site", "pack")
local plugin_dir = fs.join_paths(vim.fn.stdpath("data"), "lazy")
fs.rm_dir(plugin_dir)
log.info("DoomNuke: Deleting packer plugins. Doom-nvim will re-install on next launch.")
log.info("DoomNuke: Deleting lazy plugins. Doom-nvim will re-install on next launch.")
end

if target == "all" or target == "mason" then
local util = require("packer.util")
local mason_dir = util.join_paths(vim.fn.stdpath("data"), "mason")
local mason_dir = fs.join_paths(vim.fn.stdpath("data"), "mason")
fs.rm_dir(mason_dir)
log.info("DoomNuke: Deleting mason packages")
end
Expand Down
12 changes: 6 additions & 6 deletions lua/doom/core/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,27 +49,27 @@ if not utils.is_module_enabled("features", "netrw") then
g.loaded_netrwFileHandlers = 1
end

-- Load the colourscheme
profiler.start("framework|doom.core.ui")
utils.safe_require("doom.core.ui")
profiler.stop("framework|doom.core.ui")

-- Set some extra commands
utils.safe_require("doom.core.commands")

profiler.start("framework|doom.core.modules")
-- Load Doom modules.
local modules = utils.safe_require("doom.core.modules")
modules.start()
profiler.start("framework|init enabled modules")
modules.load_modules()
profiler.stop("framework|init enabled modules")
profiler.start("framework|user settings")
modules.handle_user_config()
profiler.stop("framework|user settings")
modules.try_sync()
modules.handle_lazynvim()
profiler.stop("framework|doom.core.modules")

-- Load the colourscheme
profiler.start("framework|doom.core.ui")
utils.safe_require("doom.core.ui")
profiler.stop("framework|doom.core.ui")

-- Execute autocommand for user to hook custom config into
vim.api.nvim_exec_autocmds("User", {
pattern = "DoomStarted",
Expand Down
105 changes: 11 additions & 94 deletions lua/doom/core/modules.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,97 +29,19 @@ local core_modules = {
}
modules.enabled_modules = vim.tbl_deep_extend("keep", core_modules, dofile(modules.source))

local system = require("doom.core.system")

--- Initial bootstrapping of packer including auto-installation if necessary
--- Initial bootstrapping of impatient.nvim
modules.start = function()
if doom.impatient_enabled then
local has_impatient = pcall(require, "impatient")
if not has_impatient then
-- Packer Bootstrapping
local packer_path = vim.fn.stdpath("data") .. "/site/pack/packer/start/impatient.nvim"
if vim.fn.empty(vim.fn.glob(packer_path)) > 0 then
vim.notify("Bootstrapping impatient.nvim, please wait ...")
vim.fn.system({
"git",
"clone",
"--depth",
"1",
"https://github.com/lewis6991/impatient.nvim",
packer_path,
})
end

vim.cmd("packadd impatient.nvim")

require("impatient")
end
end

local has_packer = pcall(require, "packer")
if not has_packer then
modules._needs_sync = true
-- Packer Bootstrapping
local packer_path = vim.fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
if vim.fn.empty(vim.fn.glob(packer_path)) > 0 then
vim.notify("Bootstrapping packer.nvim, please wait ...")
vim.fn.system({
"git",
"clone",
"--depth",
"1",
"https://github.com/wbthomason/packer.nvim",
packer_path,
})
end

vim.cmd("packadd packer.nvim")
end

-- Load packer
local packer = require("packer")

-- Change some defaults
-- Of particular interest is compile_path: we use stdpath("data"), so as to not
-- have anything generated in Doom source (which goes in stdpath("config")).
packer.init({
compile_path = system.doom_compile_path,
git = {
clone_timeout = 300, -- 5 mins
subcommands = {
-- Prevent packer from downloading all branches metadata to reduce cloning cost
-- for heavy size plugins like plenary (removed the '--no-single-branch' git flag)
install = "clone --depth %i --progress",
},
},
display = {
open_fn = doom.use_floating_win_packer and function()
return require("packer.util").float({ border = doom.border_style })
end,
},
profile = {
enable = true,
},
log = {
level = doom.logging,
},
})

packer.reset()
end

local keymaps_service = require("doom.services.keymaps")
local commands_service = require("doom.services.commands")
local autocmds_service = require("doom.services.autocommands")

--- Applies commands, autocommands, packages from enabled modules (`modules.lua`).
modules.load_modules = function()
local use = require("packer").use
local logger = require("doom.utils.logging")
-- Handle the Modules
for section_name, _ in pairs(doom.modules) do
for module_name, module in pairs(doom.modules[section_name]) do
if type(module) ~= "table" then
print(("Error on module %s type is %s val is %s"):format(module_name, type(module), module))
end
local profile_msg = ("modules|init `%s.%s`"):format(section_name, module_name)
profiler.start(profile_msg)

Expand Down Expand Up @@ -164,12 +86,11 @@ modules.load_modules = function()
spec.commit = utils.pick_compatible_field(spec.commit)
end

if not doom.freeze_dependencies then
spec.commit = nil
end
-- Only pin dependencies if doom.freeze_dependencies is true
spec.pin = spec.commit and doom.freeze_dependencies

-- Initialise packer
use(spec)
-- Save module spec to be initialised later
table.insert(doom.packages, spec)
end
end

Expand Down Expand Up @@ -213,13 +134,6 @@ end

--- Applies user's commands, autocommands, packages from `use_*` helper functions.
modules.handle_user_config = function()
local use = require("packer").use

-- Handle extra user modules
for _, packer_spec in ipairs(doom.packages) do
use(packer_spec)
end

-- Handle extra user cmds
for _, cmd_spec in pairs(doom.cmds) do
commands_service.set(cmd_spec[1], cmd_spec[2], cmd_spec[3] or cmd_spec.opts)
Expand All @@ -245,8 +159,11 @@ modules.try_sync = function()
logger.error("Doom-nvim has been installed. Please restart doom-nvim.")
end,
})
require("packer").sync()
end
end

modules.handle_lazynvim = function()
require("lazy").setup(doom.packages)
end

return modules
52 changes: 8 additions & 44 deletions lua/doom/modules/core/doom/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,16 @@ required.settings = {
}

required.packages = {
["packer.nvim"] = {
"wbthomason/packer.nvim",
},
-- Required by some treesitter modules
["aniseed"] = {
"Olical/aniseed",
commit = "9892a40d4cf970a2916a984544b7f984fc12f55c",
module_pattern = "aniseed",
["lazy.nvim"] = {
"folke/lazy.nvim",
},
["plenary.nvim"] = {
"nvim-lua/plenary.nvim",
commit = "4b7e52044bbb84242158d977a50c4cbcd85070c7",
module = "plenary",
},
["popup.nvim"] = {
"nvim-lua/popup.nvim",
commit = "b7404d35d5d3548a82149238289fa71f7f6de4ac",
module = "popup",
commit = "1c7e3e6b0f4dd5a174fcea9fda8a4d7de593b826",
},
["nvim-web-devicons"] = {
"kyazdani42/nvim-web-devicons",
commit = "a8cf88cbdb5c58e2b658e179c4b2aa997479b3da",
module = "nvim-web-devicons",
},
-- Must include impatient.nvim here, even though it's bootstrapped in
-- core.modules.lua so that packer doesn't try and clean it up.
["impatient.nvim"] = {
"lewis6991/impatient.nvim",
disabled = not doom.impatient_enabled,
},
}

Expand Down Expand Up @@ -161,12 +142,11 @@ required.binds = function()
{ "r", "<cmd>DoomRollback<CR>", name = "Rollback" },
{ "R", "<cmd>DoomReport<CR>", name = "Report issue" },
{ "u", "<cmd>DoomUpdate<CR>", name = "Update" },
{ "s", "<cmd>PackerSync<CR>", name = "Sync packages" },
{ "I", "<cmd>PackerInstall<CR>", name = "Install packages" },
{ "C", "<cmd>PackerClean<CR>", name = "Clean packages" },
{ "b", "<cmd>PackerCompile<CR>", name = "Build packages" },
{ "S", "<cmd>PackerStatus<CR>", name = "Inform packages" },
{ "p", "<cmd>PackerProfile<CR>", name = "Profile" },
{ "s", "<cmd>Lazy sync<CR>", name = "Sync packages" },
{ "I", "<cmd>Lazy install<CR>", name = "Install packages" },
{ "C", "<cmd>Lazy clean<CR>", name = "Clean packages" },
-- { "b", "<cmd>Lazy build<CR>", name = "Build packages" },
{ "p", "<cmd>Lazy profile<CR>", name = "Profile" },
},
},
{
Expand Down Expand Up @@ -198,22 +178,6 @@ required.binds = function()
},
},
},
{
"g",
name = "+git",
{
{ "p", [[<cmd>TermExec cmd="git pull"<CR>]], name = "Pull" },
{ "P", [[<cmd>TermExec cmd="git push"<CR>]], name = "Push" },
{
"C",
name = "+commit",
{
{ "c", [[<cmd>TermExec cmd="git commit"<CR>]], name = "commit" },
{ "a", [[<cmd>TermExec cmd="git commit --ammend"<CR>]], name = "ammend" },
},
},
},
},
{
"h",
name = "+help",
Expand Down
Loading

0 comments on commit 9d647d2

Please sign in to comment.