(neovim) another try of my own setup

This commit is contained in:
Bartek Stalewski 2025-07-24 03:26:03 +02:00
parent 50e0f23feb
commit 7225cf3967
No known key found for this signature in database
54 changed files with 677 additions and 586 deletions

View file

@ -9,6 +9,7 @@ vim.api.nvim_create_autocmd("FileType", {
group = vim.api.nvim_create_augroup("spell", { clear = true }),
pattern = { "text", "plaintex", "typst", "gitcommit", "markdown" },
callback = function()
-- vim.api.nvim_set_hl(0, "SpellBad", { bg = "#770000", fg = "#ffffff" })
vim.opt_local.spell = true
end,
})
@ -35,3 +36,65 @@ vim.api.nvim_create_autocmd("User", {
}, { prefix = "Snacks" })
end,
})
-- remember last location
vim.api.nvim_create_autocmd("BufReadPost", {
group = vim.api.nvim_create_augroup("last-loc", { clear = true }),
callback = function(event)
local exclude = { "gitcommit" }
local buf = event.buf
if vim.tbl_contains(exclude, vim.bo[buf].filetype) or vim.b[buf].my_last_loc then
return
end
vim.b[buf].my_last_loc = true
local mark = vim.api.nvim_buf_get_mark(buf, '"')
local lcount = vim.api.nvim_buf_line_count(buf)
if mark[1] > 0 and mark[1] <= lcount then
pcall(vim.api.nvim_win_set_cursor, 0, mark)
end
end,
})
-- lsp
vim.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup("lsp-attach", { clear = true }),
callback = function(event)
local map = function(keys, func, desc)
vim.keymap.set("n", keys, func, { buffer = event.buf, desc = desc })
end
map("<leader>cd", vim.diagnostic.open_float, "diagnostic (float)")
map("<leader>ch", vim.lsp.buf.hover, "help")
map("<leader>ca", vim.lsp.buf.code_action, "actions")
map("<leader>cf", vim.lsp.buf.format, "format file")
local function client_supports_method(client, method, bufnr)
if vim.fn.has("nvim-0.11") == 1 then
return client:supports_method(method, bufnr)
else
return client.supports_method(method, { bufnr = bufnr })
end
end
local client = vim.lsp.get_client_by_id(event.data.client_id)
if
client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf)
then
local highlight_augroup = vim.api.nvim_create_augroup("lsp-highlight", { clear = false })
vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, {
buffer = event.buf,
group = highlight_augroup,
callback = vim.lsp.buf.document_highlight,
})
vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI" }, {
buffer = event.buf,
group = highlight_augroup,
callback = vim.lsp.buf.clear_references,
})
vim.api.nvim_create_autocmd("LspDetach", {
group = vim.api.nvim_create_augroup("lsp-detach", { clear = true }),
callback = function(event2)
vim.lsp.buf.clear_references()
vim.api.nvim_clear_autocmds({ group = "lsp-highlight", buffer = event2.buf })
end,
})
end
end,
})

View file

@ -0,0 +1,3 @@
require("config.settings")
require("config.keymaps")
require("config.autocmds")

View file

@ -1,62 +1,44 @@
-- 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
vim.g.mapleader = " "
vim.g.maplocalleader = "\\"
local map = vim.keymap.set
local nomap = vim.keymap.del
nomap("n", "<leader><space>")
nomap("n", "<leader>,")
nomap("n", "<leader>.")
nomap("n", "<leader>?")
nomap("n", "<leader>K")
nomap("n", "<leader>l")
nomap("n", "<leader>L")
nomap("n", "<leader>S")
nomap("n", "<leader>`")
local diagnostic_goto = function(next, severity)
local go = next and vim.diagnostic.goto_next or vim.diagnostic.goto_prev
severity = severity and vim.diagnostic.severity[severity] or nil
return function()
go({ severity = severity })
end
end
nomap("n", "<leader>bb")
nomap("n", "<leader>bD")
nomap("n", "<leader>bo")
nomap("n", "<leader>E")
nomap("n", "<leader>fb")
nomap("n", "<leader>fc")
nomap("n", "<leader>fF")
nomap("n", "<leader>fr")
nomap("n", "<leader>fB")
nomap("n", "<leader>fe")
nomap("n", "<leader>fE")
nomap("n", "<leader>fn")
nomap("n", "<leader>fp")
nomap("n", "<leader>fR")
nomap("n", "<leader>ft")
nomap("n", "<leader>fT")
nomap("n", "<leader>gY")
nomap("n", "<leader>gS")
nomap("n", "<leader>qq")
nomap("n", "<leader>xl")
nomap("n", "<leader>xq")
map({ "i", "n", "s" }, "<esc>", function()
vim.cmd("noh")
return "<esc>"
end, { expr = true, desc = "Escape and Clear hlsearch" })
map("i", "<C-a>", "<esc>I")
map("i", "<C-e>", "<esc>A")
map("n", "<esc><cr>", "<esc><cmd>wq!<cr>", { desc = "Save and Exit", remap = true })
map("n", "<tab>", "<C-w>w", { desc = "Switch Pane", remap = true })
map("n", "]d", diagnostic_goto(true), { desc = "Next Diagnostic" })
map("n", "[d", diagnostic_goto(false), { desc = "Prev Diagnostic" })
map("n", "]e", diagnostic_goto(true, "ERROR"), { desc = "Next Error" })
map("n", "[e", diagnostic_goto(false, "ERROR"), { desc = "Prev Error" })
map("n", "]w", diagnostic_goto(true, "WARN"), { desc = "Next Warning" })
map("n", "[w", diagnostic_goto(false, "WARN"), { desc = "Prev Warning" })
map("v", "<leader>/", "gc", { desc = "toggle comments", remap = true })
map("n", "<esc><cr>", "<cmd>wqa<cr>", { desc = "save and exit", remap = true })
map("n", "<tab>", "<C-w>w", { desc = "switch pane", remap = true })
map("n", "+", ":vertical resize +5<CR>")
map("n", "_", ":vertical resize -5<CR>")
map("n", "=", ":resize +5<CR>")
map("n", "-", ":resize -5<CR>")
map("n", "<leader>-", "<C-W>s", { desc = "Split Horizontally", remap = true })
map("n", "<leader>/", "gcc", { desc = "Toggle Comments", remap = true })
map("n", "<leader>|", "<C-W>v", { desc = "Split Vertically", remap = true })
map("n", "<leader>-", "<C-W>s", { desc = "split horizontally", remap = true })
map("n", "<leader>/", "gcc", { desc = "toggle comments", remap = true })
map("n", "<leader>|", "<C-W>v", { desc = "split vertically", remap = true })
map("n", "<leader>b[", "<cmd>bprevious<CR>", { desc = "buffer previous", remap = true })
map("n", "<leader>b]", "<cmd>bnext<CR>", { desc = "buffer next", remap = true })
@ -68,9 +50,17 @@ map("n", "<leader>bl", function()
end, { desc = "buffer list", remap = true })
map("n", "<leader>bn", "<cmd>enew<CR>", { desc = "buffer create", remap = true })
map("n", "<leader>cd", vim.diagnostic.open_float, { desc = "Line Diagnostics" })
map({ "n", "v" }, "<leader>cf", function()
require("conform").format({
lsp_fallback = true,
async = false,
})
end, { desc = "format", remap = true })
map("n", "<leader>e", function()
Snacks.explorer()
end, { desc = "Explorer", remap = true })
end, { desc = "explorer", remap = true })
map("n", "<leader>s", "<cmd>set hlsearch!<cr>", { desc = "toggle hlsearch", remap = true })
map("n", "<leader>ff", function()
@ -88,6 +78,12 @@ map("n", "<leader>hs", function()
Snacks.picker.search_history()
end, { desc = "search", remap = true })
map(
"n",
"<leader>m",
'<cmd>execute "set colorcolumn=" . (&colorcolumn == "" ? "80,120" : "")<cr>',
{ desc = "toggle columns" }
)
map("n", "<leader>n", function()
vim.cmd("set number!")
vim.cmd('execute "set signcolumn=" . (&signcolumn == "yes" ? "no" : "yes")')
@ -96,15 +92,10 @@ map("n", "<leader>n", function()
else
Snacks.indent.enable()
end
end, { desc = "Toggle Decorations", remap = true })
map("n", "<leader>T", function()
end, { desc = "toggle decorations", remap = true })
map("n", "<leader>t", function()
Snacks.terminal()
end, { desc = "Terminal", remap = true })
map("n", "<leader>s", "<cmd>set hlsearch!<cr>", { desc = "Toggle hlsearch", remap = true })
end, { desc = "terminal", remap = true })
map("n", "<leader>us", "<cmd>set spell!<cr>", { desc = "toggle spell", remap = true })
map("n", "<leader>uw", "<cmd>set wrap!<cr>", { desc = "toggle wrap", remap = true })
map("v", "<leader>/", "gc", { desc = "Toggle Comments", remap = true })

View file

@ -1,55 +0,0 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
spec = {
-- add LazyVim and import its plugins
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
-- import/override with your 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 = true, -- check for plugin updates periodically
notify = false, -- notify on update
}, -- automatically check for plugin updates
performance = {
rtp = {
-- disable some rtp plugins
disabled_plugins = {
"gzip",
-- "matchit",
-- "matchparen",
-- "netrwPlugin",
"tarPlugin",
"tohtml",
"tutor",
"zipPlugin",
},
},
},
rocks = {
enabled = false,
},
})

View file

@ -0,0 +1,3 @@
require("core.lazy")
require("core.lsp")
require("core.mason-path")

View file

@ -0,0 +1,49 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
spec = {
{ import = "plugins" },
},
defaults = {
lazy = true,
},
install = {
missing = true,
},
checker = {
enabled = true,
notify = true,
},
change_detection = {
enabled = true,
notify = true,
},
ui = {
-- border = "rounded"
},
performance = {
rtp = {
disabled_plugins = {
"gzip",
"tarPlugin",
"tohtml",
"tutor",
"zipPlugin",
},
},
},
})

View file

@ -0,0 +1,275 @@
vim.lsp.enable({
"lua",
"terraform",
"markdown",
})
vim.diagnostic.config({
-- virtual_lines = true,
virtual_text = true,
underline = false,
update_in_insert = false,
severity_sort = true,
float = {
border = "rounded",
source = false,
},
signs = {
text = {
[vim.diagnostic.severity.ERROR] = "",
[vim.diagnostic.severity.WARN] = "",
[vim.diagnostic.severity.INFO] = "",
[vim.diagnostic.severity.HINT] = "",
},
numhl = {
[vim.diagnostic.severity.ERROR] = "ErrorMsg",
[vim.diagnostic.severity.WARN] = "WarningMsg",
},
},
})
-- Extras
local function restart_lsp(bufnr)
bufnr = bufnr or vim.api.nvim_get_current_buf()
local clients = vim.lsp.get_clients({ bufnr = bufnr })
for _, client in ipairs(clients) do
vim.lsp.stop_client(client.id)
end
vim.defer_fn(function()
vim.cmd("edit")
end, 100)
end
vim.api.nvim_create_user_command("LspRestart", function()
restart_lsp()
end, {})
local function lsp_status()
local bufnr = vim.api.nvim_get_current_buf()
local clients = vim.lsp.get_clients({ bufnr = bufnr })
if #clients == 0 then
print("󰅚 No LSP clients attached")
return
end
print("󰒋 LSP Status for buffer " .. bufnr .. ":")
print("─────────────────────────────────")
for i, client in ipairs(clients) do
print(string.format("󰌘 Client %d: %s (ID: %d)", i, client.name, client.id))
print(" Root: " .. (client.config.root_dir or "N/A"))
print(" Filetypes: " .. table.concat(client.config.filetypes or {}, ", "))
-- Check capabilities
local caps = client.server_capabilities
local features = {}
if caps.completionProvider then
table.insert(features, "completion")
end
if caps.hoverProvider then
table.insert(features, "hover")
end
if caps.definitionProvider then
table.insert(features, "definition")
end
if caps.referencesProvider then
table.insert(features, "references")
end
if caps.renameProvider then
table.insert(features, "rename")
end
if caps.codeActionProvider then
table.insert(features, "code_action")
end
if caps.documentFormattingProvider then
table.insert(features, "formatting")
end
print(" Features: " .. table.concat(features, ", "))
print("")
end
end
vim.api.nvim_create_user_command("LspStatus", lsp_status, { desc = "Show detailed LSP status" })
local function check_lsp_capabilities()
local bufnr = vim.api.nvim_get_current_buf()
local clients = vim.lsp.get_clients({ bufnr = bufnr })
if #clients == 0 then
print("No LSP clients attached")
return
end
for _, client in ipairs(clients) do
print("Capabilities for " .. client.name .. ":")
local caps = client.server_capabilities
local capability_list = {
{ "Completion", caps.completionProvider },
{ "Hover", caps.hoverProvider },
{ "Signature Help", caps.signatureHelpProvider },
{ "Go to Definition", caps.definitionProvider },
{ "Go to Declaration", caps.declarationProvider },
{ "Go to Implementation", caps.implementationProvider },
{ "Go to Type Definition", caps.typeDefinitionProvider },
{ "Find References", caps.referencesProvider },
{ "Document Highlight", caps.documentHighlightProvider },
{ "Document Symbol", caps.documentSymbolProvider },
{ "Workspace Symbol", caps.workspaceSymbolProvider },
{ "Code Action", caps.codeActionProvider },
{ "Code Lens", caps.codeLensProvider },
{ "Document Formatting", caps.documentFormattingProvider },
{ "Document Range Formatting", caps.documentRangeFormattingProvider },
{ "Rename", caps.renameProvider },
{ "Folding Range", caps.foldingRangeProvider },
{ "Selection Range", caps.selectionRangeProvider },
}
for _, cap in ipairs(capability_list) do
local status = cap[2] and "" or ""
print(string.format(" %s %s", status, cap[1]))
end
print("")
end
end
vim.api.nvim_create_user_command("LspCapabilities", check_lsp_capabilities, { desc = "Show LSP capabilities" })
local function lsp_diagnostics_info()
local bufnr = vim.api.nvim_get_current_buf()
local diagnostics = vim.diagnostic.get(bufnr)
local counts = { ERROR = 0, WARN = 0, INFO = 0, HINT = 0 }
for _, diagnostic in ipairs(diagnostics) do
local severity = vim.diagnostic.severity[diagnostic.severity]
counts[severity] = counts[severity] + 1
end
print("󰒡 Diagnostics for current buffer:")
print(" Errors: " .. counts.ERROR)
print(" Warnings: " .. counts.WARN)
print(" Info: " .. counts.INFO)
print(" Hints: " .. counts.HINT)
print(" Total: " .. #diagnostics)
end
vim.api.nvim_create_user_command("LspDiagnostics", lsp_diagnostics_info, { desc = "Show LSP diagnostics count" })
local function lsp_info()
local bufnr = vim.api.nvim_get_current_buf()
local clients = vim.lsp.get_clients({ bufnr = bufnr })
print("═══════════════════════════════════")
print(" LSP INFORMATION ")
print("═══════════════════════════════════")
print("")
-- Basic info
print("󰈙 Language client log: " .. vim.lsp.get_log_path())
print("󰈔 Detected filetype: " .. vim.bo.filetype)
print("󰈮 Buffer: " .. bufnr)
print("󰈔 Root directory: " .. (vim.fn.getcwd() or "N/A"))
print("")
if #clients == 0 then
print("󰅚 No LSP clients attached to buffer " .. bufnr)
print("")
print("Possible reasons:")
print(" • No language server installed for " .. vim.bo.filetype)
print(" • Language server not configured")
print(" • Not in a project root directory")
print(" • File type not recognized")
return
end
print("󰒋 LSP clients attached to buffer " .. bufnr .. ":")
print("─────────────────────────────────")
for i, client in ipairs(clients) do
print(string.format("󰌘 Client %d: %s", i, client.name))
print(" ID: " .. client.id)
print(" Root dir: " .. (client.config.root_dir or "Not set"))
print(" Command: " .. table.concat(client.config.cmd or {}, " "))
print(" Filetypes: " .. table.concat(client.config.filetypes or {}, ", "))
-- Server status
if client.is_stopped() then
print(" Status: 󰅚 Stopped")
else
print(" Status: 󰄬 Running")
end
-- Workspace folders
if client.workspace_folders and #client.workspace_folders > 0 then
print(" Workspace folders:")
for _, folder in ipairs(client.workspace_folders) do
print("" .. folder.name)
end
end
-- Attached buffers count
local attached_buffers = {}
for buf, _ in pairs(client.attached_buffers or {}) do
table.insert(attached_buffers, buf)
end
print(" Attached buffers: " .. #attached_buffers)
-- Key capabilities
local caps = client.server_capabilities
local key_features = {}
if caps.completionProvider then
table.insert(key_features, "completion")
end
if caps.hoverProvider then
table.insert(key_features, "hover")
end
if caps.definitionProvider then
table.insert(key_features, "definition")
end
if caps.documentFormattingProvider then
table.insert(key_features, "formatting")
end
if caps.codeActionProvider then
table.insert(key_features, "code_action")
end
if #key_features > 0 then
print(" Key features: " .. table.concat(key_features, ", "))
end
print("")
end
-- Diagnostics summary
local diagnostics = vim.diagnostic.get(bufnr)
if #diagnostics > 0 then
print("󰒡 Diagnostics Summary:")
local counts = { ERROR = 0, WARN = 0, INFO = 0, HINT = 0 }
for _, diagnostic in ipairs(diagnostics) do
local severity = vim.diagnostic.severity[diagnostic.severity]
counts[severity] = counts[severity] + 1
end
print(" 󰅚 Errors: " .. counts.ERROR)
print(" 󰀪 Warnings: " .. counts.WARN)
print(" 󰋽 Info: " .. counts.INFO)
print(" 󰌶 Hints: " .. counts.HINT)
print(" Total: " .. #diagnostics)
else
print("󰄬 No diagnostics")
end
print("")
print("Use :LspLog to view detailed logs")
print("Use :LspCapabilities for full capability list")
end
-- Create command
vim.api.nvim_create_user_command("LspInfo", lsp_info, { desc = "Show comprehensive LSP information" })

View file

@ -0,0 +1,25 @@
local mason_bin = vim.fn.stdpath("data") .. "/mason/bin"
local current_path = vim.env.PATH or ""
-- Remove any existing Mason bin entries to prevent duplicates
local path_entries = vim.split(current_path, ":")
local clean_path_entries = {}
local seen = {}
for _, entry in ipairs(path_entries) do
-- Skip Mason bin entries and duplicates
if entry ~= mason_bin and entry ~= "" and not seen[entry] then
seen[entry] = true
table.insert(clean_path_entries, entry)
end
end
-- Add Mason bin directory at the beginning
local new_path = mason_bin .. ":" .. table.concat(clean_path_entries, ":")
vim.env.PATH = new_path
-- Verify Mason bin directory exists
if vim.fn.isdirectory(mason_bin) == 0 then
-- Mason not installed yet, create placeholder
vim.fn.mkdir(mason_bin, "p")
end

View file

@ -1,12 +1,61 @@
return {
"saghen/blink.cmp",
opts = {
keymap = {
preset = "none",
["<Tab>"] = { "accept", "fallback" },
},
cmdline = {
enabled = false,
{
"saghen/blink.cmp",
dependencies = {
"rafamadriz/friendly-snippets",
"L3MON4D3/LuaSnip",
},
event = "InsertEnter",
version = "*",
config = function()
require("blink.cmp").setup({
snippets = { preset = "luasnip" },
signature = { enabled = true },
appearance = {
use_nvim_cmp_as_default = false,
nerd_font_variant = "normal",
},
sources = {
default = { "lsp", "path", "snippets", "buffer" },
providers = {
cmdline = {
min_keyword_length = 2,
},
},
},
keymap = {
["<Tab>"] = { "accept", "fallback" },
},
cmdline = {
enabled = false,
},
completion = {
menu = {
border = nil,
scrolloff = 1,
scrollbar = false,
draw = {
columns = {
{ "kind_icon" },
{ "label", "label_description", gap = 1 },
{ "kind" },
{ "source_name" },
},
},
},
documentation = {
window = {
border = nil,
scrollbar = false,
winhighlight = "Normal:BlinkCmpDoc,FloatBorder:BlinkCmpDocBorder,EndOfBuffer:BlinkCmpDoc",
},
auto_show = true,
auto_show_delay_ms = 500,
},
},
})
require("luasnip.loaders.from_vscode").lazy_load()
end,
},
}

View file

@ -1,10 +0,0 @@
return {
"stevearc/conform.nvim",
opts = {
formatters = {
shfmt = {
prepend_args = { "-i", "2", "-ci", "-bn" },
},
},
},
}

View file

@ -1,11 +0,0 @@
return {
{ "akinsho/bufferline.nvim", enabled = false },
{ "catppuccin/nvim", enabled = false },
{ "folke/persistence.nvim", enabled = false },
{ "folke/tokyonight.nvim", enabled = false },
{ "folke/trouble.nvim", enabled = false },
{ "MagickDuck/grug-far.nvim", enabled = false },
{ "nvim-neo-tree/neo-tree.nvim", enabled = false },
{ "todo-comments.nvim", enabled = false },
{ "windwp/nvim-ts-autotag", enabled = false },
}

View file

@ -0,0 +1,23 @@
return {
"lewis6991/gitsigns.nvim",
lazy = false,
config = function()
require("gitsigns").setup({
signs = {
add = { text = "" },
change = { text = "" },
delete = { text = "" },
topdelete = { text = "" },
changedelete = { text = "" },
untracked = { text = "" },
},
signs_staged = {
add = { text = "" },
change = { text = "" },
delete = { text = "" },
topdelete = { text = "" },
changedelete = { text = "" },
},
})
end,
}

View file

@ -1,12 +0,0 @@
return {
{
"mfussenegger/nvim-lint",
opts = {
linters = {
["markdownlint-cli2"] = {
args = { "--config", vim.fn.stdpath("config") .. "/linters/global.markdownlint-cli2.yaml" },
},
},
},
},
}

View file

@ -0,0 +1,95 @@
return {
{
"williamboman/mason.nvim",
cmd = "Mason",
keys = { { "<leader>cm", "<cmd>Mason<cr>", desc = "Mason" } },
build = ":MasonUpdate",
opts = {
ensure_installed = {
"lua-language-server",
"markdown-toc",
"markdownlint-cli2",
"marksman",
"shfmt",
"stylua",
"terraform-ls",
"tflint",
},
},
config = function(_, opts)
require("mason").setup(opts)
local mr = require("mason-registry")
local function ensure_installed()
for _, tool in ipairs(opts.ensure_installed) do
if mr.has_package(tool) then
local p = mr.get_package(tool)
if not p:is_installed() then
vim.notify("Mason: Installing " .. tool .. "...", vim.log.levels.INFO)
p:install():once("closed", function()
if p:is_installed() then
vim.notify("Mason: Successfully installed " .. tool, vim.log.levels.INFO)
else
vim.notify("Mason: Failed to install " .. tool, vim.log.levels.ERROR)
end
end)
end
else
vim.notify("Mason: Package '" .. tool .. "' not found", vim.log.levels.WARN)
end
end
end
if mr.refresh then
mr.refresh(ensure_installed)
else
ensure_installed()
end
end,
},
{
"mfussenegger/nvim-lint",
event = { "BufReadPre", "BufNewFile" },
config = function()
require("lint").linters_by_ft = {
markdown = { "markdownlint-cli2" },
terraform = { "terraform_validate" },
tf = { "terraform_validate" },
}
local markdownlint = require("lint").linters["markdownlint-cli2"]
markdownlint.args = {
"--config",
"/Users/f/.config/nvim-ftpd/linters/global.markdownlint-cli2.yaml",
}
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
callback = function()
require("lint").try_lint()
end,
})
end,
},
{
"stevearc/conform.nvim",
event = { "BufReadPre", "BufNewFile" },
dependencies = { "mason.nvim" },
config = function()
require("conform").setup({
formatters_by_ft = {
["terraform-vars"] = { "terraform_fmt" },
bash = { "shfmt" },
lua = { "stylua" },
markdown = { "markdownlint-cli2" },
sh = { "shfmt" },
terraform = { "terraform_fmt" },
tf = { "terraform_fmt" },
zsh = { "shfmt" },
},
-- format_on_save = {
-- lsp_fallback = true,
-- async = false,
-- },
})
end,
},
}

View file

@ -1,10 +0,0 @@
return {
"williamboman/mason.nvim",
opts = {
ensure_installed = {
"lua-language-server",
"terraform-ls",
"tflint",
},
},
}

View file

@ -1,57 +1,60 @@
return {
"nvim-lualine/lualine.nvim",
opts = {
options = {
theme = "powerline",
section_separators = "",
component_separators = "",
globalstatus = false,
},
sections = {
lualine_a = { "mode" },
lualine_b = {
{ "branch" },
{
"diff",
symbols = {
added = "",
modified = "",
removed = "",
event = "VeryLazy",
config = function()
require("lualine").setup({
options = {
theme = "powerline",
section_separators = "",
component_separators = "",
globalstatus = false,
},
sections = {
lualine_a = { "mode" },
lualine_b = {
{ "branch" },
{
"diff",
symbols = {
added = "",
modified = "",
removed = "",
},
},
{
"diagnostics",
symbols = {
error = "",
warn = "",
info = "",
hint = "",
},
},
},
{
"diagnostics",
symbols = {
error = "",
warn = "",
info = "",
hint = "",
lualine_c = {
{ "filetype", icon_only = true, separator = "", padding = { left = 1, right = 0 } },
{ "filename", file_status = true, path = 1 },
},
lualine_x = {
{
"lsp_status",
symbols = {
spinner = { "", "", "", "", "", "", "", "", "", "" },
done = "",
separator = " ",
},
},
},
},
lualine_c = {
{ "filetype", icon_only = true, separator = "", padding = { left = 1, right = 0 } },
{ "filename", file_status = true, path = 1 },
},
lualine_x = {
{
"lsp_status",
symbols = {
spinner = { "", "", "", "", "", "", "", "", "", "" },
done = "",
separator = " ",
},
lualine_y = {
{ "searchcount" },
{ "progress", separator = " ", padding = { left = 1, right = 0 } },
{ "location", padding = { left = 0, right = 1 } },
},
lualine_z = {},
},
lualine_y = {
{ "searchcount" },
{ "progress", separator = " ", padding = { left = 1, right = 0 } },
{ "location", padding = { left = 0, right = 1 } },
tabline = {
lualine_a = { "buffers" },
},
lualine_z = {},
},
tabline = {
lualine_a = { "buffers" },
},
},
})
end,
}

View file

@ -0,0 +1,20 @@
return {
"MeanderingProgrammer/render-markdown.nvim",
ft = { "markdown", "norg", "rmd", "org", "codecompanion" },
config = function()
require("render-markdown").setup({
code = {
sign = false,
width = "block",
right_pad = 1,
},
heading = {
sign = false,
icons = {},
},
checkbox = {
enabled = false,
},
})
end,
}

View file

@ -0,0 +1,13 @@
return {
"echasnovski/mini.pairs",
event = "VeryLazy",
config = function()
require("mini.pairs").setup({
modes = { insert = true, command = true, terminal = false },
skip_next = [=[[%w%%%'%[%"%.%`%$]]=],
skip_ts = { "string" },
skip_unbalanced = true,
markdown = true,
})
end,
}

View file

@ -1,15 +1,14 @@
return {
{
"loctvl842/monokai-pro.nvim",
priority = 1000,
opts = {
"loctvl842/monokai-pro.nvim",
priority = 10000,
lazy = false,
dependencies = {
"echasnovski/mini.icons",
},
config = function()
require("monokai-pro").setup({
filter = "classic",
},
},
{
"LazyVim/LazyVim",
opts = {
colorscheme = "monokai-pro",
},
},
})
vim.cmd.colorscheme("monokai-pro")
end,
}

View file

@ -1,8 +1,27 @@
return {
"folke/noice.nvim",
opts = {
messages = {
view_search = false,
},
event = "VeryLazy",
dependencies = {
"MunifTanjim/nui.nvim",
},
config = function()
require("noice").setup({
lsp = {
override = {
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
["vim.lsp.util.stylize_markdown"] = true,
["cmp.entry.get_documentation"] = true,
},
},
messages = {
view_search = false,
},
presets = {
bottom_search = true,
command_palette = true,
long_message_to_split = true,
lsp_doc_border = true,
},
})
end,
}

View file

@ -1,19 +1,26 @@
return {
"nvim-treesitter/nvim-treesitter",
opts = {
ensure_installed = {
"bash",
"diff",
"gotmpl",
"helm",
"json",
"lua",
"markdown",
"markdown_inline",
"python",
"regex",
"terraform",
"vim",
},
},
build = ":TSUpdate",
event = "VeryLazy",
config = function()
require("nvim-treesitter.configs").setup({
ensure_installed = {
"bash",
"diff",
"gotmpl",
"hcl",
"helm",
"json",
"lua",
"markdown",
"markdown_inline",
"python",
"regex",
"terraform",
"vim",
},
highlight = { enable = true },
indent = { enable = true },
})
end,
}

View file

@ -1,39 +1,38 @@
return {
"folke/which-key.nvim",
event = "VeryLazy",
opts_extend = { "spec" },
opts = {
preset = "helix",
icons = {
mappings = false,
},
defaults = {},
spec = {
{
mode = { "n", "v" },
{
"<leader>b",
group = "buffer",
expand = function()
return require("which-key.extras").expand.buf()
end,
},
{ "<leader>b", group = "buffer" },
{ "<leader>c", group = "code" },
{ "<leader>f", group = "find" },
{ "<leader>h", group = "history" },
{ "<leader>u", group = "ui" },
{ "<leader><tab>", group = "tabs", hidden = true },
{ "<leader>d", group = "debug", hidden = true },
{ "<leader>dp", group = "profiler", hidden = true },
{ "<leader>gh", group = "hunks", hidden = true },
{ "<leader>q", group = "quit/session", hidden = true },
{ "<leader>s", group = "search", hidden = true },
{ "<leader>t", hidden = true },
{ "<leader>w", hidden = true },
{ "<leader>x", group = "diagnostics/quickfix", hidden = true },
{ "gx", desc = "Open with system app", hidden = true },
config = function()
require("which-key").setup({
preset = "helix",
delay = 300,
icons = {
rules = false,
breadcrumb = "",
separator = "󱦰 ",
group = "󰹍 ",
},
},
},
plugins = {
spelling = {
enabled = false,
},
},
win = {
height = {
max = math.huge,
},
},
spec = {
{
mode = { "n", "v" },
{ "[", group = "previous..." },
{ "]", group = "next..." },
{ "<leader>b", group = "buffer" },
{ "<leader>c", group = "code" },
{ "<leader>f", group = "find" },
{ "<leader>h", group = "history" },
{ "<leader>u", group = "ui" },
},
},
})
end,
}