21

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?

1
  • in the end, notepad++ has this feature, but VS is not ... wow, I'm truly amazed May 31, 2016 at 5:10

2 Answers 2

26

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.

1
  • 7
    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, 2017 at 11:20
13

Press Ctrl+G and click the Offset radio button. Your cursor position will be shown in the You are here: line

Example:

Notepad++ "Go To..." window

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .