kevinwaddle / eless

A Better 'less' - Combination of bash script and a minimal emacs view-mode config - Created using Org Babel

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Eless - A Better Less

ShellCheck Status: https://travis-ci.org/kaushalmodi/eless.svg?branch=master


Documentation: Org exported HTML | Wiki


eless is a combination of Bash script and a minimal emacs view-mode config.

This script is designed to:

  • Be portable – Just one bash script to download to run
  • Be independent of a user’s emacs config
    • You can still customize the =eless= config if you like.
  • Not require an emacs server to be already running

It was created out of a need to have something like less (in the sense of launch quickly, do, and quit, but better in these ways:

  • Syntax highlighting
  • Org-mode file rendering
  • A better navigable man page viewer
  • A better Info viewer
  • Dired, especially wdired (batch edit symbolic links, for example?)
  • Colored diffs, git diff, git log, ls, etc. (auto ANSI detection)
  • Filter log files to only show (or not show) lines matching a regexp
  • Auto-revert log files when I want (like tail -f)
  • Quickly change frame and font sizes
  • .. and more; basically everything that emacs has to offer!

I call it eless and here’s a little taste of what it looks like:

https://raw.githubusercontent.com/kaushalmodi/eless/master/doc/images/eless-examples.png

Shown above, starting from top left image and proceeding clock-wise..

  • eless eless.org
  • rg --color=ansi 'man pages' | eless (rg?)
  • man grep (I have set my PAGER env var to eless.)
  • info eless (I have aliased info to =’\info \!* | eless’= in my tcsh shell.)
  • eless . (Shows the current directory contents in dired.)
  • diff of eless.org with an older saved version and piping the result to eless

As a bonus:

  • This script passes ShellCheck, and
  • Unofficial Bash strict mode is enabled.
  • Always-in-sync documentation as the eless script and documentation are generated using Org Babel from one file (even this README).

Try it out

Here are some usage examples:

eless foo.txt               # Open foo.txt in eless in terminal (-nw) mode by default.
eless foo.txt --gui         # Open foo.txt in eless in GUI mode.
echo 'foo' | eless          #
echo 'foo' | eless -        # Same as above. The hyphen after eless does not matter; is anyways discarded.
grep 'bar' foo.txt | eless  #
PAGER=eless man grep        # Launches man pages in eless (terminal mode), if the environment variable PAGER is set to eless.
PAGER=eless man grep --gui  # Launches man pages in eless (GUI mode), if the environment variable PAGER is set to eless.
diff foo bar | eless        # Colored diff!
diff -u foo bar | eless     # Colored diff for unified diff format
eless .                     # Open dired in the current directory (enhanced 'ls')
ls --color=always | eless   # Auto-detect ANSI color codes and convert those to colors
PAGER=eless git diff        # Show git diff with ANSI coded colors
eless -h | eless            # See eless help ;-)
info emacs | eless          # Read emacs Info manual in eless
eless foo.tar.xz            # Read the contents of archives; emacs does the unarchiving automatically

Contributors

  • Thanks to Iqbal Ansari for adding support to read piped data in emacs -Q -nw.
  • Thanks to Adam Porter for adding a bash collapsing function for debug statements, and testing out and providing suggestions on improving the eless build flow.

About

A Better 'less' - Combination of bash script and a minimal emacs view-mode config - Created using Org Babel

License:MIT License


Languages

Language:Shell 71.2%Language:Emacs Lisp 28.8%