{"id":13413005,"url":"https://github.com/Darazaki/indent-o-matic","last_synced_at":"2025-03-14T19:30:53.464Z","repository":{"id":37457605,"uuid":"407891973","full_name":"Darazaki/indent-o-matic","owner":"Darazaki","description":"Dumb automatic fast indentation detection for Neovim written in Lua","archived":false,"fork":false,"pushed_at":"2023-06-03T18:28:47.000Z","size":49,"stargazers_count":173,"open_issues_count":0,"forks_count":13,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-07-31T20:51:48.146Z","etag":null,"topics":["neovim","neovim-lua","neovim-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/Darazaki.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-09-18T15:05:49.000Z","updated_at":"2024-07-24T18:36:28.000Z","dependencies_parsed_at":"2024-01-03T03:33:39.145Z","dependency_job_id":"57f05a16-9930-4777-9286-87f41b6406a5","html_url":"https://github.com/Darazaki/indent-o-matic","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Darazaki%2Findent-o-matic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Darazaki%2Findent-o-matic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Darazaki%2Findent-o-matic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Darazaki%2Findent-o-matic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Darazaki","download_url":"https://codeload.github.com/Darazaki/indent-o-matic/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221495322,"owners_count":16832459,"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-plugin"],"created_at":"2024-07-30T20:01:32.229Z","updated_at":"2024-10-26T04:31:33.939Z","avatar_url":"https://github.com/Darazaki.png","language":"Lua","funding_links":[],"categories":["Formatting","Lua"],"sub_categories":["Indent"],"readme":"# indent-o-matic\n\nDumb automatic fast indentation detection for Neovim written in Lua\n\n## How it works\n\nInstead of trying to be smart about detecting an indentation using statistics,\nit will find the first thing that looks like a standard indentation (tab or 8/4/2 spaces)\nand assume that's what the file's indentation is\n\nThis has the advantage of being fast and very often correct while being simple enough\nthat most people will understand what it will do predictably\n\n## Requirements\n\n- Neovim \u003e= 0.4.4\n\n## Installation\n\nCan be installed through any standard Vim package manager, configuration is optional\n\nE.g. through [vim-plug](https://github.com/junegunn/vim-plug):\n\n```vim\ncall plug#begin()\n    Plug 'Darazaki/indent-o-matic'\ncall plug#end()\n```\n\nThen restart Neovim and run `:PlugInstall`\n\n## Configuration\n\nConfiguration is done in Lua:\n\n```lua\nrequire('indent-o-matic').setup {\n    -- The values indicated here are the defaults\n\n    -- Number of lines without indentation before giving up (use -1 for infinite)\n    max_lines = 2048,\n\n    -- Space indentations that should be detected\n    standard_widths = { 2, 4, 8 },\n\n    -- Skip multi-line comments and strings (more accurate detection but less performant)\n    skip_multiline = true,\n}\n```\n\nYou can also directly configure it from a Vim file by using the `lua` instruction:\n\n```vim\nlua \u003c\u003cEOF\nrequire('indent-o-matic').setup {\n    -- ...\n}\nEOF\n```\n\nOptionally you can define language-specific settings using the `filetype_$ft` tables:\n\n```lua\nrequire('indent-o-matic').setup {\n    -- Global settings (optional, used as fallback)\n    max_lines = 2048,\n    standard_widths = { 2, 4, 8 },\n\n    -- Disable indent-o-matic for LISP files\n    filetype_lisp = {\n        max_lines = 0,\n    },\n\n    -- Only detect 4 spaces and tabs for Rust files\n    filetype_rust = {\n        standard_widths = { 4 },\n    },\n\n    -- Don't detect 8 spaces indentations inside files without a filetype\n    filetype_ = {\n        standard_widths = { 2, 4 },\n    },\n}\n```\n\nIf a preference hasn't been set in the language-specific settings, it'll be retrieved\nfrom the global settings\n\n`:IndentOMatic` is also made available to detect the current buffer's indentation\non demand\n\nIf you want this plugin to only be invoked manually through `:IndentOMatic`,\nyou can add `autocmd! indent_o_matic` to your init file\n\n## Alternatives\n\n- [guess-indent.nvim](https://github.com/NMAC427/guess-indent.nvim) by Nicolas Camenisch: Smarter algorithm, configuration similar to indent-o-matic (see [explanations/benchmarks](https://github.com/Darazaki/indent-o-matic/issues/12))\n- [crazy8.nvim](https://github.com/zsugabubus/crazy8.nvim) by zsugabubus: Smarter algorithm\n- [DetectIndent](https://github.com/ciaranm/detectindent) by Ciaran McCreesh: Manually ran, smarter algorithm, Vim compatible\n- [vim-sleuth](https://github.com/tpope/vim-sleuth) by Tim Pope: Even smarter, Vim compatible\n\n## Contributing\n\nI've made this little plugin as a fun side-project to learn how Lua works with Neovim\nas a beginner so, if you've an idea, feel free to write a PR to improve this project!\n\nThe only rules to follow are:\n\n- PRs should go to the `testing` branch (for, well, testing if everything still works)\n- The detection algorithm should stay dumb\n- The plugin itself should work with Lua \u0026 Vim code only\n- No configuration required\n- System requirements shouldn't be restricted\n- Break the rules within reason\n\nNote: Forking or taking part of the code without asking is also a-ok, this is libre\nMIT-licensed stuff!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDarazaki%2Findent-o-matic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDarazaki%2Findent-o-matic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDarazaki%2Findent-o-matic/lists"}