{"id":17720409,"url":"https://github.com/z0mbix/vim-shfmt","last_synced_at":"2026-04-06T06:04:43.836Z","repository":{"id":19139514,"uuid":"86270034","full_name":"z0mbix/vim-shfmt","owner":"z0mbix","description":"Vim plugin for shfmt (https://github.com/mvdan/sh)","archived":false,"fork":false,"pushed_at":"2022-04-05T18:02:44.000Z","size":8,"stargazers_count":130,"open_issues_count":3,"forks_count":11,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-04-17T20:13:13.953Z","etag":null,"topics":["plugin","shfmt","vim"],"latest_commit_sha":null,"homepage":null,"language":"Vim script","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/z0mbix.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}},"created_at":"2017-03-26T22:42:38.000Z","updated_at":"2024-04-16T10:16:06.000Z","dependencies_parsed_at":"2022-07-22T20:09:22.297Z","dependency_job_id":null,"html_url":"https://github.com/z0mbix/vim-shfmt","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/z0mbix%2Fvim-shfmt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/z0mbix%2Fvim-shfmt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/z0mbix%2Fvim-shfmt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/z0mbix%2Fvim-shfmt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/z0mbix","download_url":"https://codeload.github.com/z0mbix/vim-shfmt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227621914,"owners_count":17795021,"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":["plugin","shfmt","vim"],"created_at":"2024-10-25T15:26:49.496Z","updated_at":"2026-04-06T06:04:38.819Z","avatar_url":"https://github.com/z0mbix.png","language":"Vim script","funding_links":[],"categories":["Vim Script","vim"],"sub_categories":[],"readme":"# Vim plugin for shfmt\n\nThe **Vim shfmt** plugin runs [shfmt](https://github.com/mvdan/sh) to auto format the current buffer by a command `:Shfmt`.\nIf instead you prefer to format a textobject, say a paragraph, by `gq`, then add to the file `after/ftplugin/sh.vim` in your Vim configuration folder the lines\n\n```vim\nif executable('shfmt')\n  let \u0026l:formatprg='shfmt -i ' . \u0026l:shiftwidth . ' -ln posix -sr -ci -s'\nendif\n```\n\nand press, say `gqip`.\nCustomize the options ` -ln posix -sr -ci -s` to your liking.\n\n## Requirements\n\nYou just need the **`shfmt`** command\n\n## Installation\n\nObtain a copy of this plugin and place `shfmt.vim` in your Vim plugin directory or be sensible and use something like Plug:\n\n```viml\nPlug 'z0mbix/vim-shfmt', { 'for': 'sh' }\n```\n\n## Usage\n\nYou can use the `:Shfmt` command to run shfmt and automatically format the current buffer\n\nYou can also use the `:Shfmt` command together with options. For example,\n\n```\n:Shfmt -p\n```\n\n```\n:Shfmt -i 2\n```\n\n### Configuration\n\n**shfmt** uses tabs by default for auto formatting, so if you prefer to use 2 spaces, you can set the following in your `.vimrc` file:\n\n```viml\nlet g:shfmt_extra_args = '-i 2'\n```\n\n### Auto format on save\n\nIf you would like to auto format shell scripts on save, you can add the following to your vim config:\n\n```viml\nlet g:shfmt_fmt_on_save = 1\n```\n\n## License\n\nThe Vim shfmt plugin is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fz0mbix%2Fvim-shfmt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fz0mbix%2Fvim-shfmt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fz0mbix%2Fvim-shfmt/lists"}