Monday, March 1, 2010

Re: :buffers output - gather it on a specific buffer

On Mon, 1 Mar 2010, David Fishburn wrote:

> Vim 7.2.367
>
> Does anyone know how to get the same data :buffers provides for the
> current buffer?

Maybe I'm missing something (You seem more Vim-savvy than I am, so I'm
surprised I would know), but here goes...

In the examples below, replace '...' with bufnr("%") to get the value
for the current buffer, or just pass in the bufnr you have.

> From the :help :buffers
>
> Indicators (chars in the same column are mutually exclusive):
> u an unlisted buffer (only displayed when [!] is used)
> |unlisted-buffer|

!buflisted(...)

> % the buffer in the current window

bufnr("%")

> # the alternate buffer for ":e #" and CTRL-^

bufnr("#")

> a an active buffer: it is loaded and visible

bufloaded(...) && bufwinnr(...) != -1

> h a hidden buffer: It is loaded, but currently not
> displayed in a window |hidden-buffer|

bufloaded(...) && bufwinnr(...) == -1


The rest have me stumped for the 'for a bufnr I specify' part. And
someone can correct me if I'm wrong, but they don't seem to be
'localizable' (i.e. '&' works fine, rather than '&l:').

> - a buffer with 'modifiable' off

! &modifiable

> = a readonly buffer

&readonly

> + a modified buffer

&modified

> x a buffer with read errors

...I have no idea on this one... 'read errors'?

Best,
Ben

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: