-
Notifications
You must be signed in to change notification settings - Fork 189
/
mini-bufremove.txt
129 lines (98 loc) · 4.74 KB
/
mini-bufremove.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
*mini.bufremove* Remove buffers
*MiniBufremove*
MIT License Copyright (c) 2021 Evgeni Chasnovski
==============================================================================
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 you
can 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 high
number of different scenarios and customization intentions, writing exact
rules 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`
Module config
Default values:
>lua
MiniBufremove.config = {
-- Whether to set Vim's settings for buffers (allow hidden buffers)
set_vim_settings = true,
-- 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: