2026-07-10 14:58:05 +02:00
|
|
|
# vim-licenser
|
|
|
|
|
|
|
|
|
|
A plugin for Vim and NeoVim that helps you add license headers to your source
|
|
|
|
|
code files.
|
|
|
|
|
|
2026-07-10 16:17:51 +02:00
|
|
|
## Installation
|
|
|
|
|
|
|
|
|
|
### Manual Installation
|
|
|
|
|
|
|
|
|
|
1. Clone the repository:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
git clone https://github.com/naortega/vim-licenser.git
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
2. Copy the plugin files to your Vim/NeoVim configuration directory:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
cp -r vim-licenser/plugin/* ~/.vim/plugin/
|
|
|
|
|
cp -r vim-licenser/doc/* ~/.vim/doc/
|
|
|
|
|
cp -r vim-licenser/licenses/* ~/.vim/licenses/
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
For NeoVim, use `~/.config/nvim/` instead of `~/.vim/`.
|
|
|
|
|
|
|
|
|
|
### Using vim-plug
|
|
|
|
|
|
|
|
|
|
Add the following to your `init.vim` or `.vimrc`:
|
|
|
|
|
|
|
|
|
|
```vim
|
|
|
|
|
Plug 'naortega/vim-licenser'
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Then run `:PlugInstall` in Vim/NeoVim.
|
|
|
|
|
|
|
|
|
|
### Using packer.nvim
|
|
|
|
|
|
|
|
|
|
Add the following to your `init.lua`:
|
|
|
|
|
|
|
|
|
|
```lua
|
|
|
|
|
use 'naortega/vim-licenser'
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Then run `:PackerSync` in NeoVim.
|
|
|
|
|
|
|
|
|
|
### Using lazy.nvim
|
|
|
|
|
|
|
|
|
|
Add the following to your `init.lua`:
|
|
|
|
|
|
|
|
|
|
```lua
|
|
|
|
|
{
|
|
|
|
|
'naortega/vim-licenser',
|
|
|
|
|
lazy = true,
|
|
|
|
|
cmd = 'Licenser',
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Using dein.vim
|
|
|
|
|
|
|
|
|
|
Add the following to your `init.vim`:
|
|
|
|
|
|
|
|
|
|
```vim
|
|
|
|
|
call dein#add('naortega/vim-licenser')
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Then run `:call dein#install()` in Vim/NeoVim.
|
|
|
|
|
|
|
|
|
|
### Using Vundle
|
|
|
|
|
|
|
|
|
|
Add the following to your `.vimrc`:
|
|
|
|
|
|
|
|
|
|
```vim
|
|
|
|
|
Plugin 'naortega/vim-licenser'
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Then run `:PluginInstall` in Vim.
|
|
|
|
|
|
2026-07-10 14:58:05 +02:00
|
|
|
## Usage
|
|
|
|
|
|
|
|
|
|
You can add a license header to your source file by running the following
|
|
|
|
|
command in Vim or NeoVim:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
:Licenser <license>
|
|
|
|
|
```
|
|
|
|
|
|
2026-07-10 16:17:51 +02:00
|
|
|
### Configuration
|
|
|
|
|
|
|
|
|
|
Set your author name in your `init.vim` or `.vimrc`:
|
|
|
|
|
|
|
|
|
|
```vim
|
|
|
|
|
let g:licenser_author = "Your Name"
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
For NeoVim with `init.lua`:
|
|
|
|
|
|
|
|
|
|
```lua
|
|
|
|
|
vim.g.licenser_author = "Your Name"
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Supported Licenses
|
|
|
|
|
|
|
|
|
|
vim-licenser includes templates for the following licenses:
|
|
|
|
|
|
|
|
|
|
- AGPL (GNU Affero General Public License v3)
|
|
|
|
|
- Apache2 (Apache License 2.0)
|
|
|
|
|
- BSD2 (BSD 2-Clause License)
|
|
|
|
|
- BSD3 (BSD 3-Clause License)
|
|
|
|
|
- GPL (GNU General Public License v3)
|
|
|
|
|
- GPLv2 (GNU General Public License v2)
|
|
|
|
|
- ISC (ISC License)
|
|
|
|
|
- LGPL (GNU Lesser General Public License v3)
|
|
|
|
|
- MIT (MIT License)
|
|
|
|
|
- MIT0 (MIT No Attribution License)
|
|
|
|
|
- MPL2 (Mozilla Public License v2.0)
|
|
|
|
|
- Unlicense (public domain)
|
|
|
|
|
- Zlib (Zlib License)
|
|
|
|
|
|
|
|
|
|
Use tab completion to see all available licenses: `:Licenser <TAB>`
|
|
|
|
|
|
|
|
|
|
### Supported File Types
|
|
|
|
|
|
|
|
|
|
vim-licenser automatically detects your file type and applies the appropriate
|
|
|
|
|
comment style. Supported file types include:
|
|
|
|
|
bash, c, cpp, csharp, css, dart, go, groovy, haskell, html, java, javascript,
|
|
|
|
|
json, kotlin, lua, matlab, perl, php, python, r, ruby, rust, scala, shell, sql,
|
|
|
|
|
swift, typescript, typescriptreact, vim, xml, yaml
|
|
|
|
|
|
|
|
|
|
For more information, see `:help licenser` after installation.
|
|
|
|
|
|
2026-07-10 14:58:05 +02:00
|
|
|
## Adding New Licenses
|
|
|
|
|
|
|
|
|
|
To add a new license, create a new file in the `licenses` directory with the
|
|
|
|
|
name of the license (e.g., `MIT.txt`) and add the license text to the file. The
|
|
|
|
|
license text can contain the YEAR and AUTHOR placeholders, which will be
|
|
|
|
|
replaced with the current year and the author name when the license header is
|
|
|
|
|
added to the source file.
|
|
|
|
|
|
|
|
|
|
## License
|
|
|
|
|
|
|
|
|
|
This project is licensed under the Zlib License. See the [LICENSE](LICENSE)
|
|
|
|
|
file for details.
|