This commit is contained in:
Greg 2026-03-23 15:07:00 +02:00
parent 9885f851ab
commit fed986e646
8 changed files with 18 additions and 40 deletions

View file

@ -47,23 +47,11 @@ vim.api.nvim_create_autocmd("BufReadPost", {
}) })
local group = vim.api.nvim_create_augroup("AutoRestartOnConfigChange", { clear = true }) local group = vim.api.nvim_create_augroup("AutoRestartOnConfigChange", { clear = true })
local notify_file = vim.fn.stdpath("cache") .. "/.restart_notify"
vim.api.nvim_create_autocmd("VimEnter", {
group = group,
callback = function()
if vim.fn.filereadable(notify_file) == 1 then
vim.notify("Neovim restarted successfully!", vim.log.levels.INFO)
os.remove(notify_file)
end
end,
})
vim.api.nvim_create_autocmd("BufWritePost", { vim.api.nvim_create_autocmd("BufWritePost", {
group = group, group = group,
pattern = vim.fn.stdpath("config") .. "/**", pattern = vim.fn.stdpath("config") .. "/**",
callback = function() callback = function()
vim.fn.writefile({}, notify_file)
vim.cmd("AutoSession save") vim.cmd("AutoSession save")
vim.cmd("restart") vim.cmd("restart")
end, end,

View file

@ -49,21 +49,8 @@ map("n", "<C-Tab>", "<cmd>e #<cr>", { desc = "Switch to Other Buffer" })
map("n", "<S-h>", ":bprevious<CR>", { desc = "Previous buffer" }) map("n", "<S-h>", ":bprevious<CR>", { desc = "Previous buffer" })
map("n", "<S-l>", ":bnext<CR>", { desc = "Next buffer" }) map("n", "<S-l>", ":bnext<CR>", { desc = "Next buffer" })
map("v", "<C-r>", function() map({ "v", "n" }, "<leader>sr", function()
-- get contents of visual selection require("grug-far").open({ transient = true, prefills = { paths = vim.fn.expand("%") } })
-- handle unpack deprecation
table.unpack = table.unpack or unpack
local function get_visual()
local _, ls, cs = table.unpack(vim.fn.getpos("v"))
local _, le, ce = table.unpack(vim.fn.getpos("."))
return vim.api.nvim_buf_get_text(0, ls - 1, cs - 1, le - 1, ce, {})
end
local pattern = table.concat(get_visual())
-- escape regex and line endings
pattern = vim.fn.substitute(vim.fn.escape(pattern, "^$.*\\/~[]"), "\n", "\\n", "g")
-- send parsed substitution command to command line
vim.api.nvim_input("<Esc>:%s/" .. pattern .. "//<Left>")
end) end)
-- diagnostics -- diagnostics
@ -104,9 +91,6 @@ end, { desc = "Code actions" })
-- https://github.com/neovim/neovim/issues/28004 -- https://github.com/neovim/neovim/issues/28004
map("n", "<leader>rn", function() map("n", "<leader>rn", function()
vim.lsp.buf.rename() vim.lsp.buf.rename()
vim.defer_fn(function()
vim.cmd("wa")
end, 100)
end, { desc = "Rename symbols" }) end, { desc = "Rename symbols" })
-- Move lines -- Move lines

View file

@ -1,5 +1,6 @@
-- space as a leader key -- space as a leader key
vim.g.mapleader = " " vim.g.mapleader = " "
vim.g.maplocalleader = " "
-- flush buffer on focus change -- flush buffer on focus change
vim.g.autowrite = "on" vim.g.autowrite = "on"

View file

@ -2,7 +2,4 @@ vim.pack.add({ "https://github.com/windwp/nvim-autopairs" })
local Autopairs = require("nvim-autopairs") local Autopairs = require("nvim-autopairs")
Autopairs.setup() Autopairs.setup({})

View file

@ -16,3 +16,5 @@ require("plugins.aerial")
require("plugins.i18n") require("plugins.i18n")
require("plugins.blink") require("plugins.blink")
require("plugins.session") require("plugins.session")
require("plugins.markdown")
require("plugins.grug")

View file

@ -28,7 +28,6 @@ vim.lsp.enable({
"tailwindcss", "tailwindcss",
"html", "html",
"cssls", "cssls",
"emmet_language_server",
"lua_ls", "lua_ls",
"tsgo", "tsgo",
"codebook", "codebook",

View file

@ -10,7 +10,6 @@ local lsps = {
"tailwindcss-language-server", "tailwindcss-language-server",
"html-lsp", "html-lsp",
"css-lsp", "css-lsp",
"emmet-language-server",
"lua-language-server", "lua-language-server",
"codebook", "codebook",
} }

View file

@ -14,7 +14,7 @@
"src": "https://github.com/rmagatti/auto-session" "src": "https://github.com/rmagatti/auto-session"
}, },
"blink.cmp": { "blink.cmp": {
"rev": "f22f66eb7c4d037ed523a78b27ee235b7bc9a1f4", "rev": "612f4bd2bc29d9e7dc7be1dde960908951bedad1",
"src": "https://github.com/saghen/blink.cmp" "src": "https://github.com/saghen/blink.cmp"
}, },
"conform.nvim": { "conform.nvim": {
@ -29,6 +29,10 @@
"rev": "6cd7280adead7f586db6fccbd15d2cac7e2188b9", "rev": "6cd7280adead7f586db6fccbd15d2cac7e2188b9",
"src": "https://github.com/rafamadriz/friendly-snippets" "src": "https://github.com/rafamadriz/friendly-snippets"
}, },
"grug-far.nvim": {
"rev": "dc4684e163971bb1f5bfb93fbd4bb3e892bf9b15",
"src": "https://github.com/MagicDuck/grug-far.nvim"
},
"i18n.nvim": { "i18n.nvim": {
"rev": "128959499a9425bb4f1a5574fd92a23be00cb442", "rev": "128959499a9425bb4f1a5574fd92a23be00cb442",
"src": "https://github.com/yelog/i18n.nvim" "src": "https://github.com/yelog/i18n.nvim"
@ -43,7 +47,7 @@
"src": "https://github.com/rebelot/kanagawa.nvim" "src": "https://github.com/rebelot/kanagawa.nvim"
}, },
"lazydev.nvim": { "lazydev.nvim": {
"rev": "5231c62aa83c2f8dc8e7ba957aa77098cda1257d", "rev": "ff2cbcba459b637ec3fd165a2be59b7bbaeedf0d",
"src": "https://github.com/folke/lazydev.nvim" "src": "https://github.com/folke/lazydev.nvim"
}, },
"lualine.nvim": { "lualine.nvim": {
@ -63,7 +67,7 @@
"src": "https://github.com/windwp/nvim-autopairs" "src": "https://github.com/windwp/nvim-autopairs"
}, },
"nvim-lspconfig": { "nvim-lspconfig": {
"rev": "0203a9608d63eda57679b01e69f33a7b4c34b0d1", "rev": "841c6d4139aedb8a3f2baf30cef5327371385b93",
"src": "https://github.com/neovim/nvim-lspconfig" "src": "https://github.com/neovim/nvim-lspconfig"
}, },
"nvim-surround": { "nvim-surround": {
@ -83,12 +87,16 @@
"rev": "b9fd5226c2f76c951fc8ed5923d85e4de065e509", "rev": "b9fd5226c2f76c951fc8ed5923d85e4de065e509",
"src": "https://github.com/nvim-lua/plenary.nvim" "src": "https://github.com/nvim-lua/plenary.nvim"
}, },
"render-markdown.nvim": {
"rev": "e3c18ddd27a853f85a6f513a864cf4f2982b9f26",
"src": "https://github.com/MeanderingProgrammer/render-markdown.nvim"
},
"smear-cursor.nvim": { "smear-cursor.nvim": {
"rev": "c85bdbb25db096fbcf616bc4e1357bd61fe2c199", "rev": "c85bdbb25db096fbcf616bc4e1357bd61fe2c199",
"src": "https://github.com/sphamba/smear-cursor.nvim" "src": "https://github.com/sphamba/smear-cursor.nvim"
}, },
"snacks.nvim": { "snacks.nvim": {
"rev": "9912042fc8bca2209105526ac7534e9a0c2071b2", "rev": "e6fd58c82f2f3fcddd3fe81703d47d6d48fc7b9f",
"src": "https://github.com/folke/snacks.nvim" "src": "https://github.com/folke/snacks.nvim"
}, },
"tokyonight.nvim": { "tokyonight.nvim": {