Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yutkat/confirm-quit.nvim
Check and then exit from Neovim
https://github.com/yutkat/confirm-quit.nvim
Last synced: about 2 months ago
JSON representation
Check and then exit from Neovim
- Host: GitHub
- URL: https://github.com/yutkat/confirm-quit.nvim
- Owner: yutkat
- License: mit
- Created: 2021-04-07T13:18:56.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-01-24T02:26:54.000Z (4 months ago)
- Last Synced: 2024-01-24T10:41:37.980Z (4 months ago)
- Language: Lua
- Size: 19.5 KB
- Stars: 19
- Watchers: 2
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Lists
- awesome-neovim - yutkat/confirm-quit.nvim - Confirm before quitting Neovim. (Utility / Cursorline)
- awesome-neovim - yutkat/confirm-quit.nvim - Confirm before quitting Neovim. (Utility / Cursorline)
- awesome-neovim - yutkat/confirm-quit.nvim - Confirm before quitting Neovim. (Utility / Cursorline)
README
# confirm-quit
This plugin will give you a confirmation message when you close the last window. It prevents Neovim from closing unexpectedly.
![2021-04-07_22-15](https://user-images.githubusercontent.com/8683947/113873204-8fc59280-97ef-11eb-82b3-1c8b55373277.png)
## Installation
### Lazy
```lua
{
"yutkat/confirm-quit.nvim",
event = "CmdlineEnter",
opts = {},
}
```### Packer
```lua
use {
"yutkat/confirm-quit.nvim",
event = "CmdlineEnter",
config = function() require "confirm-quit".setup() end,
}
```## Default options
```lua
{
overwrite_q_command = true, -- Replaces :q and :qa with :ConfirmQuit and :ConfirmQuitAll
}
```## Commands
You do not need to use those commands directly. `:q` and `:qa` are aliases to `:ConfirmQuit` and `:ConfirmQuitAll` if you didn't change the default config.
I also recommend you set `vim.opt.confirm = true` to get prompted if you want to save all the unsaved changes.
```vim
ConfirmQuit " Same as :q, unless it's the last window, in which case it prompts you before taking any action.
ConfirmQuitAll " Similar to :ConfirmQuit. Will always prompt you to quitConfirmQuit! " An alias to :q!
ConfirmQuitAll! " An alias to :qa!
```## Lua interface
```lua
require "confirm-quit".confirm_quit() -- :ConfirmQuit
require "confirm-quit".confirm_quit_all() -- :ConfirmQuitAllrequire "confirm-quit".confirm_quit { bang = true } -- ConfirmQuit!
require "confirm-quit".confirm_quit_all { bang = true } -- ConfirmQuitAll!
```## Keymaps
Here's an example of how you'd set up keymaps:
```lua
vim.keymap.set("n", "q", require "confirm-quit".confirm_quit)
vim.keymap.set("n", "Q", require "confirm-quit".confirm_quit_all)
```