vim-cpywrite : Generate copyright headers for any open source license
script karma |
Rating 0/0,
Downloaded by 396 |
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 current state:
0 == "standard header/brief"
1 == "verbatim"
:CPYwriteToggleFilename
Toggles the state of the g:cpywrite#hide_filename option and prints a
description of the current state:
0 == "showing"
1 == "hidden"
<Plug>(cpywrite)
Does the same as calling :CPYwrite with no argument
{Normal}LH
Maps to <Plug>(cpywrite)
Options
----------
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.
g:cpywrite#verbatim_mode (number; default: 0)
When set to a non-zero value, 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#hide_filename (number; default: 0)
When set to a non-zero value, hides the name of the current buffer from the
license header in all modes. Otherwise, the buffer's name will appear on the
first line.
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 |
|
script versions (upload new version)
Click on the package to download.
ip used for rating: 3.236.228.250
|