From 38fd1b675ead54c5969e808113d21f5bfa277825 Mon Sep 17 00:00:00 2001 From: zymon Date: Sun, 25 Aug 2024 16:06:58 +0200 Subject: [PATCH] autocmds --- init.lua | 1 + lua/znvim/autocmds.lua | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 lua/znvim/autocmds.lua diff --git a/init.lua b/init.lua index eb0c153..9b2d42f 100644 --- a/init.lua +++ b/init.lua @@ -14,3 +14,4 @@ vim.opt.rtp:prepend(lazypath) require("znvim.options") require("lazy").setup("znvim.plugins") require("znvim.keymaps") +require("znvim.autocmds") diff --git a/lua/znvim/autocmds.lua b/lua/znvim/autocmds.lua new file mode 100644 index 0000000..f64089a --- /dev/null +++ b/lua/znvim/autocmds.lua @@ -0,0 +1,16 @@ +vim.api.nvim_create_autocmd("TextYankPost", { -- highlight yanked characters + callback = function() + vim.highlight.on_yank({ timeout = 250 }) + end +}) + +vim.api.nvim_create_autocmd("FileType", { -- close some filetypes with + pattern = { + "help", + "man", + }, + callback = function(event) + vim.bo[event.buf].buflisted = false + vim.keymap.set("n", "q", "quit", { buffer = event.buf, silent = true }) + end, +})