From 4ec198e9de4c29378a9307f739770e71282d5d45 Mon Sep 17 00:00:00 2001 From: Squibid Date: Fri, 30 Dec 2022 12:44:28 -0500 Subject: fix config not working in other dirs. whoops --- lua/core/auto.lua | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 lua/core/auto.lua (limited to 'lua/core/auto.lua') diff --git a/lua/core/auto.lua b/lua/core/auto.lua new file mode 100644 index 0000000..2733b59 --- /dev/null +++ b/lua/core/auto.lua @@ -0,0 +1,79 @@ +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("")' +}) + +-- 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" + }, + command = 'set colorcolumn=0' +}) + +-- disable intent markers in certain files +a.nvim_create_autocmd('FileType', { + pattern = { + 'netrw', + "help", + "term", + "gitcommit", + "packer", + "vim", + "Trouble", + "norg" + }, + command = 'IndentBlanklineDisable' +}) + +-- source and compile lua conf when written +local packer_group = a.nvim_create_augroup('Packer', { clear = true }) +vim.api.nvim_create_autocmd('BufWritePost', { + command = 'source | PackerCompile', + group = packer_group, + pattern = vim.fn.expand '$MYVIMRC', +}) + +-- telescope preview opts +a.nvim_create_autocmd('User', { + pattern = 'TelescopePreviewerLoaded', + command = 'setlocal number', +}) -- cgit v1.2.1