• Stars
    star
    119
  • Rank 297,930 (Top 6 %)
  • Language
    Shell
  • License
    MIT License
  • Created over 7 years ago
  • Updated almost 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Better 'less' - A bash script that loads emacs with minimal view-mode config - Created with Org mode

Eless - A Better Less

https://github.com/kaushalmodi/eless/actions/workflows/test.yml/badge.svg

*Documentation*


*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/docs/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

Meta Features

  • [X] This script passes ShellCheck, and
  • [X] Unofficial Bash /strict mode/[fn:1] is enabled.
  • [X] Always-in-sync documentation as the eless script and documentation are generated using Org Babel from one file (even this README).
  • [X] The documentation site is generated on-the-fly on Netlify using that same one file.
  • [X] This bash script has tests too!

[fn:1] http://redsymbol.net/articles/unofficial-bash-strict-mode/

Requirements

SoftwareDetails
emacsIf only running the eless script, the mininum required emacs version is 22.1 (manually tested). If developing (running make all html test), the minimum required version is 25.3.
bashThis is a bash script. So even if you don’t use bash shell, you need to have the bash binary discoverable through your environment variable PATH. Tested to work in =tcsh= shell on RHEL 6.6.
perlPerl is used to replace grep -Po and case-insensitive sed based replacements (using /I) as those features are available only in GNU versions of grep and sed (which are not present by default on macOS systems). Tested with Perl v5.16.3 on RHEL 6.6.
texinfoRequired to generate the eless Info manual (when doing make install)
NOTE 1
If the environment variable EMACS is set, eless uses that as the emacs binary, else it defaults to using emacs as emacs binary.
NOTE 2
eless is known to not work with info (texinfo) 6.1 (see eless issue #35). If you want to use eless to view Info manuals, ensure that it is at least version 6.5.

Installation

Manual installation

Clone this rep

For the following instructions, let’s assume that you clone this repo to ~/downloads/eless.

git clone https://github.com/kaushalmodi/eless ~/downloads/eless

Run make

cd ~/downloads/eless
make install PREFIX=~/.local

Installation Directory Structure

The above make install will install the eless script and documentation in a directory structure like this:

<PREFIX>
    β”œβ”€β”€ bin/
    β”‚    └── eless
    └── share/
         └── eless/
              β”œβ”€β”€ eless.org
              └── info/
                   β”œβ”€β”€ eless.info
                   └── dir
NOTE
Make sure that you add <PREFIX>/bin/ directory to your PATH environment variable and <PREFIX>/share/eless/info/ to INFOPATH.

Uninstallation

Assuming that you used PREFIX=~/.local in the Run =make= step above, uninstall it using the same PREFIX:

cd ~/downloads/eless
make uninstall PREFIX=~/.local

Homebrew users

Homebrew users can install eless using:

brew install eless

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            #
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
PAGER=eless python3; help('def')      # Read (I)Python keyword help pages (example: help for 'def' keyword)
PAGER=eless python3; help('shlex')    # Read (I)Python module help pages (example: help for 'shlex' module)
PAGER=eless python3; help('TYPES')    # Read (I)Python topic help pages (example: help for 'TYPES' topic)
PAGER=eless man grep                  # Launches man pages in eless (terminal mode), if the env var PAGER is set to eless (does not work on macOS).
PAGER=less man -P eless grep          # Launches man pages in eless (terminal mode), if the env var PAGER is *not* set to eless (works on macOS).
PAGER="eless --gui" man grep          # Launches man pages in eless (GUI mode), if the env var PAGER is set to "eless --gui" (does not work on macOS).
PAGER=less man -P "eless --gui" grep  # Launches man pages in eless (GUI mode), if the env var PAGER is *not* set to eless (works on macOS).
NOTE
Above examples are tested to work in a =bash= shell. Specifically, examples like PAGER=eless man grep might need to be adapted for the shell you are using, and also the OS.

Contributors

  • Thanks to Skye Shaw for helping improving eless so that it can run on macOS and emacs 22.1, and suggesting Bash trap.
  • 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.

More Repositories

1

ox-hugo

A carefully crafted Org exporter back-end for Hugo
Emacs Lisp
826
star
2

.emacs.d

My emacs configuration
Emacs Lisp
258
star
3

hugo-bare-min-theme

A bare minimum theme for Hugo (https://gohugo.io) to help develop and debug Hugo sites -- https://hugo-bare-min.netlify.com/,
HTML
78
star
4

hello_musl

NimScript (config.nims) for building a static binary using Nim + musl + pcre + libressl/openssl
Nim
77
star
5

hugo-search-fuse-js

Hugo theme component for implementing static site search using Fuse.js
HTML
65
star
6

nim_config

Global project-agnostic config.nims
Nim
58
star
7

hugo-debugprint

Hugo "debugprint.html" partial
HTML
47
star
8

dotfiles

Python
44
star
9

hugo-atom-feed

Hugo theme component for ATOM feed custom Output Format
33
star
10

custom_uvm_report_server

Customized UVM Report Server
SystemVerilog
29
star
11

hugo-onyx-theme

A Hugo theme built using the Hugo Alabaster theme as base
CSS
28
star
12

nim-systemverilog-dpic

Using Nim to interface with SystemVerilog test benches via DPI-C
SystemVerilog
21
star
13

ptr_math

Pointer arithmetic in Nim
Nim
11
star
14

ntodo

CLI app for Todoist written in Nim (REST API v8)
Nim
10
star
15

std_vector

Nim wrapper for C++ std::vector
Nim
10
star
16

ox-minutes

Plain text backend for Org for meeting minutes
Emacs Lisp
9
star
17

tomelr

Emacs-Lisp Library for converting S-expressions to TOML
Emacs Lisp
6
star
18

version

Fetch and parse the version number of most CLI apps
Nim
5
star
19

elnim

Collection of Nim procs/templates/macros which can serve as "phew! I am glad Nim has this!" for Emacs/Emacs-Lisp/Lisp enthusiasts.
Nim
5
star
20

strfmt

A string formatting module for Nim, inspired by Python's .format
Nim
4
star
21

nim-systemverilog-vpi

Using Nim to interface with Verilog and SystemVerilog test benches via VPI
C
3
star
22

hugo-micro-json

Hugo theme component for a custom JSON Output Format
2
star
23

p4ztag_to_json

Convert Perforce P4 Ztag data format to JSON
Nim
2
star
24

hugo-jf2

Hugo theme component for JF2 custom Output Format
2
star
25

nim-svdpi

Small wrapper for SystemVerilog DPI-C header svdpi.h
Nim
2
star
26

jenkins-minimal

Minimal Jenkins config repo
Shell
2
star
27

nim-eggx

Nim wrapper for EGGX / ProCALL X11 Graphics library
C
1
star
28

scripts

Bunch of scripts
Shell
1
star
29

iosevka-mirror

Repo to host Iosevka woff and woff2 for my sites (Credit: https://github.com/be5invis/Iosevka)
Shell
1
star
30

noxhugo

Utility to build Hugo sites using ox-hugo (Emacs + Org mode)
Nim
1
star
31

parse_c_header

Library to parse C header files
Nim
1
star
32

baser

Emacs-Lisp Library for converting to and from Decimal, Hexadecimal and Binary numbers
Emacs Lisp
1
star
33

nim-nightly-docs

Unofficial repo to host nightly builds of Nim docs from devel branch
HTML
1
star