gitaction
is a script that executes a different action for each file type
specified. It is called by the
git
program when pressing
F2
or
^Xa
(see the
.gitrc.TERM
configuration files in the
git
manual). The first parameter is the current directory name and the second
one is the file name to be matched against the default patterns. The
matching is done using the shell 'case' statement
If you press
F2
or
^Xa
on a
*.c
file,
git
will compile it, if you press
F2
or
^Xa
on a
*.tar.gz
file,
git
will list the tar archive contents, if you press the same keys on a
*.gz
file,
git
will display its uncompressed contents on the screen, etc ...
By default
gitaction
checks for the following patterns:
"*.cc" "*.c" "*.l" "*.y" "*.h" "*.s" "*.S" "*.o" "*.a" "*.sa"
"Makefile" "makefile"
"*.tar.gz" "*.tgz" "*.tar.z" "*.tar.Z" "*.taz" "*.tar" "*.gz"
"*.z" "*.Z"
"*.zip" "*.arj" "*.rar"
"*.doc" "*.txt" "*.lsm"
"*.gif" "*.jpg" "*.jpeg" "*.tif" "*.bmp"
"*.mpg"
"*.mod" "*.s3m" "*.voc" "*.wav"
"*.ps" "*.dvi" "*.tex"
compressed/uncompressed manual pages
and acts as appropriate. If no pattern is found, the file is displayed
using more. Feel free to change this. If you want to find out what the
default action for each file type is (or if you want to modify it), just
read/modify the
gitaction
script.
If you press
F2
or
^Xa
on a
*.gif
file or
*.jpg
file and you have the
zgv
utility installed, you will be able to see it. If you want to change
the gif/jpeg viewer, all you need to do is to change its name in the
gitaction
script. I don't know a
*.bmp
or
*.tif
viewer. Feel free to add one in the
gitaction
script.
The script can be easy enhanced. Just read it.
The
.gitaction
script is a local version of the
gitaction
script. When started,
gitaction
tries to search a script called
.gitaction
in the current directory and, if it finds it, it starts it. If
.gitaction 's
exit code is 0 (
.gitaction
couldn't find a matching pattern),
gitaction
starts its own case statement trying to match the current file name (the
second parameter) against its default patterns.
The
.gitaction
script *must* be executable. An example of
.gitaction
can be fount in
/usr/local/lib .
You should copy the example in the current directory and then modify it.