mirror of
https://github.com/neovim/neovim.git
synced 2025-09-25 04:28:33 +00:00
vim-patch:7.4.791 #3078
Problem: The buffer list can be very long.
Solution: Add an argument to ":ls" to specify the type of buffer to list.
(Marcin Szamotulski)
d51cb706a4
This commit is contained in:
@@ -971,9 +971,10 @@ A buffer can also be unlisted. This means it exists, but it is not in the
|
|||||||
list of buffers. |unlisted-buffer|
|
list of buffers. |unlisted-buffer|
|
||||||
|
|
||||||
|
|
||||||
:files[!] *:files*
|
:files[!] [flags] *:files*
|
||||||
:buffers[!] *:buffers* *:ls*
|
:buffers[!] [flags] *:buffers* *:ls*
|
||||||
:ls[!] Show all buffers. Example:
|
:ls[!] [flags]
|
||||||
|
Show all buffers. Example:
|
||||||
|
|
||||||
1 #h "/test/text" line 1 ~
|
1 #h "/test/text" line 1 ~
|
||||||
2u "asdf" line 0 ~
|
2u "asdf" line 0 ~
|
||||||
@@ -999,6 +1000,21 @@ list of buffers. |unlisted-buffer|
|
|||||||
+ a modified buffer
|
+ a modified buffer
|
||||||
x a buffer with read errors
|
x a buffer with read errors
|
||||||
|
|
||||||
|
[flags] can be a combination of the following characters,
|
||||||
|
which restrict the buffers to be listed:
|
||||||
|
+ modified buffers
|
||||||
|
- buffers with 'modifiable' off
|
||||||
|
= readonly buffers
|
||||||
|
a active buffers
|
||||||
|
u unloaded buffers (overrides the "!")
|
||||||
|
h hidden buffers
|
||||||
|
x buffers with a read error
|
||||||
|
% current buffer
|
||||||
|
# alternate buffer
|
||||||
|
Combining flags means they are "and"ed together, e.g.:
|
||||||
|
h+ hidden buffers which are modified
|
||||||
|
a+ active buffers which are modified
|
||||||
|
|
||||||
*:bad* *:badd*
|
*:bad* *:badd*
|
||||||
:bad[d] [+lnum] {fname}
|
:bad[d] [+lnum] {fname}
|
||||||
Add file name {fname} to the buffer list, without loading it.
|
Add file name {fname} to the buffer list, without loading it.
|
||||||
|
@@ -2159,9 +2159,23 @@ void buflist_list(exarg_T *eap)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (buf = firstbuf; buf != NULL && !got_int; buf = buf->b_next) {
|
for (buf = firstbuf; buf != NULL && !got_int; buf = buf->b_next) {
|
||||||
/* skip unlisted buffers, unless ! was used */
|
// skip unspecified buffers
|
||||||
if (!buf->b_p_bl && !eap->forceit)
|
if ((!buf->b_p_bl && !eap->forceit && !strchr((char *)eap->arg, 'u'))
|
||||||
|
|| (strchr((char *)eap->arg, 'u') && buf->b_p_bl)
|
||||||
|
|| (strchr((char *)eap->arg, '+')
|
||||||
|
&& ((buf->b_flags & BF_READERR) || !bufIsChanged(buf)))
|
||||||
|
|| (strchr((char *)eap->arg, 'a')
|
||||||
|
&& (buf->b_ml.ml_mfp == NULL || buf->b_nwindows == 0))
|
||||||
|
|| (strchr((char *)eap->arg, 'h')
|
||||||
|
&& (buf->b_ml.ml_mfp == NULL || buf->b_nwindows != 0))
|
||||||
|
|| (strchr((char *)eap->arg, '-') && buf->b_p_ma)
|
||||||
|
|| (strchr((char *)eap->arg, '=') && !buf->b_p_ro)
|
||||||
|
|| (strchr((char *)eap->arg, 'x') && !(buf->b_flags & BF_READERR))
|
||||||
|
|| (strchr((char *)eap->arg, '%') && buf != curbuf)
|
||||||
|
|| (strchr((char *)eap->arg, '#')
|
||||||
|
&& (buf == curbuf || curwin->w_alt_fnum != buf->b_fnum))) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
msg_putchar('\n');
|
msg_putchar('\n');
|
||||||
if (buf_spname(buf) != NULL)
|
if (buf_spname(buf) != NULL)
|
||||||
STRLCPY(NameBuff, buf_spname(buf), MAXPATHL);
|
STRLCPY(NameBuff, buf_spname(buf), MAXPATHL);
|
||||||
|
@@ -267,7 +267,7 @@ return {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
command='buffers',
|
command='buffers',
|
||||||
flags=bit.bor(BANG, TRLBAR, CMDWIN),
|
flags=bit.bor(BANG, EXTRA, TRLBAR, CMDWIN),
|
||||||
addr_type=ADDR_LINES,
|
addr_type=ADDR_LINES,
|
||||||
func='buflist_list',
|
func='buflist_list',
|
||||||
},
|
},
|
||||||
@@ -885,7 +885,7 @@ return {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
command='files',
|
command='files',
|
||||||
flags=bit.bor(BANG, TRLBAR, CMDWIN),
|
flags=bit.bor(BANG, EXTRA, TRLBAR, CMDWIN),
|
||||||
addr_type=ADDR_LINES,
|
addr_type=ADDR_LINES,
|
||||||
func='buflist_list',
|
func='buflist_list',
|
||||||
},
|
},
|
||||||
@@ -1521,7 +1521,7 @@ return {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
command='ls',
|
command='ls',
|
||||||
flags=bit.bor(BANG, TRLBAR, CMDWIN),
|
flags=bit.bor(BANG, EXTRA, TRLBAR, CMDWIN),
|
||||||
addr_type=ADDR_LINES,
|
addr_type=ADDR_LINES,
|
||||||
func='buflist_list',
|
func='buflist_list',
|
||||||
},
|
},
|
||||||
|
@@ -133,7 +133,7 @@ static int included_patches[] = {
|
|||||||
// 794 NA
|
// 794 NA
|
||||||
793,
|
793,
|
||||||
// 792,
|
// 792,
|
||||||
// 791,
|
791,
|
||||||
// 790,
|
// 790,
|
||||||
// 789,
|
// 789,
|
||||||
// 788 NA
|
// 788 NA
|
||||||
|
Reference in New Issue
Block a user