generated from nvimdev/nvim-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 235a633
Showing
9 changed files
with
235 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: Ci | ||
|
||
on: [push] | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Stylua | ||
uses: JohnnyMorganz/stylua-action@v3 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
version: latest | ||
args: --check . | ||
|
||
|
||
docs: | ||
runs-on: ubuntu-latest | ||
name: pandoc to vimdoc | ||
if: ${{ github.ref == 'refs/heads/main' }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: panvimdoc | ||
uses: kdheepak/panvimdoc@main | ||
with: | ||
vimdoc: nvim-plugin-template | ||
treesitter: true | ||
- uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
commit_message: 'chore(doc): auto generate docs' | ||
commit_user_name: "github-actions[bot]" | ||
commit_user_email: "github-actions[bot]@users.noreply.github.com" | ||
commit_author: "github-actions[bot] <github-actions[bot]@users.noreply.github.com>" | ||
|
||
test: | ||
name: Run Test | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: rhysd/action-setup-vim@v1 | ||
id: vim | ||
with: | ||
neovim: true | ||
version: nightly | ||
|
||
- name: luajit | ||
uses: leafo/gh-actions-lua@v10 | ||
with: | ||
luaVersion: "luajit-2.1.0-beta3" | ||
|
||
- name: luarocks | ||
uses: leafo/gh-actions-luarocks@v4 | ||
|
||
- name: run test | ||
shell: bash | ||
run: | | ||
luarocks install luacheck | ||
luarocks install vusted | ||
vusted ./test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
column_width = 100 | ||
line_endings = "Unix" | ||
indent_type = "Spaces" | ||
indent_width = 2 | ||
quote_style = "AutoPreferSingle" | ||
call_parentheses = "Always" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 nvimdev | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# nvim-plugin-template | ||
neovim plugin template integration test and doc publish | ||
|
||
## Usage | ||
|
||
1. click `use this template` button generate a repo on your github. | ||
2. clone your plugin repo.open terminal then cd plugin directory. | ||
3. run `python3 rename.py your-plugin-name` this will replace all `nvim-plugin-template` to your `pluing-name`. | ||
then it will prompt you input `y` or `n` to remove example codes in `init.lua` and | ||
`test/plugin_spec.lua`. if you are familiar this repo just input y. if you are first look at this | ||
template I suggest you look at them first. after these step the `rename.py` will also auto | ||
remove. | ||
|
||
now you have a clean plugin env . enjoy! | ||
|
||
## Format | ||
|
||
format use `stylua` and provide `.stylua.toml`. | ||
|
||
## Test | ||
use vusted for test install by using `luarocks --lua-version=5.1 install vusted` then run `vusted test` | ||
for your test cases. | ||
|
||
create test case in test folder file rule is `foo_spec.lua` with `_spec` more usage please check | ||
[busted usage](https://lunarmodules.github.io/busted/) | ||
|
||
## Ci | ||
Ci support auto generate doc from README and integration test and lint check by `stylua`. | ||
|
||
|
||
## More | ||
Other usage you can look at my plugins | ||
|
||
## License MIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
*nvim-plugin-template.txt* For NVIM v0.8.0 Last change: 2023 August 05 | ||
|
||
============================================================================== | ||
Table of Contents *nvim-plugin-template-table-of-contents* | ||
|
||
1. nvim-plugin-template |nvim-plugin-template-nvim-plugin-template| | ||
- Usage |nvim-plugin-template-nvim-plugin-template-usage| | ||
- Format |nvim-plugin-template-nvim-plugin-template-format| | ||
- Test |nvim-plugin-template-nvim-plugin-template-test| | ||
- Ci |nvim-plugin-template-nvim-plugin-template-ci| | ||
- More |nvim-plugin-template-nvim-plugin-template-more| | ||
- License MIT |nvim-plugin-template-nvim-plugin-template-license-mit| | ||
|
||
============================================================================== | ||
1. nvim-plugin-template *nvim-plugin-template-nvim-plugin-template* | ||
|
||
neovim plugin template integration test and doc publish | ||
|
||
|
||
USAGE *nvim-plugin-template-nvim-plugin-template-usage* | ||
|
||
1. click `use this template` button generate a repo on your github. | ||
2. clone your plugin repo.open terminal then cd plugin directory. | ||
3. run `python3 rename.py your-plugin-name` this will replace all `nvim-plugin-template` to your `pluing-name`. | ||
then it will prompt you input `y` or `n` to remove example codes in `init.lua` and | ||
`test/plugin_spec.lua`. if you are familiar this repo just input y. if you are first look at this | ||
template I suggest you look at them first. after these step the `rename.py` will also auto | ||
remove. | ||
|
||
now you have a clean plugin env. enjoy! | ||
|
||
|
||
FORMAT *nvim-plugin-template-nvim-plugin-template-format* | ||
|
||
format use `stylua` and provide `.stylua.toml`. | ||
|
||
|
||
TEST *nvim-plugin-template-nvim-plugin-template-test* | ||
|
||
use vusted for test install by using `luarocks --lua-version=5.1 install | ||
vusted` then run `vusted test` for your test cases. | ||
|
||
create test case in test folder file rule is `foo_spec.lua` with `_spec` more | ||
usage please check busted usage <https://lunarmodules.github.io/busted/> | ||
|
||
|
||
CI *nvim-plugin-template-nvim-plugin-template-ci* | ||
|
||
Ci support auto generate doc from README and integration test and lint check by | ||
`stylua`. | ||
|
||
|
||
MORE *nvim-plugin-template-nvim-plugin-template-more* | ||
|
||
Other usage you can look at my plugins | ||
|
||
|
||
LICENSE MIT *nvim-plugin-template-nvim-plugin-template-license-mit* | ||
|
||
Generated by panvimdoc <https://github.com/kdheepak/panvimdoc> | ||
|
||
vim:tw=78:ts=8:noet:ft=help:norl: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
local function example() | ||
return true | ||
end | ||
|
||
return { | ||
example = example, | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/python | ||
# -*- coding: UTF-8 -*- | ||
|
||
import os, sys | ||
|
||
pdir = os.getcwd() | ||
|
||
if len(sys.argv) == 2: | ||
new_name = sys.argv[1] | ||
for dir in os.listdir(pdir): | ||
if dir == "lua": | ||
os.rename(os.path.join("lua", "nvim-plugin-template"), os.path.join("lua",new_name)) | ||
if dir == "plugin": | ||
os.rename(os.path.join("plugin", "nvim-plugin-template.lua"), | ||
os.path.join("plugin",new_name + ".lua")) | ||
if dir == 'doc': | ||
os.rename(os.path.join("doc", "nvim-plugin-template.txt"), | ||
os.path.join("doc",new_name + ".txt")) | ||
if dir == '.github': | ||
with open(os.path.join(".github","workflows","ci.yml"), 'r+') as f: | ||
d = f.read() | ||
t = d.replace('nvim-plugin-template', new_name) | ||
f.seek(0, 0) | ||
f.write(t) | ||
|
||
choice = input("Do you want also remove example code in init.lua and test (y|n): ") | ||
if choice.lower() == 'y': | ||
with open(os.path.join(pdir, 'lua',new_name,'init.lua'), 'w') as f: | ||
f.truncate() | ||
|
||
with open(os.path.join(pdir, 'test','plugin_spec.lua'), 'w') as f: | ||
f.truncate() | ||
|
||
os.remove(os.path.join(os.getcwd(), 'rename.py')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
local example = require('nvim-plugin-template').example | ||
|
||
describe('neovim plugin', function() | ||
it('work as expect', function() | ||
local result = example() | ||
assert.is_true(result) | ||
end) | ||
end) |