Jump to content




less - Like the Unix command!


5 replies to this topic

#1 LDDestroier

  • Members
  • 1,089 posts
  • LocationACDC Town

Posted 07 January 2016 - 07:14 PM

I saw a lot of people who made a program to replicate the function of 'cat', but all of them just print the contents of the file and don't allow scrolling.
But then SquidDev told me that's what cat is supposed to do, and now I feel dumb.

See the program for syntax.

Allows for the downloading of files as well. Because that's useful...

pastebin get en8GA73P less
std pb en8GA73P less
std ld less less

It uses arrow keys to scroll left/right and up/down, as well as the mouse scroll. Hold CTRL to mouse-scroll left and right.
When making files, it checks if the path is read-only, and checks if there is enough space.

Also, to exit, press 'X', and to go to a specific line, press 'L'.
To go to bottom of the screen, press 'END' or 'SHIFT+G'. To go to the top, press 'HOME' or 'G'.

Edited by LDDestroier, 08 January 2016 - 05:51 PM.


#2 SquidDev

    Frickin' laser beams

  • Members
  • 1,402 posts
  • LocationDoes anyone put something serious here?

Posted 07 January 2016 - 07:24 PM

If you've got scrolling, it is closer to less than cat :P

In all seriousness, it might be useful to have some functionality from less: being able to do a forwards and backwards search using Lua patterns, page up/down support, as well as several less shortcuts: G,g,q, etc...

Also, the keys table holds the key codes for each key, so you don't need to use constants, but keys.up instead.

#3 LDDestroier

  • Members
  • 1,089 posts
  • LocationACDC Town

Posted 07 January 2016 - 08:08 PM

View PostSquidDev, on 07 January 2016 - 07:24 PM, said:

If you've got scrolling, it is closer to less than cat :P

In all seriousness, it might be useful to have some functionality from less: being able to do a forwards and backwards search using Lua patterns, page up/down support, as well as several less shortcuts: G,g,q, etc...

Also, the keys table holds the key codes for each key, so you don't need to use constants, but keys.up instead.
Oh yeah...I mixed the two commands up in my head. Time to rename it...

#4 LDDestroier

  • Members
  • 1,089 posts
  • LocationACDC Town

Posted 08 January 2016 - 05:53 PM

View PostSquidDev, on 07 January 2016 - 07:24 PM, said:

In all seriousness, it might be useful to have some functionality from less: being able to do a forwards and backwards search using Lua patterns, page up/down support, as well as several less shortcuts: G,g,q, etc...

While having it search through a document and find the next match of a certain word is hard, I added a goto line function, as well as the 'g', 'q', and 'G' keybinds.

#5 FUNCTION MAN!

  • Members
  • 292 posts

Posted 09 January 2016 - 08:19 PM

e, y, f, b (and ^E, ^Y, ^F & ^B move forward a line, backwards a line, forwards a window, and backwards a window, respectively. (^LETTER is Ctrl+LETTER)
n repeats the previous search (i.e., find next), and N is find next backwards.
j and k go up and down (I'd prefer it to be k/l myself, maybe make key bindings configurable?)
&<pattern> will hide all lines that don't match <pattern>.

Edited by FUNCTION MAN!, 09 January 2016 - 08:19 PM.


#6 LDDestroier

  • Members
  • 1,089 posts
  • LocationACDC Town

Posted 11 January 2016 - 12:01 AM

I added some extra buttons based on the less help menu. Boy are there a lot! I didn't add them all, though.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users