Skip to content

codam-coding-college/codam-header.nvim

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Codam Header for Neovim

This extension provides the Codam header integration in Neovim. The original 42 re-write is found at 42-header.nvim.

# ************************************************************************** #
#                                                                            #
#                                                        ::::::::            #
#   neovim-codam-header                                :+:    :+:            #
#                                                     +:+                    #
#   By: fras <[email protected]>                 +#+                     #
#                                                   +#+                      #
#   Created: 2024/05/20 16:33:33 by fras          #+#    #+#                 #
#   Updated: 2024/05/26 00:33:49 by fras          ########   odam.nl         #
#                                                                            #
# ************************************************************************** #

✨ Features

  • Command: Stdheader
  • Auto update on save (optional)
  • Supports commentstring
  • Supports Git

🎈 Setup

📦 Packer.nvim
use {
  "f-ras/codam-header.nvim",
  cmd = { "Stdheader" },
  config = function()
    require "codamheader"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

Create a file 'codam-header.lua' in ~/.config/nvim/plugins/ with the following content:

return {
  "f-ras/codam-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("codamheader").setup(opts)
  end,
}

⚙ Options

{
  ---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

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.

Releases

No releases published

Packages

No packages published

Languages

  • Lua 100.0%