diff options
| author | Ariel D'Alessandro <dalessandro.ariel@gmail.com> | 2023-01-22 10:18:07 +0100 |
|---|---|---|
| committer | Ariel D'Alessandro <dalessandro.ariel@gmail.com> | 2023-01-22 10:18:07 +0100 |
| commit | 5455aacdedfb2829f000b2f120a6d5194d1227f8 (patch) | |
| tree | ca73cfdf3b9106aab00c5acb3d239df61e9c43d9 /lua/config/autocmds.lua | |
| parent | bf157b642c2910abae1810c985817e42502000b5 (diff) | |
| download | nvim-conf-5455aacdedfb2829f000b2f120a6d5194d1227f8.tar.gz nvim-conf-5455aacdedfb2829f000b2f120a6d5194d1227f8.zip | |
feat: big change on the structure of the plugins, move several things to config dir
Diffstat (limited to 'lua/config/autocmds.lua')
| -rw-r--r-- | lua/config/autocmds.lua | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/lua/config/autocmds.lua b/lua/config/autocmds.lua new file mode 100644 index 0000000..ee165ee --- /dev/null +++ b/lua/config/autocmds.lua @@ -0,0 +1,39 @@ +-- resize splits if window got resized +vim.api.nvim_create_autocmd({ "VimResized" }, { + callback = function() + vim.cmd("tabdo wincmd =") + end, +}) + +-- close some filetypes with <q> +vim.api.nvim_create_autocmd("FileType", { + pattern = { + "qf", + "help", + "man", + "notify", + "lspinfo", + "spectre_panel", + "startuptime", + "tsplayground", + "PlenaryTestPopup", + }, + callback = function(event) + vim.bo[event.buf].buflisted = false + vim.keymap.set("n", "q", "<cmd>close<cr>", { buffer = event.buf, silent = true }) + end, +}) + +vim.api.nvim_create_autocmd("FileType", { + pattern = { "gitcommit", "markdown" }, + callback = function() + vim.opt_local.wrap = true + vim.opt_local.spell = true + end, +}) + +vim.api.nvim_create_autocmd({"BufWritePre"}, { + callback = function () + vim.cmd([[%s/\s\+$//e]]) + end +}) |