sponsor Vim development Vim logo Vim Book Ad

Licenses : Provides commands to add licenses at the top of the buffer

 script karma  Rating 10/4, Downloaded by 1698  Comments, bugs, improvements  Vim wiki

created by
Antoni Boucher
 
script type
utility
 
description
This plugin provides commands to insert licenses at the top of the buffer.
If the license is already at the top of the buffer, nothing is added.
This plugin works for the most popular programming languages, including
C, Java, Objective-C, C++, C#, PHP, Python, JavaScript, Ruby, Perl, Asm and Haskell.
The HTML and CSS languages are also supported.
It may work for other languages.

There are currently more than 10 licenses, and you can add your own.
To do so, copy the license text in ~/.vim/licenses/licenseFile.txt.
Then add a command for this license:

    command! License call InsertLicense('licenseFile')

If your license file contains a <year> tag, it will be automatically
replaced by the current year.

The <name of copyright holder> tag will be automatically replaced by the
content of the g:licenses_copyright_holders_name variable (if not empty), so that
the copyright holder's name will be automatically added to the license.
Thus, you may want to add such a line to you .vimrc:

let g:licenses_copyright_holders_name = 'Last Name, First Name <my@email.com>'

And the <name of author> tag will be replaced by the content of the
g:licenses_authors_name variable (if not empty).

This way you can autocomplete the license template with, for example, the company
you work for as the copyright holder, and you as the author. Or you can set
yourself as the copyright holder, and thus your name will be next to the year.

If you do not want this plugin to create all these commands, you may
restrict to the licenses you want by using the g:licenses_default_commands
option. For instance, to have this plugin add only a command for the GNU GPL,
Mit and Foobar licenses, use this:

let g:licenses_default_commands = ['gpl', 'mit', 'foobar']

Commands:
:Affero
    Add the GNU Affero license to the buffer.

:Apache
    Add the Apache License 2.0 to the buffer.

:Bsd2
    Add the BSD 2-Clause "New" or "Revised" license to the buffer.

:Bsd3
    Add the BSD 3-Clause "Simplified" or "FreeBSD" license to the buffer.

:Epl
    Add the Eclipse Public License to the buffer.

:Gfdl
    Add the GNU Free Documentation License (FDL) to the buffer.

:Gpl
    Add the GNU General Public License (GPL) version 3.0 to the buffer.

:Gplv2
    Add the GNU General Public License (GPL) version 2.0 to the buffer.

:Lgpl
    Add the GNU "Lesser" General Public License (LGPL) license to the buffer.

:Mit
    Add the MIT license to the buffer.

:Mpl
    Add the Mozilla Public License 2.0 to the buffer.

:Unlicense
    Add the Unlicense to the buffer.

:Wtfpl
    Add the Do What The Fuck You Want To Public License (WTFPL) to the buffer.

:Zlib
    Add the Zlib License to the buffer.

Settings:

The g:licenses_copyright_holders_name option

The name of the copyright holder to automatically insert in the buffer in the license.

The g:licenses_authors_name option

The author name to automatically insert in the buffer in the license.

The g:licenses_default_commands option

Choose what commands to create for the listed licenses.

Git repository:

https://github.com/antoyo/vim-licenses
 
install details
1. Download the licenses.zip file and unzip the files to the $HOME/.vim directory. After this step,
    you should have the following files and directories (the directory structure should be preserved):

    doc/licenses.txt                         - documentation (help) file
    licenses/                                     - licenses directory
    plugin/licenses.vim                  - main licenses plugin file
    test/test_insert_license.vim    - The plugin unit tests
    LICENSE                                   - The licenses plugin license

2. Change to the $HOME/.vim/doc directory, start Vim and run the ":helptags ." command
     to process the licenses help file. Without this step, you cannot jump to the licenses help topics.
3. Restart Vim.
4. You can now use one of the commands above to add a license to the buffer. You can
     use the ":help licenses" command to get more information about using the licenses plugin.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
licenses.zip 0.5 2016-09-17 7.0 Antoni Boucher This version breaks backward compatibility!
Please update your configuration according to the documentation.

Added new licenses.
Removed trailing spaces in the inserted licenses.
Fixed bug to avoid overriding the alternate buffer.
Added copyright holder variable (breaks backward compatibility).
licenses.zip 0.4 2014-07-01 7.0 Antoni Boucher Added new licenses.
Added an option to specify the default license commands to create.
licenses.zip 0.3 2014-05-19 7.0 Antoni Boucher Added many new licenses.
Created better comments option parser to support more languages.
Added an option to set the author's name instead of having to manually change the license text files.
The error shown when no <year> tag was in the license text is now hidden.
Added unit tests.
licenses.zip 0.2 2014-02-24 7.0 Antoni Boucher Added support for Windows.
licenses.zip 0.1 2014-02-23 7.0 Antoni Boucher Initial upload
ip used for rating: 3.145.119.199

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github