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

Commit

Permalink
Merge remote-tracking branch 'luigi-fork/feature/module-architecture'…
Browse files Browse the repository at this point in the history
… into custom-module-architecture

# Conflicts:
#	lua/doom/modules/annotations/binds.lua
#	lua/doom/modules/annotations/init.lua
#	lua/doom/modules/annotations/packages.lua
#	lua/doom/modules/comment/binds.lua
#	lua/doom/modules/comment/init.lua
#	lua/doom/modules/comment/packages.lua
#	lua/doom/modules/lua/config.lua
  • Loading branch information
connorgmeean committed Jan 21, 2022
2 parents 69a7bf6 + 8234e5c commit fbb6360
Show file tree
Hide file tree
Showing 21 changed files with 125 additions and 90 deletions.
16 changes: 13 additions & 3 deletions lua/doom/modules/annotations/binds.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
local binds = {
{ "<leader>c", name = '+code', {
{ 'g', ':lua require("neogen").generate()<CR>', name = 'Generate annotations'}
} },
{
"<leader>",
name = "+prefix",
{
{
"c",
name = "+code",
{
{ "g", require("neogen").generate, name = "Generate annotations" },
},
},
},
},
}

return binds
17 changes: 6 additions & 11 deletions lua/doom/modules/annotations/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,17 @@ local annotations = {}
annotations.defaults = {
enabled = true,
languages = {
lua = {
template = {
annotation_convention = "emmylua",
}
},
python = {
lua = {
template = {
annotation_convention = 'google_docstrings',
}
}
}
annotation_convention = "ldoc",
},
},
},
}

annotations.packer_config = {}
annotations.packer_config["neogen"] = function()
require('neogen').setup(doom.annotations)
require("neogen").setup(doom.annotations)
end

return annotations
2 changes: 1 addition & 1 deletion lua/doom/modules/annotations/packages.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ return {
["neogen"] = {
"danymat/neogen",
commit = "966d09146857af9ba23a4633dce0e83ad51f2b23",
after = 'nvim-treesitter',
after = "nvim-treesitter",
},
}
1 change: 0 additions & 1 deletion lua/doom/modules/auto_install/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ local auto_install = {}
auto_install.defaults = {
lsp_dir = vim.fn.stdpath("data") .. "/lsp-install/",
dap_dir = vim.fn.stdpath("data") .. "/dap-install/",
treesitter_dir = vim.fn.stdpath("data") .. "/treesitter-install/",
}

auto_install.packer_config = {}
Expand Down
4 changes: 4 additions & 0 deletions lua/doom/modules/auto_install/packages.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
local is_plugin_disabled = require("doom.utils").is_plugin_disabled

return {
["DAPInstall.nvim"] = {
"Pocco81/DAPInstall.nvim",
Expand All @@ -8,13 +10,15 @@ return {
"DIList",
"DIUninstall",
},
disabled = is_plugin_disabled("dap"),
module = "dap-install",
disable = true,
},
["nvim-lsp-installer"] = {
"williamboman/nvim-lsp-installer",
commit = "7a4f43beaf579f48b190e4a0784d4b3317157495",
opt = true,
disabled = is_plugin_disabled("lsp"),
module = "nvim-lsp-install",
},
}
32 changes: 28 additions & 4 deletions lua/doom/modules/comment/binds.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,31 @@
local binds = {
{ 'gcc', '<CMD>lua require("Comment.api").call("toggle_current_linewise_op")<CR>g@$', name = 'Comment Line' },
{ 'gc', '<CMD>lua require("Comment.api").call("toggle_linewise_op")<CR>g@', name = 'Comment Motion' },
{ 'gcA', '<CMD>lua require("Comment.api").insert_linewise_eol(cfg)<CR>', name = 'Comment end of line' },
{ 'gc', '<ESC><CMD>lua require("Comment.api").toggle_blockwise_op(vim.fn.visualmode())<CR>', name = 'Comment Line (Visual)', mode = 'v' },
{
"gc",
[[<cmd>lua require("Comment.api").call("toggle_linewise_op")<CR>g@]],
name = "Comment motion",
},
{
"gc",
[[<Esc><cmd>lua require("Comment.api").toggle_linewise_op(vim.fn.visualmode())<CR>]],
name = "Comment line",
mode = "v",
},
{
"gb",
[[<Esc><cmd>lua require("Comment.api").toggle_blockwise_op(vim.fn.visualmode())<CR>]],
name = "Comment block",
mode = "v",
},
{
"gcc",
[[<cmd>lua require("Comment.api").call("toggle_current_linewise_op")<CR>g@$]],
name = "Comment line",
},
{
"gcA",
[[<cmd>lua require("Comment.api").insert_linewise_eol()<CR>]],
name = "Comment end of line",
},
}

return binds
81 changes: 41 additions & 40 deletions lua/doom/modules/comment/init.lua
Original file line number Diff line number Diff line change
@@ -1,57 +1,58 @@
local comment = {}

comment.defaults = {
---Add a space b/w comment and the line
---@type boolean
padding = true,

---Whether the cursor should stay at its position
---NOTE: This only affects NORMAL mode mappings and doesn't work with dot-repeat
---@type boolean
sticky = true,

---Lines to be ignored while comment/uncomment.
---Could be a regex string or a function that returns a regex string.
---Example: Use '^$' to ignore empty lines
---@type string|fun():string
ignore = nil,
--- Add a space b/w comment and the line
--- @type boolean
padding = true,

--- Whether the cursor should stay at its position
--- NOTE: This only affects NORMAL mode mappings and doesn't work with dot-repeat
--- @type boolean
sticky = true,

--- Lines to be ignored while comment/uncomment.
--- Could be a regex string or a function that returns a regex string.
--- Example: Use '^$' to ignore empty lines
--- @type string|fun():string
ignore = nil,

--- Passes to ts-context-commentstring to get commentstring in JSX
pre_hook = function(ctx)
-- Only calculate commentstring for tsx filetypes
if vim.bo.filetype == "typescriptreact" then
local comment_utils = require("Comment.utils")

-- Detemine whether to use linewise or blockwise commentstring
local type = ctx.ctype == comment_utils.ctype.line and "__default" or "__multiline"

-- Determine the location where to calculate commentstring from
local location = nil
if ctx.ctype == comment_utils.ctype.block then
location = require("ts_context_commentstring.utils").get_cursor_location()
elseif ctx.cmotion == comment_utils.cmotion.v or ctx.cmotion == comment_utils.cmotion.V then
location = require("ts_context_commentstring.utils").get_visual_start_location()
end

return require("ts_context_commentstring.internal").calculate_commentstring({
key = type,
location = location,
})
end
end,
}

comment.packer_config = {}
comment.packer_config['comment'] = function()
local config = vim.tbl_extend('force', doom.comment, {
comment.packer_config["Comment.nvim"] = function()
local config = vim.tbl_extend("force", doom.comment, {
-- Disable mappings as we'll handle it in binds.lua
mappings = {
basic = false,
extra = false,
extended = false,
},
-- Passes to ts-context-commentstring to get commentstring in JSX
pre_hook = function(ctx)
-- Only calculate commentstring for tsx filetypes
if vim.bo.filetype == 'typescriptreact' then
local U = require('Comment.utils')

-- Detemine whether to use linewise or blockwise commentstring
local type = ctx.ctype == U.ctype.line and '__default' or '__multiline'

-- Determine the location where to calculate commentstring from
local location = nil
if ctx.ctype == U.ctype.block then
location = require('ts_context_commentstring.utils').get_cursor_location()
elseif ctx.cmotion == U.cmotion.v or ctx.cmotion == U.cmotion.V then
location = require('ts_context_commentstring.utils').get_visual_start_location()
end

return require('ts_context_commentstring.internal').calculate_commentstring({
key = type,
location = location,
})
end
end
})

require('Comment').setup(config)
require("Comment").setup(config)
end

return comment
3 changes: 2 additions & 1 deletion lua/doom/modules/comment/packages.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
return {
["comment"] = {
["Comment.nvim"] = {
"numToStr/Comment.nvim",
commit = "90df2f87c0b17193d073d1f72cea2e528e5b162d",
module = "Comment",
},
}
10 changes: 5 additions & 5 deletions lua/doom/modules/core/autocmds.lua
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
local is_plugin_disabled = require("doom.utils").is_plugin_disabled

local autocmds = {
{ "BufWritePost", "*/doom/**/*.lua", require("doom.utils.reloader").full_reload },
{ "BufWritePost", "*/doom/**/*.lua", function() require("doom.utils.reloader").full_reload() end },
{
"BufWritePost",
"*/doom-nvim/modules.lua,*/doom-nvim/config.lua",
require("doom.utils.reloader").full_reload,
function() require("doom.utils.reloader").full_reload() end,
},
}

Expand Down Expand Up @@ -35,17 +35,17 @@ if is_plugin_disabled("explorer") then
table.insert(autocmds, {
"FileType",
"netrw",
require("doom.core.settings.netrw").set_maps,
require("doom.core.netrw").set_maps,
})
table.insert(autocmds, {
"FileType",
"netrw",
require("doom.core.settings.netrw").draw_icons(),
require("doom.core.netrw").draw_icons,
})
table.insert(autocmds, {
"TextChanged",
"*",
require("doom.core.settings.netrw").draw_icons(),
require("doom.core.netrw").draw_icons,
})
end

Expand Down
3 changes: 1 addition & 2 deletions lua/doom/modules/core/binds.lua
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,13 @@ if not is_plugin_disabled("whichkey") then
("<cmd>e %s<CR>"):format(require("doom.core.config.modules").source),
name = "Edit modules",
},
{ "i", "<cmd>DoomInfo<CR>", name = "Inform config" },
{ "l", "<cmd>DoomConfigsReload<CR>", name = "Reload config" },
{ "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>PackerInstall<CR>", name = "Clean 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" },
Expand Down
3 changes: 0 additions & 3 deletions lua/doom/modules/core/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ required.defaults = {
playground = {
enable = true,
},
tree_docs = {
enable = true,
},
context_commentstring = {
enable = true,
},
Expand Down
11 changes: 9 additions & 2 deletions lua/doom/modules/core/packages.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
local is_plugin_disabled = require("doom.utils").is_plugin_disabled

return {
["packer.nvim"] = {
"wbthomason/packer.nvim",
Expand Down Expand Up @@ -39,13 +41,18 @@ return {
module = "popup",
},
["nest.nvim"] = {
"LuigiPiucco/nest.nvim",
"connorgmeehan/nest.nvim",
branch = "integrations-api",
after = "nvim-mapper",
},
["nvim-mapper"] = {
"lazytanuki/nvim-mapper",
before = "telescope.nvim",
before = is_plugin_disabled("telescope") or "telescope.nvim",
},
["nvim-web-devicons"] = {
"kyazdani42/nvim-web-devicons",
commit = "8df4988ecf8599fc1f8f387bbf2eae790e4c5ffb",
module = "nvim-web-devicons",
},
['nvim-web-devicons'] = {
'kyazdani42/nvim-web-devicons',
Expand Down
6 changes: 3 additions & 3 deletions lua/doom/modules/dashboard/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ dashboard.defaults = {
command = "Telescope marks",
},
d = {
description = { " Open Configuration SPC d c" },
description = { " Open Configuration SPC D c" },
command = "e " .. require("doom.core.config").source,
},
e = {
description = { " Open Modules SPC d m" },
description = { " Open Modules SPC D m" },
command = "e " .. require("doom.core.config.modules").source,
},
f = {
description = { " Open Documentation SPC d d" },
description = { " Open Documentation SPC D d" },
command = [[lua require("doom.core.functions").open_docs()]],
},
},
Expand Down
1 change: 0 additions & 1 deletion lua/doom/modules/editorconfig/packages.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@ return {
["editorconfig-vim"] = {
"editorconfig/editorconfig-vim",
commit = "3078cd10b28904e57d878c0d0dab42aa0a9fdc89",
opt = true,
},
}
1 change: 0 additions & 1 deletion lua/doom/modules/explorer/packages.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ return {
["nvim-tree.lua"] = {
"kyazdani42/nvim-tree.lua",
commit = "5d8453dfbd34ab00cb3e8ce39660f9a54cdd35f3",
requires = "nvim-web-devicons",
cmd = {
"NvimTreeClipboard",
"NvimTreeClose",
Expand Down
10 changes: 5 additions & 5 deletions lua/doom/modules/lsp/packages.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
local is_plugin_disabled = require("doom.utils").is_plugin_disabled

return {
["nvim-lspconfig"] = {
"neovim/nvim-lspconfig",
Expand All @@ -13,7 +15,7 @@ return {
["nvim-cmp"] = {
"hrsh7th/nvim-cmp",
commit = "2e4270d02843d15510b3549354e238788ca07ca5",
after = "LuaSnip",
after = is_plugin_disabled("snippets") or "LuaSnip",
},
["cmp-nvim-lua"] = {
"hrsh7th/cmp-nvim-lua",
Expand All @@ -38,10 +40,8 @@ return {
["cmp_luasnip"] = {
"saadparwaiz1/cmp_luasnip",
commit = "16832bb50e760223a403ffa3042859845dd9ef9d",
after = {
"nvim-cmp",
"LuaSnip",
},
after = "nvim-cmp",
disabled = is_plugin_disabled("snippets"),
},
["lsp_signature.nvim"] = {
"ray-x/lsp_signature.nvim",
Expand Down
4 changes: 2 additions & 2 deletions lua/doom/modules/lua/autocmds.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local autocmds = {
{
"BufNewFile,BufRead",
"*.lua",
"FileType",
"lua",
function()
dofile(vim.api.nvim_get_runtime_file("*/doom/modules/lua/config.lua", false)[1])
end,
Expand Down
Loading

0 comments on commit fbb6360

Please sign in to comment.