nvim: Restructure lua dir

Moved plugins into individual component module files which are
automatically required by lazy.nvim. Should make everything a tiny bit
more modular, or at least prepare the way for true modularity if I ever
have the time on my hands to ensure everything works with missing
modules.

Moved core settings into their own directory (`core`), and created a
`personal` folder which contains functions/plugins I wrote that do not
necessarily have to be their own imported plugin yet.

Finally, extended the utility functions a little, so we can detect if a
plugin exists and change e.g. key maps based on that (once again,
extending modularity a little more). Some simple attempts have been made
at that in the `mappings.lua` file, though it is nowhere near extensive
yet - most keymaps are still set regardless of plugin availability.

However, with this slimmer base to work off of, I feel more confident in
changing future things about this setup a little more ad-hoc without
having as many ripple repercussions as before.
This commit is contained in:
Marty Oehme 2023-06-15 15:45:21 +02:00
parent f343b1a76d
commit f33b4c9c37
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A
38 changed files with 1221 additions and 908 deletions

View file

@ -0,0 +1,142 @@
local luasnip = require("luasnip")
local cmp = require("cmp")
local has_words_before = function()
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
local kind_icons = {
Text = "",
Method = "",
Function = "",
Constructor = "",
Field = "",
Variable = "",
Class = "",
Interface = "",
Module = "",
Property = "",
Unit = "",
Value = "",
Enum = "",
Keyword = "",
Snippet = "",
Color = "",
File = "",
Reference = "",
Folder = "",
EnumMember = "",
Constant = "",
Struct = "",
Event = "",
Operator = "",
TypeParameter = "",
}
cmp.setup({
window = { documentation = cmp.config.window.bordered() },
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
sources = {
{ name = "nvim_lsp" },
{ name = "otter" },
{ name = "luasnip", keyword_length = 2 },
{ name = "pandoc_references" },
{ name = "nvim_lua" },
{
name = "beancount",
option = {
account = vim.env["HOME"] .. "/documents/records/budget/main.beancount", -- TODO implement dynamically
},
},
{ name = "calc" },
{ name = "path" },
{ name = "buffer", keyword_length = 3 },
{ name = "digraphs" },
{ name = "latex_symbols" },
{ name = "spell", keyword_length = 3 },
{ name = "tmux" }, -- { name = 'rg', keyword_length = 5 },
{ name = "vCard" },
},
mapping = cmp.mapping.preset.insert({
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<CR>"] = cmp.mapping({
i = function(fallback)
if cmp.visible() and cmp.get_active_entry() then
cmp.confirm({
behavior = cmp.ConfirmBehavior.Replace,
select = false,
})
else
fallback()
end
end,
s = cmp.mapping.confirm({ select = true }),
c = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace,
select = false,
}), -- disable selection in cmd mode
}),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
-- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable()
-- they way you will only jump inside the snippet region
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
}),
formatting = {
fields = { "kind", "abbr", "menu" },
format = function(entry, vim_item)
-- Kind icons, removing kind text leaving only icon
-- vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind)
vim_item.kind = string.format("%s", kind_icons[vim_item.kind])
-- Source
vim_item.menu = ({
buffer = "[Buf]",
calc = "[Cal]",
digraphs = "[Dig]",
latex_symbols = "[LaTeX]",
luasnip = "[Snip]",
nvim_lsp = "[Lsp]",
nvim_lua = "[Lua]",
pandoc_references = "[Bib]",
spell = "[Spl]",
vCard = "[vCrd]",
})[entry.source.name]
return vim_item
end,
},
})
-- `/` cmdline setup.
cmp.setup.cmdline("/", {
mapping = cmp.mapping.preset.cmdline(),
sources = { { name = "buffer" } },
})
-- `:` cmdline setup.
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({ { name = "path" } }, {
{ name = "cmdline", option = { ignore_cmds = { "Man", "!" } } },
}),
})

View file

@ -0,0 +1,168 @@
vim.diagnostic.config({ virtual_text = true })
vim.fn.sign_define("DiagnosticSignError", { text = "", texthl = "DiagnosticSignError" })
vim.fn.sign_define("DiagnosticSignWarn", { text = "", texthl = "DiagnosticSignWarn" })
vim.fn.sign_define("DiagnosticSignInfo", { text = "", texthl = "DiagnosticSignInfo" })
vim.fn.sign_define("DiagnosticSignHint", { text = "", texthl = "DiagnosticSignHint" })
local lsp = require("lsp-setup")
local servers = {
ansiblels = {},
arduino_language_server = {},
astro = {},
bashls = {},
beancount = {},
clangd = {},
cssls = {},
docker_compose_language_service = {},
dockerls = {},
emmet_ls = {},
gopls = {},
julials = {},
lua_ls = {
settings = {
Lua = {
diagnostics = { globals = { "vim" } },
-- enable when working on neovim stuff. Takes *long* to load
-- workspace = { library = vim.api.nvim_get_runtime_file("", true) },
telemetry = { enable = false },
},
},
},
marksman = {},
pyright = {},
ruff_lsp = {},
tailwindcss = {},
taplo = {},
texlab = {},
tsserver = {},
yamlls = {},
zk = {},
}
local function on_attach(client, bufnr)
local map = vim.keymap.set
map("n", "[d", "<cmd>lua vim.diagnostic.goto_prev()<cr>", { buffer = bufnr, desc = "Previous diagnostic" })
map("n", "]d", "<cmd>lua vim.diagnostic.goto_next()<cr>", { buffer = bufnr, desc = "Next diagnostic" })
map(
"n",
"[e",
"<cmd>lua vim.diagnostic.goto_prev({severity = vim.diagnostic.severity.ERROR})<cr>",
{ buffer = bufnr, desc = "Previous error" }
)
map(
"n",
"]e",
"<cmd>lua vim.diagnostic.goto_next({severity = vim.diagnostic.severity.ERROR})<cr>",
{ buffer = bufnr, desc = "Next error" }
)
local prefix = require("which-key").register
prefix({ ["<localleader>l"] = { name = "+lsp" } })
map("n", "<localleader>li", "<cmd>LspInfo<cr>", { buffer = bufnr, desc = "Lsp Info" })
map(
"n",
"<localleader>ld",
"<cmd>lua vim.diagnostic.open_float()<cr>",
{ buffer = bufnr, desc = "Line diagnostics" }
)
map("n", "<localleader>la", "<cmd>lua vim.lsp.buf.code_action()<cr>", { buffer = bufnr, desc = "Codeactions" })
map("n", "<localleader>ln", "<cmd>lua vim.lsp.buf.rename()<cr>", { buffer = bufnr, desc = "Rename element" })
if vim.fn.exists(":Telescope") then
map("n", "<localleader>lr", "<cmd>Telescope lsp_references<cr>", { buffer = bufnr, desc = "References" })
map("n", "<localleader>lf", "<cmd>Telescope lsp_definitions<cr>", { buffer = bufnr, desc = "Definition" })
map(
"n",
"<localleader>lt",
"<cmd>Telescope lsp_type_definitions<cr>",
{ buffer = bufnr, desc = "Type definition" }
)
map(
"n",
"<localleader>lm",
"<cmd>Telescope lsp_implementations<cr>",
{ buffer = bufnr, desc = "Implementation" }
)
else
map("n", "<localleader>lr", "<cmd>lua vim.lsp.buf.references()<cr>", { buffer = bufnr, desc = "References" })
map("n", "<localleader>lf", "<cmd>lua vim.lsp.buf.definition()<cr>", { buffer = bufnr, desc = "Definition" })
map(
"n",
"<localleader>lt",
"<cmd>lua vim.lsp.buf.type_definition()<cr>",
{ buffer = bufnr, desc = "Type definition" }
)
map(
"n",
"<localleader>lm",
"<cmd>lua vim.lsp.buf.implementation()<cr>",
{ buffer = bufnr, desc = "Implementation" }
)
end
map("n", "<localleader>ll", "<cmd>lua vim.lsp.buf.format()<CR>", { buffer = bufnr, desc = "Format document" })
map("n", "K", "<cmd>lua vim.lsp.buf.hover()<cr>", { buffer = bufnr, desc = "Hover definition" })
map("n", "<localleader>lc", "<cmd>lua vim.lsp.buf.declaration()<cr>", { buffer = bufnr, desc = "Declaration" })
map(
"n",
"<localleader>ls",
"<cmd>lua vim.lsp.buf.signature_help()<cr>",
{ buffer = bufnr, desc = "Signature help" }
)
if vim.g.format_on_save then
require("lsp-setup.utils").format_on_save(client)
end
end
lsp.setup({
default_mappings = false,
servers = servers,
on_attach = on_attach,
inlay_hints = {
enabled = vim.fn.has("nvim-0.10") == true and true or false,
},
})
local lspconfig = require("lspconfig")
-- ensure python virtualenv is determined automatically on lsp start
lspconfig.pyright.setup({
on_attach = function(client, _)
local python_path, msg = require("util.pyenv").get_path(client.config.root_dir)
vim.notify(string.format("%s\n%s", msg, python_path))
client.config.settings.python.pythonPath = python_path
end,
})
-- set up arduino with the help of arduino.nvim plugin
if require("util").is_available("arduino") then
lspconfig.arduino_language_server.setup({
on_new_config = require("arduino").on_new_config,
})
end
local null_ls = require("null-ls")
null_ls.setup({})
require("mason-null-ls").setup({
ensure_installed = { "black", "prettier", "shfmt", "eslint-lsp", "stylua", "jq" },
automatic_installation = false,
handlers = {
shfmt = function(_, _)
null_ls.register(null_ls.builtins.formatting.shfmt.with({
extra_filetypes = { "bash", "zsh" },
}))
end,
prettier = function(_, _)
null_ls.register(null_ls.builtins.formatting.prettier.with({
extra_filetypes = { "astro" },
}))
end,
eslint = function(_, _)
null_ls.register(null_ls.builtins.diagnostics.eslint.with({
extra_filetypes = { "astro" },
}))
null_ls.register(null_ls.builtins.code_actions.eslint.with({
extra_filetypes = { "astro" },
}))
end,
},
})

View file

@ -0,0 +1,28 @@
require("lualine").setup({
options = {
icons_enabled = true,
theme = "auto",
component_separators = { left = "", right = "" },
section_separators = { left = "", right = "" },
disabled_filetypes = {},
always_divide_middle = true,
},
sections = {
lualine_a = { "mode" },
lualine_b = { "branch", "diff", "diagnostics" },
lualine_c = { "filename" },
lualine_x = { "encoding", "fileformat", "filetype" },
lualine_y = { "progress", "location" },
lualine_z = { "hostname" },
},
inactive_sections = {
lualine_a = {},
lualine_b = { "branch", "diff" },
lualine_c = { "filename" },
lualine_x = {},
lualine_y = { "location" },
lualine_z = {},
},
tabline = {},
extensions = { "quickfix", "toggleterm" },
})

View file

@ -0,0 +1,38 @@
require("mini.ai").setup()
require("mini.comment").setup({
hooks = {
pre = function()
require("ts_context_commentstring.internal").update_commentstring()
end,
},
})
require("mini.cursorword").setup({ delay = 500 })
require("mini.fuzzy").setup()
require("mini.indentscope").setup({
symbol = "",
draw = { animation = require("mini.indentscope").gen_animation.none() },
options = { indent_at_cursor = false },
})
require("mini.map").setup()
require("mini.move").setup() -- has not hit stable yet
require("mini.pairs").setup()
require("mini.trailspace").setup()
local starter = require("mini.starter")
starter.setup({
evaluate_single = true,
items = {
starter.sections.builtin_actions(),
starter.sections.recent_files(10, false),
starter.sections.recent_files(10, true),
-- Use this if you set up 'mini.sessions'
starter.sections.telescope(),
},
content_hooks = {
starter.gen_hook.adding_bullet(),
starter.gen_hook.padding(3, 2),
starter.gen_hook.aligning("center", "center"),
},
})
vim.api.nvim_set_hl(0, "MiniCursorword", { bold = true })

View file

@ -0,0 +1,55 @@
require("toggleterm").setup({
open_mapping = [[<leader>=]],
insert_mappings = false, -- don't map the key in insert mode
})
local Terminal = require("toggleterm.terminal").Terminal
-- need to disable indentlines since they obscure first line of terminal
if require("util").is_available("mini.nvim") then
vim.api.nvim_create_autocmd({ "TermOpen" }, {
pattern = "*",
callback = function()
vim.b.miniindentscope_disable = true
end,
})
end
-- create a lazygit window with the lazygit command
local lazygit = Terminal:new({
cmd = "lazygit",
hidden = true,
direction = "float",
float_opts = { border = "curved" },
})
function _Lazygit_toggle()
lazygit:toggle()
end
-- create python window
local function get_python_cmd()
if vim.fn.executable("ptipython") then
return "ptipython"
end
if vim.fn.executable("ipython") then
return "ipython"
end
if vim.fn.executable("ptpython") then
return "ptpython"
end
if vim.fn.executable("python") then
return "python"
end
end
local pythonterm = Terminal:new({
cmd = get_python_cmd(),
hidden = true,
direction = "float",
float_opts = { border = "curved" },
})
function _Pythonterm_toggle()
pythonterm:toggle()
end
vim.cmd([[command! Lazygit :lua _Lazygit_toggle()<cr>]])
vim.cmd([[command! Pythonterm :lua _Pythonterm_toggle()<cr>]])

View file

@ -0,0 +1,46 @@
return {
-- allow seamless navigation between vim buffers and tmux/wezterm splits
{
"numToStr/Navigator.nvim",
branch = "master",
config = true,
event = "VeryLazy",
},
-- jump between letters with improved fFtT quicksearch, mimics sneak
{ "ggandor/lightspeed.nvim", event = "VeryLazy" },
-- yank from *anywhere* (even ssh session) to clipboard, using :OSCYank
{ "ojroques/vim-oscyank", event = "VeryLazy" },
-- personal dict improvements for git sync
{ "micarmst/vim-spellsync", event = "VeryLazy" },
{
"folke/which-key.nvim",
config = true,
event = "VeryLazy",
},
-- collection of plugins
{
"echasnovski/mini.nvim",
version = "*",
config = function()
require("plugins.config.mini")
end,
event = "VimEnter", -- need to load pretty soon for Starter screen
},
-- simpler, programmable and multiple terminal toggling for nvim
{
"akinsho/nvim-toggleterm.lua",
config = function()
require("plugins.config.toggleterm")
end,
lazy = false,
cmd = { "ToggleTerm", "TermExec", "Lazygit", "Pythonterm" },
},
-- colorschemes
{
"RRethy/nvim-base16",
lazy = false,
priority = 1000,
dependencies = { "rktjmp/fwatch.nvim" },
},
}

View file

@ -0,0 +1,55 @@
return {
{
"quarto-dev/quarto-nvim",
dependencies = {
"jmbuhr/otter.nvim",
"neovim/nvim-lspconfig",
"vim-pandoc/vim-pandoc-syntax",
"hrsh7th/nvim-cmp",
"nvim-treesitter/nvim-treesitter",
},
config = function()
require("quarto").setup({
lspFeatures = {
enabled = true,
languages = { "r", "python", "julia" },
diagnostics = { enabled = true, triggers = { "BufWrite" } },
completion = { enabled = true },
},
})
end,
ft = "quarto",
},
{
"lkhphuc/jupyter-kernel.nvim",
config = true,
cmd = "JupyterAttach",
build = ":UpdateRemotePlugins",
keys = {
{
"<localleader>ck",
"<Cmd>JupyterInspect<CR>",
desc = "Inspect object in kernel",
},
},
},
-- REPL work
{
"WhiteBlackGoose/magma-nvim-goose",
build = ":UpdateRemotePlugins",
config = function()
vim.g.magma_image_provider = "kitty"
vim.g.magma_automatically_open_output = false
end,
cmd = {
"MagmaInit",
"MagmaEvaluateOperator",
"MagmaEvaluateLine",
"MagmaEvaluateVisual",
"MagmaRestart",
},
ft = { "quarto", "python" },
},
}

View file

@ -0,0 +1,52 @@
return {
-- adds exchange operator with cx. common use: cxiw . on 2 words to switch
{
"tommcdo/vim-exchange",
event = "VeryLazy",
},
-- Align tables and other alignable things
{
"junegunn/vim-easy-align",
event = "VeryLazy",
},
-- surround things with other things using ys/cs/ds
{ "kylechui/nvim-surround", version = "*", config = true, event = "VeryLazy" },
-- extend the ^a / ^x possibilities to dates, hex, alphabets, markdown headers
{
"monaqa/dial.nvim",
config = function()
local augend = require("dial.augend")
require("dial.config").augends:register_group({
-- default augends used when no group name is specified
default = {
augend.integer.alias.decimal,
augend.integer.alias.hex,
augend.date.alias["%Y/%m/%d"],
augend.date.alias["%Y-%m-%d"],
augend.date.alias["%m/%d"],
augend.date.alias["%H:%M:%S"],
augend.date.alias["%H:%M"],
augend.constant.alias.de_weekday_full,
augend.constant.alias.de_weekday,
augend.constant.alias.bool,
augend.semver.alias.semver,
augend.constant.alias.Alpha,
augend.constant.alias.alpha,
augend.hexcolor.new({ case = "lower" }),
augend.constant.new({
elements = { "and", "or" },
word = true, -- if false, "sand" is incremented into "sor", "doctor" into "doctand", etc.
cyclic = true, -- "or" is incremented into "and".
}),
augend.constant.new({
elements = { "&&", "||" },
word = false,
cyclic = true,
}),
},
})
end,
event = "VeryLazy",
},
}

View file

@ -0,0 +1,18 @@
return {
{
"vifm/vifm.vim",
config = function()
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
vim.g.vifm_replace_netrw = 1
vim.g.vifm_exec_args = '-c "set vifminfo=" -c "set statusline=" -c "only"'
end,
cmd = "Vifm",
}, -- integrate file manager
{
"nvim-tree/nvim-tree.lua", -- integrate file tree
config = true,
dependencies = { "nvim-tree/nvim-web-devicons", config = true },
cmd = "NvimTreeToggle",
},
}

View file

@ -0,0 +1,64 @@
return {
{
"lewis6991/gitsigns.nvim", -- show vcs changes on left-hand gutter
event = "VeryLazy",
config = function()
require("gitsigns").setup({
numhl = true,
signcolumn = false,
on_attach = function(bufnr)
local gs = package.loaded.gitsigns
local function map(mode, l, r, opts)
opts = opts or {}
opts.buffer = bufnr
vim.keymap.set(mode, l, r, opts)
end
-- Navigation
map("n", "]h", function()
if vim.wo.diff then
return "]h"
end
vim.schedule(function()
gs.next_hunk()
end)
return "<Ignore>"
end, { expr = true })
map("n", "[h", function()
if vim.wo.diff then
return "[h"
end
vim.schedule(function()
gs.prev_hunk()
end)
return "<Ignore>"
end, { expr = true })
-- Actions
require("which-key").register({ ["<localleader>h"] = { name = "+git" } })
map({ "n", "v" }, "<localleader>hs", ":Gitsigns stage_hunk<CR>", { desc = "stage hunk" })
map({ "n", "v" }, "<localleader>hr", ":Gitsigns reset_hunk<CR>", { desc = "reset hunk" })
map("n", "<localleader>hS", gs.stage_buffer, { desc = "stage buffer" })
map("n", "<localleader>hu", gs.undo_stage_hunk, { desc = "undo stage hunk" })
map("n", "<localleader>hR", gs.reset_buffer, { desc = "reset buffer" })
map("n", "<localleader>hp", gs.preview_hunk, { desc = "preview hunk" })
map("n", "<localleader>hb", function()
gs.blame_line({ full = true })
end, { desc = "blame line" })
map("n", "<localleader>hB", gs.toggle_current_line_blame, { desc = "toggle blame" })
map("n", "<localleader>hd", gs.diffthis, { desc = "diffthis" })
map("n", "<localleader>hD", function()
gs.diffthis("~")
end, { desc = "diffbase" })
map("n", "<localleader>ht", gs.toggle_deleted, { desc = "toggle deleted" })
-- Text object
map({ "o", "x" }, "ih", ":<C-U>Gitsigns select_hunk<CR>")
map({ "o", "x" }, "ah", ":<C-U>Gitsigns select_hunk<CR>")
end,
})
end,
},
}

View file

@ -0,0 +1,73 @@
return {
-- vista-like outline view for code
{ "simrat39/symbols-outline.nvim", config = true, cmd = "SymbolsOutline" },
-- show a signature whenever editing a function or similar
{ "ray-x/lsp_signature.nvim", config = true, event = "VeryLazy" },
{
"junnplus/lsp-setup.nvim",
dependencies = {
"neovim/nvim-lspconfig",
{
"williamboman/mason.nvim",
cmd = {
"Mason",
"MasonInstall",
"MasonUninstall",
"MasonUninstallAll",
"MasonLog",
"MasonUpdate",
},
build = ":MasonUpdate",
},
{
"williamboman/mason-lspconfig.nvim",
cmd = { "LspInstall", "LspUninstall" },
},
{
"jose-elias-alvarez/null-ls.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
"jay-babu/mason-null-ls.nvim",
},
event = "VeryLazy",
},
},
event = "BufReadPost",
config = function()
require("plugins.config.lsp")
end,
},
{
"hrsh7th/nvim-cmp",
branch = "main",
dependencies = {
"andersevenrud/cmp-tmux",
"cbarrete/completion-vcard",
"f3fora/cmp-spell",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-path",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-calc",
"hrsh7th/cmp-cmdline",
"hrsh7th/cmp-nvim-lua",
"dmitmel/cmp-digraphs",
"jc-doyle/cmp-pandoc-references",
"kdheepak/cmp-latex-symbols",
"lukas-reineke/cmp-rg",
"crispgm/cmp-beancount",
"ray-x/cmp-treesitter",
"saadparwaiz1/cmp_luasnip",
{
"L3MON4D3/LuaSnip",
dependencies = { "rafamadriz/friendly-snippets" },
},
},
config = function()
require("plugins.config.cmp")
end,
event = { "InsertEnter", "CmdlineEnter", "VeryLazy" },
},
-- loading animations for some LSP
{ "j-hui/fidget.nvim", config = true, tag = "legacy", event = "VeryLazy" },
-- a pretend-lsp for formatters and linters
}

View file

@ -0,0 +1,5 @@
return {
{ "edKotinsky/Arduino.nvim", ft = "arduino", config = true }, -- statusline
{ "euclidianAce/BetterLua.vim", ft = "lua" }, -- better syntax highlighting for lua
{ "aliou/bats.vim", ft = { "bash", "sh", "zsh", "bats" } }, -- enable syntax for bats shell-code testing library
}

View file

@ -0,0 +1,56 @@
local writing_ft = { "quarto", "pandoc", "markdown", "text", "tex" }
return {
-- UI improvements
-- provide distraction free writing
{ "folke/zen-mode.nvim", config = true, event = "VeryLazy" },
-- provide even distraction free-er writing (lowlight paragraphs)
{ "folke/twilight.nvim", event = "VeryLazy" },
-- enable 'speed-reading' mode (bionic reading)
{
"JellyApple102/easyread.nvim",
config = true,
ft = writing_ft,
cmd = "EasyreadToggle",
},
{
"andrewferrier/wrapping.nvim",
config = function()
require("wrapping").setup({
create_keymappings = false,
notify_on_switch = false,
})
end,
},
-- generate an auto-updating html preview for md files
{
"iamcco/markdown-preview.nvim",
build = function()
vim.fn["mkdp#util#install"]()
end,
ft = writing_ft,
},
-- bring zettelkasten commands
{
"mickael-menu/zk-nvim",
config = function()
require("zk").setup({ picker = "telescope" })
end,
},
-- simple static markdown linking and link following using zettel IDs
{ "marty-oehme/zettelkasten.nvim", ft = writing_ft, event = "VeryLazy" },
-- syntax highlighting for markdown criticmarkup (comments, additions, ...)
{ "vim-pandoc/vim-criticmarkup", ft = writing_ft },
-- inline display of latex formulas
-- TODO always demands latex treesitter to be installed even if it is
-- TODO always turns softwrapped lines off on exiting insert mode
--{
--"jbyuki/nabla.nvim",
--ft = writing_ft,
--config = function()
--require("nabla").enable_virt({ autogen = true, silent = true })
--end,
--},
}

View file

@ -0,0 +1,77 @@
return {
-- fuzzy matching
{
"nvim-telescope/telescope.nvim",
dependencies = {
"nvim-lua/popup.nvim",
"nvim-lua/plenary.nvim",
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
},
event = "VeryLazy",
cmd = "Telescope",
config = function()
-- Setup up telescope fuzzy finding settings
--
-- Makes use of optionally installed external programs to work fully:
-- rg (ripgrep) for in-text searches
-- fd for quicker directory structure searches
-- lsp for a variety of lsp queries
require("telescope").setup({
defaults = {
vimgrep_arguments = {
"rg",
"--ignore-vcs",
"--hidden",
"--color=never",
"--no-heading",
"--with-filename",
"--line-number",
"--column",
"--smart-case",
},
generic_sorter = require("mini.fuzzy").get_telescope_sorter,
-- Appearance
prompt_prefix = "",
selection_caret = "󰳟 ",
color_devicons = true,
},
pickers = {
buffers = { theme = "ivy" },
oldfiles = { theme = "ivy" },
find_files = {
theme = "dropdown",
-- nice minimal picker design
borderchars = {
{ "", "", "", "", "", "", "", "" },
prompt = { "", "", " ", "", "", "", "", "" },
results = {
"",
"",
"",
"",
"",
"",
"",
"",
},
preview = {
"",
"",
"",
"",
"",
"",
"",
"",
},
},
width = 0.8,
previewer = false,
prompt_title = false,
},
},
})
require("telescope").load_extension("fzf")
end,
},
}

View file

@ -0,0 +1,73 @@
return {
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
config = function()
local rainbow = require("ts-rainbow")
require("nvim-treesitter.configs").setup({
-- one of "all", "maintained" (parsers with maintainers), or a list of languages
ensure_installed = "all",
highlight = {
enable = true,
disable = function(_, bufnr)
return vim.api.nvim_buf_line_count(bufnr) > 7000
end,
},
incremental_selection = { enable = true },
textobjects = { enable = true },
indent = { enable = true },
autotag = { enable = true },
-- enable rainbow brackets, needs p00f/nvim-ts-rainbow
rainbow = {
enable = true,
strategy = { rainbow.strategy.global },
},
-- for improved commentstrings, needs corresponding plugin
context_commentstring = {
enable = true,
enable_autocmd = false, -- since we run it as a hook from the mini.comment plugin
},
-- allows using . and ; to target treesitter branches
textsubjects = {
enable = true,
keymaps = {
["."] = "textsubjects-smart",
[";"] = "textsubjects-container-outer",
},
},
})
end,
event = "BufReadPost",
cmd = {
"TSBufDisable",
"TSBufEnable",
"TSBufToggle",
"TSDisable",
"TSEnable",
"TSToggle",
"TSInstall",
"TSInstallInfo",
"TSInstallSync",
"TSModuleInfo",
"TSUninstall",
"TSUpdate",
"TSUpdateSync",
},
-- rainbow brackets using treesitter
-- show current cursor context at top of buffer
-- improves commenting plugin above by using ts
dependencies = {
"https://gitlab.com/HiPhish/nvim-ts-rainbow2.git",
{ "romgrk/nvim-treesitter-context", config = true },
"JoosepAlviste/nvim-ts-context-commentstring",
{
"RRethy/nvim-treesitter-textsubjects",
},
"windwp/nvim-ts-autotag",
},
},
{ "nvim-treesitter/playground", cmd = "TSPlaygroundToggle" }, -- interactively view and query the treesitter tree
}

View file

@ -0,0 +1,53 @@
return {
-- statusline
{
"nvim-lualine/lualine.nvim",
requires = { "nvim-tree/nvim-web-devicons", config = true },
config = function()
require("plugins.config.lualine")
end,
event = "VeryLazy",
},
-- create a pretty pop-up notification
{
"rcarriga/nvim-notify",
config = function()
vim.notify = require("notify")
end,
event = "VeryLazy",
},
-- make all vim.ui interfaces prettyy
{ "stevearc/dressing.nvim", config = true, event = "VeryLazy" },
-- numbers to absolute for all buffers but the current which is relative
{ "jeffkreeftmeijer/vim-numbertoggle", event = "VeryLazy" },
-- auto-hiding colorcolumn
{
"m4xshen/smartcolumn.nvim",
event = "VeryLazy",
opts = {
colorcolumn = { "100" },
scope = "window",
disabled_filetypes = {
"help",
"text",
"markdown",
"NvimTree",
"lazy",
"mason",
"help",
"quarto",
},
},
},
-- display pretty colors when they are mentioned in buffer
{
"NvChad/nvim-colorizer.lua", -- color hex, named colors in the correct preview scheme
config = function()
require("colorizer").setup({
user_default_options = { mode = "virtualtext" },
})
end,
event = "VeryLazy",
},
}