From 092bd64da1af33a8f7a8ebc19e31653e76c652d5 Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Wed, 12 Jan 2022 22:57:04 +0100 Subject: Add autocommands --- lua/config/autocommands.lua | 29 +++++++++++++++++++++++++++++ lua/config/init.lua | 1 + 2 files changed, 30 insertions(+) create mode 100644 lua/config/autocommands.lua diff --git a/lua/config/autocommands.lua b/lua/config/autocommands.lua new file mode 100644 index 0000000..213801a --- /dev/null +++ b/lua/config/autocommands.lua @@ -0,0 +1,29 @@ +-- autocmd! remove all autocommands, if entered under a group it will clear that group + +vim.cmd([[ + augroup _general_settings + autocmd! + autocmd FileType qf,help,man,lspinfo nnoremap q :close + autocmd TextYankPost * silent!lua require('vim.highlight').on_yank({higroup = 'Search', timeout = 200}) + autocmd BufWinEnter * :set formatoptions-=cro + autocmd FileType qf set nobuflisted + augroup end + augroup _git + autocmd! + autocmd FileType gitcommit setlocal wrap + autocmd FileType gitcommit setlocal spell + augroup end + augroup _markdown + autocmd! + autocmd FileType markdown setlocal wrap + autocmd FileType markdown setlocal spell + augroup end + augroup _auto_resize + autocmd! + autocmd VimResized * tabdo wincmd = + augroup end + augroup _alpha + autocmd! + autocmd User AlphaReady set showtabline=0 | autocmd BufUnload set showtabline=2 + augroup end +]]) diff --git a/lua/config/init.lua b/lua/config/init.lua index 638db6f..9343ad3 100644 --- a/lua/config/init.lua +++ b/lua/config/init.lua @@ -15,3 +15,4 @@ require("config.project") require("config.impatient") require("config.alpha") require("config.whichkey") +require("config.autocommands") -- cgit v1.2.3-70-g09d2