https://github.com/chrisgrieser/nvim-origami
Fold with relentless elegance. A collection of quality-of-life features related to folding.
Science Score: 36.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
✓Academic publication links
Links to: researchgate.net -
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (11.2%) to scientific vocabulary
Keywords
Keywords from Contributors
Repository
Fold with relentless elegance. A collection of quality-of-life features related to folding.
Basic Info
Statistics
- Stars: 340
- Watchers: 2
- Forks: 10
- Open Issues: 1
- Releases: 0
Topics
Metadata Files
README.md
nvim-origami 🐦📄
A collection of quality-of-life features related to folding.
Features
- Use the LSP to provide folds, with Treesitter as fallback if the LSP does not provide folding information (and indent-based folding as fallback if neither is available).
- Fold-text decorations: Displays the number of lines, diagnostics, and changes in the fold, while preserving the syntax highlighting of the line (displaying git changes requires gitsigns.nvim).
- Overload
h,l, and$as fold keymaps:hwill fold a line when used on the first non-blank character (or before), and behaves as regularhotherwise.lunfolds the cursorline when used on a folded line, and behaves as regularlotherwise.$unfolds the cursorline recursively when used on a folded line, and behaves as regular$otherwise- This allows you to ditch
zc,zo,zaandzO, since you only needh,l, and$.
- Auto-fold: Automatically fold comments and/or imports when opening a file (requires an LSP that provides that information).
- Pause folds while searching, and restore folds when done with searching. (Normally, folds are opened when you search for text inside them and stay open afterward.)
All features are independent, so you can choose to only enable some of them.
nvim-origami replaces most features of nvim-ufo in a much more lightweight
manner and adds some features that nvim-ufo does not provide.
Table of Content
Breaking changes in v2.0
- nvim 0.11 is now required.
nvim-ufois *no longer compatible* with this plugin (most of its features are now offered bynvim-origamiin a more lightweight way).- Saving folds across sessions is no longer supported.
- If you do not like the changes, you can pin
nvim-origamito the tagv1.9.
Installation
Requirements
- nvim 0.11+
- not using nvim-ufo, since nvim-origami is incompatible with it
```lua -- lazy.nvim { "chrisgrieser/nvim-origami", event = "VeryLazy", opts = {}, -- needed even when using default config
-- recommended: disable vim's auto-folding
init = function()
vim.opt.foldlevel = 99
vim.opt.foldlevelstart = 99
end,
}, ```
Configuration
lua
-- default settings
require("origami").setup {
useLspFoldsWithTreesitterFallback = true,
pauseFoldsOnSearch = true,
foldtext = {
enabled = true,
padding = 3,
lineCount = {
template = "%d lines", -- `%d` is replaced with the number of folded lines
hlgroup = "Comment",
},
diagnosticsCount = true, -- uses hlgroups and icons from `vim.diagnostic.config().signs`
gitsignsCount = true, -- requires `gitsigns.nvim`
},
autoFold = {
enabled = true,
kinds = { "comment", "imports" }, ---@type lsp.FoldingRangeKind[]
},
foldKeymaps = {
setup = true, -- modifies `h`, `l`, and `$`
hOnlyOpensOnFirstColumn = false,
},
}
If you use other keys than h, l, and $ for vertical movement, set
opts.foldKeymaps.setup = false and map the keys yourself:
lua
vim.keymap.set("n", "<Left>", function() require("origami").h() end)
vim.keymap.set("n", "<Right>", function() require("origami").l() end)
vim.keymap.set("n", "<End>", function() require("origami").dollar() end)
FAQ
Error when opening or reloading a file
txt
Error executing vim.schedule lua callback: ...0.11.2/share/nvim/runtime/lua/vim/lsp/_folding_range.lua:311: attempt to index a nil value
This error occasionally occurs with autoFold enabled. It is, however, not
caused by nvim-origami but by a bug with vim.lsp.foldclose() in nvim core.
A future version of nvim will hopefully fix this.
Folds are opened after running a formatter
This is a known issue of many formatting
plugins
and not related to nvim-origami.
The only two tools I am aware of that are able to preserve folds are the efm-language-server and conform.nvim.
Debug folding issues
Debug issues with folds provided by the LSP:
lua
require("origami").inspectLspFolds("special") -- comment & import only
require("origami").inspectLspFolds("all")
Credits
- u/marjrohn for the decorator approach to styling foldtext.
About the developer
In my day job, I am a sociologist studying the social mechanisms underlying the digital economy. For my PhD project, I investigate the governance of the app economy and how software ecosystems manage the tension between innovation and compatibility. If you are interested in this subject, feel free to get in touch.
Owner
- Name: Chris Grieser
- Login: chrisgrieser
- Kind: user
- Location: Berlin, Germany
- Company: Technical University of Berlin
- Website: https://chris-grieser.de/
- Repositories: 189
- Profile: https://github.com/chrisgrieser
Researcher in sociology & software developer
GitHub Events
Total
- Issues event: 16
- Watch event: 127
- Delete event: 3
- Issue comment event: 31
- Push event: 114
- Pull request review event: 3
- Pull request review comment event: 1
- Pull request event: 15
- Fork event: 5
- Create event: 7
Last Year
- Issues event: 16
- Watch event: 127
- Delete event: 3
- Issue comment event: 31
- Push event: 114
- Pull request review event: 3
- Pull request review comment event: 1
- Pull request event: 15
- Fork event: 5
- Create event: 7
Committers
Last synced: 9 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Chris Grieser | 7****r | 138 |
| dependabot[bot] | 4****] | 2 |
| Saint | 5****t | 1 |
| Heyward Fann | f****d@g****m | 1 |
| Gaetan Lepage | g****n@g****m | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 16
- Total pull requests: 13
- Average time to close issues: 13 days
- Average time to close pull requests: about 23 hours
- Total issue authors: 16
- Total pull request authors: 7
- Average comments per issue: 1.81
- Average comments per pull request: 0.38
- Merged pull requests: 10
- Bot issues: 0
- Bot pull requests: 4
Past Year
- Issues: 10
- Pull requests: 13
- Average time to close issues: about 19 hours
- Average time to close pull requests: about 23 hours
- Issue authors: 10
- Pull request authors: 7
- Average comments per issue: 1.8
- Average comments per pull request: 0.38
- Merged pull requests: 10
- Bot issues: 0
- Bot pull requests: 4
Top Authors
Issue Authors
- hrqmonteiro (1)
- fmicheloni (1)
- fannheyward (1)
- liangkarl (1)
- patnr (1)
- stelcodes (1)
- kobzar (1)
- leelhn2345 (1)
- agaro1121 (1)
- wSedlacek (1)
- Crazy-Hopper (1)
- ALameLlama (1)
- vunhatchuong (1)
- swj1442291549 (1)
- arslanmaj (1)
Pull Request Authors
- dependabot[bot] (4)
- fannheyward (3)
- sainttttt (2)
- patnr (1)
- GaetanLepage (1)
- IProxymate (1)
- lcrockett (1)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- actions/checkout v2 composite
- kdheepak/panvimdoc main composite
- stefanzweifel/git-auto-commit-action v4 composite
- JohnnyMorganz/stylua-action v2 composite
- actions/checkout v3 composite