Skip to content

Commit

Permalink
Release 0.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rdipardo committed Jan 11, 2022
1 parent 4aed209 commit 074d56f
Show file tree
Hide file tree
Showing 4 changed files with 134 additions and 47 deletions.
60 changes: 57 additions & 3 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,55 @@ CHANGELOG
:depth: 1
:backlinks: top

0.7.0
======
**(2022-01-10)**

Fixed
-----
.. _fixes-in-070:

- copyright now appears in the correct place in GPL v1 and v2 license headers.
Previously, an overly permissive regex would match the historical ZIP code of
the Free Software Foundation (a regression dating from version `0.4.0`_ )
- makefiles and Dockerfiles with no extension are no longer treated as shell scripts
- generic dotfiles no longer match with Vim script
- running the ``cpywrite`` module as a script will not make a backup of newly created files
- new files generated by the ``cpywrite`` module will not be padded with null bytes
- unit tests no longer hang on neovim

Changed
-------
.. _changes-in-070:

- by default, executable script files no longer have their shebang lines replaced with a
template. Setting ``g:cpywrite#preserve_shebangs`` to ``0`` restores the old behaviour
- the ``&syntax`` property is now always considered when detecting file type

Added
-----
- new ``:CPYwriteKeepShebangs`` command for setting ``g:cpywrite#preserve_shebangs``
- new supported file types:

+ Config
+ Dockerfile
+ (DOS) INI
+ Makefile
+ Properties
+ reStructuredText
+ Xresources (detected by ``&syntax``, i.e., works in vim sessions only)
+ YAML

**Note.**

Typical make- and Dockerfiles with no extension will be prepended with bash-style
``#`` comments as before, *without* a shebang line (see `above <#fixes-in-070>`_).

Makefile extensions ``.mk`` and ``.mak`` will also match the Make file type; the
``.dockerfile`` extension matches the Dockerfile type.

.. _`0.4.0`: https://github.com/rdipardo/vim-cpywrite/commit/d657a99672dc0d1cafc51444cd730203b82baf7f

0.6.0
======
**(2021-10-01)**
Expand All @@ -14,11 +63,15 @@ Fixed
-----
- prevent authorship regex from matching publication dates in the verbatim text
of the Apache 2.0, GD and X11 licenses
- running the ``cpywrite`` module as a Python script will not overwrite
existing files

Added
-----
- new ``g:cpywrite#machine_readable`` option to format license and copyright as
tags; can be set with ``:CPYwriteToggleStyle``
- new ``g:cpywrite#no_anonymous`` option to always state the copyright holder
above Public Domain licenses
above Public Domain licenses; can be set with ``:CPYwriteAllowAnonymous``
- support for DOS Batch files

0.5.0
Expand Down Expand Up @@ -54,10 +107,11 @@ Changed
-------
- the initial value of ``g:cpywrite#default_license`` is now ``'Apache-2.0'``
- drop the `deprecated FreeBSD variant`_ of the BSD 2-Clause License
- detect more styles of authorship template, like a generic range years
- detect more styles of authorship template, like a generic range of years
(e.g. ``<yyyy, yyyy>``), or an actual year that's merely historical
(e.g. copyright notice of the 0BSD). The old matching rules are retained
for the licenses that need them (e.g. the GFDLs, the ECLs, etc.)
for the licenses that need them (e.g. the GFDLs, the ECLs,
`the older GPLs <#fixes-in-070>`_, etc.)

.. _deprecated FreeBSD variant: https://spdx.org/licenses/BSD-2-Clause-FreeBSD

Expand Down
96 changes: 54 additions & 42 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,10 @@ vim-cpywrite

|gh-actions| |current version|

:WARNING: **This branch is for development purposes.**
**End users are advised to checkout a** `release`_ **package**

.. _release: https://github.com/rdipardo/vim-cpywrite/releases

Generate copyright headers for any open source license

.. figure:: https://raw.githubusercontent.com/rdipardo/vim-cpywrite/media/pre/nvim_043_ver_031.gif
:alt: nvim-043-linux-demo
.. figure:: https://raw.githubusercontent.com/rdipardo/vim-cpywrite/media/rel/vim_8.2.4046.gif
:alt: vim-win-x64-demo
:align: center
:width: 900

Expand All @@ -31,7 +26,7 @@ standard header, it's inserted at the top of the current buffer with your
copyright info.

When no standard header is provided, you can either insert a brief license
acknowledgement, or the full license text. (See the ``g:cpywrite#verbatim_mode``
acknowledgment, or the full license text. (See the ``g:cpywrite#verbatim_mode``
option `below <#options>`_.)

This plugin learns your name and email by invoking ``git``. If that fails, the
Expand All @@ -45,6 +40,10 @@ Features
* Python bindings compatible with python 2.7.x or 3.4+, depending on your
platform and (neo)vim version, of course

:NOTE: Python 3.10 requires `neovim 0.6.0`_ or newer.
All vim versions from 7.4 and up should be compatible.
`Bug reports <https://github.com/rdipardo/vim-cpywrite/issues>`_ are welcome.

* Choose from more than 420 licenses (press ``<tab>`` after the ``:CPYwriteDefaultLicense``
or ``:CPYwrite`` command for suggestions)

Expand All @@ -55,6 +54,7 @@ Features
licenses. Vim users may want to add ``set wildmenu`` to their ``.vimrc`` file

.. _completeopt: https://neovim.io/doc/user/options.html#'completeopt'
.. _`neovim 0.6.0`: https://github.com/neovim/neovim/commit/e65b724451ba5f65dfcaf8f8c16afdd508db7359

Quick Reference
===============
Expand All @@ -75,6 +75,9 @@ Commands
| | licence id when called with no argument -- |
| | supports ``<tab>`` completion |
+------------------------------------------------+---------------------------------------------+
|``:CPYwriteKeepShebangs`` | Switches ``g:cpywrite#preserve_shebangs`` |
| | on or off |
+------------------------------------------------+---------------------------------------------+
|``:CPYwriteToggleMode`` | Switches ``g:cpywrite#verbatim_mode`` on or |
| | off |
+------------------------------------------------+---------------------------------------------+
Expand All @@ -99,39 +102,46 @@ Default mappings

Options
-------
+-------------------------------+----------------------------------------------+
|``g:cpywrite#default_license`` | The SPDX identifier of the license to be |
| | fetched by the ``:CPYwrite`` command. |
| | Default: ``'Apache-2.0'`` |
+-------------------------------+----------------------------------------------+
|``g:cpywrite#verbatim_mode`` | When set to a non-zero value, the full |
| | license text will be requested -- 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.). |
| | Default: ``0`` |
+-------------------------------+----------------------------------------------+
|``g:cpywrite#no_anonymous`` | When set to a non-zero value, copyright |
| | information is never omitted, even if the |
| | license implies a Public Domain grant. |
| | Default: ``0`` |
| +----------------------------------------------+
| | Has no effect when |
| | ``g:cpywrite#machine_readable`` is on |
+-------------------------------+----------------------------------------------+
|``g:cpywrite#machine_readable``| When set to a non-zero value, the license |
| | and copyright statement are formatted as |
| | tags. |
| | Default: ``0`` |
| +----------------------------------------------+
| | Overrides ``g:cpywrite#verbatim_mode`` and |
| | ``g:cpywrite#no_anonymous`` |
+-------------------------------+----------------------------------------------+
|``g:cpywrite#hide_filename`` | When set to a non-zero value, hides the name |
| | of the current buffer from the license |
| | header in all modes. |
| | Default: ``0`` |
+-------------------------------+----------------------------------------------+
+----------------------------------+-----------------------------------------------+
| ``g:cpywrite#default_license`` | The SPDX identifier of the license to be |
| | fetched by the ``:CPYwrite`` command. |
| | Default: ``'Apache-2.0'`` |
+----------------------------------+-----------------------------------------------+
| ``g:cpywrite#preserve_shebangs`` | When set to a non-zero value, the license |
| | header is inserted *after* any shebang or |
| | encoding directive (since `0.7.0`_). |
| | Default: ``1`` |
+----------------------------------+-----------------------------------------------+
| ``g:cpywrite#verbatim_mode`` | When set to a non-zero value, the full |
| | license text will be requested -- 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.). |
| | Default: ``0`` |
+----------------------------------+-----------------------------------------------+
| ``g:cpywrite#no_anonymous`` | When set to a non-zero value, copyright |
| | information is never omitted, even if the |
| | license implies a Public Domain grant. |
| | Default: ``0`` |
+----------------------------------+-----------------------------------------------+
| | Has no effect when |
| | ``g:cpywrite#machine_readable`` is on |
+----------------------------------+-----------------------------------------------+
| ``g:cpywrite#machine_readable`` | When set to a non-zero value, the license |
| | and copyright statement are formatted as |
| | tags. |
| | Default: ``0`` |
+----------------------------------+-----------------------------------------------+
| | Overrides ``g:cpywrite#verbatim_mode`` and |
| | ``g:cpywrite#no_anonymous`` |
+----------------------------------+-----------------------------------------------+
| ``g:cpywrite#hide_filename`` | When set to a non-zero value, hides the name |
| | of the current buffer from the license header |
| | in all modes. |
| | Default: ``0`` |
+----------------------------------+-----------------------------------------------+

.. _`0.7.0`: https://github.com/rdipardo/vim-cpywrite/blob/master/CHANGELOG.rst#changes-in-070

Requirements
============
Expand Down Expand Up @@ -217,11 +227,13 @@ Edit your ``~/.vimrc``, ``~/.vim/vimrc``, or ``~/.config/nvim/init.vim``:
Projects like this one
======================

* vim-copyright_ (*not* a fork)
* vim-licenses_, formerly licenses_
* vim-header_
* license-to-vim_
* `license loader`_

.. _vim-copyright: https://github.com/nine2/vim-copyright
.. _vim-licenses: https://github.com/antoyo/vim-licenses
.. _licenses: https://github.com/vim-scripts/Licenses
.. _vim-header: https://github.com/alpertuna/vim-header
Expand Down Expand Up @@ -260,7 +272,7 @@ Distributed under the terms of the MIT license.
.. |current version| image:: https://img.shields.io/github/v/release/rdipardo/vim-cpywrite?logo=vim
:alt: Vim Scripts version

.. _supported programming languages: https://github.com/rdipardo/vim-cpywrite/blob/3db79fd8b4d31c497442ac85bef21f9aac3e27f9/rplugin/pythonx/cpywrite/generator.py#L306
.. _supported programming languages: https://github.com/rdipardo/vim-cpywrite/blob/4d99f7af6a54442055e2c17a3ee12258623b64e9/rplugin/pythonx/cpywrite/generator.py#L320
.. _vim-pathogen: https://github.com/tpope/vim-pathogen#native-vim-package-management
.. _native package directory: https://github.com/vim/vim/blob/03c3bd9fd094c1aede2e8fe3ad8fd25b9f033053/runtime/doc/repeat.txt#L515
.. _DIY plugin management: https://shapeshed.com/vim-packages
Expand Down
23 changes: 21 additions & 2 deletions doc/cpywrite.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@ OPTIONS *cpywrite-options*
Set this to the SPDX identifier of your favourite license. Press <tab> after
the |:CPYwriteDefaultLicense| or |:CPYwrite| command for suggestions.

*g:cpywrite#preserve_shebangs*
`number` (default: 1)

When set to a non-zero value, the license header is inserted after any shebang
line: `#! . . .`, or encoding directive: `# -*- coding: . . . -*-`

When set to 0, shebangs and encoding directives wil be overwritten. A template
shebang line is inserted at the top of perl, python, and shell script files.

*g:cpywrite#verbatim_mode*
`number` (default: 0)
WARNING this option has no effect when |g:cpywrite#machine_readable|
Expand Down Expand Up @@ -131,8 +140,8 @@ license is one of the |Public-Domain-licenses|.
`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.
license header in all modes. Otherwise, the buffer's name will appear above the
license text.

=============================================================================
COMMANDS *cpywrite-commands*
Expand All @@ -154,6 +163,16 @@ quotes) and prints the updated value. Use <tab> for name completion.

Simply prints |g:cpywrite#default_license| when called with no argument.

*:CPYwriteKeepShebangs*
:CPYwriteKeepShebangs

Toggles the state of the |g:cpywrite#preserve_shebangs| option and prints a
description of the current state:
>
0 == "overwrite"
1 == "preserve existing"
<

*:CPYwriteToggleMode*
:CPYwriteToggleMode

Expand Down
2 changes: 2 additions & 0 deletions doc/tags
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
:CPYwrite cpywrite.txt /*:CPYwrite*
:CPYwriteAllowAnonymous cpywrite.txt /*:CPYwriteAllowAnonymous*
:CPYwriteDefaultLicense cpywrite.txt /*:CPYwriteDefaultLicense*
:CPYwriteKeepShebangs cpywrite.txt /*:CPYwriteKeepShebangs*
:CPYwriteToggleFilename cpywrite.txt /*:CPYwriteToggleFilename*
:CPYwriteToggleMode cpywrite.txt /*:CPYwriteToggleMode*
:CPYwriteToggleStyle cpywrite.txt /*:CPYwriteToggleStyle*
Expand All @@ -20,6 +21,7 @@ g:cpywrite#default_license cpywrite.txt /*g:cpywrite#default_license*
g:cpywrite#hide_filename cpywrite.txt /*g:cpywrite#hide_filename*
g:cpywrite#machine_readable cpywrite.txt /*g:cpywrite#machine_readable*
g:cpywrite#no_anonymous cpywrite.txt /*g:cpywrite#no_anonymous*
g:cpywrite#preserve_shebangs cpywrite.txt /*g:cpywrite#preserve_shebangs*
g:cpywrite#verbatim_mode cpywrite.txt /*g:cpywrite#verbatim_mode*
g:cpywrite#version cpywrite.txt /*g:cpywrite#version*
reuse cpywrite.txt /*reuse*

0 comments on commit 074d56f

Please sign in to comment.