generated from ellisonleao/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 87adfa0
Showing
9 changed files
with
256 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,54 @@ | ||
name: Bug Report | ||
description: File a bug/issue | ||
title: "bug: " | ||
labels: [bug] | ||
body: | ||
- type: markdown | ||
attributes: | ||
value: | | ||
**Before** reporting an issue, make sure to read the documentation and search existing issues. Usage questions such as ***"How do I...?"*** belong in Discussions and will be closed. | ||
- type: checkboxes | ||
attributes: | ||
label: Did you check docs and existing issues? | ||
description: Make sure you checked all of the below before submitting an issue | ||
options: | ||
- label: I have read all the plugin docs | ||
required: true | ||
- label: I have searched the existing issues | ||
required: true | ||
- label: I have searched the existing issues of plugins related to this issue | ||
required: true | ||
- type: input | ||
attributes: | ||
label: "Neovim version (nvim -v)" | ||
placeholder: "0.8.0 commit db1b0ee3b30f" | ||
validations: | ||
required: true | ||
- type: input | ||
attributes: | ||
label: "Operating system/version" | ||
placeholder: "MacOS 11.5" | ||
validations: | ||
required: true | ||
- type: textarea | ||
attributes: | ||
label: Describe the bug | ||
description: A clear and concise description of what the bug is. Please include any related errors you see in Neovim. | ||
validations: | ||
required: true | ||
- type: textarea | ||
attributes: | ||
label: Steps To Reproduce | ||
description: Steps to reproduce the behavior. | ||
placeholder: | | ||
1. | ||
2. | ||
3. | ||
validations: | ||
required: true | ||
- type: textarea | ||
attributes: | ||
label: Expected Behavior | ||
description: A concise description of what you expected to happen. | ||
validations: | ||
required: true |
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,36 @@ | ||
name: Feature Request | ||
description: Suggest a new feature | ||
title: "feature: " | ||
labels: [enhancement] | ||
body: | ||
- type: checkboxes | ||
attributes: | ||
label: Did you check the docs? | ||
description: Make sure you read all the docs before submitting a feature request | ||
options: | ||
- label: I have read all the docs | ||
required: true | ||
- type: textarea | ||
validations: | ||
required: true | ||
attributes: | ||
label: Is your feature request related to a problem? Please describe. | ||
description: A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] | ||
- type: textarea | ||
validations: | ||
required: true | ||
attributes: | ||
label: Describe the solution you'd like | ||
description: A clear and concise description of what you want to happen. | ||
- type: textarea | ||
validations: | ||
required: true | ||
attributes: | ||
label: Describe alternatives you've considered | ||
description: A clear and concise description of any alternative solutions or features you've considered. | ||
- type: textarea | ||
validations: | ||
required: false | ||
attributes: | ||
label: Additional context | ||
description: Add any other context or screenshots about the feature request here. |
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,33 @@ | ||
--- | ||
on: [push, pull_request] | ||
name: lint-test | ||
|
||
jobs: | ||
stylua: | ||
name: stylua | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: JohnnyMorganz/stylua-action@v3 | ||
with: | ||
version: latest | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
args: --color always --check lua | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
nvim-versions: ['stable', 'nightly'] | ||
name: test | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v3 | ||
|
||
- uses: rhysd/action-setup-vim@v1 | ||
with: | ||
neovim: true | ||
version: ${{ matrix.nvim-versions }} | ||
|
||
- name: run tests | ||
run: make 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 @@ | ||
vendor/plenary.nvim |
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 = 120 | ||
line_endings = "Unix" | ||
indent_type = "Spaces" | ||
indent_width = 2 | ||
quote_style = "AutoPreferDouble" | ||
no_call_parentheses = false |
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) 2024 getty104 | ||
|
||
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,63 @@ | ||
# air-duster.nvim | ||
|
||
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/ellisonleao/nvim-plugin-template/lint-test.yml?branch=main&style=for-the-badge) | ||
|
||
A Neovim plugin for removing trailing white spaces and tabs | ||
|
||
## Installation | ||
With [lazy.nvim](https://github.com/folke/lazy.nvim) | ||
|
||
```lua | ||
{ | ||
"getty104/air-duster.nvim", | ||
config = function() | ||
require("air-duster").setup() | ||
end, | ||
}, | ||
``` | ||
|
||
With [packer.nvim](https://github.com/wbthomason/packer.nvim) | ||
|
||
```lua | ||
use({ | ||
"getty104/air-duster.nvim", | ||
config = function() | ||
require("air-duster").setup() | ||
end, | ||
}) | ||
``` | ||
|
||
## Usage | ||
|
||
When you call the `setup()` function, the following commands are activated. | ||
|
||
- `RemoveDust` | ||
- Remove trailing white spaces and tabs | ||
- `RemoveWhiteSpaces` | ||
- Remove trailing white spaces | ||
- `RemoveTabs` | ||
- Remove trailing tabs | ||
|
||
## Autocmd Examble | ||
If you want to remove trailing white spaces and tabs, you can implement it with `nvim_create_autocmd` | ||
|
||
```lua | ||
local function RemoveDust() | ||
if vim.bo.filetype ~= "markdown" then | ||
vim.api.nvim_exec("RemoveWhiteSpaces", false) | ||
end | ||
|
||
vim.api.nvim_exec("RemoveTabs", false) | ||
end | ||
|
||
vim.api.nvim_create_augroup("handler", { clear = true }) | ||
vim.api.nvim_create_autocmd("BufWritePre", { | ||
group = "handler", | ||
pattern = "*", | ||
callback = RemoveDust, | ||
}) | ||
``` | ||
|
||
## License | ||
|
||
[MIT License](/LICENSE) |
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,15 @@ | ||
local Api = {} | ||
|
||
Api.remove_trailing_white_spaces = function() | ||
local cursor = vim.api.nvim_win_get_cursor(0) | ||
vim.api.nvim_exec("%s/\\s\\+$//ge", false) | ||
vim.api.nvim_win_set_cursor(0, cursor) | ||
end | ||
|
||
Api.remove_trailing_tabs = function() | ||
local cursor = vim.api.nvim_win_get_cursor(0) | ||
vim.api.nvim_exec("%s/\\t/ /ge", false) | ||
vim.api.nvim_win_set_cursor(0, cursor) | ||
end | ||
|
||
return Api |
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,27 @@ | ||
local api = require("air-duster.api") | ||
local config = require("air-duster.config") | ||
|
||
local M = {} | ||
|
||
M.setup = function(_args) | ||
vim.api.nvim_create_user_command("RemoveDust", function() | ||
api.remove_trailing_white_spaces() | ||
api.remove_trailing_tabs() | ||
end, { | ||
desc = "Remove trailing white spaces and tabs", | ||
}) | ||
|
||
vim.api.nvim_create_user_command("RemoveWhiteSpaces", function() | ||
api.remove_trailing_white_spaces() | ||
end, { | ||
desc = "Remove trailing white spaces", | ||
}) | ||
|
||
vim.api.nvim_create_user_command("RemoveTabs", function() | ||
api.remove_trailing_white_spaces() | ||
end, { | ||
desc = "Remove trailing tabs", | ||
}) | ||
end | ||
|
||
return M |