{"id":26748111,"url":"https://github.com/expertcoderz/universal-nvim-previewer","last_synced_at":"2025-04-14T22:14:27.192Z","repository":{"id":284657748,"uuid":"950494647","full_name":"Expertcoderz/universal-nvim-previewer","owner":"Expertcoderz","description":"A dead-simple Neovim plugin for previewing files.","archived":false,"fork":false,"pushed_at":"2025-04-12T14:49:47.000Z","size":8,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-14T22:14:23.466Z","etag":null,"topics":["neovim","neovim-lua","neovim-lua-plugin","neovim-plugin","nvim","nvim-lua","nvim-lua-plugin","nvim-plugin"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Expertcoderz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-18T08:52:44.000Z","updated_at":"2025-04-12T14:49:51.000Z","dependencies_parsed_at":"2025-03-27T02:28:12.717Z","dependency_job_id":"5f8abc65-c05e-4d22-8872-ac1822ed76b7","html_url":"https://github.com/Expertcoderz/universal-nvim-previewer","commit_stats":null,"previous_names":["expertcoderz/universal-nvim-previewer"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Expertcoderz%2Funiversal-nvim-previewer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Expertcoderz%2Funiversal-nvim-previewer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Expertcoderz%2Funiversal-nvim-previewer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Expertcoderz%2Funiversal-nvim-previewer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Expertcoderz","download_url":"https://codeload.github.com/Expertcoderz/universal-nvim-previewer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248968917,"owners_count":21191162,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["neovim","neovim-lua","neovim-lua-plugin","neovim-plugin","nvim","nvim-lua","nvim-lua-plugin","nvim-plugin"],"created_at":"2025-03-28T10:16:20.597Z","updated_at":"2025-04-14T22:14:27.174Z","avatar_url":"https://github.com/Expertcoderz.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 👁️ universal-nvim-previewer\n\nA dead-simple Neovim plugin for previewing files, supporting arbitrary\nfiletypes.\n\n## Features\n\n- written in 100% Lua\n- platform-independent\n- doesn't invoke the shell or any external commands other than those used for\n  processing and previewing\n- cleans up temporary files on keymap trigger and upon buffer close\n- compatible with previewer applications that fork after opening (e.g. some web\n  browsers)\n\n## How It Works\n\n1. Upon keymap trigger (`start`), run a *processor* application, chosen based\n   on the current filetype, to generate the temporary file used for the preview.\n   A preview is now considered to be active.\n2. Run a *previewer* application, chosen based on the current filetype, to\n   preview the file. This step is omitted if a preview is already active, in\n   which case the user can manually refresh the file from the previewer.\n3. Upon keymap trigger (`stop`), or when the buffer is closed, clean up the\n   temporary file used for the preview. The preview is now no longer active.\n\nNote that universal-nvim-previewer doesn't care about the state of the previewer\napplication after it has been launched. To see changes in the preview, the user\nmust manually refresh it (in a way specific to the application); to close the\npreview, the user must manually close the application. This is an intentional\ndesign choice to accomodate web browsers that don't provide a means of being\nnotified when the file changes (making automatic refresh difficult or kludgy to\nimplement) and don't necessarily close the correct tab upon SIGTERM due to\ntheir multi-process design (preventing the preview from being closed from nvim).\n\n## Installation\n\nExample setup with [lazy.nvim](https://github.com/folke/lazy.nvim):\n\n```lua\n{\n    \"Expertcoderz/universal-nvim-previewer\",\n    opts = {}, -- mandatory; leave blank to use the defaults\n}\n```\n\n## Configuration\n\nuniversal-nvim-previewer is configured by defining certain values under the\n`opts` table (which is passed to the `setup` function of the plugin module).\n\n### Processors\n\nProcessor applications are configured by specifying the dictionary `processors`\nunder `opts`. In this dictionary, each filetype (based on the value of\n`vim.bo.filetype`) is mapped to a function that takes in the path to a temporary\npreview file (`outputPath`) and optionally the filetype itself (`filetype`),\nreturning a table of the command to run plus the arguments to supply to it.\nThis command is expected to accept the current Neovim buffer's contents from\nstandard input and place the processed output at `outputPath`; previewing will\nfail if no file at `outputPath` is readable after the processor command exits.\n\nThe default setting of the `processors` dictionary is:\n\n```lua\n{\n    [\"markdown\"] = function(outputPath)\n        return { \"pandoc\", \"-f\", \"commonmark_x\", \"-t\", \"html\", \"-o\", outputPath }\n    end,\n    [\"rst\"] = function(outputPath)\n        return { \"pandoc\", \"-f\", \"rst\", \"-t\", \"html\", \"-o\", outputPath }\n    end,\n\n    -- Default processor for other filetypes\n    -- (If no default is set, previewing will be disabled for such filetypes.)\n    [\"\"] = function(outputPath, filetype)\n        if filetype == \"make\" then\n            filetype = \"makefile\"\n        end\n        return { \"highlight\", \"-S\", filetype, \"-O\", \"html\", \"-k\", \"monospace\", \"-o\", outputPath }\n    end,\n}\n```\n\n### Previewers\n\nPreviewer applications are configured similarly to processor applications; the\ndefault setting of the `previewers` dictionary is:\n\n```lua\n{\n    -- Default previewer (opens the default web browser on the temporary file)\n    -- (If no default is set, previewing will be disabled for such filetypes.)\n    -- (The second argument is the filetype but it is unused in this example.)\n    [\"\"] = function(outputPath, _)\n        return { vim.env.BROWSER, outputPath }\n    end,\n}\n```\n\n### Keymaps\n\nKeymaps can be customized in the `keymaps` dictionary under `opts`. The default\nsetting is:\n\n```lua\n{\n    start = \"+\",\n    stop = \"-\",\n    stopAll = \"_\",\n}\n```\n\n## License\n\nuniversal-nvim-previewer is licensed under the MIT License. See the LICENSE\nfile for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexpertcoderz%2Funiversal-nvim-previewer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fexpertcoderz%2Funiversal-nvim-previewer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexpertcoderz%2Funiversal-nvim-previewer/lists"}