{"id":13412983,"url":"https://github.com/emileferreira/nvim-strict","last_synced_at":"2025-03-14T19:30:46.687Z","repository":{"id":64781505,"uuid":"577333180","full_name":"emileferreira/nvim-strict","owner":"emileferreira","description":"Strict, native code style formatting plugin for Neovim. Expose deep nesting, overlong lines, trailing whitespace, trailing empty lines, todos and inconsistent indentation.","archived":false,"fork":false,"pushed_at":"2023-03-16T10:19:10.000Z","size":253,"stargazers_count":33,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-07-31T20:51:44.496Z","etag":null,"topics":["formatting","lua","neovim","neovim-plugin","nvim","nvim-plugin","regex"],"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/emileferreira.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}},"created_at":"2022-12-12T14:03:50.000Z","updated_at":"2024-07-05T14:03:17.000Z","dependencies_parsed_at":"2024-01-07T12:05:08.199Z","dependency_job_id":null,"html_url":"https://github.com/emileferreira/nvim-strict","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/emileferreira%2Fnvim-strict","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emileferreira%2Fnvim-strict/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emileferreira%2Fnvim-strict/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emileferreira%2Fnvim-strict/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emileferreira","download_url":"https://codeload.github.com/emileferreira/nvim-strict/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221495317,"owners_count":16832458,"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":["formatting","lua","neovim","neovim-plugin","nvim","nvim-plugin","regex"],"created_at":"2024-07-30T20:01:31.944Z","updated_at":"2024-10-26T04:31:31.420Z","avatar_url":"https://github.com/emileferreira.png","language":"Lua","funding_links":[],"categories":["Formatting"],"sub_categories":["Comment","Folding"],"readme":"# nvim-strict\n\nStrict, native code style formatting plugin for Neovim. Expose deep nesting, overlong lines, trailing whitespace, trailing empty lines, todos and inconsistent indentation.\n\n![nvim-strict demo](demo.png)\n\nStrict (or nvim-strict) is an all-Lua wrapper for a collection of regular expressions which combine to provide lightweight, IDE-like code style hints and formatting.\n\nStrict is language agnostic; it highlights and formats properties common to all programming languages. It pairs well with the Neovim LSP client for language-specific code formatting with strict and configurable code style formatting.\n\n## Features\n\n* Highlights deeply-nested code\n* Highlights and splits overlong lines\n* Highlights and removes trailing empty lines and whitespace\n* Highlights and converts tab or space indentation\n* Highlights TODO comments\n* Formatting functions preserve window, cursor, jumplist and search state\n* Include and exclude filetypes and buftypes\n* No external dependencies\n* Highly configurable and extensible\n* Blazingly fast\n\n## Installation\n\nStrict can be installed using any package manager. Here is an example using [packer.nvim](https://github.com/wbthomason/packer.nvim) to install and setup Strict using the default configuration. Note that Strict is only enabled once the `setup` function has been called.\n\n```lua\nuse({\n    'emileferreira/nvim-strict',\n    config = function()\n        require('strict').setup()\n    end\n})\n```\n\n## Configuration\n\nStrict comes with batteries included and (IMHO) sane defaults. The default configuration is shown below. It can be modified and passed to the `setup` function to override the default values. The configuration options are documented in [strict.txt](doc/strict.txt).\n\n```lua\nlocal default_config = {\n    included_filetypes = nil,\n    excluded_filetypes = nil,\n    excluded_buftypes = { 'help', 'nofile', 'terminal', 'prompt' },\n    match_priority = -1,\n    deep_nesting = {\n        highlight = true,\n        highlight_group = 'DiffDelete',\n        depth_limit = 3,\n        ignored_trailing_characters = nil,\n        ignored_leading_characters = nil\n    },\n    overlong_lines = {\n        highlight = true,\n        highlight_group = 'DiffDelete',\n        length_limit = 80,\n        split_on_save = true\n    },\n    trailing_whitespace = {\n        highlight = true,\n        highlight_group = 'SpellBad',\n        remove_on_save = true\n    },\n    trailing_empty_lines = {\n        highlight = true,\n        highlight_group = 'SpellBad',\n        remove_on_save = true\n    },\n    space_indentation = {\n        highlight = false,\n        highlight_group = 'SpellBad',\n        convert_on_save = false\n    },\n    tab_indentation = {\n        highlight = true,\n        highlight_group = 'SpellBad',\n        convert_on_save = true\n    },\n    todos = {\n        highlight = true,\n        highlight_group = 'DiffAdd'\n    }\n}\n```\n\nThe following is an example of a more forgiving configuration.\n\n```lua\nrequire('strict').setup({\n    excluded_filetypes = { 'text', 'markdown', 'html' },\n    deep_nesting = {\n        depth_limit = 5,\n        ignored_trailing_characters = ',',\n        ignored_leading_characters = '.'\n    },\n    overlong_lines = {\n        length_limit = 120\n    }\n})\n```\n\n## Bypassing\n\nThe highlights of Strict can be temporarily disabled, per window, by the following command.\n\n```\n:call clearmatches()\n```\n\nThe command below writes the current buffer without triggering autocmds which bypasses the format-on-save functionality of Strict.\n\n```\n:noa w\n```\n\n## Keymaps\n\nThe formatting functions are exported for use in keymaps, autocmds or other plugins. Below is a basic example of using the functions in keymaps.\n\n```lua\nlocal strict = require('strict')\nlocal options = { noremap = true, silent = true }\nvim.keymap.set('n', '\u003cLeader\u003etw', strict.remove_trailing_whitespace, options)\nvim.keymap.set('n', '\u003cLeader\u003etl', strict.remove_trailing_empty_lines, options)\nvim.keymap.set('n', '\u003cLeader\u003est', strict.convert_spaces_to_tabs, options)\nvim.keymap.set('n', '\u003cLeader\u003ets', strict.convert_tabs_to_spaces, options)\nvim.keymap.set('n', '\u003cLeader\u003eol', strict.split_overlong_lines, options)\n```\n\n## Reviews\n\n\"Looks cool!\" - [TJ DeVries](https://github.com/tjdevries), Neovim core maintainer\n\n## Contributing\n\nPull requests, bug reports and feature requests are welcomed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femileferreira%2Fnvim-strict","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femileferreira%2Fnvim-strict","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femileferreira%2Fnvim-strict/lists"}