1

I want the ruler made to show the current characters code. This code differs from encoding to encoding.

This is because I have to handle different file comming from users. Some from Unix/Linux, most from Windows.

Concerning VIM version 8.0.1453

(I use vim to write perl skripts)

3

There's an example under :help statusline:

<   Similar, but add ASCII value of char under the cursor (like "ga") >
      :set statusline=%<%f%h%m%r%=%b\ 0x%B\ \ %l,%c%V\ %P

It's "Emulat[ing] [the] standard status line with 'ruler' set" and "add[ing] ASCII value of char under the cursor."

The relevant items are

    b N   Value of character under cursor.
    B N   As above, in hexadecimal.

As Christian Brabandt points out, you can set just the ruler with rulerformat, which takes similar items. For example,

:set rulerformat=%b\ 0x%B\ %c%V\ %p%%

Note (see vim-help,:h ruler):
"If the statusline is given by 'statusline' ... this option takes precedence over 'ruler' and 'rulerformat'"

2
  • 1
    you might want to mention, that you can also set the ruler using :set rulerformat Jun 21 at 17:22
  • I don't think so Jun 21 at 18:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.