Skip to content

Commit cf3de5c

Browse files
committed
initial commit
0 parents  commit cf3de5c

File tree

10 files changed

+106
-0
lines changed

10 files changed

+106
-0
lines changed

.github/workflows/default.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
on: [push, pull_request]
3+
4+
jobs:
5+
stylua:
6+
name: stylua
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
- uses: JohnnyMorganz/stylua-action@1.0.0
11+
with:
12+
token: ${{ secrets.GITHUB_TOKEN }}
13+
args: --color always --check .
14+
15+
test:
16+
runs-on: ubuntu-latest
17+
strategy:
18+
matrix:
19+
nvim-versions: ['stable', 'nightly']
20+
name: test
21+
steps:
22+
- name: checkout
23+
uses: actions/checkout@v2
24+
25+
- uses: rhysd/action-setup-vim@v1
26+
with:
27+
neovim: true
28+
version: ${{ matrix.nvim-versions }}
29+
30+
- name: run tests
31+
run: make test

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "vendor/plenary.nvim"]
2+
path = vendor/plenary.nvim
3+
url = https://github.com/nvim-lua/plenary.nvim.git

.stylua.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
column_width = 120
2+
line_endings = "Unix"
3+
indent_type = "Spaces"
4+
indent_width = 2
5+
quote_style = "AutoPreferDouble"
6+
no_call_parentheses = false

Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.PHONY: test prepare
2+
3+
prepare:
4+
@git submodule update --depth 1 --init
5+
6+
test: prepare
7+
@nvim \
8+
--headless \
9+
--noplugin \
10+
-u tests/minimal_vim.vim \
11+
-c "PlenaryBustedDirectory tests/ { minimal_init = 'tests/minimal_vim.vim' }"

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# A Neovim Plugin Template
2+
3+
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/ellisonleao/neovim-plugin-template/default?style=for-the-badge)
4+
![Lua](https://img.shields.io/badge/Made%20with%20Lua-blueviolet.svg?style=for-the-badge&logo=lua)
5+
6+
A template repository for Neovim plugins.
7+
8+
## Using it
9+
10+
Via `gh`:
11+
12+
```
13+
$ gh repo create my-plugin -p ellisonleao/neovim-plugin-template
14+
```
15+
16+
Via github web page:
17+
18+
Click on `Use this template`
19+
20+
![](https://docs.github.com/assets/cb-36544/images/help/repository/use-this-template-button.png)
21+
22+
## Features and structure
23+
24+
- 100% lua
25+
- Github actions to run tests and formatting (Stylua)
26+
- tests with busted and plenary.nvim
27+
28+
### Plugin structure
29+
30+
```
31+
32+
```

lua/module/init.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
-- module represents a lua module for the plugin
2+
local M = {}
3+
4+
M.my_first_function = function()
5+
return "my first function"
6+
end
7+
8+
return M

plugin/module.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
vim.cmd([[command! MyFirstFunction lua require('module').my_first_function() ]])

tests/minimal_vim.vim

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
set rtp+=.
2+
set rtp+=vendor/plenary.nvim
3+
4+
runtime plugin/plenary.vim
5+
6+
lua require('plenary.busted')

tests/module/module_spec.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
local module = require("module")
2+
3+
describe("my function", function()
4+
it("works!", function()
5+
assert.are.equal("my first function", module.my_first_function())
6+
end)
7+
end)

vendor/plenary.nvim

Submodule plenary.nvim added at 6647212

0 commit comments

Comments
 (0)