Refresh generated nvim config
This commit is contained in:
89
config/neovim/store/lazy-plugins/persistence.nvim/.github/ISSUE_TEMPLATE/bug_report.yml
vendored
Normal file
89
config/neovim/store/lazy-plugins/persistence.nvim/.github/ISSUE_TEMPLATE/bug_report.yml
vendored
Normal file
@ -0,0 +1,89 @@
|
||||
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](https://github.com/folke/persistence.nvim) and search [existing issues](https://github.com/folke/persistence.nvim/issues). Usage questions such as ***"How do I...?"*** belong in [Discussions](https://github.com/folke/persistence.nvim/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 persistence.nvim docs
|
||||
required: true
|
||||
- label: I have searched the existing issues of persistence.nvim
|
||||
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
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Repro
|
||||
description: Minimal `init.lua` to reproduce this issue. Save as `repro.lua` and run with `nvim -u repro.lua`
|
||||
value: |
|
||||
-- DO NOT change the paths and don't remove the colorscheme
|
||||
local root = vim.fn.fnamemodify("./.repro", ":p")
|
||||
|
||||
-- set stdpaths to use .repro
|
||||
for _, name in ipairs({ "config", "data", "state", "cache" }) do
|
||||
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
|
||||
end
|
||||
|
||||
-- bootstrap lazy
|
||||
local lazypath = root .. "/plugins/lazy.nvim"
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath, })
|
||||
end
|
||||
vim.opt.runtimepath:prepend(lazypath)
|
||||
|
||||
-- install plugins
|
||||
local plugins = {
|
||||
"folke/tokyonight.nvim",
|
||||
"folke/persistence.nvim",
|
||||
-- add any other plugins here
|
||||
}
|
||||
require("lazy").setup(plugins, {
|
||||
root = root .. "/plugins",
|
||||
})
|
||||
|
||||
vim.cmd.colorscheme("tokyonight")
|
||||
-- add anything else here
|
||||
render: Lua
|
||||
validations:
|
||||
required: false
|
||||
36
config/neovim/store/lazy-plugins/persistence.nvim/.github/ISSUE_TEMPLATE/feature_request.yml
vendored
Normal file
36
config/neovim/store/lazy-plugins/persistence.nvim/.github/ISSUE_TEMPLATE/feature_request.yml
vendored
Normal file
@ -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 persistence.nvim 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.
|
||||
72
config/neovim/store/lazy-plugins/persistence.nvim/.github/workflows/ci.yml
vendored
Normal file
72
config/neovim/store/lazy-plugins/persistence.nvim/.github/workflows/ci.yml
vendored
Normal file
@ -0,0 +1,72 @@
|
||||
name: CI
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
strategy:
|
||||
matrix:
|
||||
# os: [ubuntu-latest, windows-latest]
|
||||
os: [ubuntu-latest]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- 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 Tests
|
||||
run: |
|
||||
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/main' }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: panvimdoc
|
||||
uses: kdheepak/panvimdoc@main
|
||||
with:
|
||||
vimdoc: persistence.nvim
|
||||
version: "Neovim >= 0.8.0"
|
||||
demojify: true
|
||||
treesitter: true
|
||||
- name: Push changes
|
||||
uses: stefanzweifel/git-auto-commit-action@v4
|
||||
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>"
|
||||
release:
|
||||
name: release
|
||||
if: ${{ github.ref == 'refs/heads/main' }}
|
||||
needs:
|
||||
- docs
|
||||
- tests
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: google-github-actions/release-please-action@v3
|
||||
id: release
|
||||
with:
|
||||
release-type: simple
|
||||
package-name: persistence.nvim
|
||||
- uses: actions/checkout@v3
|
||||
- name: tag stable versions
|
||||
if: ${{ steps.release.outputs.release_created }}
|
||||
run: |
|
||||
git config user.name github-actions[bot]
|
||||
git config user.email github-actions[bot]@users.noreply.github.com
|
||||
git remote add gh-token "https://${{ secrets.GITHUB_TOKEN }}@github.com/google-github-actions/release-please-action.git"
|
||||
git tag -d stable || true
|
||||
git push origin :stable || true
|
||||
git tag -a stable -m "Last Stable Release"
|
||||
git push origin stable
|
||||
8
config/neovim/store/lazy-plugins/persistence.nvim/.gitignore
vendored
Normal file
8
config/neovim/store/lazy-plugins/persistence.nvim/.gitignore
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
tt.*
|
||||
.tests
|
||||
doc/tags
|
||||
debug
|
||||
.repro
|
||||
foo.*
|
||||
*.log
|
||||
data
|
||||
@ -0,0 +1,61 @@
|
||||
# Changelog
|
||||
|
||||
## [2.0.0](https://github.com/folke/persistence.nvim/compare/v1.2.1...v2.0.0) (2023-10-15)
|
||||
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
* **start:** session name is now based on the cwd when the session starts and not when the session ends. Fixes #1688
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **start:** session name is now based on the cwd when the session starts and not when the session ends. Fixes [#1688](https://github.com/folke/persistence.nvim/issues/1688) ([0361df7](https://github.com/folke/persistence.nvim/commit/0361df7775f5b4ed51a6d7fe159438573b7f07a6))
|
||||
|
||||
## [1.2.1](https://github.com/folke/persistence.nvim/compare/v1.2.0...v1.2.1) (2023-10-13)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* dont save the session when only `gitcommit` buffers are present. Fixes [#14](https://github.com/folke/persistence.nvim/issues/14) ([8f7cbcc](https://github.com/folke/persistence.nvim/commit/8f7cbccfb506fe6cb35db9ad966137c363b049c5))
|
||||
|
||||
## [1.2.0](https://github.com/folke/persistence.nvim/compare/v1.1.0...v1.2.0) (2023-10-13)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* don't save the session when no files are open (save_empty = false) ([e9afeaf](https://github.com/folke/persistence.nvim/commit/e9afeaf3a7bb645ca73980cd13048c48c292500c))
|
||||
|
||||
## [1.1.0](https://github.com/folke/persistence.nvim/compare/v1.0.1...v1.1.0) (2023-02-28)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **persistence:** `pre_save` option to call before saving ([#22](https://github.com/folke/persistence.nvim/issues/22)) ([f4bb0c5](https://github.com/folke/persistence.nvim/commit/f4bb0c5641a0e6c9ac3675ddd794ca78099d8510))
|
||||
|
||||
## [1.0.1](https://github.com/folke/persistence.nvim/compare/v1.0.0...v1.0.1) (2023-01-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* dont throw error when session was already stopped ([70c281e](https://github.com/folke/persistence.nvim/commit/70c281e54e34630d8bef9b1cf9f7a0ac3edd6a1c))
|
||||
|
||||
## 1.0.0 (2023-01-04)
|
||||
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
* save sessions in state instead of config
|
||||
|
||||
### Features
|
||||
|
||||
* added config options ([a39f3f1](https://github.com/folke/persistence.nvim/commit/a39f3f10c836709f9b6e009b20a1f028851c50e0))
|
||||
* inital version ([8b32094](https://github.com/folke/persistence.nvim/commit/8b32094309ee986066c219d2b4d88a4045fbcb8c))
|
||||
* save sessions in state instead of config ([c304745](https://github.com/folke/persistence.nvim/commit/c30474509666187181add6122e775f9978478c81))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* dont show errors when loading a session ([ad7fcd4](https://github.com/folke/persistence.nvim/commit/ad7fcd4fed0cecb9ae3c6cbc4a61801ef4e2466d))
|
||||
* properly escape session file names on Windows ([#7](https://github.com/folke/persistence.nvim/issues/7)) ([83af96b](https://github.com/folke/persistence.nvim/commit/83af96b1f205dddab066c96b029ceeee192b48d4))
|
||||
* renamed session to persistence in autocmds ([38203a1](https://github.com/folke/persistence.nvim/commit/38203a17a97d49bfcc938f171ecfa44f52dda08e))
|
||||
* vim.fn.has('win32') returns 0 or 1, not a boolean ([#8](https://github.com/folke/persistence.nvim/issues/8)) ([77cf5a6](https://github.com/folke/persistence.nvim/commit/77cf5a6ee162013b97237ff25450080401849f85))
|
||||
201
config/neovim/store/lazy-plugins/persistence.nvim/LICENSE
Normal file
201
config/neovim/store/lazy-plugins/persistence.nvim/LICENSE
Normal 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.
|
||||
61
config/neovim/store/lazy-plugins/persistence.nvim/README.md
Normal file
61
config/neovim/store/lazy-plugins/persistence.nvim/README.md
Normal file
@ -0,0 +1,61 @@
|
||||
# 💾 Persistence
|
||||
|
||||
**Persistence** is a simple lua plugin for automated session management.
|
||||
|
||||
## ✨ Features
|
||||
|
||||
- automatically saves the active session under `~/.local/state/nvim/sessions` on exit
|
||||
- simple API to restore the current or last session
|
||||
|
||||
## ⚡️ Requirements
|
||||
|
||||
- Neovim >= 0.7.2
|
||||
|
||||
## 📦 Installation
|
||||
|
||||
Install the plugin with your preferred package manager:
|
||||
|
||||
### [lazy.nvim](https://github.com/folke/lazy.nvim)
|
||||
|
||||
```lua
|
||||
-- Lua
|
||||
{
|
||||
"folke/persistence.nvim",
|
||||
event = "BufReadPre", -- this will only start session saving when an actual file was opened
|
||||
opts = {
|
||||
-- add any custom options here
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## ⚙️ Configuration
|
||||
|
||||
Persistence comes with the following defaults:
|
||||
|
||||
```lua
|
||||
{
|
||||
dir = vim.fn.expand(vim.fn.stdpath("state") .. "/sessions/"), -- directory where session files are saved
|
||||
options = { "buffers", "curdir", "tabpages", "winsize" }, -- sessionoptions used for saving
|
||||
pre_save = nil, -- a function to call before saving the session
|
||||
post_save = nil, -- a function to call after saving the session
|
||||
save_empty = false, -- don't save if there are no open file buffers
|
||||
pre_load = nil, -- a function to call before loading the session
|
||||
post_load = nil, -- a function to call after loading the session
|
||||
}
|
||||
```
|
||||
|
||||
## 🚀 Usage
|
||||
|
||||
**Persistence** works well with plugins like `startify` or `dashboard`. It will never restore a session automatically,
|
||||
but you can of course write an autocmd that does exactly that if you want.
|
||||
|
||||
```lua
|
||||
-- restore the session for the current directory
|
||||
vim.api.nvim_set_keymap("n", "<leader>qs", [[<cmd>lua require("persistence").load()<cr>]], {})
|
||||
|
||||
-- restore the last session
|
||||
vim.api.nvim_set_keymap("n", "<leader>ql", [[<cmd>lua require("persistence").load({ last = true })<cr>]], {})
|
||||
|
||||
-- stop Persistence => session won't be saved on exit
|
||||
vim.api.nvim_set_keymap("n", "<leader>qd", [[<cmd>lua require("persistence").stop()<cr>]], {})
|
||||
```
|
||||
@ -0,0 +1,85 @@
|
||||
*persistence.nvim.txt* For Neovim >= 0.8.0 Last change: 2024 May 16
|
||||
|
||||
==============================================================================
|
||||
Table of Contents *persistence.nvim-table-of-contents*
|
||||
|
||||
1. Persistence |persistence.nvim-persistence|
|
||||
- Features |persistence.nvim-persistence-features|
|
||||
- Requirements |persistence.nvim-persistence-requirements|
|
||||
- Installation |persistence.nvim-persistence-installation|
|
||||
- Configuration |persistence.nvim-persistence-configuration|
|
||||
- Usage |persistence.nvim-persistence-usage|
|
||||
|
||||
==============================================================================
|
||||
1. Persistence *persistence.nvim-persistence*
|
||||
|
||||
**Persistence** is a simple lua plugin for automated session management.
|
||||
|
||||
|
||||
FEATURES *persistence.nvim-persistence-features*
|
||||
|
||||
- automatically saves the active session under `~/.local/state/nvim/sessions` on exit
|
||||
- simple API to restore the current or last session
|
||||
|
||||
|
||||
REQUIREMENTS *persistence.nvim-persistence-requirements*
|
||||
|
||||
- Neovim >= 0.7.2
|
||||
|
||||
|
||||
INSTALLATION *persistence.nvim-persistence-installation*
|
||||
|
||||
Install the plugin with your preferred package manager:
|
||||
|
||||
|
||||
LAZY.NVIM ~
|
||||
|
||||
>lua
|
||||
-- Lua
|
||||
{
|
||||
"folke/persistence.nvim",
|
||||
event = "BufReadPre", -- this will only start session saving when an actual file was opened
|
||||
opts = {
|
||||
-- add any custom options here
|
||||
}
|
||||
}
|
||||
<
|
||||
|
||||
|
||||
CONFIGURATION *persistence.nvim-persistence-configuration*
|
||||
|
||||
Persistence comes with the following defaults:
|
||||
|
||||
>lua
|
||||
{
|
||||
dir = vim.fn.expand(vim.fn.stdpath("state") .. "/sessions/"), -- directory where session files are saved
|
||||
options = { "buffers", "curdir", "tabpages", "winsize" }, -- sessionoptions used for saving
|
||||
pre_save = nil, -- a function to call before saving the session
|
||||
post_save = nil, -- a function to call after saving the session
|
||||
save_empty = false, -- don't save if there are no open file buffers
|
||||
pre_load = nil, -- a function to call before loading the session
|
||||
post_load = nil, -- a function to call after loading the session
|
||||
}
|
||||
<
|
||||
|
||||
|
||||
USAGE *persistence.nvim-persistence-usage*
|
||||
|
||||
**Persistence** works well with plugins like `startify` or `dashboard`. It will
|
||||
never restore a session automatically, but you can of course write an autocmd
|
||||
that does exactly that if you want.
|
||||
|
||||
>lua
|
||||
-- restore the session for the current directory
|
||||
vim.api.nvim_set_keymap("n", "<leader>qs", [[<cmd>lua require("persistence").load()<cr>]], {})
|
||||
|
||||
-- restore the last session
|
||||
vim.api.nvim_set_keymap("n", "<leader>ql", [[<cmd>lua require("persistence").load({ last = true })<cr>]], {})
|
||||
|
||||
-- stop Persistence => session won't be saved on exit
|
||||
vim.api.nvim_set_keymap("n", "<leader>qd", [[<cmd>lua require("persistence").stop()<cr>]], {})
|
||||
<
|
||||
|
||||
Generated by panvimdoc <https://github.com/kdheepak/panvimdoc>
|
||||
|
||||
vim:tw=78:ts=8:noet:ft=help:norl:
|
||||
@ -0,0 +1,8 @@
|
||||
persistence.nvim-persistence persistence.nvim.txt /*persistence.nvim-persistence*
|
||||
persistence.nvim-persistence-configuration persistence.nvim.txt /*persistence.nvim-persistence-configuration*
|
||||
persistence.nvim-persistence-features persistence.nvim.txt /*persistence.nvim-persistence-features*
|
||||
persistence.nvim-persistence-installation persistence.nvim.txt /*persistence.nvim-persistence-installation*
|
||||
persistence.nvim-persistence-requirements persistence.nvim.txt /*persistence.nvim-persistence-requirements*
|
||||
persistence.nvim-persistence-usage persistence.nvim.txt /*persistence.nvim-persistence-usage*
|
||||
persistence.nvim-table-of-contents persistence.nvim.txt /*persistence.nvim-table-of-contents*
|
||||
persistence.nvim.txt persistence.nvim.txt /*persistence.nvim.txt*
|
||||
@ -0,0 +1,22 @@
|
||||
local M = {}
|
||||
|
||||
---@class PersistenceOptions
|
||||
---@field pre_save? fun()
|
||||
---@field post_save? fun()
|
||||
---@field pre_load? fun()
|
||||
---@field post_load? fun()
|
||||
local defaults = {
|
||||
dir = vim.fn.expand(vim.fn.stdpath("state") .. "/sessions/"), -- directory where session files are saved
|
||||
options = { "buffers", "curdir", "tabpages", "winsize", "skiprtp" }, -- sessionoptions used for saving
|
||||
save_empty = false, -- don't save if there are no open file buffers
|
||||
}
|
||||
|
||||
---@type PersistenceOptions
|
||||
M.options = {}
|
||||
|
||||
function M.setup(opts)
|
||||
M.options = vim.tbl_deep_extend("force", {}, defaults, opts or {})
|
||||
vim.fn.mkdir(M.options.dir, "p")
|
||||
end
|
||||
|
||||
return M
|
||||
@ -0,0 +1,99 @@
|
||||
local Config = require("persistence.config")
|
||||
|
||||
local M = {}
|
||||
---@type string?
|
||||
M.current = nil
|
||||
|
||||
local e = vim.fn.fnameescape
|
||||
|
||||
function M.get_current()
|
||||
local pattern = "/"
|
||||
if vim.fn.has("win32") == 1 then
|
||||
pattern = "[\\:]"
|
||||
end
|
||||
local name = vim.fn.getcwd():gsub(pattern, "%%")
|
||||
return Config.options.dir .. name .. ".vim"
|
||||
end
|
||||
|
||||
function M.get_last()
|
||||
local sessions = M.list()
|
||||
table.sort(sessions, function(a, b)
|
||||
return vim.loop.fs_stat(a).mtime.sec > vim.loop.fs_stat(b).mtime.sec
|
||||
end)
|
||||
return sessions[1]
|
||||
end
|
||||
|
||||
function M.setup(opts)
|
||||
Config.setup(opts)
|
||||
M.start()
|
||||
end
|
||||
|
||||
function M.start()
|
||||
M.current = M.get_current()
|
||||
vim.api.nvim_create_autocmd("VimLeavePre", {
|
||||
group = vim.api.nvim_create_augroup("persistence", { clear = true }),
|
||||
callback = function()
|
||||
if Config.options.pre_save then
|
||||
Config.options.pre_save()
|
||||
end
|
||||
|
||||
if not Config.options.save_empty then
|
||||
local bufs = vim.tbl_filter(function(b)
|
||||
if vim.bo[b].buftype ~= "" then
|
||||
return false
|
||||
end
|
||||
if vim.bo[b].filetype == "gitcommit" then
|
||||
return false
|
||||
end
|
||||
if vim.bo[b].filetype == "gitrebase" then
|
||||
return false
|
||||
end
|
||||
return vim.api.nvim_buf_get_name(b) ~= ""
|
||||
end, vim.api.nvim_list_bufs())
|
||||
if #bufs == 0 then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
M.save()
|
||||
|
||||
if type(Config.options.post_save) == "function" then
|
||||
Config.options.post_save()
|
||||
end
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
function M.stop()
|
||||
M.current = nil
|
||||
pcall(vim.api.nvim_del_augroup_by_name, "persistence")
|
||||
end
|
||||
|
||||
function M.save()
|
||||
local tmp = vim.o.sessionoptions
|
||||
vim.o.sessionoptions = table.concat(Config.options.options, ",")
|
||||
vim.cmd("mks! " .. e(M.current or M.get_current()))
|
||||
vim.o.sessionoptions = tmp
|
||||
end
|
||||
|
||||
function M.load(opt)
|
||||
opt = opt or {}
|
||||
local sfile = opt.last and M.get_last() or M.get_current()
|
||||
if sfile and vim.fn.filereadable(sfile) ~= 0 then
|
||||
if type(Config.options.pre_load) == "function" then
|
||||
Config.options.pre_load()
|
||||
end
|
||||
|
||||
vim.cmd("silent! source " .. e(sfile))
|
||||
|
||||
if type(Config.options.post_load) == "function" then
|
||||
Config.options.post_load()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function M.list()
|
||||
return vim.fn.glob(Config.options.dir .. "*.vim", true, true)
|
||||
end
|
||||
|
||||
return M
|
||||
@ -0,0 +1 @@
|
||||
std="lua51+vim"
|
||||
@ -0,0 +1,3 @@
|
||||
indent_type = "Spaces"
|
||||
indent_width = 2
|
||||
column_width = 120
|
||||
@ -0,0 +1,2 @@
|
||||
[vim]
|
||||
any = true
|
||||
Reference in New Issue
Block a user