license-to-vim icon indicating copy to clipboard operation
license-to-vim copied to clipboard

License your code from Vim like a secret agent

license-to-vim

This is a simple Vim plugin that gives you the license to license your code. You can insert a license right into your code without leaving Vim!

The table below lists all licenses currently available in this plugin, as well as the abbreviation used by the plugin and whether the license suggests adding a stub.

License Abbreviation Stub
GNU Affero General Public License 3.0 agpl Yes
Apache License 2.0 apache Yes
Artistic License 2.0 artistic No
Beerware License 42 beer No
Blue Oak Model License 1.0 blue-oak No
Boost Software License 1.0 boost No
BSD 2-Clause License bsd-2 No
BSD 3-Clause License bsd-3 No
CC0 1.0 cc0 Yes
Eclipse Public License 1.0 epl No
European Union Public License 1.2 (EN) eupl No
Good Luck With That Public License glwt No
GNU General Public License 2.0 gpl-2 Yes
GNU General Public License 3.0 gpl-3 Yes
ISC License isc No
GNU Lesser General Public License 2.1 lgpl-2 Yes
GNU Lesser General Public License 3.0 lgpl-3 Yes
MIT License mit No
Mozilla Public License 2.0 mpl No
Microsoft Public License ms-pl No
Microsoft Reciprocal License ms-rl No
Universal Permissive License 1.0 upl No
University of Illinois/NCSA Open Source License uiuc No
Unlicense unlicense No
Do What The Fuck You Want To Public License wtf No

Don't see the license you want? Open an issue and I'd be happy to add it.

To insert the full text of a license at the top of the file, enter :License('abbr'), where abbr refers to the abbreviation in the table. Some licenses require that license stubs be inserted at the top of files. (See the Stub column in the table.) For applicable licenses, you can get the stub using :Stub('abbr'). Calling :Stub on licenses without an available stub causes an error.

Some licenses and stubs require a year, author, and/or email address. This plugin automatically populates those for you! The year always uses the current year, but to set your name and email address, add these lines to your .vimrc or equivalent:

let g:license_author = 'Rick Astley'
let g:license_email = '[email protected]'

Though, unless you happen to be Rick Astley, you should use your own information. You don't need to set these values; if the variables aren't set, the plugin will use the global Git configured username and email if a git executable is found, otherwise the author and email in the inserted license text will appear as {AUTHOR} and {EMAIL}, respectively.

Installation

If you don't have a preferred installation method, I recommend installing Vim Plug. Then just add

Plug 'ararslan/license-to-vim'

to your .vimrc or equivalent and submit :source % then :PlugInstall.

License

Copyright (C) 2016, Alex Arslan. Distributed under the same terms as Vim itself. See :help license.