diff options
author | Squibid <me@zacharyscheiman.com> | 2022-12-30 12:42:17 -0500 |
---|---|---|
committer | Squibid <me@zacharyscheiman.com> | 2022-12-30 12:42:17 -0500 |
commit | eaa58ff6184e6b0bb3abf03d2314864795a13fbd (patch) | |
tree | 01c211d0c668d90da20b2c6a678b9d40b09ff20f /core/auto.lua | |
parent | 65a03860fbf2216efd8f24e295c70e8027608d72 (diff) | |
download | nvim-eaa58ff6184e6b0bb3abf03d2314864795a13fbd.tar.gz nvim-eaa58ff6184e6b0bb3abf03d2314864795a13fbd.tar.bz2 nvim-eaa58ff6184e6b0bb3abf03d2314864795a13fbd.zip |
reorganize to multi file config and switch to lazy.nvim for plugins
Diffstat (limited to 'core/auto.lua')
-rw-r--r-- | core/auto.lua | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/core/auto.lua b/core/auto.lua new file mode 100644 index 0000000..2733b59 --- /dev/null +++ b/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("<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" + }, + 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 <afile> | PackerCompile', + group = packer_group, + pattern = vim.fn.expand '$MYVIMRC', +}) + +-- telescope preview opts +a.nvim_create_autocmd('User', { + pattern = 'TelescopePreviewerLoaded', + command = 'setlocal number', +}) |