mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 7.4.791
Problem: The buffer list can be very long. Solution: Add an argument to ":ls" to specify the type of buffer to list. (Marcin Szamotulski)
This commit is contained in:
@@ -986,9 +986,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 ~
|
||||||
@@ -1014,6 +1015,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.
|
||||||
|
15
src/buffer.c
15
src/buffer.c
@@ -2761,7 +2761,20 @@ buflist_list(eap)
|
|||||||
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 unlisted buffers, unless ! was used */
|
||||||
if (!buf->b_p_bl && !eap->forceit)
|
if ((!buf->b_p_bl && !eap->forceit && !vim_strchr(eap->arg, 'u'))
|
||||||
|
|| (vim_strchr(eap->arg, 'u') && buf->b_p_bl)
|
||||||
|
|| (vim_strchr(eap->arg, '+')
|
||||||
|
&& ((buf->b_flags & BF_READERR) || !bufIsChanged(buf)))
|
||||||
|
|| (vim_strchr(eap->arg, 'a')
|
||||||
|
&& (buf->b_ml.ml_mfp == NULL || buf->b_nwindows == 0))
|
||||||
|
|| (vim_strchr(eap->arg, 'h')
|
||||||
|
&& (buf->b_ml.ml_mfp == NULL || buf->b_nwindows != 0))
|
||||||
|
|| (vim_strchr(eap->arg, '-') && buf->b_p_ma)
|
||||||
|
|| (vim_strchr(eap->arg, '=') && !buf->b_p_ro)
|
||||||
|
|| (vim_strchr(eap->arg, 'x') && !(buf->b_flags & BF_READERR))
|
||||||
|
|| (vim_strchr(eap->arg, '%') && buf != curbuf)
|
||||||
|
|| (vim_strchr(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)
|
||||||
|
@@ -217,7 +217,7 @@ EX(CMD_browse, "browse", ex_wrongmodifier,
|
|||||||
NEEDARG|EXTRA|NOTRLCOM|CMDWIN,
|
NEEDARG|EXTRA|NOTRLCOM|CMDWIN,
|
||||||
ADDR_LINES),
|
ADDR_LINES),
|
||||||
EX(CMD_buffers, "buffers", buflist_list,
|
EX(CMD_buffers, "buffers", buflist_list,
|
||||||
BANG|TRLBAR|CMDWIN,
|
BANG|EXTRA|TRLBAR|CMDWIN,
|
||||||
ADDR_LINES),
|
ADDR_LINES),
|
||||||
EX(CMD_bufdo, "bufdo", ex_listdo,
|
EX(CMD_bufdo, "bufdo", ex_listdo,
|
||||||
BANG|NEEDARG|EXTRA|NOTRLCOM|RANGE|NOTADR|DFLALL,
|
BANG|NEEDARG|EXTRA|NOTRLCOM|RANGE|NOTADR|DFLALL,
|
||||||
@@ -526,7 +526,7 @@ EX(CMD_file, "file", ex_file,
|
|||||||
RANGE|NOTADR|ZEROR|BANG|FILE1|TRLBAR,
|
RANGE|NOTADR|ZEROR|BANG|FILE1|TRLBAR,
|
||||||
ADDR_LINES),
|
ADDR_LINES),
|
||||||
EX(CMD_files, "files", buflist_list,
|
EX(CMD_files, "files", buflist_list,
|
||||||
BANG|TRLBAR|CMDWIN,
|
BANG|EXTRA|TRLBAR|CMDWIN,
|
||||||
ADDR_LINES),
|
ADDR_LINES),
|
||||||
EX(CMD_filetype, "filetype", ex_filetype,
|
EX(CMD_filetype, "filetype", ex_filetype,
|
||||||
EXTRA|TRLBAR|CMDWIN,
|
EXTRA|TRLBAR|CMDWIN,
|
||||||
@@ -847,7 +847,7 @@ EX(CMD_lwindow, "lwindow", ex_cwindow,
|
|||||||
RANGE|NOTADR|COUNT|TRLBAR,
|
RANGE|NOTADR|COUNT|TRLBAR,
|
||||||
ADDR_LINES),
|
ADDR_LINES),
|
||||||
EX(CMD_ls, "ls", buflist_list,
|
EX(CMD_ls, "ls", buflist_list,
|
||||||
BANG|TRLBAR|CMDWIN,
|
BANG|EXTRA|TRLBAR|CMDWIN,
|
||||||
ADDR_LINES),
|
ADDR_LINES),
|
||||||
EX(CMD_move, "move", ex_copymove,
|
EX(CMD_move, "move", ex_copymove,
|
||||||
RANGE|WHOLEFOLD|EXTRA|TRLBAR|CMDWIN|MODIFY,
|
RANGE|WHOLEFOLD|EXTRA|TRLBAR|CMDWIN|MODIFY,
|
||||||
|
@@ -741,6 +741,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
791,
|
||||||
/**/
|
/**/
|
||||||
790,
|
790,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user