Browse Source

refact: Modules now stored under `doom.core/modules/langs/user`

my-config
connorgmeean 3 years ago
parent
commit
5ce762a8a1
  1. 2
      lua/doom/core/config.lua
  2. 14
      lua/doom/core/doom_global.lua
  3. 46
      lua/doom/core/modules.lua
  4. 2
      lua/doom/modules/core/doom/init.lua
  5. 10
      lua/doom/modules/core/nest/init.lua
  6. 2
      lua/doom/modules/core/treesitter/init.lua
  7. 2
      lua/doom/modules/langs/bash/init.lua
  8. 2
      lua/doom/modules/langs/c_sharp/init.lua
  9. 8
      lua/doom/modules/langs/config/init.lua
  10. 2
      lua/doom/modules/langs/cpp/init.lua
  11. 2
      lua/doom/modules/langs/css/init.lua
  12. 2
      lua/doom/modules/langs/go/init.lua
  13. 2
      lua/doom/modules/langs/haskell/init.lua
  14. 2
      lua/doom/modules/langs/java/init.lua
  15. 2
      lua/doom/modules/langs/kotlin/init.lua
  16. 4
      lua/doom/modules/langs/lua/init.lua
  17. 2
      lua/doom/modules/langs/python/init.lua
  18. 2
      lua/doom/modules/langs/svelte/init.lua
  19. 6
      lua/doom/modules/langs/vue/init.lua
  20. 0
      lua/doom/modules/modules/annotations/init.lua
  21. 0
      lua/doom/modules/modules/auto_install/init.lua
  22. 0
      lua/doom/modules/modules/auto_session/init.lua
  23. 0
      lua/doom/modules/modules/autopairs/init.lua
  24. 0
      lua/doom/modules/modules/colorizer/init.lua
  25. 0
      lua/doom/modules/modules/comment/init.lua
  26. 0
      lua/doom/modules/modules/dap/init.lua
  27. 0
      lua/doom/modules/modules/dashboard/init.lua
  28. 0
      lua/doom/modules/modules/doom_themes/init.lua
  29. 0
      lua/doom/modules/modules/editorconfig/init.lua
  30. 0
      lua/doom/modules/modules/explorer/init.lua
  31. 0
      lua/doom/modules/modules/firenvim/init.lua
  32. 0
      lua/doom/modules/modules/gitsigns/init.lua
  33. 0
      lua/doom/modules/modules/illuminate/init.lua
  34. 0
      lua/doom/modules/modules/indentlines/init.lua
  35. 0
      lua/doom/modules/modules/lazygit/init.lua
  36. 0
      lua/doom/modules/modules/linter/init.lua
  37. 0
      lua/doom/modules/modules/lsp/init.lua
  38. 0
      lua/doom/modules/modules/lsp_progress/init.lua
  39. 0
      lua/doom/modules/modules/minimap/init.lua
  40. 0
      lua/doom/modules/modules/neogit/init.lua
  41. 0
      lua/doom/modules/modules/neorg/init.lua
  42. 0
      lua/doom/modules/modules/netrw/init.lua
  43. 0
      lua/doom/modules/modules/projects/init.lua
  44. 0
      lua/doom/modules/modules/range_highlight/init.lua
  45. 0
      lua/doom/modules/modules/ranger/init.lua
  46. 0
      lua/doom/modules/modules/restclient/init.lua
  47. 0
      lua/doom/modules/modules/show_registers/init.lua
  48. 0
      lua/doom/modules/modules/snippets/init.lua
  49. 0
      lua/doom/modules/modules/statusline/init.lua
  50. 0
      lua/doom/modules/modules/statusline2/init.lua
  51. 0
      lua/doom/modules/modules/suda/init.lua
  52. 0
      lua/doom/modules/modules/superman/init.lua
  53. 0
      lua/doom/modules/modules/symbols/init.lua
  54. 0
      lua/doom/modules/modules/tabline/init.lua
  55. 0
      lua/doom/modules/modules/telescope/init.lua
  56. 0
      lua/doom/modules/modules/terminal/init.lua
  57. 0
      lua/doom/modules/modules/todo_comments/init.lua
  58. 0
      lua/doom/modules/modules/trouble/init.lua
  59. 0
      lua/doom/modules/modules/whichkey/init.lua
  60. 0
      lua/doom/modules/modules/zen/init.lua
  61. 2
      modules.lua

2
lua/doom/core/config.lua

@ -84,7 +84,7 @@ config.load = function()
local ok, result = xpcall(require, debug.traceback, ("%s.%s"):format(root_folder, module_name))
if ok then
doom.modules[module_name] = result
doom[section_name][module_name] = result
else
local log = require("doom.utils.logging")
log.error(

14
lua/doom/core/doom_global.lua

@ -1,7 +1,7 @@
-- doom.core.doom_global
--
--
-- Sets the `doom` global object including defaults and helper functions.
-- We set it directly within this file (rather than returning the object) and
-- We set it directly within this file (rather than returning the object) and
-- setting it elsewhere to allow sumneko_lua to provide documented type
-- completions.
@ -275,7 +275,7 @@ doom = {
--- Binds keybinds using a modified nest.nvim syntax.
---
--- Example:
---
---
--- doom.use_keybind({
--- { '<leader>f', name = '+files', {
--- { 'f', ':Telescope find_files', name = 'Find files' },
@ -298,6 +298,12 @@ doom = {
end,
---
-- This is where modules are stored.
-- The entire data structure will be stored in modules[module_name] = {}
-- The key (`user` vs `modules` vs `langs`) cooresponds with the section in
-- the user's modules.lua.
core = {},
user = {},
modules = {},
langs = {},
}

46
lua/doom/core/modules.lua

@ -74,32 +74,34 @@ end
modules.load_modules = function()
local use = require("packer").use
-- Handle the Modules
for module_name, module in pairs(doom.modules) do
-- Import dependencies with packer from module.packages
if module.packages then
for dependency_name, packer_spec in pairs(module.packages) do
-- Set packer_spec to configure function
if module.configs and module.configs[dependency_name] then
packer_spec.config = module.configs[dependency_name]
for _, section_name in ipairs({"core", "modules", "user", "langs",}) do
for module_name, module in pairs(doom[section_name]) do
-- Import dependencies with packer from module.packages
if module.packages then
for dependency_name, packer_spec in pairs(module.packages) do
-- Set packer_spec to configure function
if module.configs and module.configs[dependency_name] then
packer_spec.config = module.configs[dependency_name]
end
-- Set/unset frozen packer dependencies
packer_spec.commit = doom.freeze_dependencies and packer_spec.commit or nil
-- Initialise packer
use(packer_spec)
end
-- Set/unset frozen packer dependencies
packer_spec.commit = doom.freeze_dependencies and packer_spec.commit or nil
-- Initialise packer
use(packer_spec)
end
end
-- Setup package autogroups
if module.autocmds then
local autocmds = type(module.autocmds) == 'function' and module.autocmds() or module.autocmds
utils.make_augroup(module_name, autocmds)
end
-- Setup package autogroups
if module.autocmds then
local autocmds = type(module.autocmds) == 'function' and module.autocmds() or module.autocmds
utils.make_augroup(module_name, autocmds)
end
if module.cmds then
for _, cmd_spec in ipairs(module.cmds) do
utils.make_cmd(cmd_spec[1], cmd_spec[2])
if module.cmds then
for _, cmd_spec in ipairs(module.cmds) do
utils.make_cmd(cmd_spec[1], cmd_spec[2])
end
end
end
end

2
lua/doom/modules/core/doom/init.lua

@ -36,7 +36,7 @@ required.packages = {
required.configs = {}
required.configs["nvim-mapper"] = function()
require("nvim-mapper").setup(doom.modules.doom.settings.mapper)
require("nvim-mapper").setup(doom.core.doom.settings.mapper)
end
required.binds = function ()

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

@ -26,10 +26,12 @@ nest.configs["nest.nvim"] = function()
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)
for _, section_name in ipairs({"user", "modules", "langs"}) do
for module_name, module in pairs(doom[section_name]) 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
-- Apply user keybinds

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

@ -61,7 +61,7 @@ treesitter.packages = {
treesitter.configs = {}
treesitter.configs["nvim-treesitter"] = function()
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, {
require("nvim-treesitter.configs").setup(vim.tbl_deep_extend("force", doom.core.treesitter.settings.treesitter, {
autopairs = {
enable = is_module_enabled("autopairs"),
},

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

@ -10,7 +10,7 @@ bash.autocmds = {
"*.sh",
function()
local langs_utils = require('doom.modules.langs.utils')
langs_utils.use_lsp(doom.modules.bash.settings.language_server_name)
langs_utils.use_lsp(doom.langs.bash.settings.language_server_name)
vim.defer_fn(function()
require("nvim-treesitter.install").ensure_installed("bash")

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

@ -11,7 +11,7 @@ c_sharp.autocmds = {
function()
local langs_utils = require('doom.modules.langs.utils')
local lsp_util = require 'lspconfig.util';
langs_utils.use_lsp(doom.modules.c_sharp.settings.language_server_name, {
langs_utils.use_lsp(doom.langs.c_sharp.settings.language_server_name, {
config = {
root_dir = function(fname)
return lsp_util.root_pattern '*.sln'(fname)

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

@ -24,12 +24,12 @@ config.packages = {
config.configs = {}
config.configs["SchemaStore.nvim"] = function()
local langs_utils = require('doom.modules.langs.utils')
langs_utils.use_lsp(doom.modules.config.settings.json_language_server_name, {
langs_utils.use_lsp(doom.langs.config.settings.json_language_server_name, {
config = {
settings = {
json = {
schemas = require('schemastore').json.schemas {
select = doom.modules.config.settings.json_schemas,
select = doom.langs.config.settings.json_schemas,
},
},
},
@ -43,8 +43,8 @@ config.autocmds = {
"*.json,*.yaml,*.toml",
function()
local langs_utils = require('doom.modules.langs.utils')
-- langs_utils.use_lsp(doom.modules.config.settings.toml_language_server_name)
-- langs_utils.use_lsp(doom.modules.config.settings.yaml_language_server_name)
-- langs_utils.use_lsp(doom.langs.config.settings.toml_language_server_name)
-- langs_utils.use_lsp(doom.langs.config.settings.yaml_language_server_name)
vim.defer_fn(function()
require("nvim-treesitter.install").ensure_installed("json5", "yaml", "toml")

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

@ -11,7 +11,7 @@ cpp.autocmds = {
"*.cpp,*.c,*.h",
function()
local langs_utils = require('doom.modules.langs.utils')
langs_utils.use_lsp(doom.modules.cpp.settings.language_server_name)
langs_utils.use_lsp(doom.langs.cpp.settings.language_server_name)
vim.defer_fn(function()
require("nvim-treesitter.install").ensure_installed("cpp", "c")

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

@ -10,7 +10,7 @@ css.autocmds = {
"css,scss,vue,svelte,html",
function()
local langs_utils = require("doom.modules.langs.utils")
langs_utils.use_lsp(doom.modules.css.settings.language_server_name)
langs_utils.use_lsp(doom.langs.css.settings.language_server_name)
vim.defer_fn(function()
require("nvim-treesitter.install").ensure_installed("css")

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

@ -10,7 +10,7 @@ go.autocmds = {
"*.go",
function()
local langs_utils = require('doom.modules.langs.utils')
langs_utils.use_lsp(doom.modules.go.settings.language_server_name)
langs_utils.use_lsp(doom.langs.go.settings.language_server_name)
defer_fn(function()
require("nvim-treesitter.install").ensure_installed("go")

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

@ -10,7 +10,7 @@ haskell.autocmds = {
"*.hs",
function()
local langs_utils = require('doom.modules.langs.utils')
langs_utils.use_lsp(doom.modules.haskell.settings.language_server_name)
langs_utils.use_lsp(doom.langs.haskell.settings.language_server_name)
local parser_config = require "nvim-treesitter.parsers".get_parser_configs()
parser_config.haskell = {

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

@ -10,7 +10,7 @@ java.autocmds = {
"*.java",
function()
local langs_utils = require('doom.modules.langs.utils')
langs_utils.use_lsp(doom.modules.java.settings.language_server_name)
langs_utils.use_lsp(doom.langs.java.settings.language_server_name)
vim.defer_fn(function()
require("nvim-treesitter.install").ensure_installed("java")

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

@ -10,7 +10,7 @@ kotlin.autocmds = {
"*.kt",
function()
local langs_utils = require('doom.modules.langs.utils')
langs_utils.use_lsp(doom.modules.kotlin.settings.language_server_name)
langs_utils.use_lsp(doom.langs.kotlin.settings.language_server_name)
defer_fn(function()
require("nvim-treesitter.install").ensure_installed("kotlin")

4
lua/doom/modules/langs/lua/init.lua

@ -39,7 +39,7 @@ lua.packages = {
lua.configs = {}
lua.configs["lua-dev.nvim"] = function()
require("lua-dev").setup(doom.modules.lua.settings.dev)
require("lua-dev").setup(doom.langs.lua.settings.dev)
end
lua.autocmds = {
@ -53,7 +53,7 @@ lua.autocmds = {
table.insert(runtime_path, "lua/?.lua")
table.insert(runtime_path, "lua/?/init.lua")
local config = vim.tbl_deep_extend("force", doom.modules.lua.settings, {
local config = vim.tbl_deep_extend("force", doom.langs.lua.settings, {
settings = {
Lua = {
runtime = {

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

@ -10,7 +10,7 @@ python.autocmds = {
"*.py",
function()
local langs_utils = require('doom.modules.langs.utils')
langs_utils.use_lsp(doom.modules.python.settings.language_server_name)
langs_utils.use_lsp(doom.langs.python.settings.language_server_name)
vim.defer_fn(function()
require("nvim-treesitter.install").ensure_installed("python")

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

@ -10,7 +10,7 @@ svelte.autocmds = {
"*.svelte",
function()
local langs_utils = require('doom.modules.langs.utils')
langs_utils.use_lsp(doom.modules.svelte.settings.language_server_name)
langs_utils.use_lsp(doom.langs.svelte.settings.language_server_name)
vim.defer_fn(function()
require("nvim-treesitter.install").ensure_installed("svelte")

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

@ -125,7 +125,7 @@ vue.autocmds = {
local volar_api_config = vim.tbl_deep_extend(
"force",
{},
doom.modules.vue.settings.volar_api,
doom.langs.vue.settings.volar_api,
base_config
)
langs_utils.use_lsp("volar", {
@ -136,7 +136,7 @@ vue.autocmds = {
local volar_doc_config = vim.tbl_deep_extend(
"force",
{},
doom.modules.vue.settings.volar_doc,
doom.langs.vue.settings.volar_doc,
base_config
)
langs_utils.use_lsp("volar", {
@ -147,7 +147,7 @@ vue.autocmds = {
local volar_html_config = vim.tbl_deep_extend(
"force",
{},
doom.modules.vue.settings.volar_html,
doom.langs.vue.settings.volar_html,
base_config
)
langs_utils.use_lsp("volar", {

0
lua/doom/modules/features/annotations/init.lua → lua/doom/modules/modules/annotations/init.lua

0
lua/doom/modules/features/auto_install/init.lua → lua/doom/modules/modules/auto_install/init.lua

0
lua/doom/modules/features/auto_session/init.lua → lua/doom/modules/modules/auto_session/init.lua

0
lua/doom/modules/features/autopairs/init.lua → lua/doom/modules/modules/autopairs/init.lua

0
lua/doom/modules/features/colorizer/init.lua → lua/doom/modules/modules/colorizer/init.lua

0
lua/doom/modules/features/comment/init.lua → lua/doom/modules/modules/comment/init.lua

0
lua/doom/modules/features/dap/init.lua → lua/doom/modules/modules/dap/init.lua

0
lua/doom/modules/features/dashboard/init.lua → lua/doom/modules/modules/dashboard/init.lua

0
lua/doom/modules/features/doom_themes/init.lua → lua/doom/modules/modules/doom_themes/init.lua

0
lua/doom/modules/features/editorconfig/init.lua → lua/doom/modules/modules/editorconfig/init.lua

0
lua/doom/modules/features/explorer/init.lua → lua/doom/modules/modules/explorer/init.lua

0
lua/doom/modules/features/firenvim/init.lua → lua/doom/modules/modules/firenvim/init.lua

0
lua/doom/modules/features/gitsigns/init.lua → lua/doom/modules/modules/gitsigns/init.lua

0
lua/doom/modules/features/illuminate/init.lua → lua/doom/modules/modules/illuminate/init.lua

0
lua/doom/modules/features/indentlines/init.lua → lua/doom/modules/modules/indentlines/init.lua

0
lua/doom/modules/features/lazygit/init.lua → lua/doom/modules/modules/lazygit/init.lua

0
lua/doom/modules/features/linter/init.lua → lua/doom/modules/modules/linter/init.lua

0
lua/doom/modules/features/lsp/init.lua → lua/doom/modules/modules/lsp/init.lua

0
lua/doom/modules/features/lsp_progress/init.lua → lua/doom/modules/modules/lsp_progress/init.lua

0
lua/doom/modules/features/minimap/init.lua → lua/doom/modules/modules/minimap/init.lua

0
lua/doom/modules/features/neogit/init.lua → lua/doom/modules/modules/neogit/init.lua

0
lua/doom/modules/features/neorg/init.lua → lua/doom/modules/modules/neorg/init.lua

0
lua/doom/modules/features/netrw/init.lua → lua/doom/modules/modules/netrw/init.lua

0
lua/doom/modules/features/projects/init.lua → lua/doom/modules/modules/projects/init.lua

0
lua/doom/modules/features/range_highlight/init.lua → lua/doom/modules/modules/range_highlight/init.lua

0
lua/doom/modules/features/ranger/init.lua → lua/doom/modules/modules/ranger/init.lua

0
lua/doom/modules/features/restclient/init.lua → lua/doom/modules/modules/restclient/init.lua

0
lua/doom/modules/features/show_registers/init.lua → lua/doom/modules/modules/show_registers/init.lua

0
lua/doom/modules/features/snippets/init.lua → lua/doom/modules/modules/snippets/init.lua

0
lua/doom/modules/features/statusline/init.lua → lua/doom/modules/modules/statusline/init.lua

0
lua/doom/modules/features/statusline2/init.lua → lua/doom/modules/modules/statusline2/init.lua

0
lua/doom/modules/features/suda/init.lua → lua/doom/modules/modules/suda/init.lua

0
lua/doom/modules/features/superman/init.lua → lua/doom/modules/modules/superman/init.lua

0
lua/doom/modules/features/symbols/init.lua → lua/doom/modules/modules/symbols/init.lua

0
lua/doom/modules/features/tabline/init.lua → lua/doom/modules/modules/tabline/init.lua

0
lua/doom/modules/features/telescope/init.lua → lua/doom/modules/modules/telescope/init.lua

0
lua/doom/modules/features/terminal/init.lua → lua/doom/modules/modules/terminal/init.lua

0
lua/doom/modules/features/todo_comments/init.lua → lua/doom/modules/modules/todo_comments/init.lua

0
lua/doom/modules/features/trouble/init.lua → lua/doom/modules/modules/trouble/init.lua

0
lua/doom/modules/features/whichkey/init.lua → lua/doom/modules/modules/whichkey/init.lua

0
lua/doom/modules/features/zen/init.lua → lua/doom/modules/modules/zen/init.lua

2
modules.lua

@ -6,7 +6,7 @@
-- Uncomment a plugin to enable it and comment out to disable and uninstall it.
return {
features = {
modules = {
-- Language features (33ms)
"annotations", -- Code annotation generator
"auto_install", -- Auto install LSP providers

Loading…
Cancel
Save