Browse Source

Merge branch 'test/module-architecture' into feature/module-architecture-2

# Conflicts:
#	config.lua
#	init.lua
#	lua/doom/core/config/init.lua
#	lua/doom/modules/core/doom/init.lua
#	lua/doom/modules/core/treesitter/init.lua
#	lua/doom/modules/features/gitsigns/init.lua
#	lua/doom/modules/features/lsp/init.lua
#	lua/doom/modules/features/lsp_progress/init.lua
#	lua/doom/modules/features/whichkey/init.lua
#	lua/doom/modules/langs/utils.lua
#	modules.lua
my-config
connorgmeean 3 years ago
parent
commit
a15b23862f
  1. 4
      init.lua
  2. 44
      lua/doom/core/config/init.lua
  3. 6
      lua/doom/core/functions.lua
  4. 4
      lua/doom/core/init.lua
  5. 14
      lua/doom/modules/core/doom/init.lua
  6. 24
      lua/doom/modules/core/nest/init.lua
  7. 10
      lua/doom/modules/core/treesitter/init.lua
  8. 9
      lua/doom/modules/features/annotations/init.lua
  9. 11
      lua/doom/modules/features/auto_install/init.lua
  10. 13
      lua/doom/modules/features/autopairs/init.lua
  11. 2
      lua/doom/modules/features/comment/init.lua
  12. 4
      lua/doom/modules/features/dap/init.lua
  13. 8
      lua/doom/modules/features/dashboard/init.lua
  14. 8
      lua/doom/modules/features/explorer/init.lua
  15. 2
      lua/doom/modules/features/gitsigns/init.lua
  16. 2
      lua/doom/modules/features/illuminate/init.lua
  17. 2
      lua/doom/modules/features/indentlines/init.lua
  18. 2
      lua/doom/modules/features/lazygit/init.lua
  19. 2
      lua/doom/modules/features/linter/init.lua
  20. 22
      lua/doom/modules/features/lsp/init.lua
  21. 2
      lua/doom/modules/features/neogit/init.lua
  22. 4
      lua/doom/modules/features/neorg/init.lua
  23. 2
      lua/doom/modules/features/show_registers/init.lua
  24. 2
      lua/doom/modules/features/snippets/init.lua
  25. 6
      lua/doom/modules/features/statusline/init.lua
  26. 44
      lua/doom/modules/features/statusline2/init.lua
  27. 2
      lua/doom/modules/features/symbols/init.lua
  28. 2
      lua/doom/modules/features/tabline/init.lua
  29. 6
      lua/doom/modules/features/telescope/init.lua
  30. 2
      lua/doom/modules/features/terminal/init.lua
  31. 2
      lua/doom/modules/features/trouble/init.lua
  32. 2
      lua/doom/modules/features/whichkey/init.lua
  33. 16
      lua/doom/modules/init.lua
  34. 2
      lua/doom/modules/langs/config/init.lua
  35. 7
      lua/doom/modules/langs/typescript/init.lua
  36. 6
      lua/doom/modules/langs/utils.lua
  37. 95
      lua/doom/modules/langs/vue/init.lua
  38. 19
      lua/doom/utils/init.lua
  39. 2
      modules.lua

4
init.lua

@ -18,9 +18,11 @@ utils.load_modules("doom", { "modules" })
-- Defer and schedule loading of modules until the Neovim API functions are
-- safe to call to avoid weird errors with plugins stuff.
vim.defer_fn(function()
-- Load Doom modules.
utils.load_modules("doom", { "modules" })
-- Start dashboard if it is enabled and an empty buffer is opened initially.
if
not require("doom.utils").is_plugin_disabled("dashboard")
require("doom.utils").is_module_enabled("dashboard")
and (vim.api.nvim_buf_get_number(0) > 1
or vim.api.nvim_buf_get_lines(0, 0, 1, false)[1]:len() == 0)
and vim.api.nvim_buf_get_name(0):len() == 0 -- Empty buffer name

44
lua/doom/core/config/init.lua

@ -196,6 +196,7 @@ config.load = function()
vim.opt.foldtext = require("doom.core.functions").sugar_folds()
doom = config.defaults
doom.uses = {} -- Extra packages
doom.cmds = {} -- Extra commands
doom.autocmds = {} -- Extra autocommands
doom.binds = {} -- Extra binds
doom.modules = {} -- Modules
@ -207,7 +208,7 @@ config.load = function()
-- Add doom.use helper function
-- @param string|packer_spec PackerSpec
doom.use = function(...)
doom.use_package = function(...)
local arg = {...}
-- Get table of packages via git repository name
local packages_to_add = vim.tbl_map(function (t)
@ -226,7 +227,36 @@ config.load = function()
table.insert(doom.uses, type(packer_spec) == "string" and { packer_spec } or packer_spec)
end
end
--]]
doom.use_keybind = function(...)
local arg = {...}
for _, bind in ipairs(arg) do
table.insert(doom.binds, bind)
end
end
doom.use_cmd = function(...)
local arg = {...}
for _, cmd in ipairs(arg) do
if type(cmd[1] == "string") then
doom.cmds[cmd[1]] = cmd;
elseif cmd ~= nil then
doom.use_cmd(unpack(cmd))
end
end
end
doom.use_autocmd = function(...)
local arg = {...}
for _, autocmd in ipairs(arg) do
if type(autocmd[1]) == 'string' and type(autocmd[2]) == 'string' then
local key = string.format('%s-%s', autocmd[1], autocmd[2])
doom.autocmds[key] = autocmd
elseif autocmd ~= nil then
doom.use_autocmd(unpack(autocmd))
end
end
end
-- Combine core modules with user-enabled modules
local all_modules = vim.tbl_deep_extend('keep', {
@ -248,7 +278,15 @@ config.load = function()
if ok then
doom.modules[module_name] = result
else
print(vim.inspect(result))
local log = require("doom.utils.logging")
log.error(
string.format(
"There was an error loading module '%s.%s'. Traceback:\n%s",
section_name,
module_name,
result
)
)
end
end
end

6
lua/doom/core/functions.lua

@ -4,7 +4,7 @@ local utils = require("doom.utils")
local fs = require("doom.utils.fs")
local system = require("doom.core.system")
local async = require("doom.utils.async")
local is_plugin_disabled = utils.is_plugin_disabled
local is_module_enabled = utils.is_module_enabled
local functions = {}
@ -383,7 +383,7 @@ functions.toggle_background = function()
end
-- Only define if lsp enabled, it only makes sense there.
if not is_plugin_disabled("lsp") then
if is_module_enabled("lsp") then
-- Toggle completion (by running cmp setup again).
functions.toggle_completion = function()
_doom.cmp_enable = not _doom.cmp_enable
@ -440,7 +440,7 @@ functions.change_number = function()
end
-- Toggle autopairs.
if not is_plugin_disabled("autopairs") then
if is_module_enabled("autopairs") then
functions.toggle_autopairs = function()
local autopairs = require("nvim-autopairs")
if autopairs.state.disabled then

4
lua/doom/core/init.lua

@ -3,13 +3,13 @@
--- (ui, options, doomrc, etc)
local utils = require("doom.utils")
local is_plugin_disabled = utils.is_plugin_disabled
local is_module_enabled = utils.is_module_enabled
-- Required setup modules.
local core_modules = { "commands", "ui" }
-- If the explorer is disabled, the user probably wants a better netrw.
-- Otherwise, don't bother configuring it.
if is_plugin_disabled("explorer") then
if is_module_enabled("explorer") then
table.insert(core_modules, "netrw")
end
utils.load_modules("doom.core", core_modules)

14
lua/doom/modules/core/doom/init.lua

@ -3,7 +3,6 @@ local required = {}
required.settings = {
mapper = {},
}
local is_plugin_disabled = require("doom.utils").is_plugin_disabled
required.uses = {
["packer.nvim"] = {
@ -12,12 +11,12 @@ required.uses = {
-- Required by some treesitter modules
["aniseed"] = {
"Olical/aniseed",
commit = "a955096c566843302a0a509680b92ab276488add",
commit = "bd79727af8a21037222a08ec9bcaf1c85488aaa4",
module_pattern = "aniseed",
},
["plenary.nvim"] = {
"nvim-lua/plenary.nvim",
commit = "2a278c8a12a399e25b78a43ebcd4f3996cd4e4b6",
commit = "0d660152000a40d52158c155625865da2aa7aa1b",
module = "plenary",
},
["popup.nvim"] = {
@ -27,7 +26,6 @@ required.uses = {
},
["nvim-mapper"] = {
"lazytanuki/nvim-mapper",
before = is_plugin_disabled("telescope") or "telescope.nvim",
},
['nvim-web-devicons'] = {
'kyazdani42/nvim-web-devicons',
@ -43,7 +41,7 @@ end
required.binds = function ()
local utils = require("doom.utils")
local is_plugin_disabled = utils.is_plugin_disabled
local is_module_enabled = utils.is_module_enabled
local binds = {
{ "ZZ", require("doom.core.functions").quit_doom, name = "Fast exit" },
@ -124,7 +122,7 @@ required.binds = function ()
table.insert(binds, { esc_seq, "<ESC>", mode = "i" })
end
if is_plugin_disabled("explorer") then
if is_module_enabled("explorer") then
table.insert(binds, { "<F3>", ":Lexplore%s<CR>", name = "Toggle explorer" })
table.insert(binds, {
"<leader>",
@ -314,7 +312,7 @@ required.binds = function ()
end
required.autocmds = function ()
local is_plugin_disabled = require("doom.utils").is_plugin_disabled
local is_module_enabled = require("doom.utils").is_module_enabled
local autocmds = {}
@ -340,7 +338,7 @@ required.autocmds = function ()
})
end
if is_plugin_disabled("explorer") then
if is_module_enabled("explorer") then
table.insert(autocmds, {
"FileType",
"netrw",

24
lua/doom/modules/core/nest/init.lua

@ -14,20 +14,34 @@ nest.uses = {
nest.configs = {}
nest.configs["nest.nvim"] = function()
local utils = require("doom.utils")
local is_plugin_disabled = utils.is_plugin_disabled
local is_module_enabled = utils.is_module_enabled
local nest_package = require("nest")
nest_package.enable(require("nest.integrations.mapper"))
if not is_plugin_disabled("whichkey") then
if is_module_enabled("whichkey") then
local whichkey_integration = require("nest.integrations.whichkey")
nest_package.enable(whichkey_integration)
end
for _, module in pairs(doom.modules) do
if module.binds then
nest_package.applyKeymaps(type(module.binds) == 'function' and module.binds() or module.binds)
local last_module = '';
local ok, err = xpcall(function()
for module_name, module in pairs(doom.modules) do
last_module = module_name
if module.binds then
nest_package.applyKeymaps(type(module.binds) == 'function' and module.binds() or module.binds)
end
end
end, debug.traceback)
if not ok and err then
local log = require("doom.utils.logging")
log.error(
string.format(
"There was an error setting keymaps for module '%s'. Traceback:\n%s",
last_module,
err
)
)
end
end

10
lua/doom/modules/core/treesitter/init.lua

@ -42,28 +42,28 @@ treesitter.settings = {
treesitter.uses = {
["nvim-treesitter"] = {
"nvim-treesitter/nvim-treesitter",
commit = "82389e52b6b50f712593079255ee088f1631b9cd",
commit = "3e2ac54e1638da214dab58f9edf01ad93f57261d",
run = ":TSUpdate",
branch = "master",
},
["nvim-ts-context-commentstring"] = {
"JoosepAlviste/nvim-ts-context-commentstring",
commit = "097df33c9ef5bbd3828105e4bee99965b758dc3f",
commit = "7810f1fe706092290dd338f40e5e857bac4a03cf",
after = "nvim-treesitter",
},
["nvim-ts-autotag"] = {
"windwp/nvim-ts-autotag",
commit = "887fcd9e45ff112c4f39d2a8ba2594d04b99752a",
commit = "57035b5814f343bc6110676c9ae2eacfcd5340c2",
after = "nvim-treesitter",
},
}
treesitter.configs = {}
treesitter.configs["nvim-treesitter"] = function()
local is_plugin_disabled = require("doom.utils").is_plugin_disabled
local is_module_enabled = require("doom.utils").is_module_enabled
require("nvim-treesitter.configs").setup(vim.tbl_deep_extend("force", doom.modules.treesitter.settings.treesitter, {
autopairs = {
enable = not is_plugin_disabled("autopairs"),
enable = is_module_enabled("autopairs"),
},
}))

9
lua/doom/modules/features/annotations/init.lua

@ -5,7 +5,12 @@ annotations.settings = {
languages = {
lua = {
template = {
annotation_convention = "ldoc",
annotation_convention = "emmylua",
},
},
typescript = {
template = {
annotation_convention = "tsdoc",
},
},
},
@ -14,7 +19,7 @@ annotations.settings = {
annotations.uses = {
["neogen"] = {
"danymat/neogen",
commit = "b7d2ce8c1d17a0b90f557e5f94372f42193291a5",
commit = "778a8537865a2c692ba4909b72e1b14ea98999c6",
after = "nvim-treesitter",
},
}

11
lua/doom/modules/features/auto_install/init.lua

@ -5,7 +5,7 @@ auto_install.settings = {
dap_dir = vim.fn.stdpath("data") .. "/dap-install",
}
local is_plugin_disabled = require("doom.utils").is_plugin_disabled
local is_module_enabled = require("doom.utils").is_module_enabled
auto_install.uses = {
["DAPInstall.nvim"] = {
@ -17,16 +17,15 @@ auto_install.uses = {
"DIList",
"DIUninstall",
},
disabled = is_plugin_disabled("dap"),
disabled = not is_module_enabled("dap"),
module = "dap-install",
disable = true,
},
["nvim-lsp-installer"] = {
"williamboman/nvim-lsp-installer",
commit = "29154c2fe1147c8eed5d54a419841e5637a8c3b2",
opt = true,
disabled = is_plugin_disabled("lsp"),
module = "nvim-lsp-install",
commit = "56b7cf4e55ec51580ecd4285ba3cf848b3e1ece6",
-- disabled = not is_module_enabled("lsp"),
module = "nvim-lsp-installer",
},
}

13
lua/doom/modules/features/autopairs/init.lua

@ -9,7 +9,7 @@ autopairs.settings = {
autopairs.uses = {
["nvim-autopairs"] = {
"windwp/nvim-autopairs",
commit = "771fda8d169384d345c8bbf2f871b75ba4a2dee5",
commit = "6617498bea01c9c628406d7e23030da57f2f8718",
event = "BufReadPost",
},
}
@ -20,14 +20,9 @@ autopairs.configs["nvim-autopairs"] = function()
end
autopairs.binds = {
"<leader>",
name = "+prefix",
{
{
"t",
name = "+tweak",
{
{ "p", require("doom.core.functions").toggle_autopairs, name = "Toggle autopairs" },
"<leader>", name = "+prefix", {
{ "t", name = "+tweak", {
{ "p", function() require("doom.core.functions").toggle_autopairs() end, name = "Toggle autopairs" },
},
},
},

2
lua/doom/modules/features/comment/init.lua

@ -44,7 +44,7 @@ comment.settings = {
comment.uses = {
["Comment.nvim"] = {
"numToStr/Comment.nvim",
commit = "18a8dc0bbdfc089d5f5a850e4640d8e75381c598",
commit = "8a2b2f3b302e3a35184b1107dfb3781aa76e442a",
module = "Comment",
},
}

4
lua/doom/modules/features/dap/init.lua

@ -38,12 +38,12 @@ dap.settings = {
dap.uses = {
["nvim-dap"] = {
"mfussenegger/nvim-dap",
commit = "9fcff6e02e1a549d47a2c559a4b833798537c0bc",
commit = "3d0575a777610b364fea745b85ad497d56b8009a",
module = "dap",
},
["nvim-dap-ui"] = {
"rcarriga/nvim-dap-ui",
commit = "22e94f2303c8d8d72b541799d7733c5ded0733c5",
commit = "45805d69273f1ca0753a096abd419e89af8e5f8a",
after = { "nvim-dap", "nest.nvim" },
},
}

8
lua/doom/modules/features/dashboard/init.lua

@ -67,15 +67,15 @@ dashboard.uses = {
dashboard.configs = {}
dashboard.configs["dashboard-nvim"] = function()
local utils = require("doom.utils")
local is_plugin_disabled = utils.is_plugin_disabled
local is_module_enabled = utils.is_module_enabled
if not is_plugin_disabled("auto_session") then
if is_module_enabled("auto_session") then
vim.g.dashboard_session_directory = doom.modules.auto_session.settings.dir
end
if not is_plugin_disabled("telescope") then
if is_module_enabled("telescope") then
vim.g.dashboard_default_executive = "telescope"
end
if not is_plugin_disabled("auto_session") then
if is_module_enabled("auto_session") then
doom.modules.dashboard.settings.entries.a = {
description = { " Load Last Session SPC s r" },
command = [[lua require("persistence").load({ last = true })]],

8
lua/doom/modules/features/explorer/init.lua

@ -77,7 +77,7 @@ explorer.settings = {
explorer.uses = {
["nvim-tree.lua"] = {
"kyazdani42/nvim-tree.lua",
commit = "9b03ab40e843e251f01bccec2eca5ea9dcdebc0d",
commit = "7b0ebf8b17d85abecccfd1c924090a28d5935b88",
cmd = {
"NvimTreeClipboard",
"NvimTreeClose",
@ -93,7 +93,7 @@ explorer.uses = {
explorer.configs = {}
explorer.configs["nvim-tree.lua"] = function()
local utils = require("doom.utils")
local is_plugin_disabled = utils.is_plugin_disabled
local is_module_enabled = utils.is_module_enabled
local tree_cb = require("nvim-tree.config").nvim_tree_callback
@ -132,7 +132,7 @@ explorer.configs["nvim-tree.lua"] = function()
vim.g.nvim_tree_show_icons = show_icons
local override_icons = {}
if not is_plugin_disabled("lsp") then
if is_module_enabled("lsp") then
override_icons = {
lsp = {
hint = doom.modules.lsp.settings.icons.hint,
@ -149,7 +149,7 @@ explorer.configs["nvim-tree.lua"] = function()
enable = false,
},
}
if not is_plugin_disabled("lsp") then
if is_module_enabled("lsp") then
override_table = {
diagnostics = {
enable = true,

2
lua/doom/modules/features/gitsigns/init.lua

@ -75,7 +75,7 @@ gitsigns.settings = {
gitsigns.uses = {
["gitsigns.nvim"] = {
"lewis6991/gitsigns.nvim",
commit = "7de953329ff696408bd38d3218b0239839d285e0",
commit = "3791dfa1ee356a3250e0b74f63bad90e27455f60",
},
}

2
lua/doom/modules/features/illuminate/init.lua

@ -16,7 +16,7 @@ illuminate.settings = {
illuminate.uses = {
["vim-illuminate"] = {
"RRethy/vim-illuminate",
commit = "db98338285574265a6ce54370b54d9f939e091bb",
commit = "487563de7ed6195fd46da178cb38dc1ff110c1ce",
},
}

2
lua/doom/modules/features/indentlines/init.lua

@ -11,7 +11,7 @@ indentlines.settings = {
indentlines.uses = {
["indent-blankline.nvim"] = {
"lukas-reineke/indent-blankline.nvim",
commit = "2e35f7dcdc72f39b37c21e43cdb538d7a41c7e07",
commit = "9915d46ba9361784c70036bb7259c436249e5b0c",
event = "ColorScheme",
},
}

2
lua/doom/modules/features/lazygit/init.lua

@ -5,7 +5,7 @@ lazygit.settings = {}
lazygit.uses = {
["lazygit.nvim"] = {
"kdheepak/lazygit.nvim",
commit = "9bceeab97668935cc6b91ab5190167d9771b5210",
commit = "ca8ea75e5a1d838635fd2fcc5c3467a5bb33c4ec",
cmd = { "LazyGit", "LazyGitConfig" },
opt = true,
},

2
lua/doom/modules/features/linter/init.lua

@ -7,7 +7,7 @@ linter.settings = {
linter.uses = {
["null-ls.nvim"] = {
"jose-elias-alvarez/null-ls.nvim",
commit = "a1804de23ce354c982aa08c57d3ed89aad8a15a9",
commit = "71bb21da7faa6676629ebac5e8818b701da46f80",
after = "nvim-lspconfig",
},
}

22
lua/doom/modules/features/lsp/init.lua

@ -77,24 +77,17 @@ lsp.settings = {
},
}
local is_plugin_disabled = require("doom.utils").is_plugin_disabled
local is_module_enabled = require("doom.utils").is_module_enabled
lsp.uses = {
["nvim-lspconfig"] = {
"neovim/nvim-lspconfig",
commit = "cdc2ec53e028d32f06c51ef8b2837ebb8460ef45",
opt = true,
cmd = {
"LspInfo",
"LspStart",
"LspRestart",
"LspStop",
},
commit = "63efd6ed156ae578c7e23278ec0a82776802106b",
module = "lspconfig",
},
["nvim-cmp"] = {
"hrsh7th/nvim-cmp",
commit = "1001683bee3a52a7b7e07ba9d391472961739c7b",
after = not is_plugin_disabled("snippets") and "LuaSnip" or nil,
commit = "272cbdca3e327bf43e8df85c6f4f00921656c4e4",
after = is_module_enabled("snippets") and "LuaSnip" or nil,
},
["cmp-nvim-lua"] = {
"hrsh7th/cmp-nvim-lua",
@ -120,13 +113,12 @@ lsp.uses = {
"saadparwaiz1/cmp_luasnip",
commit = "d6f837f4e8fe48eeae288e638691b91b97d1737f",
after = "nvim-cmp",
disabled = is_plugin_disabled("snippets"),
disabled = not is_module_enabled("snippets"),
},
["lsp_signature.nvim"] = {
"ray-x/lsp_signature.nvim",
commit = "f7c308e99697317ea572c6d6bafe6d4be91ee164",
commit = "e4f7dad45a1a3bb390977b4e69a528993bcefeac",
after = "nvim-lspconfig",
opt = true,
},
}
@ -197,7 +189,7 @@ lsp.configs["nvim-lspconfig"] = function()
end
lsp.configs["nvim-cmp"] = function()
local utils = require("doom.utils")
local snippets_enabled = not utils.is_plugin_disabled("snippets")
local snippets_enabled = utils.is_module_enabled("snippets")
local cmp = require("cmp")
local luasnip = snippets_enabled and require("luasnip")

2
lua/doom/modules/features/neogit/init.lua

@ -5,7 +5,7 @@ neogit.settings = {}
neogit.uses = {
["neogit"] = {
"TimUntersberger/neogit",
commit = "3bba2b63417cb679313e0ed0b7d9b7539c7f02b0",
commit = "9987421e0724ce704d0035f50a7080c677a85d71",
cmd = "Neogit",
opt = true,
},

4
lua/doom/modules/features/neorg/init.lua

@ -32,7 +32,9 @@ neorg.settings = {
neorg.uses = {
["neorg"] = {
"nvim-neorg/neorg",
commit = "acfa3929971d488afac9c392fb34b80bac4f4c71",
commit = "9aeaf79c5ad01930705a0534a35adbdba9eb5f13",
opt = "true",
cmd = "NeorgStart"
}
}

2
lua/doom/modules/features/show_registers/init.lua

@ -5,7 +5,7 @@ show_registers.settings = {}
show_registers.uses = {
["registers.nvim"] = {
"tversteeg/registers.nvim",
commit = "dd2bfa41b2c43d65f1f715e07acf1f1d34b37de8",
commit = "c66458fe5f83b57d40b678058a8eeb6340f9275c",
opt = true,
},
}

2
lua/doom/modules/features/snippets/init.lua

@ -8,7 +8,7 @@ snippets.settings = {
snippets.uses = {
["LuaSnip"] = {
"L3MON4D3/LuaSnip",
commit = "7c634ddf7ff99245ef993b5fa459c3b61e905075",
commit = "80e68242cf8127844653060fbada32dca15579fc",
requires = { "rafamadriz/friendly-snippets", opt = true },
event = "InsertEnter",
},

6
lua/doom/modules/features/statusline/init.lua

@ -24,7 +24,7 @@ statusline.uses = {
statusline.configs = {}
statusline.configs["galaxyline.nvim"] = function()
local utils = require("doom.utils")
local is_plugin_disabled = utils.is_plugin_disabled
local is_module_enabled = utils.is_module_enabled
local gl = require("galaxyline")
local colors = require("galaxyline.themes.colors").get_color
@ -45,7 +45,7 @@ statusline.configs["galaxyline.nvim"] = function()
gl.short_line_list = doom.modules.statusline.settings.short_line_list
if not is_plugin_disabled("dashboard") and not doom.modules.statusline.settings.on_dashboard then
if is_module_enabled("dashboard") and not doom.modules.statusline.settings.on_dashboard then
table.insert(gl.exclude_filetypes, "dashboard")
end
@ -297,7 +297,7 @@ statusline.configs["galaxyline.nvim"] = function()
},
}
if not is_plugin_disabled("lsp") then
if is_module_enabled("lsp") then
table.insert(default_sections.left, {
DiagnosticError = {
provider = "DiagnosticError",

44
lua/doom/modules/features/statusline2/init.lua

@ -0,0 +1,44 @@
local statusline = {}
statusline.settings = {
}
statusline.uses = {
["lualine.nvim"] = {
"nvim-lualine/lualine.nvim",
},
}
statusline.configs = {}
statusline.configs["lualine.nvim"] = function()
require('lualine').setup {
options = {
icons_enabled = true,
theme = 'nightfox',
component_separators = { left = '', right = ''},
section_separators = { left = '', right = ''},
disabled_filetypes = {},
always_divide_middle = true,
},
sections = {
lualine_a = {'mode'},
lualine_b = {'branch', 'diff', 'diagnostics'},
lualine_c = {'filename'},
lualine_x = {'encoding', 'fileformat', 'filetype'},
lualine_y = {'progress'},
lualine_z = {'location'}
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {'filename'},
lualine_x = {'location'},
lualine_y = {},
lualine_z = {}
},
tabline = {},
extensions = {}
}
end
return statusline

2
lua/doom/modules/features/symbols/init.lua

@ -19,7 +19,7 @@ symbols.settings = {
symbols.uses = {
["symbols-outline.nvim"] = {
"simrat39/symbols-outline.nvim",
commit = "758944ebc6919c50557b6eb3a52bc41187041fe2",
commit = "1361738c47892c3cee0d0b7a3b3bc7a8b48139c2",
cmd = {
"SymbolsOutline",
"SymbolsOutlineOpen",

2
lua/doom/modules/features/tabline/init.lua

@ -142,7 +142,7 @@ tabline.settings = {
tabline.uses = {
["bufferline.nvim"] = {
"akinsho/bufferline.nvim",
commit = "871495d9e2dbe3314a421fd2d5e46f47de7ee537",
commit = "e1202c6569353d03ef0cb3da11b839dba26854dd",
event = "BufAdd",
},
}

6
lua/doom/modules/features/telescope/init.lua

@ -49,7 +49,7 @@ telescope.settings = {
telescope.uses = {
["telescope.nvim"] = {
"nvim-telescope/telescope.nvim",
commit = "567ec85b157f1606b500a0f755181f284810a28e",
commit = "1a72a92b641e1dab42036c07e2571b43c55bfaa1",
cmd = "Telescope",
opt = true,
},
@ -92,7 +92,7 @@ end
telescope.binds = function ()
local utils = require("doom.utils")
local is_plugin_disabled = utils.is_plugin_disabled
local is_module_enabled = utils.is_module_enabled
local binds = {
"<leader>",
@ -168,7 +168,7 @@ telescope.binds = function ()
},
},
}
if not is_plugin_disabled("lsp") then
if is_module_enabled("lsp") then
table.insert(binds, {
"<leader>",
name = "+prefix",

2
lua/doom/modules/features/terminal/init.lua

@ -25,7 +25,7 @@ terminal.settings = {
terminal.uses = {
["toggleterm.nvim"] = {
"akinsho/toggleterm.nvim",
commit = "e97d0c1046512e975a9f3fa95afe98f312752b1c",
commit = "36704ddf3883842f3354e11da968d4c1201f0831",
cmd = { "ToggleTerm", "TermExec" },
opt = true,
},

2
lua/doom/modules/features/trouble/init.lua

@ -5,7 +5,7 @@ trouble.settings = {}
trouble.uses = {
["trouble.nvim"] = {
"folke/trouble.nvim",
commit = "20469be985143d024c460d95326ebeff9971d714",
commit = "691d490cc4eadc430d226fa7d77aaa84e2e0a125",
cmd = { "Trouble", "TroubleClose", "TroubleRefresh", "TroubleToggle" },
opt = true,
},

2
lua/doom/modules/features/whichkey/init.lua

@ -64,7 +64,7 @@ whichkey.settings = {
whichkey.uses = {
["which-key.nvim"] = {
"folke/which-key.nvim",
commit = "28d2bd129575b5e9ebddd88506601290bb2bb221",
commit = "a3c19ec5754debb7bf38a8404e36a9287b282430",
},
}

16
lua/doom/modules/init.lua

@ -68,6 +68,7 @@ for module_name, module in pairs(doom.modules) do
use(packer_spec)
end
end
-- Setup package autogroups
if module.autocmds then
local autocmds = type(module.autocmds) == 'function' and module.autocmds() or module.autocmds
@ -85,3 +86,18 @@ end
for _, packer_spec in ipairs(doom.uses) do
use(packer_spec)
end
-- Handle extra user cmds
for _, cmd_spec in pairs(doom.cmds) do
print(cmd_spec[1])
utils.make_cmd(cmd_spec[1], cmd_spec[2])
end
-- Handle extra user autocmds
local autocmds = {}
for _, cmd_spec in pairs(doom.autocmds) do
table.insert(autocmds, cmd_spec)
end
utils.make_augroup('user', autocmds)
-- User keybinds handled in `nest` module

2
lua/doom/modules/langs/config/init.lua

@ -17,7 +17,7 @@ config.settings = {
config.uses = {
["SchemaStore.nvim"] = {
"b0o/SchemaStore.nvim",
commit = "df5e98d3b3c93e9857908fce8a219360f81c5e32",
commit = "0a3f765335acde2bdf33504a62fe944a5d6d907e",
ft = { "json", "yaml", "toml" }
},
}

7
lua/doom/modules/langs/typescript/init.lua

@ -1,3 +1,5 @@
local utils = require('doom.utils');
local typescript = {}
typescript.settings = {
@ -7,7 +9,8 @@ typescript.autocmds = {
{
"FileType",
"typescript,typescriptreact",
function()
utils.make_run_once_function(function()
print('Configuring typescript')
local langs_utils = require('doom.modules.langs.utils')
langs_utils.use_lsp('tsserver')
@ -26,7 +29,7 @@ typescript.autocmds = {
null_ls.builtins.diagnostics.eslint_d,
})
end
end,
end),
once = true,
},
}

6
lua/doom/modules/langs/utils.lua

@ -24,7 +24,7 @@ end
module.use_lsp = function(lsp_name, _opts)
local utils = require('doom.utils')
if utils.is_plugin_disabled("lsp") then
if not utils.is_module_enabled("lsp") then
return
end
local lsp = require('lspconfig')
@ -40,7 +40,7 @@ module.use_lsp = function(lsp_name, _opts)
-- Combine default on_attach with provided on_attach
local on_attach_functions = {}
if not utils.is_plugin_disabled("illuminate") then
if utils.is_module_enabled("illuminate") then
table.insert(on_attach_functions, utils.illuminate_attach)
end
if (opts.config and opts.config.on_attach) then
@ -74,7 +74,7 @@ module.use_lsp = function(lsp_name, _opts)
end
-- Auto install if possible
if not utils.is_plugin_disabled('auto_install') and not opts.no_installer then
if utils.is_module_enabled('auto_install') and not opts.no_installer then
local lsp_installer = require("nvim-lsp-installer.servers")
local server_available, server = lsp_installer.get_server(lsp_name)
if server_available then

95
lua/doom/modules/langs/vue/init.lua

@ -4,7 +4,7 @@ vue.settings = {
-- Volar API lspconfig options
volar_api = {
default_config = {
filetypes = { 'vue' },
filetypes = { "vue" },
-- If you want to use Volar's Take Over Mode (if you know, you know)
--filetypes = { 'vue', 'javascript', 'javascriptreact', 'typescriptreact', 'vue', 'json' },
init_options = {
@ -20,37 +20,37 @@ vue.settings = {
codeAction = true,
workspaceSymbol = true,
completion = {
defaultTagNameCase = 'both',
defaultAttrNameCase = 'kebabCase',
defaultTagNameCase = "both",
defaultAttrNameCase = "kebabCase",
getDocumentNameCasesRequest = false,
getDocumentSelectionRequest = false,
},
}
},
},
}
},
},
-- Volar Document lspconfig options
volar_doc = {
default_config = {
filetypes = { 'vue' },
filetypes = { "vue" },
-- If you want to use Volar's Take Over Mode (if you know, you know):
--filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue', 'json' },
init_options = {
languageFeatures = {
documentHighlight = true,
documentLink = true,
codeLens = { showReferencesNotification = true},
codeLens = { showReferencesNotification = true },
-- not supported - https://github.com/neovim/neovim/pull/14122
semanticTokens = false,
diagnostics = true,
schemaRequestService = true,
}
},
},
}
},
},
volar_html = {
default_config = {
filetypes = { 'vue' },
filetypes = { "vue" },
-- If you want to use Volar's Take Over Mode (if you know, you know), intentionally no 'json':
--filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue' },
init_options = {
@ -64,10 +64,10 @@ vue.settings = {
documentFormatting = {
defaultPrintWidth = 100,
},
}
},
},
}
}
},
},
}
vue.configs = {}
@ -79,8 +79,8 @@ vue.autocmds = {
function()
local lspconfig = require("lspconfig")
local lspconfig_util = require("lspconfig/util")
local langs_utils = require('doom.modules.langs.utils')
local langs_utils = require("doom.modules.langs.utils")
-- volar needs works with typescript server, needs to get the typescript server from the project's node_modules
local volar = lspconfig.volar -- Get the volar config to set the `cmd`
local function on_new_config(new_config, new_root_dir)
@ -96,7 +96,7 @@ vue.autocmds = {
))
or ""
end
if
new_config.init_options
and new_config.init_options.typescript
@ -106,11 +106,12 @@ vue.autocmds = {
end
end
local volar_root_dir = lspconfig_util.root_pattern("package.json")
-- Contains base configuration necessary for volar to start
local base_config = {
default_config = {
cmd = volar.document_config.default_config.cmd,
cmd = { 'vue-language-server', '--stdio' },
-- cmd = volar.document_config.default_config.cmd,
root_dir = volar_root_dir,
on_new_config = on_new_config,
init_options = {
@ -120,37 +121,57 @@ vue.autocmds = {
},
},
}
local volar_api_config = vim.tbl_deep_extend('force', {}, doom.modules.vue.settings.volar_api, base_config)
langs_utils.use_lsp('volar', {
name = 'volar_api',
local volar_api_config = vim.tbl_deep_extend(
"force",
{},
doom.modules.vue.settings.volar_api,
base_config
)
langs_utils.use_lsp("volar", {
name = "volar_api",
config = volar_api_config,
})
local volar_doc_config = vim.tbl_deep_extend('force', {}, doom.modules.vue.settings.volar_doc, base_config)
langs_utils.use_lsp('volar', {
name = 'volar_doc',
local volar_doc_config = vim.tbl_deep_extend(
"force",
{},
doom.modules.vue.settings.volar_doc,
base_config
)
langs_utils.use_lsp("volar", {
name = "volar_doc",
config = volar_doc_config,
})
local volar_html_config = vim.tbl_deep_extend('force', {}, doom.modules.vue.settings.volar_html, base_config)
langs_utils.use_lsp('volar', {
name = 'volar_html',
local volar_html_config = vim.tbl_deep_extend(
"force",
{},
doom.modules.vue.settings.volar_html,
base_config
)
langs_utils.use_lsp("volar", {
name = "volar_html",
config = volar_html_config,
})
vim.defer_fn(function()
local ts_install = require("nvim-treesitter.install")
ts_install.ensure_installed("vue", "css", "scss", "html", "scss", "javascript", "typescript")
ts_install.ensure_installed(
"vue",
"css",
"scss",
"html",
"scss",
"javascript",
"typescript"
)
end, 0)
-- Setup null-ls
if doom.modules.linter then
local null_ls = require("null-ls")
langs_utils.use_null_ls_source({
null_ls.builtins.formatting.eslint_d,
null_ls.builtins.code_actions.eslint_d,

19
lua/doom/utils/init.lua

@ -211,17 +211,30 @@ end
--- Check if the given plugin is disabled in doom-nvim/modules.lua
--- @param plugin string The plugin identifier, e.g. statusline
--- @return boolean
utils.is_plugin_disabled = function(plugin)
utils.is_module_enabled = function(plugin)
local modules = require("doom.core.config.modules").modules
-- Iterate over all modules sections (e.g. ui) and their plugins
for _, section in pairs(modules) do
if vim.tbl_contains(section, plugin) then
return false
return true
end
end
return true
return false
end
--- Returns a function that can only be run once
---@param fn function
---@return function
utils.make_run_once_function = function(fn)
local has_run = false
return function(...)
if not has_run then
fn(...)
has_run = true
end
end
end
--- Rounds a number, optionally to the nearest decimal place

2
modules.lua

@ -1,5 +1,5 @@
-- modules.lua - Doom nvim module selection
--
-- modules.lua - Doom nvim module selection
-- modules.lua controls what Doom nvim plugins modules are enabled and
-- what features are being used.
--

Loading…
Cancel
Save