{"id":14981788,"url":"https://github.com/cargo-limit/cargo-limit","last_synced_at":"2026-01-05T04:10:25.491Z","repository":{"id":45600046,"uuid":"295252876","full_name":"cargo-limit/cargo-limit","owner":"cargo-limit","description":"Productivity improvements for Rust ecosystem: warnings are skipped until errors are fixed, LSP-independent Neovim integration, etc.","archived":false,"fork":false,"pushed_at":"2024-08-09T11:14:13.000Z","size":468,"stargazers_count":262,"open_issues_count":11,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-29T23:35:58.249Z","etag":null,"topics":["build","cargo","cargo-plugin","cargo-wrapper","cli","crates","deduplication","filter","limit","neovim","neovim-plugin","nvim","plugin","productivity","runner","rust","wrapper"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cargo-limit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE-APACHE","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":null,"patreon":"alopatindev","open_collective":"cargo-limit","ko_fi":"alopatindev","tidelift":null,"community_bridge":null,"liberapay":"cargo-limit","issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":["https://github.com/cargo-limit/cargo-limit#support","https://codonaft.com/support"]}},"created_at":"2020-09-13T23:01:03.000Z","updated_at":"2024-10-14T08:10:15.000Z","dependencies_parsed_at":"2023-02-09T19:16:31.084Z","dependency_job_id":"56f53cd9-ce0d-4b00-837c-1bc01a625f72","html_url":"https://github.com/cargo-limit/cargo-limit","commit_stats":{"total_commits":363,"total_committers":3,"mean_commits":121.0,"dds":0.0826446280991735,"last_synced_commit":"9934707086e2569fb45e540472c0beb3b94dcac5"},"previous_names":["cargo-limit/cargo-limit","alopatindev/cargo-limit"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cargo-limit%2Fcargo-limit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cargo-limit%2Fcargo-limit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cargo-limit%2Fcargo-limit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cargo-limit%2Fcargo-limit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cargo-limit","download_url":"https://codeload.github.com/cargo-limit/cargo-limit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247289431,"owners_count":20914464,"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":["build","cargo","cargo-plugin","cargo-wrapper","cli","crates","deduplication","filter","limit","neovim","neovim-plugin","nvim","plugin","productivity","runner","rust","wrapper"],"created_at":"2024-09-24T14:04:15.665Z","updated_at":"2026-01-05T04:10:25.484Z","avatar_url":"https://github.com/cargo-limit.png","language":"Rust","funding_links":["https://patreon.com/alopatindev","https://opencollective.com/cargo-limit","https://ko-fi.com/alopatindev","https://liberapay.com/cargo-limit","https://github.com/cargo-limit/cargo-limit#support","https://codonaft.com/support","https://liberapay.com/cargo-limit/donate","https://ko-fi.com/summary/8c07db6b-1b19-4af7-bc6d-c321db86ade0","https://www.patreon.com/checkout/alopatindev/9785189","https://www.patreon.com/profile/creators?u=28969670"],"categories":["Development tools"],"sub_categories":["Build system"],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"logo.svg\" width=\"25%\" height=\"25%\" alt=\"\"/\u003e\n\u003c/div\u003e\n\n# cargo-limit [![Crates.io](https://img.shields.io/crates/v/cargo-limit)](https://crates.io/crates/cargo-limit) [![Crates.io](https://img.shields.io/crates/d/cargo-limit)](https://crates.io/crates/cargo-limit) [![Awesome](https://gist.githubusercontent.com/alopatindev/56009d77564991c5474197f3aba85670/raw/cc4370f645d7ad40defcf8d1d14025dfa8726fd2/awesome.svg)](https://github.com/rust-unofficial/awesome-rust#build-system)\n\n[![Liberapay](https://img.shields.io/badge/donate-Liberapay-F6C915)](https://liberapay.com/cargo-limit/donate)\n[![Ko-fi](https://img.shields.io/badge/donate-ko--fi-29abe0.svg?logo=ko-fi)](https://ko-fi.com/summary/8c07db6b-1b19-4af7-bc6d-c321db86ade0)\n[![Patreon](https://img.shields.io/badge/donate-patreon-F87668.svg?logo=patreon)](https://www.patreon.com/checkout/alopatindev/9785189)\n[![Open Collective](https://img.shields.io/badge/donate-Open_Collective-3385FF)](https://opencollective.com/cargo-limit)\n[![GitHub Sponsors](https://img.shields.io/badge/Sponsor-%E2%9D%A4-%23db61a2.svg?\u0026logo=github\u0026logoColor=white\u0026labelColor=181717\u0026style=flat-square)](#Support)\n\n## Description\n\n🚀 Cargo with less noise:\n- errors have highest priority\n    - they never appear in the middle of warnings\n    - **warnings are skipped** by default until errors are fixed\n    - external [path dependencies'](https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#specifying-path-dependencies) warnings are skipped by default\n- all messages come **in reversed order** by default\n    - to avoid extra scrolling\n- messages are grouped by filenames\n- number of messages can be limited\n- after encountering **first error** the rest of **build time is limited** by default\n- files can be **[automatically opened](#text-editoride-integrations) in your text editor on affected lines**\n\nInitially this project was a workaround for **[this issue](https://github.com/rust-lang/rust/issues/27189), which was closed with no adequate solution**.\n\nCheck out [roadmap](https://github.com/cargo-limit/cargo-limit/projects/1?fullscreen=true), [issues](https://github.com/cargo-limit/cargo-limit/issues) and [🎙️ Rustacean Station podcast episode](https://rustacean-station.org/episode/alexander-lopatin/) for more.\n\n[![asciicast](https://gist.githubusercontent.com/alopatindev/2376b843dffef8d1a3af7ef44aef67be/raw/bfa15c2221cb5be128857068dd786374f9f6f186/cargo-limit-demo.svg)](https://asciinema.org/a/441673)\n\n## Installation\n\n\u003ca href=\"https://repology.org/project/cargo-limit/versions\"\u003e\u003cimg align=\"right\" src=\"https://repology.org/badge/vertical-allrepos/cargo-limit.svg\" alt=\"Packaging status\"\u003e\u003c/a\u003e\n\n### From crates.io\n```\ncargo install --locked cargo-limit\n```\n\n### From git\n```\ncargo install --locked --force --git https://github.com/cargo-limit/cargo-limit\n```\n\n## Usage\nRun any of these in your project directory:\n```\ncargo lbench\ncargo lbuild\ncargo lcheck\ncargo lclippy\ncargo ldoc\ncargo lfix\ncargo lrun\ncargo lrustc\ncargo lrustdoc\ncargo ltest\n```\n\nAlso `llcheck`, `llrun`, etc. to **auto-open text editor for warnings** as well, not just for errors.\n\nThis tool is especially useful in combination with [cargo-watch](https://crates.io/crates/cargo-watch).\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003e💡 Environment Variables 👁️\u003c/b\u003e\u003c/summary\u003e\n\u003cp\u003e\n\n### CARGO_MSG_LIMIT\n- limit compiler messages number\n- `0` means no limit, which is default\n\n### CARGO_TIME_LIMIT\n- `cargo` execution time limit in seconds after encountering first compiling error\n    - automatically overwritten with `0` when `--keep-going` is used\n- `1` is default\n- `0` means no limit\n\n### CARGO_ASC\n- show compiler messages in ascending order\n- `false` is default\n\n### CARGO_FORCE_WARN\n- show warnings even if errors still exist\n- `false` is default\n\n### CARGO_DEPS_WARN\n- show external path dependencies' warnings\n- `false` is default\n\n### CARGO_EDITOR\n- opens affected files in external app\n    - see [neovim integration](#text-editoride-integrations)\n- empty (`\"\"`) means don't run external app\n- `\"_cargo-limit-open-in-nvim\"` is default\n\n\u003c/p\u003e\n\u003c/details\u003e\n\n## Text Editor/IDE integrations\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003e💡 Neovim Plugin 👁️\u003c/b\u003e\u003c/summary\u003e\n\u003cp\u003e\n\nRequires `nvim \u003e= 0.7.0` and `git` to be installed.\n\nThis plugin is [LSP](https://microsoft.github.io/language-server-protocol/)-independent, **it will keep working even when [rust-analyzer](https://rust-analyzer.github.io/) fails** to produce diagnostics!\n\n### Using **[vim-plug](https://github.com/junegunn/vim-plug#neovim):**\n```viml\nPlug 'cargo-limit/cargo-limit', { 'do': 'cargo install --locked cargo-limit' }\n```\n\nand run\n```bash\nnvim +PlugInstall +UpdateRemotePlugins +qa\n```\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003e💡 Using other Neovim Plugin Managers 👁️\u003c/b\u003e\u003c/summary\u003e\n\u003cp\u003e\n\n### [vim.pack](https://neovim.io/doc/user/pack.html#vim.pack):\nRequires `nvim \u003e= 0.12`.\n\n```lua\nvim.pack.add({ 'https://github.com/cargo-limit/cargo-limit' })\n```\n\nand run\n```bash\nnvim '+lua vim.pack.update()' +qa \u0026\u0026 cargo install --locked cargo-limit\n```\n\n### [lazy.nvim](https://github.com/folke/lazy.nvim):\n```lua\n{ 'cargo-limit/cargo-limit', build = 'cargo install --locked cargo-limit' },\n```\n\nand run\n```bash\nnvim --headless \"+Lazy! sync\" +qa\n```\n\n### [mini.deps](https://github.com/echasnovski/mini.deps):\n```lua\nadd({\n  source = 'cargo-limit/cargo-limit',\n  hooks = { post_checkout = function() vim.cmd(':!cargo install --locked cargo-limit') end },\n})\n```\n\nand run\n```bash\nnvim +DepsUpdate +qa\n```\n\n### [paq-nvim](https://github.com/savq/paq-nvim):\n```lua\n{ 'cargo-limit/cargo-limit', build = ':!cargo install --locked cargo-limit' },\n```\n\nand run\n```bash\nnvim +PaqSync +qa\n```\n\n### [pckr.nvim](https://github.com/lewis6991/pckr.nvim):\n```lua\n{ 'cargo-limit/cargo-limit', run = ':!cargo install --locked cargo-limit' };\n```\n\nand run\n```bash\nnvim '+Pckr install [plugin]+' +qa\n```\n\n### [packer.nvim](https://github.com/wbthomason/packer.nvim):\n```lua\n{ use 'cargo-limit/cargo-limit', run = ':!cargo install --locked cargo-limit' }\n```\n\nand run\n```bash\nnvim +PackerUpdate +qa\n```\n\n### [dein](https://github.com/Shougo/dein.vim):\n```viml\ncall dein#add('cargo-limit/cargo-limit', { 'rev': 'master', 'hook_post_update': '!cargo install --locked cargo-limit' })\n```\n\nand run\n```bash\nnvim --cmd '!call dein#install()'\n```\n\n\u003c/p\u003e\n\u003c/details\u003e\n\n### Optionally: first F2 to save, next F1/F2 to navigate affected lines\n```viml\nfun! SaveAllFilesOrOpenNextLocation() abort\n  if exists('*CargoLimitOpenNextLocation')\n    call g:CargoLimitOpenNextLocation()\n  end\n  execute 'silent! wa!'\nendf\n\nnmap \u003cF1\u003e :call g:CargoLimitOpenPrevLocation()\u003cEnter\u003e\nvmap \u003cF1\u003e \u003cEsc\u003e:call g:CargoLimitOpenPrevLocation()\u003cEnter\u003ev\nimap \u003cF1\u003e \u003cEsc\u003e:call g:CargoLimitOpenPrevLocation()\u003cEnter\u003ei\n\nnmap \u003cF2\u003e :call SaveAllFilesOrOpenNextLocation()\u003ccr\u003e\nvmap \u003cF2\u003e \u003cesc\u003e:call SaveAllFilesOrOpenNextLocation()\u003ccr\u003ev\nimap \u003cF2\u003e \u003cesc\u003e:call SaveAllFilesOrOpenNextLocation()\u003ccr\u003ei\n```\n\n### Optionally: less verbose messages\n```viml\nlet g:CargoLimitVerbosity = 2 \" warnings level\n```\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003e💡 Test the plugin! 👁️\u003c/b\u003e\u003c/summary\u003e\n\u003cp\u003e\n\n1. Open two terminals (or tmux windows, etc.)\n2. `cd your/project/directory` in both of them\n3. Run `nvim` in one of them\n4. Run `cargo lrun` in the other\n5. In case of compiling errors `nvim` opens new or existing tabs with the files on affected lines and columns\n6. Fix the error, save the file and `nvim` will jump to the next error location\n7. `cargo llrun` (`cargo llcheck`, etc.) will open them in case of warnings as well.\n\n\u003c/p\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003e⚠️ Known Limitations! 👁️\u003c/b\u003e\u003c/summary\u003e\n\u003cp\u003e\n\n### 1. Auto-jumps work only if\n- current **mode is normal**\n- current buffer is either **empty or contains some existing and unmodified** (saved) file\n\nThis is by design, in order to **not disrupt** from active text editing or file navigation process.\n\nAlso, by default, auto-jump won't happen to the affected line if it's **already modified/fixed** (until you rerun `cargo ll{check,run,etc.}`).\n\n### 2. Before running `nvim`: Current Directory should be Project (sub)directory\n- that's required so **cargo-limit** could [figure out](https://github.com/cargo-limit/cargo-limit/issues/30#issuecomment-1219793195) which exact `nvim` instance should be controlled\n- only **first `nvim` instance** with current project (sub)directory will be **controlled by cargo-limit**.\n\n\u003c/p\u003e\n\u003c/details\u003e\n\n## Customizations\nAdd **custom update handlers** to your `init.vim` if you want other Neovim behavior.\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003e💡 See examples for Neovim! 👁️\u003c/b\u003e\u003c/summary\u003e\n\u003cp\u003e\n\n### Open Files in Buffers Instead of Tabs\n```viml\nfun! g:CargoLimitUpdate(editor_data) abort\n  let l:current_file = resolve(expand('%:p'))\n  if l:current_file !=# '' \u0026\u0026 !filereadable(l:current_file)\n    return\n  end\n  for l:location in reverse(a:editor_data.locations)\n    let l:path = fnameescape(l:location.path)\n    if mode() ==# 'n' \u0026\u0026 \u0026l:modified ==# 0\n      execute 'edit ' . l:path\n      call cursor((l:location.line), (l:location.column))\n    else\n      break\n    end\n  endfor\nendf\n```\n\n### Populate a QuickFix List\n```viml\nset errorformat =%f:%l:%c:%m\n\nfun! g:CargoLimitUpdate(editor_data) abort\n  let l:winnr = winnr()\n  let l:quickfix_is_visible = len(filter(getwininfo(), 'v:val.quickfix')) \u003e# 0\n\n  cgetexpr []\n  for l:location in a:editor_data.locations\n    caddexpr l:location.path . ':' . l:location.line . ':' . l:location.column . ':' . l:location.message\n  endfor\n\n  if empty(a:editor_data.locations)\n    cclose\n  elseif !a:editor_data.corrected_locations || l:quickfix_is_visible\n    copen\n  end\n\n  if l:winnr !=# winnr()\n    wincmd p\n  end\nendf\n```\n\nBehavior may depend on your configuration. Use `:copen` if the quickfix list didn't appear to you automatically.\n\n\u003c/p\u003e\n\u003c/details\u003e\n\n\u003c/p\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003e💡 Other Text Editors/IDEs 👁️\u003c/b\u003e\u003c/summary\u003e\n\u003cp\u003e\n\n**cargo-limit** can run external app/script and provide affected locations to stdin in the following JSON format:\n```json\n{\n  \"protocol_version\": \"0.0.11\",\n  \"workspace_root\": \"/full/path/to/project\",\n  \"locations\": [\n    {\n      \"path\": \"/full/path/to/project/file.rs\",\n      \"line\": 4,\n      \"column\": 1,\n      \"message\": \"unused import: `diagnostic::DiagnosticSpan`\",\n      \"level\": \"warning\"\n    }\n  ],\n  \"corrected_locations\": 0\n}\n```\n\nTheoretically this can be used for any text editor or IDE, especially if it supports client/server communication. To do that you need a **wrapper app/script** that parses the `locations` and gives them to the text editor or IDE client.\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003e💡 Example: Gedit! 👁️\u003c/b\u003e\u003c/summary\u003e\n\u003cp\u003e\n\n1. Install [`jq`](https://stedolan.github.io/jq/download/)\n2. Create `open-in-gedit.sh`:\n```bash\n#!/bin/bash\n\njq --raw-output '.locations |= unique_by(.path) | .locations[] | [\n    \"gedit\",\n    .path,\n    \"+\" + (.line | tostring) + \":\" + (.column | tostring),\n    \"\u0026\"\n] | join(\" \")' | bash\n```\n3. `chmod +x open-in-gedit.sh`\n4. Set `CARGO_EDITOR=/path/to/open-in-gedit.sh` environment variable\n5. Run `cargo lrun` in your project directory\n6. In case of compiling errors `open-in-gedit.sh` will open files in `gedit` on affected lines and columns\n7. `cargo llrun` (`cargo llcheck`, etc.) will open them in case of warnings as well.\n\n\u003c/p\u003e\n\u003c/details\u003e\n\n\u003c/p\u003e\n\u003c/details\u003e\n\n## Similar Projects/Inspirations\n- [bacon](https://github.com/Canop/bacon) is a background rust code checker\n- [cargo-firstpage](https://github.com/cecton/cargo-firstpage) shows only the first page of rustc output\n- [ograc](https://gitlab.com/lirnril/ograc) like cargo, but backwards\n\n## Support\nIf this project improved your workflow — please consider:\n- pressing ⭐\n- sharing this project with your friends/colleges\n- buying me some ~~coffee~~ veggies 🥕\n\n---\n\nYour donations will help me allocate more time to resolve [issues](https://github.com/cargo-limit/cargo-limit/issues) and to **finish all the [planned features](https://github.com/cargo-limit/cargo-limit/projects/1?fullscreen=true)**! ❤️\n\n- **Bitcoin** (BTC) `1Afgvdz1oPaugFcLgDaAzCYYdHexV6tTvH`\n\n- **TRON** (TRX, USDT-TRC20, etc.) `TVxE2HyryNyNReMvw9HRQ3BkYePCszXSrc`\n\n- **Ethereum** (ETH, DAI, etc.) `0xa879cdb1d7d859e6e425f8e50c4ee49f4b3a7b06`\n\n- **TON**: `EQApceYoD6FDKn4azXrUxOIyT8VF4NIV_PRE7x9KsTJC9h0q`\n\n- **Zcash** (ZEC): `t1NiwnuUQC1tENTY2aPDDhKEA3pykF582TP`\n\n- **Litecoin** (LTC): `Le3yFbk854T1nrRUjWHkqTNrwz1zgDFqVX`\n\n- **Monero** (XMR): `46pRHmFpqzUBA8SLrdjW73H6ainCqRGpe8shjqQJ4UoBFAbegkAwqvjTSCBvBL71NZXYhriSuKPBkGxc1FjCeiut2EvFvxk`\n\n- **[Liberapay](https://liberapay.com/cargo-limit)**\n\n- **[Patreon](https://www.patreon.com/checkout/alopatindev/9785189)**\n\n- **[Ko-fi](https://ko-fi.com/summary/8c07db6b-1b19-4af7-bc6d-c321db86ade0)**\n\n- **[Open Collective](https://opencollective.com/cargo-limit)**\n\nFor **general donations** dedicated to all my projects please check out ⚡ [here](https://codonaft.com/sponsor).\n\nThank you for your support! 🙏🏼\n\n## Thanks\n\n**❤️ Special thanks to [Danil Suetin](https://www.patreon.com/profile/creators?u=28969670) for sponsoring this project! ❤️**\n\nAlso thanks everyone for code contributions and bug reporting. Special thanks to [Casey Rodarmor](https://github.com/casey) for providing VimL code for quickfix populator and [Otavio Salvador](https://github.com/otavio) for [NixOS package](https://search.nixos.org/packages?show=cargo-limit)!\n\n## License\nMIT/Apache-2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcargo-limit%2Fcargo-limit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcargo-limit%2Fcargo-limit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcargo-limit%2Fcargo-limit/lists"}