{"id":13412936,"url":"https://github.com/chrisgrieser/nvim-puppeteer","last_synced_at":"2025-10-25T01:17:17.960Z","repository":{"id":195551831,"uuid":"693145441","full_name":"chrisgrieser/nvim-puppeteer","owner":"chrisgrieser","description":"Automatically convert strings to f-strings or template strings and back.","archived":false,"fork":false,"pushed_at":"2025-03-25T13:03:10.000Z","size":104,"stargazers_count":65,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-02T22:06:32.923Z","etag":null,"topics":["f-strings","nvim-plugin","string-manipulation","template-strings"],"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/chrisgrieser.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"custom":"https://www.paypal.me/ChrisGrieser","ko_fi":"pseudometa"}},"created_at":"2023-09-18T12:48:34.000Z","updated_at":"2025-03-31T19:48:00.000Z","dependencies_parsed_at":"2023-09-18T17:57:48.539Z","dependency_job_id":"45ff933c-7ce0-45c4-964a-f4e2b84bfef6","html_url":"https://github.com/chrisgrieser/nvim-puppeteer","commit_stats":{"total_commits":157,"total_committers":4,"mean_commits":39.25,"dds":0.04458598726114649,"last_synced_commit":"d9098a5a35b9f1bb7013fba7bfccd6b4afdff58a"},"previous_names":["chrisgrieser/nvim-puppeteer"],"tags_count":0,"template":false,"template_full_name":"chrisgrieser/nvim-pseudometa-plugin-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisgrieser%2Fnvim-puppeteer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisgrieser%2Fnvim-puppeteer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisgrieser%2Fnvim-puppeteer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisgrieser%2Fnvim-puppeteer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chrisgrieser","download_url":"https://codeload.github.com/chrisgrieser/nvim-puppeteer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248131472,"owners_count":21052854,"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":["f-strings","nvim-plugin","string-manipulation","template-strings"],"created_at":"2024-07-30T20:01:31.340Z","updated_at":"2025-10-25T01:17:17.955Z","avatar_url":"https://github.com/chrisgrieser.png","language":"Lua","funding_links":["https://www.paypal.me/ChrisGrieser","https://ko-fi.com/pseudometa","https://ko-fi.com/Y8Y86SQ91'"],"categories":["Editing Support","Lua"],"sub_categories":["Scrollbar"],"readme":"\u003c!-- LTeX: enabled=false --\u003e\n# nvim-puppeteer 🎎\n\u003c!-- LTeX: enabled=true --\u003e\n\u003ca href=\"https://dotfyle.com/plugins/chrisgrieser/nvim-puppeteer\"\u003e\n\u003cimg alt=\"Shield\" src=\"https://dotfyle.com/plugins/chrisgrieser/nvim-puppeteer/shield\"/\u003e\u003c/a\u003e\n\nMaster of strings. Automatically convert strings to f-strings or template\nstrings and back.\n\n\u003c!-- toc --\u003e\n\n- [Features](#features)\n- [Requirements](#requirements)\n- [Installation](#installation)\n- [Configuration](#configuration)\n- [User commands](#user-commands)\n- [Special case: formatted strings in Lua](#special-case-formatted-strings-in-lua)\n- [Credits](#credits)\n\n\u003c!-- tocstop --\u003e\n\n## Features\n- When typing `{}` in a **Python string** automatically converts it to an f-string.\n- Adding `${}` or a line break in a **JavaScript string** automatically converts\n  it to a template string. (Also works in related languages like JS-React or\n  Typescript.)\n- Typing `%s` in a **non-pattern Lua string** automatically converts it to a\n  formatted string. (Opt-in, as this has [some\n  caveats](#special-case-formatted-strings-in-lua).)\n- *Removing* the `{}`, `${}`, or `%s` converts it back to a regular string.\n- Also works with multi-line strings and undos.\n- Zero configuration. Just install and you are ready to go.\n\n## Requirements\n- nvim 0.9 or higher.\n- The respective Treesitter parsers: `:TSInstall python javascript typescript`.\n  (Installing them requires\n  [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter).)\n\n## Installation\n\n```lua\n-- lazy.nvim\n{ \n\t\"chrisgrieser/nvim-puppeteer\",\n\tlazy = false, -- plugin lazy-loads itself. Can also load on filetypes.\n},\n\n-- packer\nuse { \"chrisgrieser/nvim-puppeteer\" }\n```\n\nThere is no `.setup()` call. The plugin already automatically lazy-loads itself\n(and is lightweight to begin with).\n\nYou can disable `nvim-puppeteer` only for specific filetypes via:\n\n## Configuration\nShown are the default values.\n\n```lua\n-- list of filestypes (please see the README before enabling this plugin for lua)\nvim.g.puppeteer_disable_filetypes = { \"lua\" }\n\n-- quotation mark to use when converting back to normal string (\" or ')\nvim.g.puppeteer_js_quotation_mark = '\"'\n```\n\n\u003e [!NOTE]\n\u003e When using `lazy.nvim`, `vim.g.…` variables must be set in `init`, not in\n\u003e `config`.\n\n## User commands\nThe plugin is enabled by default and lazy-loaded upon opening a relevant file type.\nIn case you wish to turn of puppeteer for the current buffer, the following user\ncommands are provided:\n\n- `PuppeteerToggle`: Toggle puppeteer for the current buffer.\n- `PuppeteerDisable`: Disable puppeteer for the current buffer.\n- `PuppeteerEnable`: Enable puppeteer for the current buffer.\n\n## Special case: formatted strings in Lua\nThrough\n[string.format](https://www.lua.org/manual/5.4/manual.html#pdf-string.format),\nthere are also formatted strings in Lua. However, auto-conversions are far more\ndifficult in lua `%s` is used as a placeholder for `string.format` and [as class\nin lua patterns](https://www.lua.org/manual/5.4/manual.html#6.4.1) at the same\ntime. While it is possible to identify in some cases whether a lua string is\nused as pattern, there are certain cases where that is not possible:\n\n```lua\n-- desired: conversion to format string when typing the placeholder \"%s\"\nlocal str = \"foobar %s baz\" -- before\nlocal str = (\"foobar %s baz\"):format() -- after\n\n-- problem case that can be dealt with: \"%s\" used as class in lua pattern\nlocal found = str:find(\"foobar %s\")\n\n-- problem case that cannot be dealt with: \"%s\" in string, which\n-- is only later used as pattern\nlocal pattern = \"foobar %s baz\"\n-- some code…\nstr:find(pattern)\n```\n\nSince the auto-conversion of lua strings can result in undesired false\nconversions, the feature is opt-in only. This way, you can decide for yourself\nwhether the occasional false positive is worth it for you or not.\n\n```lua\n-- Enable auto-conversion of lua strings by removing lua from the disabled filetypes\nvim.g.puppeteer_disable_filetypes = {}\n```\n\n\u003e [!TIP]\n\u003e You can also use `PuppeteerToggle` to temporarily disable the plugin for the\n\u003e current buffer, if a specific lua string is giving you trouble.\n\n\u003c!-- vale Google.FirstPerson = NO --\u003e\n## Credits\nIn my day job, I am a sociologist studying the social mechanisms underlying the\ndigital economy. For my PhD project, I investigate the governance of the app\neconomy and how software ecosystems manage the tension between innovation and\ncompatibility. If you are interested in this subject, feel free to get in touch.\n\n- [Website](https://chris-grieser.de/)\n- [Mastodon](https://pkm.social/@pseudometa)\n- [ResearchGate](https://www.researchgate.net/profile/Christopher-Grieser)\n- [LinkedIn](https://www.linkedin.com/in/christopher-grieser-ba693b17a/)\n\n\u003ca href='https://ko-fi.com/Y8Y86SQ91' target='_blank'\u003e\u003cimg height='36'\nstyle='border:0px;height:36px;' src='https://cdn.ko-fi.com/cdn/kofi1.png?v=3'\nborder='0' alt='Buy Me a Coffee at ko-fi.com' /\u003e\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrisgrieser%2Fnvim-puppeteer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchrisgrieser%2Fnvim-puppeteer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrisgrieser%2Fnvim-puppeteer/lists"}