19

I'm working with an HTML file, and I need to know my cursor position index in the overall file.

In Visual Studio, I can see the line number and column number in status bar.

In Notepad++ too, in the status bar, line number and column number are shown.

But I need to know the index of the cursor. For example, instead of line 4 column 23, I want to know that I'm at the 256th character in the file.

Does any editor exist out there with this feature?

  • in the end, notepad++ has this feature, but VS is not ... wow, I'm truly amazed – Thariq Nugrohotomo May 31 '16 at 5:10
25

I need to know the index of the cursor.

For example, instead of line 4 column 23, I want to know that I'm at the 256th character in the file.**

Notepad++ already has the feature you are looking for.

  1. Select all characters from the current cursor position to the start of the file using ctrl+shift+home
  2. Look at the status bar where it says "Sel: characters|rows"

    • The first value characters is the number of characters in the selection.
    • The second value rows is the number of rows in the selection.
    • The selection starts from the beginning of the file and ends where the cursor was previously .
    • The value of characters is the "index" of the cursor.

    enter image description here

Note that characters includes the end of line characters.

|improve this answer|||||
  • 6
    Note that char position is different than actual byte offset in the file for UTF-8 encoding or Unicode files in general. Use Ctrl+G and in Go To... dialog switch to Offset for You are here value to show byte offset no matter file encoding. – wqw May 5 '17 at 11:20
9

Press Ctrl-G and click the "offset" radio button. Your cursor position will be shown. Example below:

enter image description here

|improve this answer|||||

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.