Files
neovim-configuration/lua/plugins.lua

626 lines
16 KiB
Lua

local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
-- Auto-completion engine
{
'saghen/blink.cmp',
-- optional: provides snippets for the snippet source
dependencies = { 'rafamadriz/friendly-snippets',
{
"L3MON4D3/LuaSnip",
version = "v2.*"
}
},
-- use a release tag to download pre-built binaries
version = '1.*',
-- AND/OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust
-- build = 'cargo build --release',
-- If you use nix, you can build from source using latest nightly rust with:
-- build = 'nix run .#build-plugin',
---@module 'blink.cmp'
---@type blink.cmp.Config
opts = {
-- 'default' (recommended) for mappings similar to built-in completions (C-y to accept)
-- 'super-tab' for mappings similar to vscode (tab to accept)
-- 'enter' for enter to accept
-- 'none' for no mappings
--
-- All presets have the following mappings:
-- C-space: Open menu or open docs if already open
-- C-n/C-p or Up/Down: Select next/previous item
-- C-e: Hide menu
-- C-k: Toggle signature help (if signature.enabled = true)
--
-- See :h blink-cmp-config-keymap for defining your own keymap
keymap = {
preset = 'enter',
['<Up>'] = { 'select_prev', 'fallback' },
['<Down>'] = { 'select_next', 'fallback' },
['<S-Tab>'] = { 'select_prev', 'fallback' },
['<Tab>'] = { 'select_next', 'fallback' },
['<CR>'] = { 'select_and_accept', 'fallback' },
['<C-space>'] = { 'show', 'fallback' },
},
signature = { enabled = true },
appearance = {
-- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
-- Adjusts spacing to ensure icons are aligned
nerd_font_variant = 'mono'
},
-- (Default) Only show the documentation popup when manually triggered
completion = {
documentation = { auto_show = true },
menu = {
-- show more things in the menu
draw = {
columns = {
{ "label", "label_description", gap = 1 },
{ "kind_icon", "kind", gap = 1 },
{ "source_name" },
},
}
},
},
-- Default list of enabled providers defined so that you can extend it
-- elsewhere in your config, without redefining it, due to `opts_extend`
sources = {
default = { 'lsp', 'path', 'snippets', 'buffer' },
},
snippets = { preset = 'luasnip' },
-- (Default) Rust fuzzy matcher for typo resistance and significantly better performance
-- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation,
-- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"`
--
-- See the fuzzy documentation for more information
fuzzy = { implementation = "prefer_rust_with_warning" }
},
opts_extend = { "sources.default" }
},
-- Code snippet engine
{
"L3MON4D3/LuaSnip",
version = "v2.*",
config = function()
require("luasnip.loaders.from_snipmate").lazy_load()
require("luasnip.loaders.from_lua").lazy_load()
end,
},
--
-- LSP manager and others
--
-- "williamboman/mason.nvim",
-- "williamboman/mason-lspconfig.nvim",
"neovim/nvim-lspconfig",
-- Nice plugin to show what LSPs are doing in the background (and others
-- using $/progress and vim.notify())
{
"j-hui/fidget.nvim",
opts = {
-- options
},
},
-- show lsp signature while coding
{
"ray-x/lsp_signature.nvim",
event = "VeryLazy",
opts = {
bind = true,
floating_window = false,
},
},
-- fzf-lua
{
"ibhagwan/fzf-lua",
-- optional for icon support
dependencies = { "nvim-tree/nvim-web-devicons" },
config = true,
},
-- neogit setup
{
"NeogitOrg/neogit",
dependencies = {
"nvim-lua/plenary.nvim", -- required
"sindrets/diffview.nvim", -- optional - Diff integration
-- Only one of these is needed, not both.
-- "nvim-telescope/telescope.nvim", -- optional
"ibhagwan/fzf-lua", -- optional
},
config = function()
require('neogit').setup({
sort_branches = "refname"
})
end
},
-- org-mode
{
'nvim-orgmode/orgmode',
event = 'VeryLazy',
ft = { 'org' },
config = function()
-- Setup orgmode
require('orgmode').setup({
mappings = {
org = {
org_move_subtree_up = { '<Leader>oK', '<C-M-Up>' },
org_move_subtree_down = { '<Leader>oJ', '<C-M-Down>' },
}
},
-- org_agenda_files = '~/orgfiles/**/*',
-- org_default_notes_file = '~/orgfiles/refile.org',
org_agenda_files = '~/Documents/Eigene (Briefe etc.)/org/*.org',
org_default_notes_file = '~/Documents/Eigene (Briefe etc.)/org/refile.org',
org_todo_keywords = { 'TODO(t)', 'STARTED(s)', 'PLANNED(p)', '|', 'DONE(d)', 'UNPLANNED(u)' },
org_custom_exports = {
f = {
label = 'Export to HTML format',
action = function(exporter)
local current_file = vim.api.nvim_buf_get_name(0)
local target = vim.fn.fnamemodify(current_file, ':p:r') .. '.html'
local command = { 'pandoc', '--filter', 'pandoc-plot', current_file, '--standalone', '--toc',
'--number-sections', '--output', target }
local on_success = function(output)
print('Success!')
vim.api.nvim_echo({ { table.concat(output, '\n') } }, true, {})
end
local on_error = function(err)
print('Error!')
vim.api.nvim_echo({ { table.concat(err, '\n'), 'ErrorMsg' } }, true, {})
end
return exporter(command, target, on_success, on_error)
end
}
},
})
-- NOTE: If you are using nvim-treesitter with ~ensure_installed = "all"~ option
-- add ~org~ to ignore_install
-- require('nvim-treesitter.configs').setup({
-- ensure_installed = 'all',
-- ignore_install = { 'org' },
-- })
end,
},
-- org-roam - lets try it out (2025-05-20)
{
"chipsenkbeil/org-roam.nvim",
config = function()
require("org-roam").setup({
directory = "~/Documents/Eigene (Briefe etc.)/org/roam",
-- optional
-- org_files = {
-- "~/another_org_dir",
-- "~/some/folder/*.org",
-- "~/a/single/org_file.org",
-- }
bindings = {
prefix = "<LocalLeader>r"
}
})
end
},
-- comfortable table editing, esp. used in orgmode
{ 'dhruvasagar/vim-table-mode' },
-- which-key
{
"folke/which-key.nvim",
event = "VeryLazy",
opts = {
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
-- preset = 'helix',
-- preset = 'classic',
-- preset = 'modern',
preset = false,
expand = 3,
keys = {
scroll_down = "<c-d>", -- binding to scroll down inside the popup
scroll_up = "<c-u>", -- binding to scroll up inside the popup
},
plugins = {
presets = {
motions = true,
g = true,
}
},
win = {
-- no_overlap = false,
height = { min = 4 },
-- height = { min = 4, max = math.huge },
width = { min = 25, max = 120 },
-- title = true,
-- title_pos = "center",
-- border = "rounded",
col = -1,
row = -1,
padding = { 1, 3 },
},
layout = {
spacing = 2,
-- width = { min = math.huge },
width = { min = 20 },
},
},
keys = {
{
"<leader>?",
function()
require("which-key").show({ global = true })
end,
desc = "Buffer Local Keymaps (which-key)",
},
},
dependencies = { "echasnovski/mini.icons" },
},
-- treesitter
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
config = function()
local configs = require("nvim-treesitter.configs")
configs.setup({
ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "elixir", "heex", "javascript", "html", "diff", "go", "rust", "python" },
sync_install = false,
highlight = { enable = true },
indent = { enable = true },
})
end
},
-- lualine statusline plugin
{
'nvim-lualine/lualine.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons' },
config = function()
require('config.lualine')
end
},
-- neo-tree file management
{
"nvim-neo-tree/neo-tree.nvim",
branch = "v3.x",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
"MunifTanjim/nui.nvim",
-- "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information
},
config = function()
require("neo-tree").setup({
window = {
position = "left",
mappings = {
["<tab>"] = {
"toggle_node",
nowait = false, -- disable `nowait` if you have existing combos starting with this char that you want to use
},
}
}
})
end
},
{
"antosha417/nvim-lsp-file-operations",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-neo-tree/neo-tree.nvim",
},
config = function()
require("lsp-file-operations").setup()
end,
},
-- workspaces, lightweight "projects"
{
"natecraddock/workspaces.nvim",
config = function()
require("workspaces").setup {
-- sort the list of workspaces by name after loading from the workspaces path.
sort = true,
-- sort by recent use rather than by name. requires sort to be true
mru_sort = false,
-- option to automatically activate workspace when opening neovim in a workspace directory
auto_open = false,
-- option to automatically activate workspace when changing directory not via this plugin
auto_dir = true,
hooks = {
open = "FzfLua files"
}
}
end
},
-- calculate using qalc cli, call :QalcAttach or :Qalc
{
"Apeiros-46B/qalc.nvim",
config = function()
require('qalc').setup({
bufname = "Qalculate",
})
end,
},
-- TODO, WARN, HACK, PERF, NOTE, TEST and others highlighting and searching
{
"folke/todo-comments.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
opts = {
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
},
-- highlight word under cursor
{
"dwrdx/mywords.nvim",
},
-- Calendar view
{
"itchyny/calendar.vim"
},
-- Greeter to run on NeoVim startup
{
'goolord/alpha-nvim',
dependencies = {
'nvim-tree/nvim-web-devicons',
},
config = function()
require('config.alpha-nvim')
end,
},
-- improved Rust support
{
'mrcjkb/rustaceanvim',
version = '^6', -- Recommended
lazy = false, -- This plugin is already lazy
},
-- show git changes on the left
{
"lewis6991/gitsigns.nvim",
config = function()
require('gitsigns').setup()
end,
},
-- easy term on a shortcut
{
"akinsho/toggleterm.nvim",
config = true,
keys = {
{
"<C-`>",
":ToggleTerm<CR>",
desc = "Toggle terminal",
},
{
"<C-`>",
"<C-\\><C-n>:ToggleTerm<CR>",
mode = 't',
desc = "Toggle terminal",
},
},
},
-- show indent markers
{
"lukas-reineke/indent-blankline.nvim",
main = "ibl",
---@module "ibl"
---@type ibl.config
opts = {},
},
-- ollama and LLM integration
{
{
"huynle/ogpt.nvim",
event = "VeryLazy",
opts = {
default_provider = "ollama",
edgy = true, -- enable this!
single_window = false, -- set this to true if you want only one OGPT window to appear at a time
providers = {
ollama = {
api_host = os.getenv("OLLAMA_API_HOST") or "http://localhost:11434",
api_key = os.getenv("OLLAMA_API_KEY") or "",
model = "llama3.2-vision:sl",
}
}
},
dependencies = {
"MunifTanjim/nui.nvim",
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope.nvim"
}
},
{
"folke/edgy.nvim",
event = "VeryLazy",
init = function()
vim.opt.laststatus = 3
vim.opt.splitkeep = "screen" -- or "topline" or "screen"
end,
opts = {
exit_when_last = false,
animate = {
enabled = false,
},
wo = {
winbar = true,
winfixwidth = true,
winfixheight = false,
winhighlight = "WinBar:EdgyWinBar,Normal:EdgyNormal",
spell = false,
signcolumn = "no",
},
keys = {
-- -- close window
["q"] = function(win)
win:close()
end,
-- close sidebar
["Q"] = function(win)
win.view.edgebar:close()
end,
-- increase width
["<S-Right>"] = function(win)
win:resize("width", 3)
end,
-- decrease width
["<S-Left>"] = function(win)
win:resize("width", -3)
end,
-- increase height
["<S-Up>"] = function(win)
win:resize("height", 3)
end,
-- decrease height
["<S-Down>"] = function(win)
win:resize("height", -3)
end,
},
right = {
{
title = "OGPT Popup",
ft = "ogpt-popup",
size = { width = 0.2 },
wo = {
wrap = true,
},
},
{
title = "OGPT Parameters",
ft = "ogpt-parameters-window",
size = { height = 6 },
wo = {
wrap = true,
},
},
{
title = "OGPT Template",
ft = "ogpt-template",
size = { height = 6 },
},
{
title = "OGPT Sessions",
ft = "ogpt-sessions",
size = { height = 6 },
wo = {
wrap = true,
},
},
{
title = "OGPT System Input",
ft = "ogpt-system-window",
size = { height = 6 },
},
{
title = "OGPT",
ft = "ogpt-window",
size = { height = 0.5 },
wo = {
wrap = true,
},
},
{
title = "OGPT {{{selection}}}",
ft = "ogpt-selection",
size = { width = 80, height = 4 },
wo = {
wrap = true,
},
},
{
title = "OGPt {{{instruction}}}",
ft = "ogpt-instruction",
size = { width = 80, height = 4 },
wo = {
wrap = true,
},
},
{
title = "OGPT Chat",
ft = "ogpt-input",
size = { width = 80, height = 4 },
wo = {
wrap = true,
},
},
},
},
},
-- improved (wrapping!) diagnostics
{
"rachartier/tiny-inline-diagnostic.nvim",
event = "VeryLazy", -- one of LspAttach, VeryLazy
priority = 1000, -- needs to be loaded in first
config = function()
require('tiny-inline-diagnostic').setup({
options = {
use_icons_from_diagnostic = true,
enable_on_insert = true,
show_all_diags_on_cursorline = true,
multilines = {
enabled = true,
always_show = true,
}
}
})
vim.diagnostic.config({ virtual_text = false }) -- Only if needed in your configuration, if you already have native LSP diagnostics
end
},
-- new plugins here
},
})