el
el is a small shell script that I find quite useful. For me, it's an intuitive way to open (edit) files. It also works well in little wrapper functions.
Download link: http://code.cutup.org/sh/el
There's also a man page : http://code.cutup.org/sh/el.1
el is also available as a function for .bashrc/.kshrc. The function has an additional option: -g - that cd's to $el. http://code.cutup.org/sh/el.function
Save or copy the file to somewhere in your path. You may need to chmod +x el. Run el -h for a brief help message.
el - searching editor
SYNOPSIS
el [-h] [-z] [-a [search terms] ]
DESCRIPTION
Finds and edits files matching all arguments in basedir. Arguments are
regular expressions delimited by whitespace. Basedir is defined by the
value of $el. If unset it defaults to current directory.
With no arguments, lists all files in basedir. If a single file matches
all arguments, opens the file with $EDITOR. If multiple files match,
prints a numbered list of matches and prompts for input.
The first item in the list, 0) , is always the search string. Selecting
a number will open the file in $EDITOR. Lastly, input that does not
begin with a number is treated as the filename to edit.
OPTIONS
-a include hidden files
-h brief help
-z print value of $el
CONFIGURATION
Add export el to .bashrc to make the variable easily available. el(1)
gets more useful when wrapped in .bashrc functions, for example:
export el
function howto {
local el=~/docs/howto
el $@
}
This redefines the basedir locally in the function, executes el(1) as
normal, and leaves the value of basedir unchanged. The basedir can also
be temporarily changed in a shell session by setting el=/path/to/dir
home