~sanchayanmaity/dotfiles

ref: 8fd4ae0da9201cfa5b3331139420e159cea25c6f dotfiles/nvim/.config/nvim/lua/autocmd.lua -rw-r--r-- 1.0 KiB
8fd4ae0dSanchayan Maity fish: Drop all fzf + git related functions 3 months ago
                                                                                
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
vim.api.nvim_create_augroup("custom_group", {clear = true})

local aucmd_dict = {
  TermOpen = {
    {
      group   = "custom_group",
      pattern = "*",
      command = "startinsert"
    },
    {
      group   = "custom_group",
      pattern = "*",
      command = "setlocal listchars= nonumber norelativenumber"
    },
  },
  VimResized = {
    {
      group   = "custom_group",
      pattern = "*",
      command = ":wincmd ="
    }
  },
  InsertEnter = {
    {
      group   = "custom_group",
      pattern = "*",
      command = "setlocal nohlsearch"
    }
  },
  TextYankPost = {
    {
      group   = "custom_group",
      pattern = "*",
      callback = function ()
        require("vim.highlight").on_yank({timeout = 1000})
      end,
    }
  },
  VimLeave = {
    {
      group   = "custom_group",
      pattern = "*",
      command = "set guicursor=a:hor1-blinkon0"
    }
  }
}

for event, opt_tbls in pairs(aucmd_dict) do
  for _, opt_tbl in pairs(opt_tbls) do
    vim.api.nvim_create_autocmd(event, opt_tbl)
  end
end