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

Re: show total bytes in file

Expand Messages
  • Antoine J. Mechelynck
    ... Yes, it is. You ll need to write your own statusline option, with everything you want to appear. The filesise is line2byte(line( $ ) + 1) see ... HTH,
    Message 1 of 3 , Aug 1, 2004
      Rainer Bendig <lists@...> wrote:
      > Hi,
      > is it possible to show the total bytes in the file while i am editing
      > it left or right from "line,char" ?
      > --
      > so long,
      > Rainer Bendig aka mindz PGP/GPG key (ID: 0xCC7EA575)
      > http://DigitallyImpressed.com Get it from wwwkeys.de.pgp.net
      > for contacting me take a look on http://digitallyimpressed.com/contact
      > ----------------------------------------------------------------------
      > Don't reply to this e-mail address and please don't cc to me on lists.
      > If we meet on a list, you can be sure that i am already on the list.

      Yes, it is. You'll need to write your own 'statusline' option, with
      everything you want to appear. The filesise is

      line2byte(line("$") + 1)

      see
      :help 'statusline'
      :help line2byte()

      HTH,
      Tony.
    • Dave Silvia
      How about: command! Where let lhere=line( . ) | let chere=col( . ) | call cursor(1,1) | call cursor(line( $ ),col( $ )) | call cursor(lhere,chere) |
      Message 2 of 3 , Aug 1, 2004
        How about:

        command! Where
        \ let lhere=line(".") |
        \ let chere=col(".") |
        \ call cursor(1,1) |
        \ call cursor(line("$"),col("$")) |
        \ call cursor(lhere,chere) |
        \ let clast=line2byte(line("$")+1)-1 |
        \ let lbytes=line2byte(lhere-1)+chere |
        \ let rbytes=clast-lbytes-1 |
        \ echo " ".lbytes.",".rbytes.",".clast

        noremap <F12> :Where<CR>

        Output is 'bytes-to-the-left,bytes-to-the-right,total-bytes' when the f12
        key is pressed, e.g., for the example code (unix fileformat), with the
        cursor on the 'c' in 'command' the output would be

        0,321,322

        for the 't' in 'clast'

        266,55,322

        for the '>' in '<CR>'

        321,0,322

        Was that kinda what you had in mind?

        HTH,
        Dave S.

        P.S. There is an anomaly! If you're on the last line and it has no
        characters, the output is 'total-bytes',-1,'total-bytes'! There's a similar
        oddity when you're adding the first line for the first time. But as long as
        you know that:)


        -----Original Message-----
        From: rainer [mailto:lists@...]
        Sent: Sunday, August 01, 2004 5:03 AM
        To: vim@...
        Subject: show total bytes in file

        Hi,
        is it possible to show the total bytes in the file while i am editing
        it left or right from "line,char" ?
        --
        so long,
        Rainer Bendig aka mindz PGP/GPG key (ID: 0xCC7EA575)
        http://DigitallyImpressed.com Get it from wwwkeys.de.pgp.net
        for contacting me take a look on http://digitallyimpressed.com/contact
        ----------------------------------------------------------------------
        Don't reply to this e-mail address and please don't cc to me on lists.
        If we meet on a list, you can be sure that i am already on the list.
      Your message has been successfully submitted and would be delivered to recipients shortly.