Files
vim-licenser/doc/licenser.txt
T

136 lines
4.4 KiB
Plaintext
Raw Normal View History

2026-07-10 16:14:42 +02:00
*licenser.txt* A plugin for adding license headers to source code files
CONTENTS *licenser-contents*
1. Introduction ...................... |licenser-introduction|
2. Usage ............................ |licenser-usage|
3. Configuration .................... |licenser-configuration|
4. Supported Filetypes .............. |licenser-filetypes|
5. Supported Licenses ............... |licenser-licenses|
6. Examples ......................... |licenser-examples|
INTRODUCTION *licenser-introduction*
vim-licenser is a Vim plugin that makes it easy to add license headers to your
source code files. It supports multiple programming languages and a wide variety
of open-source licenses.
The plugin automatically applies the correct comment style based on the file type
and inserts the license text with proper formatting.
USAGE *licenser-usage*
*:Licenser*
:Licenser {license}
Add a license header to the current file. The {license} parameter should be
the name of one of the supported licenses (see |licenser-licenses|).
Examples:
:Licenser MIT
:Licenser Apache2
:Licenser GPLv3
The license will be inserted at the beginning of the file, respecting any
existing hashbang line (e.g., #!/bin/bash). The current year and author
name are automatically substituted into the license text.
CONFIGURATION *licenser-configuration*
*g:licenser_author*
Set the author name to be used in license headers. If not set, defaults to
"Author Name".
let g:licenser_author = "Your Name"
Example: >
let g:licenser_author = "John Doe"
<
SUPPORTED FILETYPES *licenser-filetypes*
vim-licenser supports the following filetypes with appropriate comment styles:
bash - Shell script
c - C language
cpp - C++
csharp - C#
css - Cascading Style Sheets
dart - Dart
go - Go
groovy - Groovy
haskell - Haskell
html - HTML
java - Java
javascript - JavaScript
json - JSON
kotlin - Kotlin
lua - Lua
matlab - MATLAB
perl - Perl
php - PHP
python - Python
r - R
ruby - Ruby
rust - Rust
scala - Scala
shell - Shell script
sql - SQL
swift - Swift
typescript - TypeScript
typescriptreact - TypeScript React (TSX)
vim - Vim script
xml - XML
yaml - YAML
If your filetype is not in this list, vim-licenser will display an error message.
SUPPORTED LICENSES *licenser-licenses*
vim-licenser includes license 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 (0-Clause MIT)
MPL2 - Mozilla Public License v2.0
Unlicense - Unlicense (public domain)
Zlib - Zlib License
Tab completion is available for license names. Simply type `:Licenser <TAB>` to
see all available licenses.
EXAMPLES *licenser-examples*
Add an MIT license to a Python file: >
:Licenser MIT
Add an Apache 2.0 license to a JavaScript file: >
:Licenser Apache2
Add a GPL v3 license to a Rust file: >
:Licenser GPL
The license will be inserted with the correct comment style for the file type.
For Python, this means using # comments. For Rust, it uses /* */ block comments.
The YEAR placeholder in the license text will be replaced with the current year,
and the AUTHOR placeholder will be replaced with the value of |g:licenser_author|.
==============================================================================
vim:tw=78:ts=8:ft=help:norl: