my neovim config, who would've thought
1local u = require "core.utils"
2
3u.aucmd("TextYankPost", {
4 group = u.augroup "highlight_yank",
5 callback = function()
6 vim.hl.on_yank()
7 end,
8})
9
10u.aucmd("VimResized", {
11 group = u.augroup "resize_splits",
12 callback = function()
13 vim.cmd "tabdo wincmd ="
14 vim.cmd("tabnext " .. vim.fn.tabpagenr())
15 end,
16})
17
18u.aucmd("FileType", {
19 group = u.augroup "help",
20 pattern = { "help", "man" },
21 command = "wincmd L",
22})
23
24u.aucmd("FileType", {
25 group = u.augroup "formatoptions",
26 callback = function()
27 vim.opt.formatoptions:remove {
28 "c", -- autowrap comments using textwidth with leader
29 "r", -- don't auto-insert comment leader on enter in insert
30 "o", -- don't auto-insert comment leader on o/O in normal
31 "n", -- don't recognized numbered lists
32 "2", -- don't use the indent of second paragraph line
33 }
34
35 vim.opt.formatoptions:append {
36 "l", -- long lines not broken in insert mode
37 "1", -- don't break a line after a one-letter word
38 }
39 end,
40})
41
42u.aucmd("User", {
43 pattern = "OilActionsPost",
44 callback = function(ev)
45 if ev.data.actions.type == "move" then
46 Snacks.rename.on_rename_file(
47 ev.data.actions.src_url,
48 ev.data.actions.dest_url
49 )
50 end
51 end,
52})