Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor extras #9

Merged
merged 11 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
docs: adding comments of LazyVim integration
refactor: add shell.lua to extras, move bash plugins/integrations there
  • Loading branch information
wochap committed Nov 17, 2023
commit 6a54bb7518126c2d624da96dc451f86f58a7124e
41 changes: 18 additions & 23 deletions lua/custom/custom-plugins/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -365,15 +365,24 @@ local plugins = {
},

-- LSP, pull config from LazyVim
-- https://www.lazyvim.org/plugins/lsp
-- the following opts for nvim-lspconfig are managed by LazyVim:
-- diagnostics, inlay_hints, capabilities, format, servers and setup
-- LazyVim adds keymaps to buffers with LSP clients attached
-- LazyVim installs any LSP server with Mason
-- LazyVim installs neoconf
-- NvChad lspconfig keymaps are ignored
{ "LazyVim/LazyVim", version = false },
{ import = "custom.custom-plugins.external.lazyvim_plugins_lsp" },
{ "folke/neodev.nvim", enabled = false }, -- disable neodev.nvim added by LazyVim
{
"neovim/nvim-lspconfig",
event = false,
init = function()
require("custom.custom-plugins.overrides.lspconfig").init()
end,
opts = function(_, opts)
opts.servers = {} -- remove lua_ls added by LazyVim
return vim.tbl_deep_extend("force", opts, require("custom.custom-plugins.overrides.lspconfig").options)
end,
config = function(_, opts)
Expand All @@ -387,6 +396,7 @@ local plugins = {
return {}
end,
opts = function(_, opts)
-- remove stylua and shfmt added by LazyVim
local nvchad_opts = require "plugins.configs.mason"
nvchad_opts.ensure_installed = {}
return nvchad_opts
Expand All @@ -397,47 +407,31 @@ local plugins = {
},

-- Formatter, pull config from LazyVim
-- https://www.lazyvim.org/plugins/formatting
{ "LazyVim/LazyVim" },
{ import = "lazyvim.plugins.formatting" },
{
"stevearc/conform.nvim",
dependencies = {
{
"williamboman/mason.nvim",
opts = function(_, opts)
vim.list_extend(opts.ensure_installed, { "shfmt" })
end,
},
},
keys = { { "<leader>cF", false } },
opts = function(_, opts)
opts.formatters_by_ft = {
sh = { "shfmt" },
}
opts.formatters_by_ft = {} -- remove lua, fish and sh added by LazyVim
return opts
end,
keys = { { "<leader>cF", false } },
},

-- Linter, pull config from LazyVim
-- https://www.lazyvim.org/plugins/linting
-- the following opts for nvim-lint are managed by LazyVim:
-- linters
{ import = "lazyvim.plugins.linting" },
{
"mfussenegger/nvim-lint",
event = false,
init = function()
require("core.utils").lazy_load "nvim-lint"
end,
dependencies = {
{
"williamboman/mason.nvim",
opts = function(_, opts)
vim.list_extend(opts.ensure_installed, { "shellcheck" })
end,
},
},
opts = function(_, opts)
opts.linters_by_ft = {
sh = { "shellcheck" },
}
opts.linters_by_ft = {} -- remove fish added by LazyVim
return opts
end,
},
Expand Down Expand Up @@ -507,6 +501,7 @@ local plugins = {
{ import = "custom.extras-lang.nix" },
{ import = "custom.extras-lang.python" },
{ import = "custom.extras-lang.web" },
{ import = "custom.extras-lang.shell" },
{ import = "lazyvim.plugins.extras.lang.json" },
{ import = "lazyvim.plugins.extras.lang.yaml" },
}
Expand Down
4 changes: 0 additions & 4 deletions lua/custom/custom-plugins/overrides/lspconfig.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ M.init = function()
end

M.options = {
servers = {
bashls = {},
},
diagnostics = {
signs = false,
virtual_text = false,
Expand Down Expand Up @@ -106,7 +103,6 @@ M.options = {
},
},
},
-- TODO: remove lua_ls
}

M.setup = function(_, opts)
Expand Down
1 change: 0 additions & 1 deletion lua/custom/custom-plugins/overrides/treesitter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ M.options = {
},

ensure_installed = {
"bash",
"dap_repl",
"git_config",
"markdown",
Expand Down
6 changes: 5 additions & 1 deletion lua/custom/extras-lang/lua.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ local plugins = {
"neovim/nvim-lspconfig",
optional = true,
dependencies = {
{ "folke/neodev.nvim", opts = {} },
{
"folke/neodev.nvim",
enabled = true,
opts = {},
},
},
opts = {
servers = {
Expand Down
56 changes: 56 additions & 0 deletions lua/custom/extras-lang/shell.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
local plugins = {
{
"nvim-treesitter/nvim-treesitter",
optional = true,
opts = function(_, opts)
vim.list_extend(opts.ensure_installed, { "bash" })
end,
},

{
"neovim/nvim-lspconfig",
optional = true,
opts = {
servers = {
bashls = {},
},
},
},

{
"stevearc/conform.nvim",
optional = true,
dependencies = {
{
"williamboman/mason.nvim",
opts = function(_, opts)
vim.list_extend(opts.ensure_installed, { "shfmt" })
end,
},
},
opts = {
formatters_by_ft = {
sh = { "shfmt" },
},
},
},

{
"mfussenegger/nvim-lint",
dependencies = {
{
"williamboman/mason.nvim",
opts = function(_, opts)
vim.list_extend(opts.ensure_installed, { "shellcheck" })
end,
},
},
opts = {
linters_by_ft = {
sh = { "shellcheck" },
},
},
},
}

return plugins