{"id":15405215,"url":"https://github.com/fnando/sublime-codefmt","last_synced_at":"2025-04-17T00:50:35.396Z","repository":{"id":48384917,"uuid":"318334618","full_name":"fnando/sublime-codefmt","owner":"fnando","description":"A Sublime Text plugin that allows applying code formatting with minimum configuration.","archived":false,"fork":false,"pushed_at":"2024-12-10T06:34:46.000Z","size":107,"stargazers_count":6,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-29T05:51:12.472Z","etag":null,"topics":["autopep8","code-formatter","crystal","dartfmt","eslint","flutter","gofmt","goimports","php-cs-fixer","prettier","rubocop","rubyfmt","rustfmt","sublime-text","sublime-text-package","sublime-text-plugin","svgo"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fnando.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["fnando"],"custom":["https://paypal.me/nandovieira"]}},"created_at":"2020-12-03T22:19:31.000Z","updated_at":"2025-01-09T20:58:11.000Z","dependencies_parsed_at":"2024-01-31T22:49:39.912Z","dependency_job_id":null,"html_url":"https://github.com/fnando/sublime-codefmt","commit_stats":{"total_commits":32,"total_committers":1,"mean_commits":32.0,"dds":0.0,"last_synced_commit":"c46b564df2a8519c41f104ef4cfb0f8000d2ccb0"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnando%2Fsublime-codefmt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnando%2Fsublime-codefmt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnando%2Fsublime-codefmt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnando%2Fsublime-codefmt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fnando","download_url":"https://codeload.github.com/fnando/sublime-codefmt/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249294742,"owners_count":21245993,"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":["autopep8","code-formatter","crystal","dartfmt","eslint","flutter","gofmt","goimports","php-cs-fixer","prettier","rubocop","rubyfmt","rustfmt","sublime-text","sublime-text-package","sublime-text-plugin","svgo"],"created_at":"2024-10-01T16:15:26.807Z","updated_at":"2025-04-17T00:50:35.378Z","avatar_url":"https://github.com/fnando.png","language":"Python","readme":"# Code Formatter for Sublime Text\n\nA plugin that allows applying code formatting with minimum configuration.\n\nIncludes support for running the following formatters:\n\n- [Ruby’s RuboCop](https://rubocop.org)\n- [Ruby’s rubyfmt](https://github.com/penelopezone/rubyfmt)\n- [ESLint](https://eslint.org)\n- [Prettier](https://prettier.io)\n- [Golang’s gofmt](https://pkg.go.dev/cmd/gofmt)\n- [Golang’s goimports](https://pkg.go.dev/golang.org/x/tools/cmd/goimports)\n- [Python’s autopep8](https://pypi.org/project/autopep8/)\n- [Python’s yapf](https://pypi.org/project/yapf/)\n- [PHP Code Standards Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer)\n- [Rust’s rustfmt](https://github.com/rust-lang/rustfmt)\n- [SVGO](https://github.com/svg/svgo)\n- [Flutter](https://flutter.dev/)\n- [Dart’s dartfmt](https://dart.dev/tools/dartfmt)\n- [Crystal](https://crystal-lang.org/reference/1.3/using_the_compiler/index.html#crystal-tool-format)\n\n## Installation\n\n### Setup Package Control Repository\n\n1. Follow the instructions from https://sublime.fnando.com.\n2. Open the command pallete, run “Package Control: Install Package“, then search\n   for “Codefmt“.\n\n### Git Clone\n\nClone this repository into the Sublime Text “Packages” directory, which is\nlocated where ever the “Preferences” -\u003e “Browse Packages” option in sublime\ntakes you.\n\n## Usage\n\nBy default, Codefmt is ran whenever you save a supported code file (i.e. a\nformatter is configured and enabled). You can disable this behaviour by changing\nthe settings under “Sublime Text -\u003e Preferences -\u003e Package Settings -\u003e Codefmt\n-\u003e Settings” or by using the command palette (`super+shift+p`) and searching for\n“Codefmt: Settings”.\n\nYou can also trigger commands using the command pallete by searching for “Code\nFormatter: Format File”. You can add a custom shortcut by using the following\ncommand:\n\n```json\n[{ \"keys\": [\"super+k\", \"super+f\"], \"command\": \"format_code_file\" }]\n```\n\nWhen auto saving is disabled, you can set up alternative keybindings so you can\nuse `super+s` to save and format the current file, and another shortcut to\nbypass auto formatting. The following keybindings show how to do that for macOS:\n\n```json\n[\n  {\n    \"keys\": [\"super+s\"],\n    \"command\": \"format_code_file\"\n  },\n  {\n    \"keys\": [\"ctrl+s\"],\n    \"command\": \"save\",\n    \"args\": { \"async\": true }\n  }\n]\n```\n\n### Add new formatters\n\nYou add new formatters or override the settings for an existing one. All you\nhave to do is a new key that identifiers the formatter to `formatters`, and the\nrelated configuration using the same key. So, let’s say you want add a formatter\ncalled `txtfmt`. The user configuration file could be something like this:\n\n```json5\n{\n  overrides: {\n    txtfmt: {\n      // The command that will be executed for format files.\n      // The special variables are:\n      //\n      // - `$config`: the full path to the configuration file we found.\n      // - `$file`: the full path to the file that’s being formatted.\n      command: [\"txtfmt\", \"--fix\", \"--config\", \"$config\", \"$file\"],\n\n      // The scopes that will be considered when formatting\n      scopes: [\"text.plain\"],\n\n      // Additional flags when running in debug mode.\n      // If the formatter doesn’t have a debug mode, you may set this to an empty\n      // array.\n      debug: [\"--debug\"],\n\n      // When no custom config file exists, use a default config file.\n      default_config: null,\n\n      // Config files that will be looked up on the root of the project.\n      // If the formatter doesn’t require a config file (or is automatically\n      // inferred by the formatter), you may want to set this to an empty array.\n      config_files: [\"txtfmt.config.json\"],\n    },\n  },\n\n  formatters: [\"gofmt\", \"rubocop\", \"prettier\", \"eslint\", \"txtfmt\"],\n}\n```\n\n\u003e **Note**\n\u003e\n\u003e When overriding existing commands, you only need to define the keys that are\n\u003e changing; there's no need to add all options.\n\n### Using version managers\n\nIf you use version managers like [asdf](https://asdf-vm.com), you may need to\nset the command to the full path. The following example shows how to override\n[RuboCop](https://rubocop.org)'s command to use the shim:\n\n```json\n{\n  \"overrides\": {\n    \"rubocop\": {\n      \"command\": [\n        \"/Users/fnando/.asdf/shims/rubocop\",\n        \"--auto-correct-all\",\n        \"--config\",\n        \"$config\",\n        \"$file\"\n      ]\n    }\n  }\n}\n```\n\n\u003e **Note**\n\u003e\n\u003e Commands are always executed from the root directory of your project.\n\nSome commands may require additional environment variables, like ASDF's golang\nplugin and the `ASDF_GOLANG_MOD_VERSION_ENABLED` environment variable. You can\nuse the setting `env` to specify that.\n\n### Using .sublime-project files\n\nYou can override any setting per project. Here's an `.sublime-project` example:\n\n```json\n{\n  \"folders\": [\n    {\n      \"path\": \"/home/fnando/example\"\n    }\n  ],\n\n  \"settings\": {\n    \"Codefmt\": {\n      \"env\": {\n        \"ASDF_GOLANG_MOD_VERSION_ENABLED\": \"true\"\n      },\n      \"debug\": true,\n      \"formatters\": [\"gofmt\"]\n    }\n  }\n}\n```\n\n## License\n\nCopyright (c) 2020 Nando Vieira\n\nMIT License\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","funding_links":["https://github.com/sponsors/fnando","https://paypal.me/nandovieira"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffnando%2Fsublime-codefmt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffnando%2Fsublime-codefmt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffnando%2Fsublime-codefmt/lists"}