diff options
author | Squibid <me@zacharyscheiman.com> | 2023-06-26 11:40:06 -0400 |
---|---|---|
committer | Squibid <me@zacharyscheiman.com> | 2023-06-26 11:40:06 -0400 |
commit | fad8040f48aa9da8ddb889076eff2a0bf610849e (patch) | |
tree | b0ab9a51cb380a76b7b2376724b8a35d4204be4f /lua/core/auto.lua | |
parent | 887d08fa5a2571bae3130d7811850b30f50b2c04 (diff) | |
download | nvim-fad8040f48aa9da8ddb889076eff2a0bf610849e.tar.gz nvim-fad8040f48aa9da8ddb889076eff2a0bf610849e.tar.bz2 nvim-fad8040f48aa9da8ddb889076eff2a0bf610849e.zip |
new autocmds and change comment position in auto.lua
Diffstat (limited to '')
-rw-r--r-- | lua/core/auto.lua | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/lua/core/auto.lua b/lua/core/auto.lua index 3e517ab..8206ad6 100644 --- a/lua/core/auto.lua +++ b/lua/core/auto.lua @@ -4,8 +4,7 @@ end a.nvim_create_augroup('bufcheck', {clear = true}) --- highlight yanks -auto('TextYankPost', { +auto('TextYankPost', { -- highlight yanks group = 'bufcheck', pattern = '*', callback = function() @@ -13,21 +12,18 @@ auto('TextYankPost', { end }) --- start git messages in insert mode -auto('FileType', { +auto('FileType', { -- start git messages in insert mode group = 'bufcheck', pattern = { 'gitcommit', 'gitrebase', }, command = 'startinsert | 1' }) --- return to last place -auto('BufRead', { +auto('BufRead', { -- return to last place pattern = '*', command = [[call setpos(".", getpos("'\""))]] }) --- start terminal in insert mode -auto('TermOpen', { +auto('TermOpen', { -- start terminal in insert mode group = 'bufcheck', pattern = '*', callback = function() @@ -37,8 +33,7 @@ auto('TermOpen', { end }) --- close terminal buffers after shell dies -auto('TermClose', { +auto('TermClose', { -- close terminal buffers after shell dies group = 'bufcheck', pattern = 'term://*', callback = function() @@ -47,6 +42,20 @@ auto('TermClose', { end }) +auto('InsertEnter', { -- toggle things when entering insert mode + group = 'bufcheck', + callback = function() + o.colorcolumn = { 80 } + end +}) + +auto('InsertLeave', { -- toggle things when exiting insert mode + group = 'bufcheck', + callback = function() + o.colorcolumn = { 0 } + end +}) + auto('BufWritePre', { -- make dirs when they don't exist pattern = '*', group = vim.api.nvim_create_augroup('auto_create_dir', { clear = true }), |