Advanced LsEdit

(last updated: 10/11/18)

Most users won't need to mess with any more than the topics covered in the basic LsEdit tutorial. However, just like any word processor, LsEdit can handle a whole lot more than the basics. As touched on earlier, LsEdit revolves around the concept of "lines" -- and many of the more advanced commands require a "start line" and and "end line."

For example, the .p command can be used by itself, or can have one or two numbers after it to define the "range" of lines to operate on.  If you have one number, the "range" consists of one line.  If you have two numbers, the "range" consists of everything between those two lines, inclusive.  For example, in the command '.p 1 3', the start of the range is line 1, and the end of the range is line 3.  Same with '.del 1 3'.  Respectively, these commands allow us to list lines 1-3 or delete lines 1-3.

It starts to get a bit trickier with other commands. The '.indent' command, for example, requires a range, an equal-sign, and an amount to indent by.  This will make more sense with an example, which we'll get to next.

Line Commands

We will be using the following sample text for the next few entries:

1: Most people use LsEdit as a way to store long descriptions or other files,

2: but it can also save you a lot of time in the long run.  For example,

3: LsEdit makes fixing small typigraphical errors easy.

If you noticed that "typographical" was misspelled, you get a gold star. But more to the point, the replace command, '.repl', can replace the misspelled word with the correct one.  The '.repl' command requires three parts: a range to work upon, the "old" text, and the "new" text. Let's see if these three examples make more sense -- all three do the same thing.

  .repl 1 99 = /typigraphical/typographical

  .repl 1 3  = /typi/typo

  .repl   3  = /typi/typo

Typing '.p 3' would show us the line's been fixed:

3: LsEdit makes fixing small typographical errors easy.

One problem with the sample text is that the lines are split up.  Maybe you want to combine them into one line.  To do so, just use the simple '.join' command to slam them all together.  After the above '.repl' command, this command...

  .join 1 3

... which would give us the following if we typed '.p'...

1: Most people use LsEdit as a way to store long descriptions or other files, but it can also save you a lot of time in the long run.  For example, LsEdit makes fixing small typographical errors easy.

Now let's say you wanted to split the lines up so that no line is longer than 60 columns.  Maybe we're just indecisive, but that's okay!  We have the format command, conveniently named '.format'.  It requires two parts - a range and a width.  For this example, the width is 60 columns.  So, now that everything's been '.join'ed into line 1, we'd type...

  .format 1=60

... which would give us the following if we typed '.p'...

1: Most people use LsEdit as a way to store long descriptions

2: or other files, but it can also save you a lot of time in

3: the long run.  For example, LsEdit makes fixing small

4: typographical errors easy.

See how the lines are nice and short in the last example?  It's too far to the left, though; let's shift it over five spaces with the handy indent command, named - yep, you guessed it - '.indent'. It works the same was as format does, only the "width" indicates how far to indent instead of wrap lines.  It works like this...

  .indent 1 4=5

... and if we typed '.p', we'd get...

1:      Most people use LsEdit as a way to store long descriptions

2:      or other files, but it can also save you a lot of time in

3:      the long run.  For example, LsEdit makes fixing small

4:      typographical errors easy.

Simple, huh?  We could undo that by typing '.left 1 4. Or we could center it within 75 columns with '.center 1 4=75'.  Or we could get really crazy and line it up along the right edge at 75 columns with '.right 1 4=75'...

1:                Most people use LsEdit as a way to store long descriptions

2:                 or other files, but it can also save you a lot of time in

3:                     the long run.  For example, LsEdit makes fixing small

4:                                                typographical errors easy.

Other Uses For Lists

Okay, enough horsing around with formatting. You can use LsEdit lists for other stuff too. Let's say you wanted to describe a television set that showed different pictures at different times. First you might type:

  @desc television=It's a television set. Right now, you see: {lrand:images}

Then you could create the following list in lsedit:

  lsedit television=images

  A nice romantic sunset.

  A flock of seagulls. 

  Kyo punching the stuffing out of Iori.

  A news bulletin: Cody's escaping from prison. AGAIN.

  .end

Stupid example, sure, but let's run with it.  You could alphabetize the list by typing '.sort 1 99'. Or you could mix it up a bit with '.scramble 1 99'.  It doesn't matter since you're randomizing it with '{lrand}' anyway, but who doesn't want to see Iori getting beat up?

Line Number Tokens

Okay, one more thing. Sorry, I've been holding out on you -- you don't always have to use -numbers- in your line ranges. You can use placeholders too -- instead of a line number, you can type a symbol to represent a particular line number. So it's not a real line number -- you can be lazy about it. ... Yeah, I didn't tell you about this because I didn't want to call you lazy, that's it. Here are the shortcuts you can use. (For example purposes, let's say we're on line 5, and you're inserting at the last line, line 11.)

= the first line. (i.e. line 1.  Why do we need this again?)

= the current line. (i.e. line 3.)

= the last line. (i.e. line 11.)

+2 = the current line, plus the number. (i.e. line 3 +2 = line 5.)

^+3 = the first line, plus the number. (i.e. line 1 +3 = line 4.)

$-4 = the last line, minus the number. (i.e. line 11 -4 = line 7.)

You can consider yourself a true lsedit master if you remember all these codes!  If you get stuck, or want to try any of the other commands, type '.h' from within lsedit for a helpful list.