Editing Default viewer script
Jump to navigation
Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
− | + | == Default viewer script == | |
− | |||
− | + | This script can be used to view files for which no viewer is registered. Here is its source code: | |
− | |||
− | |||
− | + | <syntaxhighlight lang="bash"> | |
− | |||
− | < | ||
#!/bin/bash | #!/bin/bash | ||
Line 33: | Line 28: | ||
head -$nlines "$1" | enconv -g -L $language -x $encoding | head -$nlines "$1" | enconv -g -L $language -x $encoding | ||
fi | fi | ||
− | </ | + | </syntaxhighlight> |
The script uses: | The script uses: | ||
Line 42: | Line 37: | ||
# [http://linux.die.net/man/1/enconv <code>enconv</code>] program for automatic conversion to the <code>$encoding</code> charset for text files trying to guess source encoding of <code>$language</code>. | # [http://linux.die.net/man/1/enconv <code>enconv</code>] program for automatic conversion to the <code>$encoding</code> charset for text files trying to guess source encoding of <code>$language</code>. | ||
− | == Plugging the script into | + | == Plugging the script into vifm == |
− | To use it in | + | To use it in vifm: |
− | # Save the script as <code>defviewer</code> at one of directories listed in your <code> | + | # Save the script as <code>defviewer</code> at one of directories listed in your <code>$PATH</code> environment variable or under <code>$VIFM/scripts</code>(most likely that it's <code>~/.vifm/scripts</code>). |
# On Unix-like operating systems make the script file executable by running<br><code>[https://en.wikipedia.org/wiki/Chmod chmod] +x defviewer</code> | # On Unix-like operating systems make the script file executable by running<br><code>[https://en.wikipedia.org/wiki/Chmod chmod] +x defviewer</code> | ||
− | |||
− | |||
− | |||
− | * | + | # Add the following line to your *vifmrc*:<br><code>fileview * defviewer %c</code> |
− | * | ||
− | Here is what it looks like | + | Here is what it looks like: |
[[File:hex-dump-screenshot.png]] | [[File:hex-dump-screenshot.png]] | ||
− | |||
− | |||
− | |||
− |