{"id":13649394,"url":"https://github.com/mkropat/vim-uniformity","last_synced_at":"2026-03-02T20:36:35.176Z","repository":{"id":142085535,"uuid":"49119112","full_name":"mkropat/vim-uniformity","owner":"mkropat","description":"Safely make whitespace across your project consistent","archived":false,"fork":false,"pushed_at":"2016-01-28T04:00:02.000Z","size":11,"stargazers_count":12,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-13T01:40:01.923Z","etag":null,"topics":["vim","whitespace"],"latest_commit_sha":null,"homepage":"","language":"VimL","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/mkropat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-06T07:04:47.000Z","updated_at":"2023-09-08T17:05:27.000Z","dependencies_parsed_at":"2023-04-22T08:31:09.776Z","dependency_job_id":null,"html_url":"https://github.com/mkropat/vim-uniformity","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mkropat/vim-uniformity","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkropat%2Fvim-uniformity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkropat%2Fvim-uniformity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkropat%2Fvim-uniformity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkropat%2Fvim-uniformity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mkropat","download_url":"https://codeload.github.com/mkropat/vim-uniformity/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkropat%2Fvim-uniformity/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30018584,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-02T17:00:27.440Z","status":"ssl_error","status_checked_at":"2026-03-02T17:00:03.402Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["vim","whitespace"],"created_at":"2024-08-02T01:04:59.132Z","updated_at":"2026-03-02T20:36:35.159Z","avatar_url":"https://github.com/mkropat.png","language":"VimL","funding_links":[],"categories":["Vim Script"],"sub_categories":[],"readme":"# uniformity.vim\n\n*Safely make whitespace across your project consistent*\n\n__uniformity.vim__ is a tool for batch updating whitespace across a project.\nBecause it's a batch tool intended to be run infrequently, it may be of use to\nyou [even if you don't normally use Vim](#why-vim).\n\nBy whitespace, I'm talking about changing indentation:\n\n- 2-spaces to 4-spaces\n- 4-spaces to 2-spaces\n- Spaces to tabs\n- Anything to anything really\n\nBut I'm also talking about:\n\n- Stripping traililng whitespace\n- Stripping zero-width Unicode characters\n- [Changing line\n  endings](http://vimdoc.sourceforge.net/htmldoc/options.html#'fileformat')\n  (Windows → *nix, *nix → Windows, etc.)\n- [Changing the file\n  encoding](http://vimdoc.sourceforge.net/htmldoc/options.html#'fileencoding')\n- Adding or removing the [UTF\n  BOM](https://en.wikipedia.org/wiki/Byte_order_mark)\n\n### Is uniformity.vim right for you?\n\nDepending on what you're trying to do, __there's a decent chance you don't even\nneed uniformity.vim__:\n\n- Do you want to change what whitespace Vim uses for any new files you create?\n  Take a look at the [built-in Vim\n  settings](http://vim.wikia.com/wiki/Indenting_source_code)\n- Do you want Vim to re-indent your files [based on what it thinks your code\n  should look\n  like](http://vimdoc.sourceforge.net/htmldoc/indent.html#C-indenting)?  Try\n  [`gg=G`](http://vim.wikia.com/wiki/Fix_indentation).\n- Do you want to change both leading and non-leading whitespace in the file?\n  Try [this trick](http://stackoverflow.com/a/16892086/27581).\n\nOn the other hand...\n\nDo you want to conservatively change whitespace so that only leading\nindentation is changed (to minimize the risk of messing up formatting)?\n__uniformity.vim__ might be the right tool for the job.\n\nWhile batch updating indentation across a project, do you want to also strip\ntrailing whitespace, convert line endings, and convert all the files to a\nsingle encoding?  __uniformity.vim__ might be the right tool for the job.\n\n### Getting Started\n\n#### Pre-requisites\n\n__uniformity.vim__ requires that the\n[__sleuth.vim__](https://github.com/tpope/vim-sleuth) plugin be installed.\nThis is necessary because __uniformity.vim__ relies on the\n[`shiftwidth`](http://vimdoc.sourceforge.net/htmldoc/options.html#'shiftwidth')\nsetting of the buffer to reflect the current indentation of the file so it can\nknow how to change each line.\n\n#### Installation\n\nYou'll want to use a plugin manager.  The instructions assume you're using\n[__vim-plug__](https://github.com/junegunn/vim-plug).\n\nInclude the following lines in your\n[`.vimrc`](http://vim.wikia.com/wiki/Open_vimrc_file):\n\n```viml\ncall plug#begin('~/.vim/plugged')\n\nPlug 'tpope/vim-sleuth'\nPlug 'mkropat/vim-uniformity'\n\ncall plug#end()\n```\n\nRestart Vim, then run `:PlugInstall` to complete the installation.\n\n#### Configuration\n\nInclude the following lines in your\n[`.vimrc`](http://vim.wikia.com/wiki/Open_vimrc_file):\n\n```viml\nlet g:uniformity_indent = '    '\nlet g:uniformity_strip_trailing_whitespace = 1\nlet g:uniformity_strip_zerowidth_chars = 0\nlet g:uniformity_bomb = 0\nlet g:uniformity_fileencoding = 'utf-8'\nlet g:uniformity_fileformat = 'unix'\n```\n\nChange each setting as desired.  You may omit any setting to have it not take\neffect.  After you're satisfied, load in the settings by restarting Vim or by\nrunning [`:source\n%`](http://vimdoc.sourceforge.net/htmldoc/repeat.html#:source).\n\nHere's the full reference of what each option does:\n\nSetting                                  | Description\n-----------------------------------------|----------------------\n`g:uniformity_indent`                    | The string that represents one level of desired indentation, such as a string that contains 2-spaces, 4-spaces, or a tab character. (To insert a tab character, you can use [this trick](http://stackoverflow.com/a/4781099/27581).)\n`g:uniformity_strip_trailing_whitespace` | If set to `1`, [trailing whitespace](http://blog.codinghorror.com/whitespace-the-silent-killer/) will be stripped\n`g:uniformity_strip_zerowidth_chars`     | If set to `1`, [zero-width Unicode characters](http://stackoverflow.com/a/11305926/27581) will be stripped\n`g:uniformity_bomb`                      | What to set [`'bomb'`](http://vimdoc.sourceforge.net/htmldoc/options.html#'bomb') to\n`g:uniformity_fileencoding`              | What to set [`'fileencoding'`](http://vimdoc.sourceforge.net/htmldoc/options.html#'fileencoding') to\n`g:uniformity_fileformat`                | What to set [`'fileformat'`](http://vimdoc.sourceforge.net/htmldoc/options.html#'fileformat') to\n\n#### Usage\n\nTo update the whitespace formatting in a single file, run:\n\n    :Uniform\n\nIf the changes look good, save the file:\n\n    :update\n\nTo update all the files in a project, we can use\n[`:argdo`](http://vimdoc.sourceforge.net/htmldoc/editing.html#:argdo).  First\n[`:lcd`](http://vimdoc.sourceforge.net/htmldoc/editing.html#:lcd) to the\nproject directory, then add all the files you're interested to the [*argument\nlist*](http://vimdoc.sourceforge.net/htmldoc/editing.html#argument-list) with\nsomething like:\n\n    :args **\\*.c **\\*.h\n\n(Replace `*.c` and `*.h` with the extensions of the files that you are\ninterested in.)\n\nTo incrementally build up the *argument list*, check out\n[`:argadd`](http://vimdoc.sourceforge.net/htmldoc/editing.html#:argadd).  To\nexclude specific files or directories, check out\n[`:argdelete`](http://vimdoc.sourceforge.net/htmldoc/editing.html#:argdelete).\nYou can view the contents of the *argument list* at any time by running\n[`:args`](http://vimdoc.sourceforge.net/htmldoc/editing.html#:args).\n\nOnce you are satisifed that the *argument list* contains all the files you want\nto act on, run:\n\n    :argdo Uniform\n    :argdo update\n\nThese commands will run through every file in the *argument list*, update the\nwhitespace in every file, then save all the files.\n\n__Tip__: if you have a lot of files and you don't want to be prompted after\nevery screenful of results, try [`:set\nnomore`](http://vimdoc.sourceforge.net/htmldoc/options.html#'more')\n\nIf you find `:argdo` cumbersome, you could also try\n[`:bufdo`](http://vimdoc.sourceforge.net/htmldoc/windows.html#:bufdo),\n[`:tabdo`](http://vimdoc.sourceforge.net/htmldoc/tabpage.html#:tabdo) or\n[`:windo`](http://vimdoc.sourceforge.net/htmldoc/windows.html#:windo).  Or\nbetter yet, write a plugin that does it better and I will gladly update this\nREADME to point to it.\n\n### Notes\n\n#### Why Vim?\n\nWhen writing a tool for batch processing a bunch of files, I typically don't\nreach for a graphical/visual app like Vim as my first choice.  However, Vim\noffers so much needed functionality out-of-the-box, [I can't imagine a simpler\nway to get the same\nfunctionality](https://github.com/mkropat/vim-uniformity/blob/master/autoload/uniformity.vim):\n\n- Vim has tried-and-true support for loading in files in any number of combinations of line endings and file encodings\n- Vim has a workable, albeit clunky, means for working with all the files in a project (`:argdo`, etc.)\n- With [__sleuth.vim__](https://github.com/tpope/vim-sleuth), Vim has a tested library for auto-detecting the indentation settings of a file\n- Vim works cross-platform\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkropat%2Fvim-uniformity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmkropat%2Fvim-uniformity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkropat%2Fvim-uniformity/lists"}