(neovim) Go back to LazyVim, as it's blazingy fast.

This commit is contained in:
Bartek Stalewski 2025-07-13 01:14:36 +02:00
parent 977453fa05
commit 737fb45fac
Signed by: ftpd
SSH key fingerprint: SHA256:vGQiaNJcfUMLt3wF58+Zx15C6SpRDA9spUeggjVY8Yo
48 changed files with 644 additions and 508 deletions

View file

@ -20,6 +20,7 @@ vim.api.nvim_create_autocmd({ "BufReadPre" }, {
vim.api.nvim_set_hl(0, "ColorColumn", { bg = "#770000" })
vim.api.nvim_set_hl(0, "DiffChange", { bg = "NONE", fg = "#e7c547" })
vim.api.nvim_set_hl(0, "DiffText", { bg = "NONE", fg = "#ff8700" })
vim.api.nvim_set_hl(0, "SpellBad", { bg = "#770000", fg = "#ffffff" })
vim.api.nvim_set_hl(0, "Visual", { bg = "#0094d8", fg = "#ffffff" })
end,
})
@ -36,65 +37,3 @@ 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

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

View file

@ -1,25 +1,62 @@
vim.g.mapleader = " "
vim.g.maplocalleader = "\\"
-- 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
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>`")
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", "<C-a>", "<esc>I")
map("i", "<C-e>", "<esc>A")
map("v", "<leader>/", "gc", { desc = "toggle comments", remap = true })
map("n", "<esc><cr>", "<cmd>wqa<cr>", { desc = "save and exit", remap = true })
map("n", "<esc><esc><cr>", "<cmd>wqa<cr>", { desc = "save and exit", remap = true })
map("n", "<tab>", "<C-w>w", { desc = "switch pane", remap = true })
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", "+", ":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 })
@ -33,7 +70,7 @@ map("n", "<leader>bn", "<cmd>enew<CR>", { desc = "buffer create", 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()
@ -51,12 +88,6 @@ 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")')
@ -65,10 +96,15 @@ 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 })
end, { desc = "Terminal", remap = true })
map("n", "<leader>s", "<cmd>set hlsearch!<cr>", { desc = "Toggle hlsearch", 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

@ -0,0 +1,55 @@
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,
},
})