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
|
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>")'
})
-- Replacement for vim-highlightedyank
autocmd('TextYankPost', {
group = vim.api.nvim_create_augroup('highlight_yank', {}),
desc = 'Hightlight selection on yank',
pattern = '*',
callback = function()
vim.highlight.on_yank { higroup = 'IncSearch', timeout = 500 }
end,
})
|