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

34152RE: Line numbering

Expand Messages
  • Keith Roberts
    Dec 11, 2003
    • 0 Attachment
      >-----Original Message-----
      >From: Iain Duncan [mailto:iainduncan@...]
      >Sent: Thursday, December 11, 2003 3:28 PM
      >To: vim-dev@...
      >Subject: Re: Line numbering
      > Keith Roberts wrote:
      >> I don't think so, but you could put it into the statusline ...
      >> :h 'stl'
      >> and look at the stuff on evaluating an expression {}
      >Thanks Keith, but I'm afraid I don't understand your reply! Could you
      >elucidate for a newbie? = )

      1) You should bottom-post (put your responses BELOW, not ABOVE what you are
      replying to). You are probably using Outlook (or another email client which
      doesn't know about bottom-posting). I use it also, but after being flamed
      repeatedly for bottom-posting, I learned to do so *in spite of* Outlook. :)
      You'll notice that I moved your response, and added mine below it.

      2) :set stl? Will show the current 'statusline' setting.
      By default, it's empty, which merely displays the buffername. I use:
      :set statusline=[%n]%f\ %m%r%y%<{%{&ff}}\ %=%l,%c%V=%p%%
      Which, among other things, adds the buffer number inside brackets on the
      left. You could put the line number there instead:
      :set statusline=[%{Nr2Hex(line('.'))}]%f\ %m%r%y%<{%{&ff}}\
      This uses the function defined below.

      3) Here's a function to return the hex equivalent of a number (from :h
      :" The function Nr2Hex() returns the Hex string of a number.
      :func Nr2Hex(nr)
      : let n = a:nr
      : let r = ""
      : while n
      : let r = '0123456789ABCDEF'[n % 16] . r
      : let n = n / 16
      : endwhile
      : return r
    • Show all 4 messages in this topic