This plugin is whole re-write of 42header in Lua.
- Command:
Stdheader
- Auto update on save (optional)
- Supports
commentstring
- Supports Git
π¦ Packer.nvim
use {
"Diogo-ss/42-header.nvim",
cmd = { "Stdheader" },
config = function()
require "42header"setup {
default_map = true, -- Default mapping <F1> in normal mode.
auto_update = true, -- Update header when saving.
user = "username", -- Your user.
mail = "[email protected]", -- Your mail.
-- add other options.
}
end,
}
π€ Lazy.nvim
{
"Diogo-ss/42-header.nvim",
cmd = { "Stdheader" },
keys = { "<F1>" },
opts = {
default_map = true, -- Default mapping <F1> in normal mode.
auto_update = true, -- Update header when saving.
user = "username", -- Your user.
mail = "[email protected]", -- Your mail.
-- add other options.
},
config = function(_, opts)
require("42header").setup(opts)
end,
}
{
---Max header size (not recommended change).
--length = 80,
---Header margin (not recommended change).
--margin = 5,
---Activate default mapping (e.g. F1).
default_map = true,
---Enable auto-update of headers.
auto_update = true,
---Default user.name.
user = "username",
---Default user.email.
mail = "[email protected]",
---ASCII art.
--asciiart = { "---", "---", ... },
---Git config.
git = {
---Enable Git support.
enabled = false,
---PATH to the Git binary.
bin = "git",
---Use global user.name, otherwise use local user.name.
user_global = true,
---Use global user.email, otherwise use local user.email.
email_global = true,
},
}
user
and mail
can be defined using global variables.
vim.g.user = "username"
vim.g.mail = "[email protected]"
NOTE: The order of priority:
global variables
>git config (if support enabled)
>user config
.