Compare commits
3
Commits
e6087ae1b0
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f40d9f81ea | ||
|
|
9aaccf3ac9 | ||
|
|
8f25a68016 |
@@ -98,7 +98,9 @@ For NeoVim with `init.lua`:
|
|||||||
vim.g.licenser_author = "Your Name"
|
vim.g.licenser_author = "Your Name"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Supported Licenses
|
### Licenses
|
||||||
|
|
||||||
|
#### Supported Licenses
|
||||||
|
|
||||||
vim-licenser includes templates for the following licenses:
|
vim-licenser includes templates for the following licenses:
|
||||||
|
|
||||||
@@ -118,17 +120,7 @@ vim-licenser includes templates for the following licenses:
|
|||||||
|
|
||||||
Use tab completion to see all available licenses: `:Licenser <TAB>`
|
Use tab completion to see all available licenses: `:Licenser <TAB>`
|
||||||
|
|
||||||
### Supported File Types
|
#### Adding New Licenses
|
||||||
|
|
||||||
vim-licenser automatically detects your file type and applies the appropriate
|
|
||||||
comment style. Supported file types include:
|
|
||||||
bash, c, cpp, csharp, css, dart, go, groovy, haskell, html, java, javascript,
|
|
||||||
json, kotlin, lua, matlab, perl, php, python, r, ruby, rust, scala, shell, sql,
|
|
||||||
swift, typescript, typescriptreact, vim, xml, yaml
|
|
||||||
|
|
||||||
For more information, see `:help licenser` after installation.
|
|
||||||
|
|
||||||
## Adding New Licenses
|
|
||||||
|
|
||||||
To add a new license, create a new file in the `licenses` directory with the
|
To add a new license, create a new file in the `licenses` directory with the
|
||||||
name of the license (e.g., `MIT.txt`) and add the license text to the file. The
|
name of the license (e.g., `MIT.txt`) and add the license text to the file. The
|
||||||
@@ -136,6 +128,37 @@ license text can contain the YEAR and AUTHOR placeholders, which will be
|
|||||||
replaced with the current year and the author name when the license header is
|
replaced with the current year and the author name when the license header is
|
||||||
added to the source file.
|
added to the source file.
|
||||||
|
|
||||||
|
### File Types
|
||||||
|
|
||||||
|
#### Supported File Types
|
||||||
|
|
||||||
|
vim-licenser automatically detects your file type and applies the appropriate
|
||||||
|
comment style. Supported file types include:
|
||||||
|
bash, c, cmake, cpp, csharp, css, dart, go, groovy, haskell, html, java,
|
||||||
|
javascript, json, kotlin, lua, matlab, perl, php, python, r, ruby, rust, scala,
|
||||||
|
shell, sql, swift, text, typescript, typescriptreact, vim, xml, yaml
|
||||||
|
|
||||||
|
For more information, see `:help licenser` after installation.
|
||||||
|
|
||||||
|
#### Adding Support for New File Types
|
||||||
|
|
||||||
|
To add support for a new file type, add an entry to the `comment_styles`
|
||||||
|
dictionary in the `plugin/licenser.vim` file. The key should be the file type
|
||||||
|
as recognized by Vim/NeoVim, and the contents should be as follows:
|
||||||
|
|
||||||
|
- `margin`: If the prefix and suffix should be used on their own lines. E.g. in
|
||||||
|
C and C++ the comment style is `/* */`, so the margin should be set to `1`.
|
||||||
|
In Python, the comment style is `#`, so the margin should be set to `0`.
|
||||||
|
- `hashbang`: If the file type supports shebang a line (e.g., `#!/usr/bin/env
|
||||||
|
python3`), set this to `1`. Otherwise, set it to `0`. This is used to
|
||||||
|
determine if the license header should be added after the shebang line.
|
||||||
|
- `prefix`: Comment string to use on the first line. Unused if `margin` is set
|
||||||
|
to `0`.
|
||||||
|
- `middle`: Comment string to use on the middle lines. If `margin` is set to
|
||||||
|
`0`, this will be used on all lines.
|
||||||
|
- `suffix`: Comment string to use on the last line. Unused if `margin` is set to
|
||||||
|
`0`.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
This project is licensed under the Zlib License. See the [LICENSE](LICENSE)
|
This project is licensed under the Zlib License. See the [LICENSE](LICENSE)
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ vim-licenser supports the following filetypes with appropriate comment styles:
|
|||||||
|
|
||||||
bash - Shell script
|
bash - Shell script
|
||||||
c - C language
|
c - C language
|
||||||
|
cmake - CMake Build Script
|
||||||
cpp - C++
|
cpp - C++
|
||||||
csharp - C#
|
csharp - C#
|
||||||
css - Cascading Style Sheets
|
css - Cascading Style Sheets
|
||||||
@@ -82,6 +83,7 @@ vim-licenser supports the following filetypes with appropriate comment styles:
|
|||||||
shell - Shell script
|
shell - Shell script
|
||||||
sql - SQL
|
sql - SQL
|
||||||
swift - Swift
|
swift - Swift
|
||||||
|
text - Plain text
|
||||||
typescript - TypeScript
|
typescript - TypeScript
|
||||||
typescriptreact - TypeScript React (TSX)
|
typescriptreact - TypeScript React (TSX)
|
||||||
vim - Vim script
|
vim - Vim script
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ function! s:GetCommentStyle(filetype) abort
|
|||||||
\ 'shell': {'margin': 0, 'hashbang': 1, 'prefix': '', 'middle': '#', 'suffix': ''},
|
\ 'shell': {'margin': 0, 'hashbang': 1, 'prefix': '', 'middle': '#', 'suffix': ''},
|
||||||
\ 'sql': {'margin': 1, 'hashbang': 0, 'prefix': '/*', 'middle': ' *', 'suffix': ' */'},
|
\ 'sql': {'margin': 1, 'hashbang': 0, 'prefix': '/*', 'middle': ' *', 'suffix': ' */'},
|
||||||
\ 'swift': {'margin': 1, 'hashbang': 0, 'prefix': '/*', 'middle': ' *', 'suffix': ' */'},
|
\ 'swift': {'margin': 1, 'hashbang': 0, 'prefix': '/*', 'middle': ' *', 'suffix': ' */'},
|
||||||
|
\ 'text': {'margin': 0, 'hashbang': 0, 'prefix': '', 'middle': '', 'suffix': ''},
|
||||||
\ 'typescript': {'margin': 1, 'hashbang': 0, 'prefix': '/*', 'middle': ' *', 'suffix': ' */'},
|
\ 'typescript': {'margin': 1, 'hashbang': 0, 'prefix': '/*', 'middle': ' *', 'suffix': ' */'},
|
||||||
\ 'typescriptreact': {'margin': 1, 'hashbang': 0, 'prefix': '/*', 'middle': ' *', 'suffix': ' */'},
|
\ 'typescriptreact': {'margin': 1, 'hashbang': 0, 'prefix': '/*', 'middle': ' *', 'suffix': ' */'},
|
||||||
\ 'vim': {'margin': 0, 'hashbang': 0, 'prefix': '', 'middle': '"', 'suffix': ''},
|
\ 'vim': {'margin': 0, 'hashbang': 0, 'prefix': '', 'middle': '"', 'suffix': ''},
|
||||||
|
|||||||
Reference in New Issue
Block a user