diff options
author | Marco Hinz <mh.codebro@gmail.com> | 2015-07-22 11:24:49 +0200 |
---|---|---|
committer | Marco Hinz <mh.codebro@gmail.com> | 2015-11-11 21:46:46 +0100 |
commit | bb43d9b9a2aae7f799eed4fc4f793afd6e466d7d (patch) | |
tree | a4de8a9db139d718e41b70b69005dd75705ccbbf /src/nvim/buffer.c | |
parent | 632408af4a3baa987cc13005675bba63675825cb (diff) | |
download | rneovim-bb43d9b9a2aae7f799eed4fc4f793afd6e466d7d.tar.gz rneovim-bb43d9b9a2aae7f799eed4fc4f793afd6e466d7d.tar.bz2 rneovim-bb43d9b9a2aae7f799eed4fc4f793afd6e466d7d.zip |
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)
https://github.com/vim/vim/commit/d51cb706a4e3ae99555bc214a64c83603c701139
Diffstat (limited to 'src/nvim/buffer.c')
-rw-r--r-- | src/nvim/buffer.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index b3eba4f5f6..10106bcb1d 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -2159,9 +2159,23 @@ void buflist_list(exarg_T *eap) int i; for (buf = firstbuf; buf != NULL && !got_int; buf = buf->b_next) { - /* skip unlisted buffers, unless ! was used */ - if (!buf->b_p_bl && !eap->forceit) + // skip unspecified buffers + 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; + } msg_putchar('\n'); if (buf_spname(buf) != NULL) STRLCPY(NameBuff, buf_spname(buf), MAXPATHL); |