plain text files are displayed in a text area with syntax highlighting. the language is determined by the file extension. rovr supports a wide range of languages.
mime types are automatically obtained using puremagic to give you a more accurate information of the file’s type. If you additionally have plugins.file_one enabled with plugins.file_one.get_description, you can view extra information, like how many sections, what type, etc.
if you have bat installed and enabled in the rovr config, it will be used to display text files with syntax highlighting for much more languages and theming. uses the same id as text
when a folder is selected, the preview panel will show a list of the files and folders inside it, allowing you to see the contents without navigating into it.
for pdf files, rovr makes use of poppler. you can also scroll through the pdf with your mouse (scrollbars are unavailable for now) or use your keyboard to navigate it.
rovr makes use of resvg-py to render svg files, so you don’t need resvg installed on your system – it automatically previews the svg file for you without any setup
for font files (like .ttf, .otf), rovr will display a preview of the font. you can customise the text used in the preview if you want to test extra things
You can change the file type to preview association by modifying the [settings.preview_rules] section in your config.toml
If your mime type is accurate enough (like image/png), you can omit the check and use the mime type only:
[settings.preview_rules]
"image/png" = "image"
the value is any of the default previewers mentioned above in an inline codeblock. Only one is allowed per mime type, but you can add fallbacks with more wildcard mime types
However, in the case of vague mime types like application/gzip, if you want to preview .svgz files as an svg instead of a failed archive file, you can use the following rule:
[settings.preview_rules."application/(x-)?gzip"]
default = "archive"
extensions = { svgz = "resvg" }
In the above example, we are telling rovr that for files with mime type application/gzip and application/x-gzip, to use archive by default, except if the file ends with .svgz, and in that case, use the svg renderer
The full syntax for the preview rules is as follows:
You can also create your own previewers for any file type. For example, if you want to preview .md files using glow, you can add the following to your config.toml:
rovr will now use glow to preview .md files instead of bat (or rovr’s built-in text highlighter). This preview is also cached, so if you have a large markdown file, it will not be re-rendered every time you open it. You can also use the --style option to change the theme of the preview.
For images, you can have type = "image" for your custom previewer. For example, if you want to preview .html files using helium (or any chromium browsers), you can add the following to your config.toml:
%file is the path configured by file, so helium writes the PNG that rovr reads. %temp keeps the source extension; %temp.png uses .png instead. This also works with other output extensions, provided your previewer can produce and rovr can display them. %tmpdir gives each run its own temporary browser profile and is removed when the command finishes.
A launcher-supplied --user-data-dir can override the temporary profile above. On Windows with scoop, it will force a profile directory, you should instead direct it to the underlying chrome.exe path
The %h is the path to the file being previewed. The command will be run with the file path as an argument, and the output will be displayed in the preview panel.
The %temp is the path to a temporary file that will be created for the
previewer to write to. You can modify the file extension by including it in the
%temp variable, like %temp.png. The temporary file will be deleted after the
preview is displayed.
The full syntax for the custom previewers is as follows:
on_nonzero_exit = "details"# or any default available previewers mentioned above
Supported Expansions:
%h - path to the file being previewed
%rh - realpath to file being previewed
%nh - name of file being previewed
%rnh - realpath name of file being previewed
%cwd - current working directory
%rcwd - realpath to current working directory
%temp - path to a temporary file that will be created for the previewer to write to.
You can include a file extension in the variable, like %temp.png. The temporary file will be deleted after the preview is displayed.
%tmpdir - path to a temporary directory that will be created for the previewer to write to.
The temporary directory will be deleted after the preview is displayed.
Helium and Glow are mentioned above, here is a few more previewers that you can use:
libreoffice: for previewing office documents like .docx, .xlsx, .pptx
Paste the following python script somewhere accessible and add it to your config.toml as a previewer: