From d0c2b5f693f08aee5eee986418e507b62a6b036e Mon Sep 17 00:00:00 2001 From: Janis Hutz Date: Fri, 24 Oct 2025 15:28:19 +0200 Subject: [PATCH] [Header] Remove --- nvim/lua/plugins/util/header.lua | 69 -------------------------------- 1 file changed, 69 deletions(-) delete mode 100644 nvim/lua/plugins/util/header.lua diff --git a/nvim/lua/plugins/util/header.lua b/nvim/lua/plugins/util/header.lua deleted file mode 100644 index 14c9cf6..0000000 --- a/nvim/lua/plugins/util/header.lua +++ /dev/null @@ -1,69 +0,0 @@ -return { - "attilarepka/header.nvim", - config = function() - local header = require("header") - local augroup = vim.api.nvim_create_augroup - local autocmd = vim.api.nvim_create_autocmd - local opts = require("utils").opts - - header.setup({ - allow_autocmds = true, - file_name = true, - date_created = true, - date_created_fmt = "%Y-%m-%d %H:%M:%S", - date_modified = true, - date_modified_fmt = "%Y-%m-%d %H:%M:%S", - line_separator = "------", - use_block_header = false, - license_from_file = false, - author_from_git = true, - }) - - vim.keymap.set("n", "h", function() - header.add_headers() - end, opts("Add headers to file")) - - augroup("file-header", { clear = true }) - autocmd("BufWritePre", { - pattern = "*", - callback = function() - if header and header.update_date_modified then - header.update_date_modified() - else - vim.notify_once("header.update_date_modified is not available", vim.log.levels.WARN) - end - end, - group = "file-header", - desc = "Update header's date modified", - }) - - autocmd({ "BufNewFile", "BufReadPost" }, { - pattern = "*", - callback = function() - if not header then - vim.notify_once( - "Could not automatically add header to new file: header module couldn't be found", - vim.log.levels.ERROR - ) - return - end - - local lines = vim.api.nvim_buf_get_lines(0, 0, -1, false) - local is_empty = #lines == 1 and lines[1] == "" - - if header.config.allow_autocmds and is_empty then - local original_fmt = header.config.date_created_fmt - local now = os.date(header.config.date_created_fmt, os.time()) - - -- force add_headers to use the current datetime, otherwise it will show 1970-01-01 - header.config.date_created_fmt = now - header.add_headers() - - header.config.date_created_fmt = original_fmt -- restore the original format - end - end, - group = "file-header", - desc = "Add copyright header to new/empty files", - }) - end, -}