summaryrefslogtreecommitdiffstats
path: root/lua/core/auto.lua
blob: 2403c5e9e24a02068384244805e707e06fab34a5 (plain) (blame)
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
a.nvim_create_augroup('bufcheck', {clear = true})

-- highlight yanks
a.nvim_create_autocmd('TextYankPost', {
  group    = 'bufcheck',
  pattern  = '*',
  callback = function() vim.highlight.on_yank{timeout = 250} end
})

-- start terminal in insert mode
a.nvim_create_autocmd('TermOpen', {
  group    = 'bufcheck',
  pattern  = '*',
  command  = 'startinsert | set winfixheight'
})

-- close terminal buffers after shell dies
a.nvim_create_autocmd('TermClose', {
  group = 'bufcheck',
  pattern = 'term://*',
  command = 'call nvim_input("<CR>")'
})

-- start git messages in insert mode
a.nvim_create_autocmd('FileType', {
  group    = 'bufcheck',
  pattern  = { 'gitcommit', 'gitrebase', },
  command  = 'startinsert | 1'
})

-- return to last place
a.nvim_create_autocmd('BufRead', {
  pattern = '*',
  command = [[call setpos(".", getpos("'\""))]]
})

-- disable color column in certain files
a.nvim_create_autocmd('FileType', {
  pattern = {
    'netrw',
    "help",
    "term",
    "gitcommit",
    "packer",
    "vim",
    "Trouble",
    "norg",
    "alpha"
  },
  command = 'set colorcolumn=0'
})

-- disable intent markers in certain files
a.nvim_create_autocmd('FileType', {
  pattern = {
    'netrw',
    "help",
    "term",
    "gitcommit",
    "packer",
    "vim",
    "Trouble",
    "norg",
    "alpha"
  },
  command = 'IndentBlanklineDisable'
})

-- disable extra tildas in certain files
a.nvim_create_autocmd('FileType', {
  pattern = '*',
  command = 'hi NonText guifg=bg'
})