Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/augustocdias/gatekeeper.nvim
https://github.com/augustocdias/gatekeeper.nvim
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/augustocdias/gatekeeper.nvim
- Owner: augustocdias
- License: mit
- Created: 2022-08-01T06:56:53.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-26T13:52:32.000Z (almost 2 years ago)
- Last Synced: 2023-03-03T14:31:45.155Z (almost 2 years ago)
- Language: Lua
- Size: 9.77 KB
- Stars: 10
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Gatekeeper.nvim
This plugin intends to make buffers with from files outside of the current
working directory read only and non modifiable. To do that it sets an auto
command for every time a buffer gets loaded.The purpose for the existence of this plugin is basically allowing to set
white lists for folders or files.## Usage
Install with your favorite package manager and call
```lua
require('gatekeeper').setup({
-- default values
exclude = {},
exclude_regex = {},
debug = false, -- will call vim.notify with info when it is being evaluated
})
```## Options
### exclude
Specifies fully qualified folders or files to be excluded and being editable.
It won't expand `~` to your home so you have to concatenate `vim.fn.expand('~')`
to your desired folder, if that's the case. Example:```lua
require('gatekeeper').setup({
exclude = {
vim.fn.expand('~/.config/nvim')
}
})
```### exclude_regex
Specifies regex patterns to evaluate files to be excluded and being editable.
If the buffer name matches the regex it won't be blocked from being edited. Example:```lua
require('gatekeeper').setup({
exclude_regex = {
'.*\.config/nvim/.*' -- any file that contains ".config/nvim" in its full path
}
})
```### debug
Will notify if a file is being blocked or not when it is evaluated.
## Commands
You can call `:GTForceWrite` on any buffer to revert and force it to be writable
and modifiable.If you want to check why some buffer is or is not being blocked, you can call `:GTExplain`.
It will print all checks on your settings against the current buffer until one
evaluates to true (which means it found an exclusion/reason to not block).