How to number lines in internal FAR editor

You have encountered a problem using Far Manager? Here you can get help.
Post Reply
KlepetoX
Posts: 129
Joined: Sun 08 Jan, 2012 08:23
Location: Czech Republic
Has thanked: 2 times
Been thanked: 1 time

How to number lines in internal FAR editor

Post by KlepetoX »

How to number lines in internal FAR editor? FAR itself, plugin, macro?

Example before:

Hello world,
how are you?
What is the weather today?

Example after:

01 Hello world,
02 how are you?
03 What is the weather today?
Shmuel
Posts: 6820
Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 41 times
Been thanked: 528 times

Re: How to number lines in internal FAR editor

Post by Shmuel »

If you mean "virtual numbering", that is, line numbers are only indicated but not physically present in the text, then I don't know of any plugin or macro that can do that.

If you mean real inserting the numbers into editor lines, then almost any search and replace plugin can do that (and it is also easy to do with a macro).

Example with LuaFAR Search plugin:
Search for: ^
Replace with: \R{1,2} (there is a space in the end that BBCode deletes)

Example with LuaFAR for Editor plugin (Process Lines utility):
Expression: ("%02d "):format(N)..L
KlepetoX
Posts: 129
Joined: Sun 08 Jan, 2012 08:23
Location: Czech Republic
Has thanked: 2 times
Been thanked: 1 time

Re: How to number lines in internal FAR editor

Post by KlepetoX »

Hello Shmuel, I meant real inserting the numbers. LuaFAR for editor did the job best, even with leading zeros. Thank you.

And may I ask one more question for LuaFAR for editor?

I can see that sorting lines is possible. But I have to set some expression. But what expression? For example I need only sort selected lines by its first letters.
Shmuel
Posts: 6820
Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 41 times
Been thanked: 528 times

Re: How to number lines in internal FAR editor

Post by Shmuel »

KlepetoX wrote:I can see that sorting lines is possible. But I have to set some expression. But what expression? For example I need only sort selected lines by its first letters.
Expressions are described in Help (press F1 while the dialog is displayed).
To sort only by the 1-st letter, ignoring others, the expression is: a:sub(1,1).
Post Reply

Return to “Support and Troubleshooting”