nvim/lua/plugins/init.lua

480 lines
13 KiB
Lua
Raw Normal View History

2023-12-02 18:02:42 +01:00
-- All plugins have lazy=true by default,to load a plugin on startup just lazy=false
-- List of all default plugins & their definitions
local default_plugins = {
"nvim-lua/plenary.nvim",
{
"NvChad/base46",
branch = "v2.0",
build = function()
require("base46").load_all_highlights()
end,
},
{
"NvChad/ui",
branch = "v2.0",
lazy = false,
},
{
"NvChad/nvterm",
init = function()
require("core.utils").load_mappings "nvterm"
end,
config = function(_, opts)
require "base46.term"
require("nvterm").setup(opts)
end,
},
2024-01-02 18:57:10 +01:00
{
"nvim-neorg/neorg",
build = ":Neorg sync-parsers",
dependencies = {"nvim-lua/plenary.nvim"},
config = function()
require("neorg").setup {
load = {
["core.defaults"] = {},
["core.export"] = {
config = { extensions = "all"},
},
["core.export.markdown"] = {
config = { extensions = "all" },
},
["core.concealer"] = {},
["core.dirman"] = {
config = {
workspaces = {
forensik = "~/Documents/Forensik/",
},
},
},
},
}
end,
},
2023-12-02 18:02:42 +01:00
{
"jiaoshijie/undotree",
dependencies = "nvim-lua/plenary.nvim",
config = function()
require('undotree').setup()
end,
keys = {
{ "<leader>u", function() require('undotree').toggle() end, desc="Undotree" },
},
},
2024-02-24 18:11:20 +01:00
{
"jbyuki/nabla.nvim",
2024-02-24 18:18:41 +01:00
config = function ()
require("nabla").enable_virt({
autogen = true,
silent = true,
})
end,
2024-02-24 18:11:20 +01:00
keys = {
{ "<leader>pp", function() require('nabla').popup() end, desc="Nabla" },
}
},
2024-03-03 15:23:02 +01:00
{
"TabbyML/vim-tabby",
config = function ()
vim.g.tabby_keybinding_accept = '<Tab>'
vim.g.tabby_node_binary = '/usr/bin/node'
end,
lazy = false,
cmd = {"Tabby"},
},
2023-12-02 18:02:42 +01:00
{
"NvChad/nvim-colorizer.lua",
init = function()
require("core.utils").lazy_load "nvim-colorizer.lua"
end,
config = function(_, opts)
require("colorizer").setup(opts)
-- execute colorizer as soon as possible
vim.defer_fn(function()
require("colorizer").attach_to_buffer(0)
end, 0)
end,
},
{
"nvim-tree/nvim-web-devicons",
opts = function()
return { override = require "nvchad.icons.devicons" }
end,
config = function(_, opts)
dofile(vim.g.base46_cache .. "devicons")
require("nvim-web-devicons").setup(opts)
end,
},
{
"lukas-reineke/indent-blankline.nvim",
version = "2.20.7",
init = function()
require("core.utils").lazy_load "indent-blankline.nvim"
end,
opts = function()
return require("plugins.configs.others").blankline
end,
config = function(_, opts)
require("core.utils").load_mappings "blankline"
dofile(vim.g.base46_cache .. "blankline")
require("indent_blankline").setup(opts)
end,
},
{
"nvim-treesitter/nvim-treesitter",
init = function()
require("core.utils").lazy_load "nvim-treesitter"
end,
cmd = { "TSInstall", "TSBufEnable", "TSBufDisable", "TSModuleInfo" },
build = ":TSUpdate",
opts = function()
return require "plugins.configs.treesitter"
end,
config = function(_, opts)
dofile(vim.g.base46_cache .. "syntax")
require("nvim-treesitter.configs").setup(opts)
2024-01-02 18:57:10 +01:00
require("neorg").setup {}
2023-12-02 18:02:42 +01:00
end,
2024-01-02 18:57:10 +01:00
run = ":Neorg sync-parsers",
2023-12-02 18:02:42 +01:00
},
-- git stuff
{
"lewis6991/gitsigns.nvim",
ft = { "gitcommit", "diff" },
init = function()
-- load gitsigns only when a git file is opened
vim.api.nvim_create_autocmd({ "BufRead" }, {
group = vim.api.nvim_create_augroup("GitSignsLazyLoad", { clear = true }),
callback = function()
vim.fn.system("git -C " .. '"' .. vim.fn.expand "%:p:h" .. '"' .. " rev-parse")
if vim.v.shell_error == 0 then
vim.api.nvim_del_augroup_by_name "GitSignsLazyLoad"
vim.schedule(function()
require("lazy").load { plugins = { "gitsigns.nvim" } }
end)
end
end,
})
end,
opts = function()
return require("plugins.configs.others").gitsigns
end,
config = function(_, opts)
dofile(vim.g.base46_cache .. "git")
require("gitsigns").setup(opts)
end,
},
-- lsp stuff
{
"williamboman/mason.nvim",
cmd = { "Mason", "MasonInstall", "MasonInstallAll", "MasonUpdate" },
opts = function()
return require "plugins.configs.mason"
end,
config = function(_, opts)
dofile(vim.g.base46_cache .. "mason")
require("mason").setup(opts)
-- custom nvchad cmd to install all mason binaries listed
vim.api.nvim_create_user_command("MasonInstallAll", function()
vim.cmd("MasonInstall " .. table.concat(opts.ensure_installed, " "))
end, {})
vim.g.mason_binaries_list = opts.ensure_installed
end,
},
{
"neovim/nvim-lspconfig",
init = function()
require("core.utils").lazy_load "nvim-lspconfig"
end,
config = function()
require "plugins.configs.lspconfig"
end,
},
-- load luasnips + cmp related in insert mode only
{
"hrsh7th/nvim-cmp",
event = "InsertEnter",
dependencies = {
{
-- snippet plugin
"L3MON4D3/LuaSnip",
dependencies = "rafamadriz/friendly-snippets",
opts = { history = true, updateevents = "TextChanged,TextChangedI" },
config = function(_, opts)
require("plugins.configs.others").luasnip(opts)
end,
},
-- autopairing of (){}[] etc
{
"windwp/nvim-autopairs",
opts = {
fast_wrap = {},
disable_filetype = { "TelescopePrompt", "vim" },
},
config = function(_, opts)
require("nvim-autopairs").setup(opts)
-- setup cmp for autopairs
local cmp_autopairs = require "nvim-autopairs.completion.cmp"
require("cmp").event:on("confirm_done", cmp_autopairs.on_confirm_done())
end,
},
-- cmp sources plugins
{
"saadparwaiz1/cmp_luasnip",
"hrsh7th/cmp-nvim-lua",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
},
},
opts = function()
return require "plugins.configs.cmp"
end,
config = function(_, opts)
require("cmp").setup(opts)
end,
},
{
"mfussenegger/nvim-dap",
dependencies = {
2024-02-21 12:23:07 +01:00
{
"leoluz/nvim-dap-go",
opts = {},
},
2023-12-02 18:02:42 +01:00
-- fancy UI for the debugger
{
"rcarriga/nvim-dap-ui",
-- stylua: ignore
keys = {
{ "<leader>du", function() require("dapui").toggle({ }) end, desc = "Dap UI" },
{ "<leader>de", function() require("dapui").eval() end, desc = "Eval", mode = {"n", "v"} },
},
opts = {},
config = function(_, opts)
-- setup dap config by VsCode launch.json file
-- require("dap.ext.vscode").load_launchjs()
2024-02-21 12:23:07 +01:00
require("dap-go").setup()
2023-12-02 18:02:42 +01:00
local dap = require("dap")
local dapui = require("dapui")
dapui.setup(opts)
dap.listeners.after.event_initialized["dapui_config"] = function()
dapui.open({})
end
dap.listeners.before.event_terminated["dapui_config"] = function()
dapui.close({})
end
dap.listeners.before.event_exited["dapui_config"] = function()
dapui.close({})
end
end,
},
-- virtual text for the debugger
{
"theHamsta/nvim-dap-virtual-text",
opts = {},
},
-- which key integration
{
"folke/which-key.nvim",
optional = true,
opts = {
defaults = {
["<leader>d"] = { name = "+debug" },
["<leader>da"] = { name = "+adapters" },
},
},
},
-- mason.nvim integration
{
"jay-babu/mason-nvim-dap.nvim",
dependencies = "mason.nvim",
cmd = { "DapInstall", "DapUninstall" },
opts = {
-- Makes a best effort to setup the various debuggers with
-- reasonable debug configurations
automatic_installation = true,
-- You can provide additional configuration to the handlers,
-- see mason-nvim-dap README for more information
handlers = {},
-- You'll need to check that you have the required things installed
-- online, please don't ask me how to install them :)
ensure_installed = {
-- Update this to ensure that you have the debuggers for the langs you want
},
},
},
},
-- stylua: ignore
keys = {
{ "<leader>dB", function() require("dap").set_breakpoint(vim.fn.input('Breakpoint condition: ')) end, desc = "Breakpoint Condition" },
{ "<leader>db", function() require("dap").toggle_breakpoint() end, desc = "Toggle Breakpoint" },
{ "<leader>dc", function() require("dap").continue() end, desc = "Continue" },
{ "<leader>dC", function() require("dap").run_to_cursor() end, desc = "Run to Cursor" },
{ "<leader>dg", function() require("dap").goto_() end, desc = "Go to line (no execute)" },
{ "<leader>di", function() require("dap").step_into() end, desc = "Step Into" },
{ "<leader>dj", function() require("dap").down() end, desc = "Down" },
{ "<leader>dk", function() require("dap").up() end, desc = "Up" },
{ "<leader>dl", function() require("dap").run_last() end, desc = "Run Last" },
{ "<leader>do", function() require("dap").step_out() end, desc = "Step Out" },
{ "<leader>dO", function() require("dap").step_over() end, desc = "Step Over" },
{ "<leader>dp", function() require("dap").pause() end, desc = "Pause" },
{ "<leader>dr", function() require("dap").repl.toggle() end, desc = "Toggle REPL" },
{ "<leader>ds", function() require("dap").session() end, desc = "Session" },
{ "<leader>dt", function() require("dap").terminate() end, desc = "Terminate" },
{ "<leader>dw", function() require("dap.ui.widgets").hover() end, desc = "Widgets" },
},
config = function()
vim.api.nvim_set_hl(0, "DapStoppedLine", { default = true, link = "Visual" })
end,
},
{
"rcarriga/nvim-dap-ui",
-- stylua: ignore
keys = {
{ "<leader>du", function() require("dapui").toggle({ }) end, desc = "Dap UI" },
{ "<leader>de", function() require("dapui").eval() end, desc = "Eval", mode = {"n", "v"} },
},
opts = {},
config = function(_, opts)
-- setup dap config by VsCode launch.json file
-- require("dap.ext.vscode").load_launchjs()
local dap = require("dap")
local dapui = require("dapui")
dapui.setup(opts)
dap.listeners.after.event_initialized["dapui_config"] = function()
dapui.open({})
end
dap.listeners.before.event_terminated["dapui_config"] = function()
dapui.close({})
end
dap.listeners.before.event_exited["dapui_config"] = function()
dapui.close({})
end
end,
},
{
"mg979/vim-visual-multi",
lazy = false,
},
{
"Civitasv/cmake-tools.nvim",
opts = {},
event = "BufRead",
},
{
"mikelue/vim-maven-plugin",
},
{
"numToStr/Comment.nvim",
keys = {
{ "gcc", mode = "n", desc = "Comment toggle current line" },
{ "gc", mode = { "n", "o" }, desc = "Comment toggle linewise" },
{ "gc", mode = "x", desc = "Comment toggle linewise (visual)" },
{ "gbc", mode = "n", desc = "Comment toggle current block" },
{ "gb", mode = { "n", "o" }, desc = "Comment toggle blockwise" },
{ "gb", mode = "x", desc = "Comment toggle blockwise (visual)" },
},
init = function()
require("core.utils").load_mappings "comment"
end,
config = function(_, opts)
require("Comment").setup(opts)
end,
},
-- file managing , picker etc
{
"nvim-tree/nvim-tree.lua",
cmd = { "NvimTreeToggle", "NvimTreeFocus" },
init = function()
require("core.utils").load_mappings "nvimtree"
end,
opts = function()
return require "plugins.configs.nvimtree"
end,
config = function(_, opts)
dofile(vim.g.base46_cache .. "nvimtree")
require("nvim-tree").setup(opts)
end,
},
{
"nvim-telescope/telescope.nvim",
dependencies = { "nvim-treesitter/nvim-treesitter", { "nvim-telescope/telescope-fzf-native.nvim", build = "make" } },
cmd = "Telescope",
init = function()
require("core.utils").load_mappings "telescope"
end,
opts = function()
return require "plugins.configs.telescope"
end,
config = function(_, opts)
dofile(vim.g.base46_cache .. "telescope")
local telescope = require "telescope"
telescope.setup(opts)
-- load extensions
for _, ext in ipairs(opts.extensions_list) do
telescope.load_extension(ext)
end
end,
},
-- Only load whichkey after all the gui
{
"folke/which-key.nvim",
keys = { "<leader>", "<c-r>", '"', "'", "`", "c", "v", "g" },
init = function()
require("core.utils").load_mappings "whichkey"
end,
cmd = "WhichKey",
config = function(_, opts)
dofile(vim.g.base46_cache .. "whichkey")
require("which-key").setup(opts)
end,
},
}
local config = require("core.utils").load_config()
if #config.plugins > 0 then
table.insert(default_plugins, { import = config.plugins })
end
require("lazy").setup(default_plugins, config.lazy_nvim)