summaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua')
-rw-r--r--lua/core/auto.lua29
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 }),