Something went wrong. Try again.
Library of 45+ independent Lua modules improving Neovim experience with minimal effort nvim-mini.org/mini.nvim
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123*mini.bufremove* Remove buffers
MIT License Copyright (c) 2021 Evgeni Chasnovski
------------------------------------------------------------------------------ *MiniBufremove*Features:- Unshow, delete, and wipeout buffer while saving window layout (opposite to builtin Neovim's commands).
# Setup ~
This module doesn't need setup, but it can be done to improve usability.Setup with `require('mini.bufremove').setup({})` (replace `{}` with your`config` table). It will create global Lua table `MiniBufremove` which youcan use for scripting or manually (with `:lua MiniBufremove.*`).
See |MiniBufremove.config| for `config` structure and default values.
This module doesn't have runtime options, so using `vim.b.minibufremove_config`will have no effect here.
To stop module from showing non-error feedback, set `config.silent = true`.
# Notes ~
1. Which buffer to show in window(s) after its current buffer is removed is decided by the algorithm: - If alternate buffer (see |CTRL-^|) is listed (see |buflisted()|), use it. - If previous listed buffer (see |:bprevious|) is different, use it. - Otherwise create a new one with `nvim_create_buf(true, false)` and use it.
# Disabling ~
To disable core functionality, set `vim.g.minibufremove_disable` (globally) or`vim.b.minibufremove_disable` (for a buffer) to `true`. Considering highnumber of different scenarios and customization intentions, writing exactrules for disabling module's functionality is left to user. See|mini.nvim-disabling-recipes| for common recipes.
------------------------------------------------------------------------------ *MiniBufremove.setup()* `MiniBufremove.setup`({config})Module setup
Parameters ~{config} `(table|nil)` Module config table. See |MiniBufremove.config|.
Usage ~>lua require('mini.bufremove').setup() -- use default config -- OR require('mini.bufremove').setup({}) -- replace {} with your config table<------------------------------------------------------------------------------ *MiniBufremove.config* `MiniBufremove.config`Defaults ~>lua MiniBufremove.config = { -- Whether to disable showing non-error feedback silent = false, }<------------------------------------------------------------------------------ *MiniBufremove.delete()* `MiniBufremove.delete`({buf_id}, {force})Delete buffer `buf_id` with |:bdelete| after unshowing it
Parameters ~{buf_id} `(number|nil)` Buffer identifier (see |bufnr()|) to use. Default: 0 for current.{force} `(boolean|nil)` Whether to ignore unsaved changes (using `!` version of command). If `false`, calling with unsaved changes will prompt confirm dialog. Default: `false`.
Return ~`(boolean|nil)` Whether operation was successful. If `nil`, no operation was done.
------------------------------------------------------------------------------ *MiniBufremove.wipeout()* `MiniBufremove.wipeout`({buf_id}, {force})Wipeout buffer `buf_id` with |:bwipeout| after unshowing it
Parameters ~{buf_id} `(number|nil)` Buffer identifier (see |bufnr()|) to use. Default: 0 for current.{force} `(boolean|nil)` Whether to ignore unsaved changes (using `!` version of command). If `false`, calling with unsaved changes will prompt confirm dialog. Default: `false`.
Return ~`(boolean|nil)` Whether operation was successful. If `nil`, no operation was done.
------------------------------------------------------------------------------ *MiniBufremove.unshow()* `MiniBufremove.unshow`({buf_id})Stop showing buffer `buf_id` in all windows
Parameters ~{buf_id} `(number|nil)` Buffer identifier (see |bufnr()|) to use. Default: 0 for current.
Return ~`(boolean|nil)` Whether operation was successful. If `nil`, no operation was done.
------------------------------------------------------------------------------ *MiniBufremove.unshow_in_window()* `MiniBufremove.unshow_in_window`({win_id})Stop showing current buffer of window `win_id`
Notes:- If `win_id` represents |cmdline-window|, this function will close it.
Parameters ~{win_id} `(number|nil)` Window identifier (see |win_getid()|) to use. Default: 0 for current.
Return ~`(boolean|nil)` Whether operation was successful. If `nil`, no operation was done.
vim:tw=78:ts=8:noet:ft=help:norl: