Go to the first, previous, next, last section, table of contents.


The GIT per file type action script

gitaction is a script that executes a different action for each file type specified. It is called by the git program when pressing F2, ESC 2 or ^Xa.

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, ESC 2 or ^Xa on a `*.c' file, git will compile it, if you press F2, ESC 2 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" "*.doc" "*.txt" "*.gif" "*.jpg" "*.tif" "*.bmp" "*.fli" "*.flc" 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, ESC 2 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.

Also, you can add a .gitaction shell script in your home directory and/or in any other directory. Before trying to match a file name, gitaction will attempt to execute ./.gitaction. If that one fails to match the file name against its patterns, it backs up to $HOME/.gitaction. When this one fails too the patterns in gitaction are tried. For an example of how to write .gitaction scripts take a look at the .gitaction shell script provided as part of the distribution and installed in the `$(prefix)/bin' directory.


Go to the first, previous, next, last section, table of contents.