aboutsummaryrefslogtreecommitdiff
path: root/.config/nvim/lua/config/autocmd.lua
blob: b1facb82fe6e0cd9e5cbf3e28b981bd24f51b3df (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
local autocmd = vim.api.nvim_create_autocmd   -- Create autocommand

-- Remove end of buffer ~ on buffer enter 
autocmd('BufEnter', {
  pattern = '*',
  command = "let &fcs='eob: '"
})

-- Turn off line numbers on entering terminal
autocmd('TermOpen', {
	pattern = '*',
	command = 'setlocal nonumber norelativenumber'
})

-- Insert mode on entering terminal
autocmd('TermOpen', {
	pattern = '*',
	command = 'startinsert'
})

-- Close terminal buffer on process exit
autocmd('BufLeave', {
  pattern = 'term://*',
  command = 'stopinsert'
})

-- Close terminal buffer on process exit
autocmd('TermClose', {
  pattern = 'term://*',
  command = 'call nvim_input("<CR>")'
})