nvim: all in on mini.nvim

This commit is contained in:
Daniel Lundin 2024-10-06 23:00:01 +02:00
parent 890ac1e91c
commit aa228521fe
Signed by: dln
SSH key fingerprint: SHA256:dQy1Xj3UiqJYpKR5ggQ2bxgz4jCH8IF+k3AB8o0kmdI
22 changed files with 450 additions and 741 deletions

View file

@ -1,2 +0,0 @@
-- bootstrap lazy.nvim, LazyVim and your plugins
require("config.lazy")

View file

@ -1,16 +0,0 @@
-- Autocmds are automatically loaded on the VeryLazy event
-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua
-- Add any additional autocmds here
local function augroup(name)
return vim.api.nvim_create_augroup("lazyvim_" .. name, { clear = true })
end
-- Set comment string for CUE files
vim.api.nvim_create_autocmd("FileType", {
group = augroup("cue"),
pattern = { "cue" },
callback = function(ev)
vim.bo[ev.buf].commentstring = "// %s"
end,
})

View file

@ -1,19 +0,0 @@
-- Keymaps are automatically loaded on the VeryLazy event
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
-- Add any additional keymaps here
-- C-/ should be comment instead of lazyterm
vim.keymap.del("n", "<c-/>")
vim.keymap.set({ "n" }, "<c-/>", "gcc", { remap = true })
vim.keymap.set({ "v" }, "<c-/>", "gc", { remap = true })
vim.keymap.set({ "n" }, "<Leader><c-/>", "gcgc", { remap = true })
vim.keymap.del({ "n" }, "<c-_>")
vim.keymap.set({ "n" }, "<c-_>", "gcc", { remap = true })
vim.keymap.set({ "v" }, "<c-_>", "gc", { remap = true })
vim.keymap.set({ "n" }, "<Leader><c-_>", "gcgc", { remap = true })
vim.keymap.set("n", "<Tab>", "<Space>,", { remap = true })
vim.keymap.set("n", "zz", "zt", { remap = true })
vim.keymap.set("n", "[d", ":lua vim.diagnostic.goto_prev { float = false }<Enter>", { remap = true })
vim.keymap.set("n", "]d", ":lua vim.diagnostic.goto_next { float = false }<Enter>", { remap = true })

View file

@ -1,60 +0,0 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
-- bootstrap lazy.nvim
-- stylua: ignore
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath })
end
vim.opt.rtp:prepend(vim.env.LAZY or lazypath)
require("lazy").setup({
spec = {
-- add LazyVim and import its plugins
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
-- extras
{ import = "lazyvim.plugins.extras.dap.core" },
{ import = "lazyvim.plugins.extras.editor.overseer" },
{ import = "lazyvim.plugins.extras.editor.telescope" },
{ import = "lazyvim.plugins.extras.formatting.prettier" },
{ import = "lazyvim.plugins.extras.lang.go" },
{ import = "lazyvim.plugins.extras.lang.json" },
{ import = "lazyvim.plugins.extras.lang.markdown" },
{ import = "lazyvim.plugins.extras.lang.nix" },
{ import = "lazyvim.plugins.extras.lang.rust" },
{ import = "lazyvim.plugins.extras.lang.toml" },
{ import = "lazyvim.plugins.extras.lang.typescript" },
{ import = "lazyvim.plugins.extras.lang.yaml" },
{ import = "lazyvim.plugins.extras.lsp.none-ls" },
{ import = "lazyvim.plugins.extras.test.core" },
{ import = "lazyvim.plugins.extras.ui.edgy" },
{ import = "lazyvim.plugins.extras.ui.treesitter-context" },
{ import = "lazyvim.plugins.extras.util.gitui" },
{ import = "lazyvim.plugins.extras.util.project" },
-- plugins
{ import = "plugins" },
},
defaults = {
-- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup.
-- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default.
lazy = false,
-- It's recommended to leave version=false for now, since a lot the plugin that support versioning,
-- have outdated releases, which may break your Neovim install.
version = false, -- always use the latest git commit
-- version = "*", -- try installing the latest stable version for plugins that support semver
},
checker = { enabled = false }, -- automatically check for plugin updates
performance = {
rtp = {
-- disable some rtp plugins
disabled_plugins = {
"gzip",
-- "matchit",
-- "matchparen",
"netrwPlugin",
"tarPlugin",
"tohtml",
"tutor",
"zipPlugin",
},
},
},
})

View file

@ -1,36 +0,0 @@
vim.opt.number = true
vim.opt.relativenumber = false
vim.g.do_filetype_lua = 1
vim.g.root_spec = { { ".git", "lua" }, "lsp", "cwd" }
vim.o.autochdir = true
vim.o.fillchars = "stl: ,stlnc: ,eob:░"
vim.o.list = false
vim.o.scrolloff = 7
vim.o.splitkeep = "screen"
vim.o.updatetime = 500
vim.o.timeout = true
vim.o.timeoutlen = 0
-- additional filetypes
vim.filetype.add({
extension = {
templ = "templ",
},
})
-- AutoCommand OSC7 workaround for tmux
-- see https://github.com/neovim/neovim/issues/21771
vim.api.nvim_create_autocmd("dirchanged", {
pattern = "*",
command = 'call chansend(v:stderr, printf("\\033]7;%s\\033", v:event.cwd))',
})
-- (No) Statusline
vim.opt.laststatus = 0
vim.api.nvim_set_hl(0, "Statusline", { link = "Normal" })
vim.api.nvim_set_hl(0, "StatuslineNC", { link = "Normal" })
local line = string.rep("", vim.api.nvim_win_get_width(0))
vim.opt.statusline = "%#WinSeparator#" .. line .. "%*"

View file

@ -1,69 +0,0 @@
return {
{
"echasnovski/mini.pairs",
enabled = false,
},
{
"nvim-cmp",
dependencies = { "hrsh7th/cmp-emoji" },
opts = function(_, opts)
local cmp = require("cmp")
table.insert(opts.sources, { name = "emoji" })
opts.view = { docs = { auto_open = false }, entries = { follow_cursor = true } }
opts.completion = {
autocomplete = false,
}
local winhighlight =
"Normal:NoiceCmdlinePopupTitle,FloatBorder:NoiceCmdlinePopupBorder,CursorLine:PMenuSel,Search:Search"
opts.window = {
completion = cmp.config.window.bordered({ winhighlight = winhighlight, border = "rounded" }),
documentation = cmp.config.window.bordered({ winhighlight = winhighlight, border = "rounded" }),
preview = cmp.config.window.bordered({ winhighlight = winhighlight, border = "rounded" }),
}
-- lua sorting = { comparators = { cmp.config.compare.sort_text, -- this needs to be 1st cmp.config.compare.offset, cmp.config.compare.exact, cmp.config.compare.score, cmp.config.compare.kind, cmp.config.compare.length, cmp.config.compare.order, } }
opts.sorting = {
priority_weight = 2,
comparators = {
cmp.config.compare.exact,
cmp.config.compare.recently_used,
cmp.config.compare.locality,
cmp.config.compare.offset,
-- cmp.config.compare.scopes,
cmp.config.compare.score,
cmp.config.compare.kind,
-- cmp.config.compare.sort_text,
cmp.config.compare.length,
cmp.config.compare.order,
},
}
return opts
end,
},
{
"Exafunction/codeium.nvim",
opts = {
enable_chat = false,
},
},
{
"monkoose/neocodeium",
event = "VeryLazy",
config = function()
local neocodeium = require("neocodeium")
neocodeium.setup()
vim.keymap.set("i", "<C-j>", neocodeium.accept)
vim.keymap.set("i", "<A-f>", neocodeium.accept)
vim.keymap.set("i", "<C-h>", neocodeium.cycle_or_complete)
end,
},
}

View file

@ -1,14 +0,0 @@
return {
{
"https://patagia.dev/patagia/dieter.nvim.git",
lazy = false,
priority = 1000,
},
{
"LazyVim/LazyVim",
opts = {
colorscheme = "dieter",
},
},
}

View file

@ -1,100 +0,0 @@
return {
{
"folke/flash.nvim",
enabled = false,
},
{
"telescope.nvim",
keys = {
{
"<Leader><Leader>",
function()
local telescope = require("telescope")
local jj_pick_status, jj_res = pcall(telescope.extensions.jj.files, opts)
if jj_pick_status then
return
end
local git_files_status, git_res = pcall(telescope.builtin.git_files, opts)
if not git_files_status then
error("Could not launch jj/git files: \n" .. jj_res .. "\n" .. git_res)
end
end,
desc = "VCS Files",
},
{
"<C-p>",
"<cmd>Telescope projects<cr>",
desc = "Projects",
},
},
opts = function(_, opts)
local actions = require("telescope.actions")
opts.defaults = {
layout_strategy = "horizontal",
layout_config = {
anchor = "top",
horizontal = {
prompt_position = "top",
mirror = false,
preview_width = 0.49,
-- preview_height = 0.5,
},
width = 0.99,
height = 0.9,
preview_cutoff = 10,
},
mappings = {
i = {
["<esc>"] = actions.close, -- <Esc> close popup
["<C-u>"] = false, -- <C-u> clear prompt
["<C-w>"] = false, -- <C-u> clear prompt
},
},
path_display = { "filename_first" },
-- previewer = false,
preview = {
-- hide_on_startup = true,
},
sorting_strategy = "ascending",
winblend = 0,
wrap_results = true,
}
end,
},
{ "avm99963/vim-jjdescription", lazy = false },
{
"zschreur/telescope-jj.nvim",
keys = {
{
"<Leader>jc",
function()
require("telescope").extensions.jj.conflicts()
end,
desc = "jj conflicts",
},
{
"<Leader>jd",
function()
require("telescope").extensions.jj.diff()
end,
desc = "jj diffs",
},
{
"<Leader>jf",
function()
require("telescope").extensions.jj.files()
end,
desc = "jj files",
},
},
config = function()
LazyVim.on_load("telescope.nvim", function()
local telescope = require("telescope")
telescope.load_extension("jj")
end)
end,
},
}

View file

@ -1,99 +0,0 @@
return {
{
"direnv/direnv.vim",
lazy = false,
priority = 900,
config = function()
vim.g.direnv_silent_load = 1
end,
},
{
"nvimtools/none-ls.nvim",
opts = function(_, opts)
local nls = require("null-ls")
opts.root_dir = opts.root_dir
or require("null-ls.utils").root_pattern(".null-ls-root", ".neoconf.json", "Makefile", ".git")
opts.sources = vim.list_extend(opts.sources or {}, {
nls.builtins.formatting.mdformat,
nls.builtins.formatting.stylua,
nls.builtins.formatting.shfmt,
nls.builtins.formatting.buf,
nls.builtins.formatting.buildifier,
nls.builtins.diagnostics.buildifier,
nls.builtins.diagnostics.buf.with({
args = { "lint", "--disable-symlinks", "--path", "$FILENAME" },
cwd = function()
local file_dir = vim.fn.expand("%:p:h") .. ";"
local buf_yaml = vim.fn.findfile("buf.yaml", file_dir)
if buf_yaml then
return vim.fn.fnamemodify(buf_yaml, ":h")
end
end,
}),
})
end,
},
{
"nvim-neo-tree/neo-tree.nvim",
opts = {
window = {
width = 30,
position = "right",
},
},
},
{
"simrat39/rust-tools.nvim",
enabled = false,
},
{
"mrcjkb/rustaceanvim",
version = "^4", -- Recommended
ft = { "rust" },
opts = {
server = {
on_attach = function(_, bufnr)
vim.keymap.set("n", "<leader>cR", function()
vim.cmd.RustLsp("codeAction")
end, { desc = "Code Action", buffer = bufnr })
vim.keymap.set("n", "<leader>dr", function()
vim.cmd.RustLsp("debuggables")
end, { desc = "Rust debuggables", buffer = bufnr })
vim.keymap.set("n", "<leader>cD", function()
vim.cmd.RustLsp("externalDocs")
end, { desc = "Rust external documentation", buffer = bufnr })
end,
},
settings = {
-- rust-analyzer language server configuration
["rust-analyzer"] = {
cargo = {
allFeatures = true,
loadOutDirsFromCheck = true,
runBuildScripts = true,
targetDir = true,
},
-- Add clippy lints for Rust.
checkOnSave = {
allFeatures = true,
command = "clippy",
extraArgs = { "--no-deps" },
},
procMacro = {
enable = true,
ignored = {
["async-trait"] = { "async_trait" },
["napi-derive"] = { "napi" },
["async-recursion"] = { "async_recursion" },
},
},
},
},
},
},
}

View file

@ -1,15 +0,0 @@
return {
{
"stevearc/conform.nvim",
opts = {
formatters_by_ft = {
["cue"] = { { "cue_fmt" } },
["html"] = { { "prettierd", "prettier" } },
["nix"] = { "nixfmt" },
["sass"] = { { "prettierd", "prettier" } },
["proto"] = { { "buf" } },
["terraform"] = { { "terraform_fmt" } },
},
},
},
}

View file

@ -1,72 +0,0 @@
return {
"b0o/incline.nvim",
config = function()
local devicons = require("nvim-web-devicons")
require("incline").setup({
window = {
margin = {
horizontal = 0,
vertical = 0,
},
padding = 0,
placement = {
horizontal = "right",
vertical = "bottom",
},
},
render = function(props)
local filename = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(props.buf), ":t")
if filename == "" then
filename = "[No Name]"
end
local ft_icon, ft_color = devicons.get_icon_color(filename)
local function get_git_diff()
local icons = { removed = "", changed = "", added = "" }
local signs = vim.b[props.buf].gitsigns_status_dict
local labels = {}
if signs == nil then
return labels
end
for name, icon in pairs(icons) do
if tonumber(signs[name]) and signs[name] > 0 then
table.insert(labels, { icon .. signs[name] .. " ", group = "Diff" .. name })
end
end
if #labels > 0 then
table.insert(labels, { "" })
end
return labels
end
local function get_diagnostic_label()
local icons = { error = "", warn = "", info = "", hint = "" }
local label = {}
for severity, icon in pairs(icons) do
local n = #vim.diagnostic.get(
props.buf,
{ severity = vim.diagnostic.severity[string.upper(severity)] }
)
if n > 0 then
table.insert(label, { icon .. n .. " ", group = "DiagnosticSign" .. severity })
end
end
if #label > 0 then
table.insert(label, { "" })
end
return label
end
return {
{ " " },
{ get_diagnostic_label() },
{ get_git_diff() },
{ filename, group = "Label" },
{ " " },
}
end,
})
end,
event = "VeryLazy",
}

View file

@ -1,35 +0,0 @@
return {
{
"neovim/nvim-lspconfig",
opts = {
diagnostics = {
virtual_text = false,
},
inlay_hints = { enabled = false },
-- codelens = {
-- enabled = true,
-- },
servers = {
nil_ls = {},
nixd = {},
starpls = {},
yamlls = {
settings = {
yaml = {
schemas = {
-- kubernetes = "*.yaml",
["http://json.schemastore.org/github-workflow"] = ".github/workflows/*",
["http://json.schemastore.org/github-action"] = ".github/action.{yml,yaml}",
["http://json.schemastore.org/ansible-stable-2.9"] = "roles/tasks/*.{yml,yaml}",
["http://json.schemastore.org/chart"] = "Chart.{yml,yaml}",
["https://json.schemastore.org/dependabot-v2"] = ".github/dependabot.{yml,yaml}",
["https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.1/schema.json"] = "*api*.{yml,yaml}",
["https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.29.1/all.json"] = "/*.yaml",
},
},
},
},
},
},
},
}

View file

@ -1,41 +0,0 @@
return {
{
"nvim-treesitter/nvim-treesitter-context",
opts = {
enable = false,
},
},
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
vim.list_extend(opts.ensure_installed, {
"bash",
"c",
"diff",
"go",
"html",
"javascript",
"jsdoc",
"json",
"jsonc",
"lua",
"luadoc",
"luap",
"markdown",
"markdown_inline",
"python",
"query",
"regex",
"rust",
"toml",
"tsx",
"typescript",
"vim",
"vimdoc",
"xml",
"yaml",
})
end,
},
}

View file

@ -1,130 +0,0 @@
return {
{
"nvimdev/dashboard-nvim",
enabled = false,
},
{
"dgagn/diagflow.nvim",
-- event = 'LspAttach', This is what I use personnally and it works great
opts = {
scope = "line",
gap_size = 0,
max_width = 50,
max_height = 20,
show_borders = true,
toggle_event = { "InsertEnter", "InsertLeave" },
},
},
{
"akinsho/bufferline.nvim",
enabled = false,
},
{
"echasnovski/mini.indentscope",
enabled = false,
},
{
"lukas-reineke/indent-blankline.nvim",
enabled = false,
},
{ "nvimdev/indentmini.nvim", opts = { char = "" } },
{
"mvllow/modes.nvim",
opts = {
colors = {
copy = "#f5c359",
delete = "#c75c6a",
insert = "#ffcc00",
visual = "#c343fc",
},
set_cursor = true,
set_cursorline = true,
set_number = true,
},
},
{
"folke/noice.nvim",
event = "VeryLazy",
keys = {
{ "<leader>sna", "<cmd>NoiceTelescope<cr>", desc = "Show all messages in Telescope" },
},
opts = function()
local enable_conceal = true -- Hide command text if true
return {
presets = { bottom_search = true }, -- The kind of popup used for /
cmdline = {
view = "cmdline", -- The kind of popup used for :
format = {
cmdline = { conceal = enable_conceal },
search_down = { conceal = enable_conceal },
search_up = { conceal = enable_conceal },
filter = { conceal = enable_conceal },
lua = { conceal = enable_conceal },
help = { conceal = enable_conceal },
input = { conceal = enable_conceal },
},
},
messages = { enabled = true, view = "mini" },
lsp = {
hover = { enabled = false },
signature = { enabled = false },
progress = { enabled = true, view = "cmdline" },
message = { enabled = false },
smart_move = { enabled = false },
},
}
end,
},
{
"rcarriga/nvim-notify",
opts = {
timeout = 1000,
render = "wrapped-compact",
top_down = false,
max_width = function()
return math.floor(vim.o.columns * 0.5)
end,
on_open = function(win)
vim.api.nvim_win_set_config(win, {
focusable = false,
zindex = 100,
})
end,
},
},
{
"nvim-lualine/lualine.nvim",
enabled = false,
},
{
"DrKJeff16/project.nvim",
config = function(_, opts)
if vim.fn.argv()[1] == nil then
require("project_nvim").setup(opts) -- Workaround for project.nvim not setting up
vim.schedule(function()
vim.cmd("Telescope projects")
end)
end
end,
opts = {
exclude_dirs = {
"~/.cargo/*",
"~/.config/*",
"/tmp/*",
},
manual_mode = false,
patterns = { ".git", ".jj" },
},
},
}