configs/nvim/lua/config/autocmds.lua
Kacper Marzecki e8e5dc1427 asd
2025-10-20 16:52:17 +02:00

26 lines
831 B
Lua

-- Autocmds are automatically loaded on the VeryLazy event
-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua
-- Add any additional autocmds here
--
-- TODO APP MAPPINGS
vim.api.nvim_create_autocmd("BufReadPost", {
pattern = "/tmp/task_edit.txt",
callback = function()
if vim.fn.line("$") == 1 and vim.fn.getline(1) == "" then
vim.cmd("startinsert")
end
end,
})
vim.api.nvim_create_autocmd("FileType", {
pattern = "*",
callback = function()
if vim.fn.expand("%") == "/tmp/task_edit.txt" then
vim.api.nvim_buf_set_keymap(0, "n", "<C-S>", ":wq<CR>", { noremap = true, silent = true })
vim.api.nvim_buf_set_keymap(0, "i", "<C-S>", "<Esc>:wq<CR>", { noremap = true, silent = true })
end
end,
})
-- END TODO APP MAPPINGS