all repos

init.lua @ main

my nvim config

init.lua/lua/core/autocmd.lua(view raw)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
local u = require "core.utils"

u.aucmd("TextYankPost", {
  group = u.augroup "highlight_yank",
  callback = function()
    vim.hl.on_yank()
  end,
})

u.aucmd("VimResized", {
  group = u.augroup "resize_splits",
  callback = function()
    vim.cmd "tabdo wincmd ="
    vim.cmd("tabnext " .. vim.fn.tabpagenr())
  end,
})

u.aucmd("FileType", {
  group = u.augroup "help",
  pattern = { "help", "man" },
  command = "wincmd L",
})

u.aucmd("FileType", {
  group = u.augroup "formatoptions",
  callback = function()
    vim.opt.formatoptions:remove {
      "c", -- autowrap comments using textwidth with leader
      "r", -- don't auto-insert comment leader on enter in insert
      "o", -- don't auto-insert comment leader on o/O in normal
      "n", -- don't recognized numbered lists
      "2", -- don't use the indent of second paragraph line
    }

    vim.opt.formatoptions:append {
      "l", -- long lines not broken in insert mode
      "1", -- don't break a line after a one-letter word
    }
  end,
})

u.aucmd("User", {
  pattern = "OilActionsPost",
  callback = function(ev)
    if ev.data.actions.type == "move" then
      Snacks.rename.on_rename_file(
        ev.data.actions.src_url,
        ev.data.actions.dest_url
      )
    end
  end,
})