nvim: Improve lazy-loading of select plugins

Aerial (on command), test-runners (on python only) and other plugins
are now only loaded when actually required.
This commit is contained in:
Marty Oehme 2023-10-02 19:18:29 +02:00
parent 643deaebec
commit 8b603b8c66
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A
7 changed files with 70 additions and 23 deletions

View file

@ -180,8 +180,6 @@ map("n", "<localleader>q", "gqap", { silent = true, desc = "Format current parag
map("x", "<localleader>q", "gq", { silent = true, desc = "Format {motion}" })
map("n", "<localleader>Q", "vapJgqap", { silent = true, desc = "Unformat then format paragraph" })
map("n", "<localleader>mp", "<Plug>MarkdownPreviewToggle", { desc = "Toggle md preview" })
-- FORMAT code with
-- PLUGIN: formatter.nvim
map("n", "<localleader>f", ":FormatLock<cr>")
@ -205,6 +203,7 @@ map("n", "<leader>ss", ":lua MiniStarter.open()<cr>", { desc = "show startpage"
-- PLUGIN: symbols-outline.nvim
map("n", "<leader>so", "<cmd>AerialToggle<cr>", { silent = true, desc = "toggle symbol outline" })
map("n", "<leader>sn", "<cmd>AerialNavToggle<cr>", { silent = true, desc = "toggle symbol navigator" })
-- PLUGIN: nvim-tree
map("n", "<leader>se", "<cmd>NvimTreeToggle<cr>", { silent = true, desc = "toggle filetree" })
@ -255,13 +254,11 @@ map("v", "<localleader>nf", ":ZkMatch<cr>", { desc = "find note from selection"
-- PLUGIN: toggleterm.nvim
-- create a lazygit or python window, set up in toggleterm settings
-- TODO create ability to go into python environment when in poetry venv and/or euporie/jupyter notebook
if is_available("nvim-toggleterm.lua") then
map("n", "<leader>G", ":Lazygit<cr>")
map("n", "<leader>tg", ":Lazygit<cr>")
map("n", "<leader>tG", ":Lazygit!<cr>")
map("n", "<leader>tp", ":Pythonterm<cr>")
map("n", "<leader>tP", ":Pythonterm!<cr>")
end
prefix({ ["<localleader>t"] = { name = "+term" } })
map("n", "<leader>tg", ":Lazygit<cr>")
map("n", "<leader>tG", ":Lazygit!<cr>")
map("n", "<leader>tp", ":Pythonterm<cr>")
map("n", "<leader>tP", ":Pythonterm!<cr>")
prefix({ ["<localleader>s"] = { name = "+set" } })
-- PLUGIN: wrapping.nvim
@ -281,10 +278,3 @@ map(
)
map("n", "<leader>sa", "<cmd>FormatOnSave<cr>", { silent = true, desc = "toggle format on save" })
-- PLUGIN: undotree
if is_available("undotree") then
map("n", "<leader>su", function()
require("undotree").toggle()
end, { silent = true, desc = "toggle undotree" })
end

View file

@ -33,7 +33,6 @@ return {
config = function()
require("plugins.config.toggleterm")
end,
lazy = false,
cmd = { "ToggleTerm", "TermExec", "Lazygit", "Pythonterm" },
},
-- colorschemes
@ -43,4 +42,10 @@ return {
priority = 1000,
dependencies = { "rktjmp/fwatch.nvim" },
},
-- try to avoid putting files in util buffers, e.g. filetree, aerial, undotree, ..
{
'stevearc/stickybuf.nvim',
config = true,
}
}

View file

@ -55,4 +55,27 @@ return {
ft = { "quarto", "python" },
lazy = false,
},
-- MARKDOWN ONLY
-- Evaluate markdown code blocks
{
"jubnzv/mdeval.nvim",
cmd = {
"MdEval",
},
ft = { "markdown" },
opts = {
require_confirmation = false,
eval_options = {},
},
lazy = false,
},
{
"AckslD/nvim-FeMaco.lua",
cmd = {
"FeMaco"
},
ft = { "markdown" },
config = true
}
}

View file

@ -47,6 +47,6 @@ return {
},
})
end,
event = "VeryLazy",
event = "InsertEnter",
},
}

View file

@ -8,7 +8,20 @@ return {
"nvim-treesitter/nvim-treesitter",
"nvim-tree/nvim-web-devicons",
},
event = "VeryLazy",
cmd = {
"AerialToggle",
"AerialOpen",
"AerialOpenAll",
"AerialClose",
"AerialCloseAll",
"AerialNext",
"AerialPrev",
"AerialGo",
"AerialInfo",
"AerialNavToggle",
"AerialNavOpen",
"AerialNavClose",
},
opts = {
backends = { "treesitter", "lsp", "markdown", "man" },
},
@ -103,7 +116,7 @@ return {
require("neotest").setup({
adapters = {
require("neotest-python")({
-- with coverage requires coverage.py and pytest-cov installed
-- with coverage requires coverage.py and pytest-cov installed
args = { "--cov" },
}),
},
@ -113,6 +126,7 @@ return {
wk.register({ ["<localleader>t"] = { name = "+test" } })
end
end,
ft = { "python" },
keys = {
{
"<leader>st",
@ -179,9 +193,10 @@ return {
},
config = function()
require("coverage").setup({
lang = { python = { coverage_command = "poetry run coverage json -q -o -" } } ,
lang = { python = { coverage_command = "poetry run coverage json -q -o -" } },
})
end,
ft = { "python" },
cmd = {
"Coverage",
"CoverageLoad",
@ -211,6 +226,6 @@ return {
desc = "show coverage summary",
silent = true,
},
}
},
},
}

View file

@ -55,6 +55,16 @@ return {
dependencies = {
"nvim-lua/plenary.nvim",
},
config = true, event = "VeryLazy",
config = true,
keys = {
{
"<leader>su",
function()
require("undotree").toggle()
end,
desc = "toggle undotree",
silent = true,
},
},
},
}

View file

@ -186,3 +186,7 @@ Gitea
caramelization
Maillard
individualities
vaccilation
SSCM
GSCM
multicriteria