{"id":13412466,"url":"https://github.com/chrisgrieser/nvim-origami","last_synced_at":"2025-04-04T11:12:47.104Z","repository":{"id":184247755,"uuid":"671557015","full_name":"chrisgrieser/nvim-origami","owner":"chrisgrieser","description":"Fold with relentless elegance.","archived":false,"fork":false,"pushed_at":"2025-03-25T13:03:14.000Z","size":69,"stargazers_count":218,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-27T00:55:23.291Z","etag":null,"topics":[],"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-07-27T15:33:56.000Z","updated_at":"2025-03-26T21:18:55.000Z","dependencies_parsed_at":"2024-01-03T03:29:57.084Z","dependency_job_id":"86fe29a9-bec3-47d4-b7a5-acee33c5e988","html_url":"https://github.com/chrisgrieser/nvim-origami","commit_stats":null,"previous_names":["chrisgrieser/nvim-origami"],"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-origami","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisgrieser%2Fnvim-origami/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisgrieser%2Fnvim-origami/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisgrieser%2Fnvim-origami/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chrisgrieser","download_url":"https://codeload.github.com/chrisgrieser/nvim-origami/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247166168,"owners_count":20894654,"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":[],"created_at":"2024-07-30T20:01:24.986Z","updated_at":"2025-04-04T11:12:47.090Z","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":["Utility","Editing Support","Lua"],"sub_categories":["Cursorline","Folding"],"readme":"\u003c!-- LTeX: enabled=false --\u003e\n# nvim-origami 🐦📄\n\u003c!-- LTeX: enabled=true --\u003e\n\u003ca href=\"https://dotfyle.com/plugins/chrisgrieser/nvim-origami\"\u003e\n\u003cimg alt=\"badge\" src=\"https://dotfyle.com/plugins/chrisgrieser/nvim-origami/shield\"/\u003e\u003c/a\u003e\n\n*Fold with relentless elegance.*\n\nA collection of Quality-of-life features related to folding.\n\n\u003cimg alt=\"Showcase\" width=60% src=\"https://github.com/user-attachments/assets/bb13ee0f-7485-4e3f-b303-880b9d4d656e\"\u003e\n\n## Table of Content\n\n\u003c!-- toc --\u003e\n\n- [Features](#features)\n- [Installation](#installation)\n- [Configuration](#configuration)\n- [FAQ](#faq)\n\t* [Folds are still opened](#folds-are-still-opened)\n\t* [Debug folding issues](#debug-folding-issues)\n- [Credits](#credits)\n- [About the developer](#about-the-developer)\n\n\u003c!-- tocstop --\u003e\n\n## Features\n1. Remember folds across sessions. `requires nvim-ufo`\n2. Pause folds while searching, restore folds when done with searching.\n   (Normally, folds are opened when you search for text inside them, and *stay*\n   open afterward.)\n3. Add line count to the `foldtext`, preserving the syntax highlighting of the\n   line (requires Treesitter parser for the language). `incompatible with\n   nvim-ufo`\n4. Overload the `h` key which will fold a line when used one the first non-blank\n   character of (or before). And overload the `l` key, which will unfold a line\n   when used on a folded line.[^1] This allows you to ditch `zc`, `zo`, and\n   `za`, `h` and `l` are all you need.\n5. Automatically fold comments and/or imports. Requires `vim.lsp.foldexpr` from\n   nvim 0.11. `incompatible with nvim-ufo`\n\n\u003e [!NOTE]\n\u003e This plugin does **not** provide a `foldmethod`. For this plugin to work, you\n\u003e either have to [set one of on your\n\u003e own](https://www.reddit.com/r/neovim/comments/1jmqd7t/sorry_ufo_these_7_lines_replaced_you/),\n\u003e or use plugin providing folding information, such as\n\u003e [nvim-ufo](http://github.com/kevinhwang91/nvim-ufo).\n\n## Installation\n\n```lua\n-- lazy.nvim\n{\n\t\"chrisgrieser/nvim-origami\",\n\tevent = \"VeryLazy\",\n\topts = {}, -- needed even when using default config\n},\n\n-- packer\nuse {\n\t\"chrisgrieser/nvim-origami\",\n\tconfig = function() require(\"origami\").setup({}) end, -- setup call needed\n}\n```\n\n## Configuration\n\n```lua\n-- default settings\nrequire(\"origami\").setup {\n\t-- requires with `nvim-ufo`\n\tkeepFoldsAcrossSessions = package.loaded[\"ufo\"] ~= nil,\n\n\tpauseFoldsOnSearch = true,\n\n\t-- incompatible with `nvim-ufo`\n\tfoldtextWithLineCount = {\n\t\tenabled = package.loaded[\"ufo\"] == nil,\n\t\ttemplate = \"   %s lines\", -- `%s` gets the number of folded lines\n\t\thlgroupForCount = \"Comment\",\n\t},\n\n\tfoldKeymaps = {\n\t\tsetup = true, -- modifies `h` and `l`\n\t\thOnlyOpensOnFirstColumn = false,\n\t},\n\n\t-- redundant with `nvim-ufo`\n\tautoFold = {\n\t\tenabled = false,\n\t\tkinds = { \"comment\", \"imports\" }, ---@type lsp.FoldingRangeKind[]\n\t},\n}\n```\n\nIf you use other keys than `h` and `l` for vertical movement, set\n`setupFoldKeymaps = false` and map the keys yourself:\n\n```lua\nvim.keymap.set(\"n\", \"\u003cLeft\u003e\", function() require(\"origami\").h() end)\nvim.keymap.set(\"n\", \"\u003cRight\u003e\", function() require(\"origami\").l() end)\n```\n\n## FAQ\n\n### Folds are still opened\n[Many formatting plugins open all your\nfolds](https://www.reddit.com/r/neovim/comments/164gg5v/preserve_folds_when_formatting/)\nand unfortunately, there is nothing this plugin can do about it. The only two\ntools I am aware of that are able to preserve folds are the\n[efm-language-server](https://github.com/mattn/efm-langserver) and\n[conform.nvim](https://github.com/stevearc/conform.nvim).\n\n### Debug folding issues\n\n```lua\n-- Folds provided by the LSP\nrequire(\"origami\").inspectLspFolds(\"special\") -- comment \u0026 import only\nrequire(\"origami\").inspectLspFolds(\"all\")\n```\n\n## Credits\n- [@magnusriga](https://github.com/neovim/neovim/pull/27217#issuecomment-2631614344)\n  for a more performant implementation of fold text with highlighting.\n\n## About the developer\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\nI also occasionally blog about vim: [Nano Tips for Vim](https://nanotipsforvim.prose.sh)\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\n[^1]: Technically, unfolding with `l` is already a built-in vim feature when\n\t`vim.opt.foldopen` includes `hor`. However, this plugin still sets up a `l`\n\tkey replicating that behavior, since the built-in version still moves you to\n\tone character to the side, which can be considered a bit counterintuitive.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrisgrieser%2Fnvim-origami","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchrisgrieser%2Fnvim-origami","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrisgrieser%2Fnvim-origami/lists"}