File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed
Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ The script comes with the following defaults:
4949 use_block_header = true ,
5050 copyright_text = nil ,
5151 license_from_file = false ,
52+ author_from_git = false ,
5253}
5354```
5455
@@ -82,6 +83,7 @@ require("header").setup({
8283 " All rights reserved."
8384 },
8485 license_from_file = false ,
86+ author_from_git = false ,
8587})
8688```
8789
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ header.config = {
1818 use_block_header = true ,
1919 copyright_text = nil ,
2020 license_from_file = false ,
21+ author_from_git = false ,
2122}
2223
2324header .constants = {
@@ -333,6 +334,13 @@ local function prepare_headers(callback)
333334 -- Format modified_time as a human-readable string
334335 creation_date = os.date (header .config .date_created_fmt , creation_date )
335336
337+ if header .config .author_from_git then
338+ local result = vim .fn .systemlist (" git config user.name" )
339+ if vim .v .shell_error == 0 and # result > 0 then
340+ header .config .author = result [1 ]
341+ end
342+ end
343+
336344 local headers = {}
337345 if header .config .file_name then
338346 table.insert (headers , header .constants .file_name .. " " .. file_name )
You can’t perform that action at this time.
0 commit comments