sponsor Vim development Vim logo Vim Book Ad

vim-cpywrite : Generate copyright headers for any open source license

 script karma  Rating 0/0, Downloaded by 76  Comments, bugs, improvements  Vim wiki

created by
Robert Di Pardo
 
script type
utility
 
description
Pass a license identifier to the :CPYwrite command and it will insert the
standard header, if available, at the top of the current buffer.

When g:cpywrite_verbatim_mode is off, licenses with no standard header will
be acknowledged below your author line. Turn on g:cpywrite_verbatim_mode to
use the full license text instead.

This plugin learns your name and email by invoking `git`; it falls back to
your OS user and host names.


Quick Reference
----------------------
:CPYwrite [{spdx_short_name}]

Fetches the license identified by `spdx_short_name` (without quotes)
-- uses the current value of `g:cpywrite_default_license` when no argument is
given -- supports <tab> completion


:CPYwriteDefaultLicense [{spdx_short_name}]

Sets g:cpywrite_default_license to the given SPDX license identifier (without
quotes) and prints the updated value. Use <tab> for name completion.

Simply prints g:cpywrite_default_license when called with no argument.


:CPYwriteToggleMode

Toggles the state of the g:cpywrite_verbatim_mode option and prints a
description of the updated state:

    0 == "standard header/brief"
    1 == "verbatim"


<Plug>(cpywrite)

Does the same as calling :CPYwrite with no argument


{Normal}LH

Maps to <Plug>(cpywrite)


Options
----------
g:cpywrite_verbatim_mode (number; default: 0)

When set to 1, the full license text will be requested, whether or not a
standard header exists. You should only choose this when the license is no
longer than 3-4 paragraphs (e.g. Unlicense, MIT, BSD 1- 2- 3-Clause, etc.)

When set to 0, only standard headers are requested. Licenses with no standard
header will be briefly mentioned below your copyright line.


g:cpywrite_default_license (string; default: 'GPL-3.0-or-later')

Set this to the SPDX identifier of your favourite license. Press <tab> after
the :CPYwriteDefaultLicense or :CPYwrite command for suggestions.


Testing Locally
--------------------
- install vader.vim (vimscript #4832) into your runtime path

- alternatively, run `git clone https://github.com/junegunn/vader.vim.git` and
edit `test/vimrc` by changing

     set rtp+=vader.vim

to

     set rtp+=/path/to/cloned/source/of/vader.vim

- change directories into /your/plugin/path/vim-cpywrite

- issue these commands:

     pip install -r test/requirements.txt
     pytest -v
     vim -ENsu test/vimrc -c '+Vader! test/vader/*' > /dev/null
 
install details
Make sure your environment has the requirements listed at https://github.com/rdipardo/vim-cpywrite#requirements

For a detailed installation guide, refer to https://github.com/rdipardo/vim-cpywrite#installation
 

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
vim-cpywrite-0.2.0.tar.gz 0.2.0 2020-08-14 7.4 Robert Di Pardo Improved startup time
vim-cpywrite-0.1.1.tar.gz 0.1.1 2020-07-26 7.4 Robert Di Pardo New commands to get/set global options
vim-cpywrite.tar.gz 0.1.0 2020-06-13 7.4 Robert Di Pardo Initial upload
ip used for rating: 18.204.55.168

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.
   
OSDN.net Logo