Loading ...
Sorry, an error occurred while loading the content.

Finding the length of a buffer in a script

Expand Messages
  • Spiros Bousbouras
    How can you find from within a script how many lines the current buffer has ? One solution is len(getbufline(bufname( % ) , 1 , $ )) but this seems wasteful.
    Message 1 of 4 , Apr 2, 2009
    • 0 Attachment
      How can you find from within a script how many lines
      the current buffer has ? One solution is
      len(getbufline(bufname('%') , 1 , '$'))
      but this seems wasteful.

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • John Beckett
      ... John --~--~---------~--~----~------------~-------~--~----~ You received this message from the vim_use maillist. For more information, visit
      Message 2 of 4 , Apr 2, 2009
      • 0 Attachment
        Spiros Bousbouras wrote:
        > How can you find from within a script how many lines the
        > current buffer has ?

        :echo line('$')

        John


        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_use" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • _sc_
        ... one way would be to let l = line( $ ) sc --~--~---------~--~----~------------~-------~--~----~ You received this message from the vim_use maillist. For
        Message 3 of 4 , Apr 2, 2009
        • 0 Attachment
          On Thursday 02 April 2009 5:43 pm, Spiros Bousbouras wrote:
          >
          > How can you find from within a script how many lines
          > the current buffer has ? One solution is
          > len(getbufline(bufname('%') , 1 , '$'))
          > but this seems wasteful.

          one way would be to

          let l = line('$')

          sc



          --~--~---------~--~----~------------~-------~--~----~
          You received this message from the "vim_use" maillist.
          For more information, visit http://www.vim.org/maillist.php
          -~----------~----~----~----~------~----~------~--~---
        • Spiros Bousbouras
          ... Great , thanks. --~--~---------~--~----~------------~-------~--~----~ You received this message from the vim_use maillist. For more information, visit
          Message 4 of 4 , Apr 2, 2009
          • 0 Attachment
            On 3 Apr, 00:02, "John Beckett" <johnb.beck...@...> wrote:
            > Spiros Bousbouras wrote:
            > > How can you find from within a script how many lines the
            > > current buffer has ?
            >
            > :echo line('$')

            Great , thanks.

            --~--~---------~--~----~------------~-------~--~----~
            You received this message from the "vim_use" maillist.
            For more information, visit http://www.vim.org/maillist.php
            -~----------~----~----~----~------~----~------~--~---
          Your message has been successfully submitted and would be delivered to recipients shortly.