Re: Get buffer's line count and check for emptiness

Salman Halim <[email protected]>
Newsgroups gmane.editors.vim
Message-ID <CANuxnEc5RKwWA9bKGmeu6cj0=5Ec0aJ6uzrmZ9=ZMVFXNcUUDw@mail.gmail.com>
line('$') == 1 to see if it's just one line
getline('1') == '' to see if that line is completely empty
Salman

On Sun, Jan 5, 2025, 08:09 Lifepillar <[email protected]> wrote:

>     var linecount = getbufinfo(bufnr)[0].linecount
>
> I also need to check whether a buffer is empty, which I do like this:
>
>     var is_empty = linecount == 1 && empty(getbufoneline(bufnr, 1))
>
> I'm wondering: is there any simpler way to perform the two tasks above
> that I'm missing?
>
> Thanks,
> Life.
>
>
> --
> --
> 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
>
> ---
> You received this message because you are subscribed to the Google Groups
> "vim_use" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion visit
> https://groups.google.com/d/msgid/vim_use/vle098%24an9%241%40ciao.gmane.io
> .
>

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/vim_use/CANuxnEc5RKwWA9bKGmeu6cj0%3D5Ec0aJ6uzrmZ9%3DZMVFXNcUUDw%40mail.gmail.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.