nvim: Integrate null_ls for formatting and linting

Formatting and linting should from now be done with null_ls instead
of formatter.nvim (and nothing for linting so far).

This will still take a little to fully transition, for now we use
null_ls for eslint linting and prettier formatting for a variety
of javascript/typescript and astro files.

null_ls uses Mason installations under the hood and any tool it
uses also gets installed by Mason.
This commit is contained in:
Marty Oehme 2023-06-15 09:46:38 +02:00
parent 3a709bb450
commit 41968e1361
Signed by: Marty
GPG Key ID: EDBF2ED917B2EF6A
4 changed files with 333 additions and 300 deletions

View File

@ -24,25 +24,25 @@
"dressing.nvim": { "branch": "master", "commit": "f16d7586fcdd8b2e3850d0abb7e46f944125cc25" },
"easyread.nvim": { "branch": "main", "commit": "0b07e315a4cd7d700c4a794bdddbec79fdc2628b" },
"fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" },
"formatter.nvim": { "branch": "master", "commit": "fa4f2729cc2909db599169f22d8e55632d4c8d59" },
"friendly-snippets": { "branch": "main", "commit": "b471f5419155ce832eff71ad8920ea8cfbd54840" },
"fwatch.nvim": { "branch": "main", "commit": "a691f7349dc66285cd75a1a698dd28bca45f2bf8" },
"gitsigns.nvim": { "branch": "main", "commit": "bb808fc7376ed7bac0fbe8f47b83d4bf01738167" },
"jupyter-kernel.nvim": { "branch": "main", "commit": "5b409598033884a3d819e2a3bcd1fe340bc8d783" },
"lazy.nvim": { "branch": "main", "commit": "f145e6f42a56306c5536e9efbfe41f7efbec285d" },
"lightspeed.nvim": { "branch": "main", "commit": "299eefa6a9e2d881f1194587c573dad619fdb96f" },
"lsp-format.nvim": { "branch": "master", "commit": "ca0df5c8544e51517209ea7b86ecc522c98d4f0a" },
"lsp-zero.nvim": { "branch": "v2.x", "commit": "8fda9a849d6ab4196ecf129905764ddefdfb64b5" },
"lsp_signature.nvim": { "branch": "master", "commit": "4665921ff8e30601c7c1328625b3abc1427a6143" },
"lualine.nvim": { "branch": "master", "commit": "05d78e9fd0cdfb4545974a5aa14b1be95a86e9c9" },
"magma-nvim-goose": { "branch": "main", "commit": "5d916c39c1852e09fcd39eab174b8e5bbdb25f8f" },
"markdown-preview.nvim": { "branch": "master", "commit": "9becceee5740b7db6914da87358a183ad11b2049" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "5230617372e656d4a2e1e236e03bf7e7b4b97273" },
"mason-null-ls.nvim": { "branch": "main", "commit": "cfbd83909cbc56e2f07cb3f8a03157e069c5c91c" },
"mason.nvim": { "branch": "main", "commit": "7d7efc738e08fc5bee822857db45cb6103f0b0c1" },
"mini.nvim": { "branch": "main", "commit": "889be69623395ad183ae6f3c21c8efe006350226" },
"nabla.nvim": { "branch": "master", "commit": "8c143ad2b3ab3b8ffbd51e238ccfcbd246452a7e" },
"neural": { "branch": "main", "commit": "155618730b87a67655bdde373ee27bfce8b07ac9" },
"nui.nvim": { "branch": "main", "commit": "7a524120a7a70761b5a65b602fd235a65cb005aa" },
"null-ls.nvim": { "branch": "main", "commit": "a138b14099e9623832027ea12b4631ddd2a49256" },
"nvim-base16": { "branch": "master", "commit": "4f3aa29f49b38edb6db1c52cea57e64ce3de2373" },
"nvim-cmp": { "branch": "main", "commit": "fc0f694af1a742ada77e5b1c91ff405c746f4a26" },
"nvim-colorizer.lua": { "branch": "master", "commit": "dde3084106a70b9a79d48f426f6d6fec6fd203f7" },

View File

@ -1,64 +0,0 @@
-- for each filetype autoformat on save
-- TODO can automatically gather from formatter table keys?
local prettierfmt = {
function()
local set_quotes = "--single-quote"
if vim.bo.filetype == "json" then set_quotes = "--double-quote" end
return {
exe = "prettier",
args = {
"--stdin-filepath", vim.api.nvim_buf_get_name(0), set_quotes
},
stdin = true
}
end
}
local shfmt = {
function() return { exe = "shfmt", args = { "-i 4" }, stdin = true } end
}
local formatters = {
bash = shfmt,
cpp = {
function()
return {
exe = "clang-format",
args = {},
stdin = true,
cwd = vim.fn.expand('%:p:h') -- Run clang-format in cwd of the file.
}
end
},
go = { function() return { exe = "goimports", stdin = true } end },
html = prettierfmt,
javascript = prettierfmt,
json = prettierfmt,
lua = {
function()
return { exe = "lua-format", args = { "--indent-width", 4 }, stdin = true }
end
},
python = { function() return { exe = "black", args = { "-" }, stdin = true } end },
rust = {
function()
return { exe = "rustfmt", args = { "--emit=stdout" }, stdin = true }
end
},
sh = shfmt,
typescript = prettierfmt,
zsh = shfmt
}
require('formatter').setup({ logging = false, filetype = formatters })
-- Format on save:
-- DISABLED FOR NOW, due to messing with git contributions if they
-- do not use a formatter. Instead, formatting with key mapping used.
-- gather filetypes to autocorrect for each activated formatter above
-- for k, _ in pairs(formatters) do
-- vim.api.nvim_create_autocmd({"Filetype " .. k}, {
-- command = "autocmd BufWritePost <buffer> FormatWrite",
-- desc = "Automatically format on write",
-- group = vim.api.nvim_create_augroup('formatonsave', {clear = true})
-- })
-- end

View File

@ -1,234 +1,329 @@
local lsp = require("lsp-zero")
vim.diagnostic.config { virtual_text = true }
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" })
lsp.ensure_installed({
'arduino_language_server',
'bashls',
'beancount',
'clangd',
'dockerls',
'docker_compose_language_service',
'lua_ls',
'pyright',
'ruff_lsp',
'taplo',
'yamlls',
"astro",
"arduino_language_server",
"bashls",
"beancount",
"clangd",
"dockerls",
"docker_compose_language_service",
"lua_ls",
"pyright",
"ruff_lsp",
"taplo",
"yamlls",
"tsserver",
"cssls",
"tailwindcss",
})
lsp.preset({ name = "recommended", set_lsp_keymaps = false })
lsp.on_attach(function(client, bufnr)
require("lsp-format").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 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
if client.server_capabilities.document_formatting then
map(
"n",
"<localleader>lf",
"<cmd>lua vim.lsp.buf.formatting()<CR>",
{ buffer = bufnr, desc = "Format document" }
)
end
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
if client.server_capabilities.document_formatting then
map('n', '<localleader>lf', "<cmd>lua vim.lsp.buf.formatting()<CR>",
{ buffer = bufnr, desc = 'Format document' })
end
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' })
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" }
)
end)
lsp.nvim_workspace()
-- ensure python virtualenv is determined automatically on lsp start
lsp.configure("pyright", {
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
require("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
require('lspconfig').arduino_language_server.setup({
on_new_config = require('arduino').on_new_config
require("lspconfig").arduino_language_server.setup({
on_new_config = require("arduino").on_new_config,
})
require("lspconfig").lua_ls.setup(lsp.nvim_lua_ls())
-- map filetypes (rhs) to individual servers (lhs)
-- most will presumably use null_ls however
local format_servers = {
["null-ls"] = {
"astro",
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"vue",
"css",
"scss",
"less",
"html",
"json",
"jsonc",
"yaml",
"markdown",
"markdown.mdx",
"graphql",
"handlebars",
"python",
"sh",
"zsh",
"bash",
"lua",
"luau",
},
}
lsp.format_on_save({
format_opts = {
async = true,
},
servers = format_servers,
})
lsp.format_mapping("gq", {
format_opts = {
async = false,
},
servers = format_servers,
})
require('lspconfig').lua_ls.setup(lsp.nvim_lua_ls())
lsp.setup()
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,
},
})
local luasnip = require("luasnip")
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
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 = ""
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 = "",
}
local cmp = require 'cmp'
local cmp = require("cmp")
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
},
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' } }
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', '!' } } }
})
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({ { name = "path" } }, {
{ name = "cmdline", option = { ignore_cmds = { "Man", "!" } } },
}),
})

View File

@ -3,18 +3,18 @@ local writing_ft = { "quarto", "pandoc", "markdown", "text", "tex" }
return {
-- essential
{ 'numToStr/Navigator.nvim', branch = "master", config = true }, -- allow seamless navigation between vim buffers and tmux/wezterm splits
{ 'jeffkreeftmeijer/vim-numbertoggle', event = "BufEnter" }, -- toggles numbers to absolute for all buffers but the current which is relative
{ 'ojroques/vim-oscyank', event = "VeryLazy" }, -- yank from *anywhere* (even ssh session) to clipboard, using :OSCYank
{ 'ggandor/lightspeed.nvim', event = "VeryLazy" }, -- jump between letters with improved fFtT quicksearch, mimics sneak
{ 'jeffkreeftmeijer/vim-numbertoggle', event = "BufEnter" }, -- toggles numbers to absolute for all buffers but the current which is relative
{ 'ojroques/vim-oscyank', event = "VeryLazy" }, -- yank from *anywhere* (even ssh session) to clipboard, using :OSCYank
{ 'ggandor/lightspeed.nvim', event = "VeryLazy" }, -- jump between letters with improved fFtT quicksearch, mimics sneak
{
'lewis6991/gitsigns.nvim', -- show vcs changes on left-hand gutter
'lewis6991/gitsigns.nvim', -- show vcs changes on left-hand gutter
config = function() require('plug._gitsigns') end,
event = "BufRead"
}, { "m4xshen/smartcolumn.nvim", config = true }, -- auto-hiding colorcolumn
-- files
{ 'vifm/vifm.vim' }, -- integrate file manager
{ 'vifm/vifm.vim' }, -- integrate file manager
{
'nvim-tree/nvim-tree.lua', -- integrate file tree
'nvim-tree/nvim-tree.lua', -- integrate file tree
config = true,
dependencies = { 'nvim-tree/nvim-web-devicons', config = true },
cmd = "NvimTreeToggle"
@ -24,21 +24,17 @@ return {
event = "BufWinEnter",
dependencies = { 'rktjmp/fwatch.nvim' }
}, {
'NvChad/nvim-colorizer.lua', -- color hex, named colors in the correct preview scheme
'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"
}, {
'mhartington/formatter.nvim', -- auto formatting on save
config = function() require('plug._format') end,
event = "VeryLazy"
}, -- editing
}, -- editing
{ 'kylechui/nvim-surround', version = '*', config = true, event = "VeryLazy" }, -- surround things with other things using ys/cs/ds
{
'monaqa/dial.nvim', -- extend the ^a / ^x possibilities to dates, hex, alphabets, markdown headers
'monaqa/dial.nvim', -- extend the ^a / ^x possibilities to dates, hex, alphabets, markdown headers
config = function()
local augend = require("dial.augend")
require("dial.config").augends:register_group {
@ -54,8 +50,8 @@ return {
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".
word = true, -- if false, "sand" is incremented into "sor", "doctor" into "doctand", etc.
cyclic = true -- "or" is incremented into "and".
},
augend.constant
.new {
@ -68,12 +64,12 @@ return {
end,
event = "VeryLazy"
}, {
'tommcdo/vim-exchange', -- adds exchange operator with cx. common use: cxiw . on 2 words to switch
'tommcdo/vim-exchange', -- adds exchange operator with cx. common use: cxiw . on 2 words to switch
event = "VeryLazy"
}, {
'junegunn/vim-easy-align', -- Align tables and other alignable things
'junegunn/vim-easy-align', -- Align tables and other alignable things
event = "VeryLazy"
}, { 'edKotinsky/Arduino.nvim', ft = 'arduino', config = true }, -- statusline
}, { 'edKotinsky/Arduino.nvim', ft = 'arduino', config = true }, -- statusline
{
'nvim-lualine/lualine.nvim',
requires = { 'nvim-tree/nvim-web-devicons', config = true },
@ -126,22 +122,22 @@ return {
desc = "Inspect object in kernel"
}
}
}, { 'micarmst/vim-spellsync', event = "VeryLazy" }, -- personal dict improvements for git sync
}, { 'micarmst/vim-spellsync', event = "VeryLazy" }, -- personal dict improvements for git sync
{ 'folke/zen-mode.nvim', config = true, event = "VeryLazy" }, -- provide distraction free writing
{ 'folke/twilight.nvim', event = "VeryLazy" }, -- provide even distraction free-er writing (lowlight paragraphs)
{ 'folke/twilight.nvim', event = "VeryLazy" }, -- provide even distraction free-er writing (lowlight paragraphs)
{
'JellyApple102/easyread.nvim',
config = true,
ft = writing_ft,
cmd = 'EasyreadToggle'
}, -- enable 'speed-reading' mode (bionic reading)
{ 'marty-oehme/zettelkasten.nvim', ft = writing_ft, event = "VeryLazy" }, -- simple static markdown linking
}, -- enable 'speed-reading' mode (bionic reading)
{ 'marty-oehme/zettelkasten.nvim', ft = writing_ft, event = "VeryLazy" }, -- simple static markdown linking
{
"iamcco/markdown-preview.nvim", -- generate an auto-updating html preview for md files
"iamcco/markdown-preview.nvim", -- generate an auto-updating html preview for md files
build = function() vim.fn["mkdp#util#install"]() end,
ft = writing_ft
}, -- languages
{ 'euclidianAce/BetterLua.vim', ft = 'lua' }, -- better syntax highlighting for lua
}, -- languages
{ '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
-- REPL work
@ -157,7 +153,7 @@ return {
version = '*',
config = function() require('plug._mini') end
}, {
"akinsho/nvim-toggleterm.lua", -- simpler, programmable and multiple terminal toggling for nvim
"akinsho/nvim-toggleterm.lua", -- simpler, programmable and multiple terminal toggling for nvim
config = function() require('plug._toggleterm') end
},
{
@ -176,7 +172,7 @@ return {
source = { openai = { api_key = vim.env.OPENAI_API_KEY } }
})
end
}, -- treesitter
}, -- treesitter
{
'nvim-treesitter/nvim-treesitter',
build = ':TSUpdate',
@ -190,10 +186,9 @@ return {
{ 'romgrk/nvim-treesitter-context', config = true },
'JoosepAlviste/nvim-ts-context-commentstring'
}
},
{ 'nvim-treesitter/playground', cmd = "TSPlaygroundToggle" }, -- interactively view and query the treesitter tree
}, { 'nvim-treesitter/playground', cmd = "TSPlaygroundToggle" }, -- interactively view and query the treesitter tree
{
'RRethy/nvim-treesitter-textsubjects', -- allows using . and ; to target treesitter branches
'RRethy/nvim-treesitter-textsubjects', -- allows using . and ; to target treesitter branches
config = function()
require 'nvim-treesitter.configs'.setup {
textsubjects = {
@ -210,7 +205,7 @@ return {
-- lsp
"VonHeikemen/lsp-zero.nvim",
dependencies = {
{ "neovim/nvim-lspconfig", branch = "master" },
{ "neovim/nvim-lspconfig", branch = "master" },
"williamboman/mason.nvim", "williamboman/mason-lspconfig.nvim", {
"hrsh7th/nvim-cmp",
branch = "main",
@ -226,13 +221,20 @@ return {
"saadparwaiz1/cmp_luasnip"
}
}, "L3MON4D3/LuaSnip", "rafamadriz/friendly-snippets",
{ "lukas-reineke/lsp-format.nvim", config = true },
{ "j-hui/fidget.nvim", config = true } -- loading animations for some LSP
-- { "lukas-reineke/lsp-format.nvim", config = true },
{ "j-hui/fidget.nvim", config = true }, -- loading animations for some LSP
{
"jay-babu/mason-null-ls.nvim",
event = { "BufReadPre", "BufNewFile" },
dependencies = {
"williamboman/mason.nvim", "jose-elias-alvarez/null-ls.nvim"
},
}
},
config = function() require('plug._lsp') end,
branch = "v2.x"
}, { 'simrat39/symbols-outline.nvim', config = true, event = "VeryLazy" }, -- vista-like outline view for code
{ 'ray-x/lsp_signature.nvim', config = true }, -- UI improvements
}, { 'simrat39/symbols-outline.nvim', config = true, event = "VeryLazy" }, -- vista-like outline view for code
{ 'ray-x/lsp_signature.nvim', config = true }, -- UI improvements
{ 'stevearc/dressing.nvim', config = true }, {
'rcarriga/nvim-notify',
config = function() vim.notify = require("notify") end