1

Regenerate nvim config

This commit is contained in:
2024-06-02 03:29:20 +02:00
parent 75eea0c030
commit ef2e28883d
5576 changed files with 604886 additions and 503 deletions

View File

@ -0,0 +1,8 @@
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates to GitHub Actions every weekday
interval: "daily"

View File

@ -0,0 +1,53 @@
name: CI
on:
push:
pull_request:
jobs:
tests:
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install Neovim
shell: bash
run: |
mkdir -p /tmp/nvim
wget -q https://github.com/neovim/neovim/releases/download/nightly/nvim.appimage -O /tmp/nvim/nvim.appimage
cd /tmp/nvim
chmod a+x ./nvim.appimage
./nvim.appimage --appimage-extract
echo "/tmp/nvim/squashfs-root/usr/bin/" >> $GITHUB_PATH
- name: Run Lints
uses: lunarmodules/luacheck@v1
with:
args: lua/trim
- name: Run Tests
run: |
alias nvim="/tmp/nvim-linux64/bin/nvim"
nvim --version
[ ! -d tests ] && exit 0
nvim --headless -u tests/init.lua -c "PlenaryBustedDirectory tests/ {minimal_init = 'tests/init.lua', sequential = true}"
docs:
runs-on: ubuntu-latest
needs: tests
if: ${{ github.ref == 'refs/heads/master' }}
steps:
- uses: actions/checkout@v4
- name: panvimdoc
uses: kdheepak/panvimdoc@main
with:
vimdoc: trim.nvim
version: "Neovim >= 0.7.0"
demojify: true
treesitter: true
- name: Push changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore(build): auto-generate vimdoc"
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>"

View File

@ -0,0 +1,22 @@
name: Release
on:
push:
tags:
- "v*.*.*"
jobs:
build:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@master
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false

View File

@ -0,0 +1,43 @@
# Compiled Lua sources
luac.out
# luarocks build files
*.src.rock
*.zip
*.tar.gz
# Object files
*.o
*.os
*.ko
*.obj
*.elf
# Precompiled Headers
*.gch
*.pch
# Libraries
*.lib
*.a
*.la
*.lo
*.def
*.exp
# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib
# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex
# Tests
.tests

View File

@ -0,0 +1,26 @@
-- Rerun tests only if their modification time changed.
cache = true
std = luajit
codes = true
self = false
-- Glorious list of warnings: https://luacheck.readthedocs.io/en/stable/warnings.html
ignore = {
"212", -- Unused argument, In the case of callback function, _arg_name is easier to understand than _, so this option is set to off.
"122", -- Indirectly setting a readonly global
}
globals = {
"_",
"TelescopeGlobalState",
"_TelescopeConfigurationValues",
"_TelescopeConfigurationPickers",
"__TelescopeKeymapStore",
}
-- Global objects defined by the C code
read_globals = {
"vim",
}

View File

@ -0,0 +1,6 @@
column_width = 160
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 2
quote_style = "AutoPreferSingle"
no_call_parentheses = true

View File

@ -0,0 +1,7 @@
# Contributing
## Submitting a new pattern for trimming
You can add patterns to [trim\.nvim/config\.lua at master · cappyzawa/trim\.nvim](https://github.com/cappyzawa/trim.nvim/blob/master/lua/trim/config.lua).
Thanks!

View File

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -0,0 +1,16 @@
Copyright (c) 2020 Shu Kutsuzawa <cappyzawa@yahoo.ne.jp>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
```
http://www.apache.org/licenses/LICENSE-2.0
```
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -0,0 +1,78 @@
# trim.nvim
[![GitHub release](https://img.shields.io/github/release/cappyzawa/trim.nvim.svg)](https://github.com/cappyzawa/trim.nvim/releases)
[![GitHub](https://img.shields.io/github/license/cappyzawa/trim.nvim.svg)](./LICENSE)
This plugin trims trailing whitespace and lines.
## Requirements
**Neovim v0.7.0+**
## How to install
### Lazy
```lua
require("lazy").setup({
"cappyzawa/trim.nvim",
opts = {}
}, opt)
```
### Packer
```lua
use({
"cappyzawa/trim.nvim",
config = function()
require("trim").setup({})
end
})
```
## How to setup
```lua
-- default config
local default_config = {
ft_blocklist = {},
patterns = {},
trim_on_write = true,
trim_trailing = true,
trim_last_line = true,
trim_first_line = true,
highlight = false,
highlight_bg = '#ff0000', -- or 'red'
highlight_ctermbg = 'red',
}
```
```lua
require('trim').setup({
-- if you want to ignore markdown file.
-- you can specify filetypes.
ft_blocklist = {"markdown"},
-- if you want to remove multiple blank lines
patterns = {
[[%s/\(\n\n\)\n\+/\1/]], -- replace multiple blank lines with a single line
},
-- if you want to disable trim on write by default
trim_on_write = false,
-- highlight trailing spaces
highlight = true
})
```
## Commands
### `:TrimToggle`
Toggle trim on save.
### `:Trim`
Trim the buffer right away.

View File

@ -0,0 +1,8 @@
trim.nvim-links trim.nvim.txt /*trim.nvim-links*
trim.nvim-table-of-contents trim.nvim.txt /*trim.nvim-table-of-contents*
trim.nvim-trim.nvim trim.nvim.txt /*trim.nvim-trim.nvim*
trim.nvim-trim.nvim-commands trim.nvim.txt /*trim.nvim-trim.nvim-commands*
trim.nvim-trim.nvim-how-to-install trim.nvim.txt /*trim.nvim-trim.nvim-how-to-install*
trim.nvim-trim.nvim-how-to-setup trim.nvim.txt /*trim.nvim-trim.nvim-how-to-setup*
trim.nvim-trim.nvim-requirements trim.nvim.txt /*trim.nvim-trim.nvim-requirements*
trim.nvim.txt trim.nvim.txt /*trim.nvim.txt*

View File

@ -0,0 +1,107 @@
*trim.nvim.txt* For Neovim >= 0.7.0 Last change: 2024 March 15
==============================================================================
Table of Contents *trim.nvim-table-of-contents*
1. trim.nvim |trim.nvim-trim.nvim|
- Requirements |trim.nvim-trim.nvim-requirements|
- How to install |trim.nvim-trim.nvim-how-to-install|
- How to setup |trim.nvim-trim.nvim-how-to-setup|
- Commands |trim.nvim-trim.nvim-commands|
==============================================================================
1. trim.nvim *trim.nvim-trim.nvim*
<https://github.com/cappyzawa/trim.nvim/releases> <./LICENSE>
This plugin trims trailing whitespace and lines.
REQUIREMENTS *trim.nvim-trim.nvim-requirements*
**Neovim v0.7.0+**
HOW TO INSTALL *trim.nvim-trim.nvim-how-to-install*
LAZY ~
>lua
require("lazy").setup({
"cappyzawa/trim.nvim",
opts = {}
}, opt)
<
PACKER ~
>lua
use({
"cappyzawa/trim.nvim",
config = function()
require("trim").setup({})
end
})
<
HOW TO SETUP *trim.nvim-trim.nvim-how-to-setup*
>lua
-- default config
local default_config = {
ft_blocklist = {},
patterns = {},
trim_on_write = true,
trim_trailing = true,
trim_last_line = true,
trim_first_line = true,
highlight = false,
highlight_bg = '#ff0000', -- or 'red'
highlight_ctermbg = 'red',
}
<
>lua
require('trim').setup({
-- if you want to ignore markdown file.
-- you can specify filetypes.
ft_blocklist = {"markdown"},
-- if you want to remove multiple blank lines
patterns = {
[[%s/\(\n\n\)\n\+/\1/]], -- replace multiple blank lines with a single line
},
-- if you want to disable trim on write by default
trim_on_write = false,
-- highlight trailing spaces
highlight = true
})
<
COMMANDS *trim.nvim-trim.nvim-commands*
:TRIMTOGGLE ~
Toggle trim on save.
:TRIM ~
Trim the buffer right away.
==============================================================================
2. Links *trim.nvim-links*
1. *GitHub release*: https://img.shields.io/github/release/cappyzawa/trim.nvim.svg
2. *GitHub*: https://img.shields.io/github/license/cappyzawa/trim.nvim.svg
Generated by panvimdoc <https://github.com/kdheepak/panvimdoc>
vim:tw=78:ts=8:noet:ft=help:norl:

View File

@ -0,0 +1,67 @@
local M = {
config = {},
}
local default_config = {
ft_blocklist = {},
patterns = {},
trim_on_write = true,
trim_trailing = true,
trim_last_line = true,
trim_first_line = true,
highlight = false,
highlight_bg = '#ff0000',
highlight_ctermbg = 'red',
}
function M.setup(opts)
opts = opts or {}
-- compatability: disable -> ft_blocklist
if opts.disable and not opts.ft_blocklist then
vim.notify('`disable` is deprecated, use `ft_blocklist` instead', vim.log.levels.WARN, { title = 'trim.nvim' })
opts.ft_blocklist = opts.disable
end
M.config = vim.tbl_deep_extend('force', default_config, opts)
if M.config.trim_trailing then
table.insert(M.config.patterns, [[%s/\s\+$//e]])
end
if M.config.trim_first_line then
table.insert(M.config.patterns, [[%s/\%^\n\+//]])
end
if M.config.trim_last_line then
table.insert(M.config.patterns, [[%s/\($\n\s*\)\+\%$//]])
end
if M.config.highlight then
local augroup = vim.api.nvim_create_augroup('TrimHighlight', { clear = true })
-- Define the autocommand for FileType events
vim.api.nvim_create_autocmd('FileType', {
group = augroup,
pattern = '*', -- This will trigger the autocmd for all file types
callback = function()
-- Check if the current file type is not in the blocklist to avoid highlighting
if not vim.tbl_contains(M.config.ft_blocklist, vim.bo.filetype) then
-- Apply highlighting for trailing whitespace
vim.api.nvim_set_hl(0, 'ExtraWhitespace', {
bg = M.config.highlight_bg,
ctermbg = M.config.highlight_ctermbg
})
vim.api.nvim_exec('match ExtraWhitespace /\\s\\+$/', false)
else
-- Clear the highlighting for this buffer if the file type is in the blocklist
vim.api.nvim_exec('match none', false)
end
end,
})
end
end
function M.get()
return M.config
end
return M

View File

@ -0,0 +1,14 @@
local M = {}
local config = require 'trim.config'
local trimmer = require 'trim.trimmer'
function M.setup(opt)
config.setup(opt)
local cfg = config.get()
if cfg.trim_on_write then
trimmer.enable(true)
end
end
return M

View File

@ -0,0 +1,59 @@
local vim = vim
local api = vim.api
local trimmer = {}
function trimmer.trim()
local config = require('trim.config').get()
local save = vim.fn.winsaveview()
for _, v in ipairs(config.patterns) do
api.nvim_exec(string.format('keepjumps keeppatterns silent! %s', v), false)
end
vim.fn.winrestview(save)
end
local has_value = function(tbl, val)
for _, v in ipairs(tbl) do
if v == val then
return true
end
end
return false
end
function trimmer.enable(is_configured)
local opts = { pattern = '*' }
local config = require('trim.config').get()
vim.api.nvim_create_augroup('TrimNvim', { clear = true })
vim.api.nvim_create_autocmd('BufWritePre', {
group = 'TrimNvim',
pattern = opts.pattern,
callback = function()
if not has_value(config.ft_blocklist, vim.bo.filetype) then
trimmer.trim()
end
end,
})
if not is_configured then
vim.notify('TrimNvim enabled', vim.log.levels.INFO, { title = 'trim.nvim' })
end
end
function trimmer.disable()
pcall(vim.api.nvim_del_augroup_by_name, 'TrimNvim')
vim.notify('TrimNvim disabled', vim.log.levels.INFO, { title = 'trim.nvim' })
end
function trimmer.toggle()
local status = pcall(vim.api.nvim_get_autocmds, {
group = 'TrimNvim',
event = 'BufWritePre',
})
if not status then
trimmer.enable(false)
else
trimmer.disable()
end
end
return trimmer

View File

@ -0,0 +1,23 @@
if vim.g.load_trim_nvim then
return
end
vim.g.load_trim_nvim = true
local trimmer = require 'trim.trimmer'
if not vim.api.nvim_create_autocmd then
vim.notify_once('trim.nvim requires nvim 0.7.0+.', vim.log.levels.ERROR, { title = 'trim.nvim' })
return
end
vim.api.nvim_create_user_command('TrimToggle', function(args)
trimmer.toggle()
end, {
range = false,
})
vim.api.nvim_create_user_command('Trim', function(args)
trimmer.trim()
end, {
range = false,
})

View File

@ -0,0 +1,69 @@
local config = require 'trim.config'
local assert = require 'luassert'
describe('default config', function()
config.setup()
local actual = config.get()
it('has empty ft_blocklist', function()
assert.are.equal(#actual.ft_blocklist, 0)
end)
it('has trim_on_write enabled', function()
assert.is_true(actual.trim_on_write)
end)
it('has trim_trailing enabled', function()
assert.is_true(actual.trim_trailing)
end)
it('has trim_last_line enabled', function()
assert.is_true(actual.trim_last_line)
end)
it('has trim_first_line enabled', function()
assert.is_true(actual.trim_first_line)
end)
it('has 3 patterns', function()
assert.are.equal(#actual.patterns, 3)
assert.are.equal(actual.patterns[1], [[%s/\s\+$//e]])
assert.are.equal(actual.patterns[2], [[%s/\%^\n\+//]])
assert.are.equal(actual.patterns[3], [[%s/\($\n\s*\)\+\%$//]])
end)
end)
describe('config', function()
config.setup {
ft_blocklist = { 'markdown' },
trim_on_write = false,
trim_trailing = false,
trim_last_line = false,
trim_first_line = false,
patterns = { [[%s/\(\n\n\)\n\+/\1/]] },
}
local actual = config.get()
it('is overwritten', function()
assert(#actual.ft_blocklist, 1)
assert(actual.ft_blocklist[1], 'markdown')
assert.is_not_true(actual.trim_on_write)
assert.is_not_true(actual.trim_trailing)
assert.is_not_true(actual.trim_last_line)
assert.is_not_true(actual.trim_first_line)
assert.are.equal(#actual.patterns, 1)
assert.are.equal(actual.patterns[1], [[%s/\(\n\n\)\n\+/\1/]])
end)
it('keeps compatability', function()
config.setup { disable = { 'lua' } }
local actual = config.get()
-- disable is deprecated, use ft_blocklist instead
assert.are.equal(#actual.ft_blocklist, 1)
assert.are.equal(actual.ft_blocklist[1], 'lua')
end)
end)

View File

@ -0,0 +1,7 @@
describe('init', function()
it('has correct environment for tests', function()
for _, path in ipairs { 'config', 'data', 'cache', 'state' } do
assert(vim.fn.stdpath(path):find('.tests/' .. path))
end
end)
end)

View File

@ -0,0 +1,36 @@
local M = {}
function M.root(root)
local f = debug.getinfo(1, 'S').source:sub(2)
return vim.fn.fnamemodify(f, ':p:h:h') .. '/' .. (root or '')
end
---@param plugin string
function M.load(plugin)
local name = plugin:match '.*/(.*)'
local package_root = M.root '.tests/site/pack/deps/start/'
if not vim.loop.fs_stat(package_root .. name) then
print('Installing ' .. plugin)
vim.fn.mkdir(package_root, 'p')
vim.fn.system {
'git',
'clone',
'--depth=1',
'https://github.com/' .. plugin .. '.git',
package_root .. '/' .. name,
}
end
end
function M.setup()
vim.cmd [[set runtimepath=$VIMRUNTIME]]
vim.opt.runtimepath:append(M.root())
vim.opt.packpath = { M.root '.tests/site' }
M.load 'nvim-lua/plenary.nvim'
vim.env.XDG_CONFIG_HOME = M.root '.tests/config'
vim.env.XDG_DATA_HOME = M.root '.tests/data'
vim.env.XDG_STATE_HOME = M.root '.tests/state'
vim.env.XDG_CACHE_HOME = M.root '.tests/cache'
end
M.setup()