pax_global_header00006660000000000000000000000064146720015320014512gustar00rootroot0000000000000052 comment=ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0 folke-todo-comments.nvim-ae0a2af/000077500000000000000000000000001467200153200171115ustar00rootroot00000000000000folke-todo-comments.nvim-ae0a2af/.editorconfig000066400000000000000000000001421467200153200215630ustar00rootroot00000000000000root = true [*] insert_final_newline = true indent_style = space indent_size = 2 charset = utf-8 folke-todo-comments.nvim-ae0a2af/.github/000077500000000000000000000000001467200153200204515ustar00rootroot00000000000000folke-todo-comments.nvim-ae0a2af/.github/ISSUE_TEMPLATE/000077500000000000000000000000001467200153200226345ustar00rootroot00000000000000folke-todo-comments.nvim-ae0a2af/.github/ISSUE_TEMPLATE/bug_report.yml000066400000000000000000000050371467200153200255340ustar00rootroot00000000000000name: Bug Report description: File a bug/issue title: "bug: " labels: [bug] body: - type: markdown attributes: value: | **Before** reporting an issue, make sure to read the [documentation](https://github.com/folke/todo-comments.nvim) and search [existing issues](https://github.com/folke/todo-comments.nvim/issues). Usage questions such as ***"How do I...?"*** belong in [Discussions](https://github.com/folke/todo-comments.nvim/discussions) and will be closed. - type: checkboxes attributes: label: Did you check docs and existing issues? description: Make sure you checked all of the below before submitting an issue options: - label: I have read all the todo-comments.nvim docs required: true - label: I have updated the plugin to the latest version before submitting this issue required: true - label: I have searched the existing issues of todo-comments.nvim required: true - label: I have searched the existing issues of plugins related to this issue required: true - type: input attributes: label: "Neovim version (nvim -v)" placeholder: "0.8.0 commit db1b0ee3b30f" validations: required: true - type: input attributes: label: "Operating system/version" placeholder: "MacOS 11.5" validations: required: true - type: textarea attributes: label: Describe the bug description: A clear and concise description of what the bug is. Please include any related errors you see in Neovim. validations: required: true - type: textarea attributes: label: Steps To Reproduce description: Steps to reproduce the behavior. placeholder: | 1. 2. 3. validations: required: true - type: textarea attributes: label: Expected Behavior description: A concise description of what you expected to happen. validations: required: true - type: textarea attributes: label: Repro description: Minimal `init.lua` to reproduce this issue. Save as `repro.lua` and run with `nvim -u repro.lua` value: | vim.env.LAZY_STDPATH = ".repro" load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))() require("lazy.minit").repro({ spec = { { "folke/todo-comments.nvim", opts = {} }, -- add any other plugins here }, }) render: lua validations: required: false folke-todo-comments.nvim-ae0a2af/.github/ISSUE_TEMPLATE/config.yml000066400000000000000000000002571467200153200246300ustar00rootroot00000000000000blank_issues_enabled: false contact_links: - name: Ask a question url: https://github.com/folke/todo-comments.nvim/discussions about: Use Github discussions instead folke-todo-comments.nvim-ae0a2af/.github/ISSUE_TEMPLATE/feature_request.yml000066400000000000000000000023501467200153200265620ustar00rootroot00000000000000name: Feature Request description: Suggest a new feature title: "feature: " labels: [enhancement] body: - type: checkboxes attributes: label: Did you check the docs? description: Make sure you read all the docs before submitting a feature request options: - label: I have read all the todo-comments.nvim docs required: true - type: textarea validations: required: true attributes: label: Is your feature request related to a problem? Please describe. description: A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - type: textarea validations: required: true attributes: label: Describe the solution you'd like description: A clear and concise description of what you want to happen. - type: textarea validations: required: true attributes: label: Describe alternatives you've considered description: A clear and concise description of any alternative solutions or features you've considered. - type: textarea validations: required: false attributes: label: Additional context description: Add any other context or screenshots about the feature request here. folke-todo-comments.nvim-ae0a2af/.github/PULL_REQUEST_TEMPLATE.md000066400000000000000000000005161467200153200242540ustar00rootroot00000000000000## Description ## Related Issue(s) ## Screenshots folke-todo-comments.nvim-ae0a2af/.github/dependabot.yml000066400000000000000000000001661467200153200233040ustar00rootroot00000000000000version: 2 updates: - package-ecosystem: "github-actions" directory: "/" schedule: interval: "weekly" folke-todo-comments.nvim-ae0a2af/.github/workflows/000077500000000000000000000000001467200153200225065ustar00rootroot00000000000000folke-todo-comments.nvim-ae0a2af/.github/workflows/ci.yml000066400000000000000000000003521467200153200236240ustar00rootroot00000000000000name: CI on: push: branches: [main, master] pull_request: jobs: ci: uses: folke/github/.github/workflows/ci.yml@main secrets: inherit with: plugin: todo-comments.nvim repo: folke/todo-comments.nvim folke-todo-comments.nvim-ae0a2af/.github/workflows/labeler.yml000066400000000000000000000002201467200153200246310ustar00rootroot00000000000000name: "PR Labeler" on: - pull_request_target jobs: labeler: uses: folke/github/.github/workflows/labeler.yml@main secrets: inherit folke-todo-comments.nvim-ae0a2af/.github/workflows/pr.yml000066400000000000000000000004231467200153200236510ustar00rootroot00000000000000name: PR Title on: pull_request_target: types: - opened - edited - synchronize - reopened - ready_for_review permissions: pull-requests: read jobs: pr-title: uses: folke/github/.github/workflows/pr.yml@main secrets: inherit folke-todo-comments.nvim-ae0a2af/.github/workflows/stale.yml000066400000000000000000000003541467200153200243430ustar00rootroot00000000000000name: Stale Issues & PRs on: schedule: - cron: "30 1 * * *" jobs: stale: if: contains(fromJSON('["folke", "LazyVim"]'), github.repository_owner) uses: folke/github/.github/workflows/stale.yml@main secrets: inherit folke-todo-comments.nvim-ae0a2af/.github/workflows/update.yml000066400000000000000000000004201467200153200245070ustar00rootroot00000000000000name: Update Repo on: workflow_dispatch: schedule: # Run every hour - cron: "0 * * * *" jobs: update: if: contains(fromJSON('["folke", "LazyVim"]'), github.repository_owner) uses: folke/github/.github/workflows/update.yml@main secrets: inherit folke-todo-comments.nvim-ae0a2af/.gitignore000066400000000000000000000001061467200153200210760ustar00rootroot00000000000000*.log /.repro /.tests /build /debug /doc/tags foo.* node_modules tt.* folke-todo-comments.nvim-ae0a2af/.lua-format000066400000000000000000000006001467200153200211550ustar00rootroot00000000000000# https://github.com/Koihik/LuaFormatter/blob/master/docs/Style-Config.md column_limit: 80 indent_width: 2 continuation_indent_width: 2 use_tab: false chop_down_parameter: true chop_down_table: true chop_down_kv_table: true single_quote_to_double_quote: true spaces_inside_table_braces: true align_parameter: true keep_simple_control_block_one_line: true extra_sep_at_table_end: true folke-todo-comments.nvim-ae0a2af/.neoconf.json000066400000000000000000000004241467200153200215110ustar00rootroot00000000000000{ "neodev": { "library": { "plugins": [ "plenary.nvim", "nvim-web-devicons", "trouble.nvim" ] } }, "lspconfig": { "lua_ls": { "Lua.runtime.version": "LuaJIT", "Lua.workspace.checkThirdParty": false } } } folke-todo-comments.nvim-ae0a2af/CHANGELOG.md000066400000000000000000000440361467200153200207310ustar00rootroot00000000000000# Changelog ## [1.4.0](https://github.com/folke/todo-comments.nvim/compare/v1.3.0...v1.4.0) (2024-09-16) ### Features * **fzf:** add fzf-lua support in Readme & add TodoFzfLua command ([#312](https://github.com/folke/todo-comments.nvim/issues/312)) ([6d6cf47](https://github.com/folke/todo-comments.nvim/commit/6d6cf47b06638bd037c7b6f87fd284d4066d8a51)) ### Bug Fixes * **config:** select `fg` by maximizing contrast rather than check if a color is dark ([#316](https://github.com/folke/todo-comments.nvim/issues/316)) ([76990a9](https://github.com/folke/todo-comments.nvim/commit/76990a9c04083068e132e4d0c9d13ef7e4635a9e)) ## [1.3.0](https://github.com/folke/todo-comments.nvim/compare/v1.2.0...v1.3.0) (2024-07-07) ### Features * added support for fzf-lua ([fe5a7c6](https://github.com/folke/todo-comments.nvim/commit/fe5a7c66d77bcb3895acda55b9fa4519110eb154)) * **fzf:** multiline by default ([8fdea2a](https://github.com/folke/todo-comments.nvim/commit/8fdea2acf78aa16b3881aa801853fa86b02c2fd8)) * **highlight:** allow extended highlighting patterns ([#185](https://github.com/folke/todo-comments.nvim/issues/185)) ([#255](https://github.com/folke/todo-comments.nvim/issues/255)) ([76c8fee](https://github.com/folke/todo-comments.nvim/commit/76c8feeda805db77b6ffb222a79661236d7a2aba)) * **highlight:** allow highlighting the full pattern ([#180](https://github.com/folke/todo-comments.nvim/issues/180)) ([ad775a7](https://github.com/folke/todo-comments.nvim/commit/ad775a7ed187761c56d14421cecab44a0656028d)) ### Bug Fixes * don't use tbl_flatten. Fixes [#272](https://github.com/folke/todo-comments.nvim/issues/272) ([9c104cf](https://github.com/folke/todo-comments.nvim/commit/9c104cf7868f1c739b43a07e5593666cc9de2d67)) * **extension:** provide default icon ([#274](https://github.com/folke/todo-comments.nvim/issues/274)) ([7de4e85](https://github.com/folke/todo-comments.nvim/commit/7de4e85211e3301572393f4b4957bff463f188fc)), closes [#202](https://github.com/folke/todo-comments.nvim/issues/202) * **highlight:** match to the end of length `#matched` ([#288](https://github.com/folke/todo-comments.nvim/issues/288)) ([a40fa7e](https://github.com/folke/todo-comments.nvim/commit/a40fa7e421a0c363f65db204f5f0ac075d3a8967)) * **telecope:** icons highlight. ([#279](https://github.com/folke/todo-comments.nvim/issues/279)) ([4573f4f](https://github.com/folke/todo-comments.nvim/commit/4573f4f1f167a2f928a46043c7fea6d1cf333fb9)) * ternary evaluation in setlist for opts.open ([#252](https://github.com/folke/todo-comments.nvim/issues/252)) ([c7a6a02](https://github.com/folke/todo-comments.nvim/commit/c7a6a02823ca4cbecfee3c2a32d8674573308014)) * **trouble:** compatibility with Trouble v3 ([#286](https://github.com/folke/todo-comments.nvim/issues/286)) ([01b4599](https://github.com/folke/todo-comments.nvim/commit/01b4599b36ea873305a993c93cb6186cb03a51e7)) ### Reverts * feat(highlight): allow highlighting the full pattern ([#180](https://github.com/folke/todo-comments.nvim/issues/180)) ([996d1a7](https://github.com/folke/todo-comments.nvim/commit/996d1a71d634bfc934d52021a0db99ee99add7c2)) ## [1.2.0](https://github.com/folke/todo-comments.nvim/compare/v1.1.0...v1.2.0) (2024-03-27) ### Features * added source for trouble v3 ([9935ae9](https://github.com/folke/todo-comments.nvim/commit/9935ae96190c4c177cf0a0dfaddbe4a8addf3eed)) ### Bug Fixes * **trouble:** trouble v3 support ([3e45f2f](https://github.com/folke/todo-comments.nvim/commit/3e45f2fad81e7eca409280836620310b1267e1c7)) ## [1.1.0](https://github.com/folke/todo-comments.nvim/compare/v1.0.1...v1.1.0) (2023-03-31) ### Features * **telescope:** access pickers with plugin_name... ([#191](https://github.com/folke/todo-comments.nvim/issues/191)) ([7420337](https://github.com/folke/todo-comments.nvim/commit/7420337c20d766e73eb83b5d17b4ef50331ed4cd)) ## [1.0.1](https://github.com/folke/todo-comments.nvim/compare/v1.0.0...v1.0.1) (2023-03-26) ### Bug Fixes * **icons:** fixed obsolete nerd font icons with nerdfix ([3bddf1d](https://github.com/folke/todo-comments.nvim/commit/3bddf1dc406b9212c881882c8cfc4798ee271762)) ## 1.0.0 (2023-01-04) ### ⚠ BREAKING CHANGES * todo-comments now requires Neovim >= 0.8.0. Use the `neovim-pre-0.8.0` branch for older versions ### Features * accept argument to filter keywords ([#116](https://github.com/folke/todo-comments.nvim/issues/116)) ([67cd3a4](https://github.com/folke/todo-comments.nvim/commit/67cd3a4112f372bb1406dae35816d502f53a5af3)) * add config option to set gui style ([#117](https://github.com/folke/todo-comments.nvim/issues/117)) ([231888a](https://github.com/folke/todo-comments.nvim/commit/231888aa37ddbdcc8a58b06dcb19dacfa65bf2c7)) * add error logging for rg ([006250f](https://github.com/folke/todo-comments.nvim/commit/006250f11d34fdd4500db5fdde5133131b48bc72)) * add max line len option (Fixes [#33](https://github.com/folke/todo-comments.nvim/issues/33)) ([8b63dfc](https://github.com/folke/todo-comments.nvim/commit/8b63dfccf1ae11aeebc9fae3b3d7a6dd12bb09b5)) * added merge_keywords option that allows disabling the default groups ([3f3b8b4](https://github.com/folke/todo-comments.nvim/commit/3f3b8b4fa8b4b91c2a0142491ee22afd76c161e3)) * added methods to jump to next/prev todo comment ([c88d199](https://github.com/folke/todo-comments.nvim/commit/c88d1997e40cec2078562e405b52be863d60615a)) * added multiline context and pattern ([144cba6](https://github.com/folke/todo-comments.nvim/commit/144cba62f6753647a8c502b25475e5ed568d5358)) * added options.highlight.exclude. Fixes [#41](https://github.com/folke/todo-comments.nvim/issues/41) ([1275879](https://github.com/folke/todo-comments.nvim/commit/12758792a0d207b5a4a4fb5a11a0d321a4608108)) * added support for specifying multiple patterns for highlighting ([808a2e5](https://github.com/folke/todo-comments.nvim/commit/808a2e524b3720804716a99fd900986b9d727d4d)) * added TEST to ([5547b53](https://github.com/folke/todo-comments.nvim/commit/5547b537593a4322f876637c6ee2aa38b2ac50ee)) * added TodoLocList. Fixes [#47](https://github.com/folke/todo-comments.nvim/issues/47) ([c641728](https://github.com/folke/todo-comments.nvim/commit/c6417282c9d3948917e712b8e0b0093f9dc995e2)) * allow changing config on the fly or disable all [#27](https://github.com/folke/todo-comments.nvim/issues/27) ([2f701d0](https://github.com/folke/todo-comments.nvim/commit/2f701d0738e3b0dfae90c69435b752bbbaeb2ed3)) * allow custom todo patterns [#4](https://github.com/folke/todo-comments.nvim/issues/4) ([1732f21](https://github.com/folke/todo-comments.nvim/commit/1732f21854f0d7f9cffd6e92f9e95c13a01bd79e)) * allow searching for todos in another directory. Implements [#21](https://github.com/folke/todo-comments.nvim/issues/21) ([6de90a5](https://github.com/folke/todo-comments.nvim/commit/6de90a566ab50da6b76200a69486b6d51c8d07ee)) * allow specifying wide_fg ([#92](https://github.com/folke/todo-comments.nvim/issues/92)) ([dca8c3f](https://github.com/folke/todo-comments.nvim/commit/dca8c3fa3b515bc85652e50bf736d2cca8a87cb2)) * also deepcopy keywords ([0f6a87b](https://github.com/folke/todo-comments.nvim/commit/0f6a87bb04925775bb2fd68c063152512e033313)) * check if ripgrep is available and show error if not ([b5cdae7](https://github.com/folke/todo-comments.nvim/commit/b5cdae78f58ac23fcf4340013e4dc7197881196a)) * expose methods to jump to next/prev todo comment ([89ee420](https://github.com/folke/todo-comments.nvim/commit/89ee420be60750d074bcb95efa6f2159c0671950)) * Group search and highlight options ([fbf91af](https://github.com/folke/todo-comments.nvim/commit/fbf91af72193987e50e542c5148ffcca2ff89050)) * Improve rg and highlight pattern matching ([7a00efb](https://github.com/folke/todo-comments.nvim/commit/7a00efb6a6c585303d333b0c543c640aa888fb83)) * inital version ([7473917](https://github.com/folke/todo-comments.nvim/commit/747391791bbb67fafeb2e690f4688720392470c8)) * intergration with lsp trouble ([194e653](https://github.com/folke/todo-comments.nvim/commit/194e65323bb1e3d35075d7b3451db697f1ba75f8)) * make it possible to disable warnings when searching ([#63](https://github.com/folke/todo-comments.nvim/issues/63)) ([9983edc](https://github.com/folke/todo-comments.nvim/commit/9983edc5ef38c7a035c17c85f60ee13dbd75dcc8)) * make sign priority configurable ([edbe161](https://github.com/folke/todo-comments.nvim/commit/edbe161856eacc859987eaf28d41b67163d49791)) * multiline todo comments ([8dffc5d](https://github.com/folke/todo-comments.nvim/commit/8dffc5d3ed1495e70c05f5ca1d100f8d3a4c44aa)) * quickfix, telescope and trouble commands ([a7c12f2](https://github.com/folke/todo-comments.nvim/commit/a7c12f288c995a738688ec3a42e6a1f6d48f3b89)) * set default multiline pattern to `^.` ([8f00cdb](https://github.com/folke/todo-comments.nvim/commit/8f00cdbbeafdad95dc1da0d846d21d9eef2d510b)) * Telescope plugin ([95f04b1](https://github.com/folke/todo-comments.nvim/commit/95f04b1a1fc9b7a17731eebde4353697c5a01f9b)) * todo-comments now requires Neovim >= 0.8.0. Use the `neovim-pre-0.8.0` branch for older versions ([916cd4f](https://github.com/folke/todo-comments.nvim/commit/916cd4f144e7211874082286f7d5889018b5739d)) * use flame icon for hacks ([745df54](https://github.com/folke/todo-comments.nvim/commit/745df540153b0fc18b1ffec02c8875be1bf9e0c7)) * use treesitter to highlight keywords in comments only. If not a TS buffer, then highlight all comments [#22](https://github.com/folke/todo-comments.nvim/issues/22) ([b3fbe23](https://github.com/folke/todo-comments.nvim/commit/b3fbe23185189ba20ee0012bfbbb14e8fa55406e)) * use vim.notify instead of echo ([b745d75](https://github.com/folke/todo-comments.nvim/commit/b745d7513207eb8d809e1a92fae76e643310bf91)) * use vim.treesitter.get_captures_at_pos to detect comments ([6120afa](https://github.com/folke/todo-comments.nvim/commit/6120afa159d1dd3ba112ee4360b4ab4562a9b266)) ### Bug Fixes * add . to args for ripgrep to make it work on Windows ([03fc95a](https://github.com/folke/todo-comments.nvim/commit/03fc95a8f49edc8533a70577dedc44972733d88d)) * add proper error logging when ripgrep fails ([358b8c9](https://github.com/folke/todo-comments.nvim/commit/358b8c9c387557d21cbc14f8269e229467487954)) * allow highlighting in quickfix buffers ([f4d35a2](https://github.com/folke/todo-comments.nvim/commit/f4d35a2e5b601385b299bb44b1f556956d286292)) * avoid E5108 after pressing q: ([#111](https://github.com/folke/todo-comments.nvim/issues/111)) ([fb6f16b](https://github.com/folke/todo-comments.nvim/commit/fb6f16b89e475676d45bf6b39077fb752521e6f1)) * better keyword highlight pattern ([52d814d](https://github.com/folke/todo-comments.nvim/commit/52d814d7b5234e353d7599f566b1125d256633b9)) * check if buf is valid before clearing todo namespace ([23dfdaf](https://github.com/folke/todo-comments.nvim/commit/23dfdafe1990ae7b6c0f0c69a02736bb1a839219)) * check is current_win is still valid before setting it again ([37e7347](https://github.com/folke/todo-comments.nvim/commit/37e73472656d0642224dc86d9ce4784d8e4f5b5c)) * clear namespace with pcall to fix lazy loading weirdness. Fixes [#130](https://github.com/folke/todo-comments.nvim/issues/130) ([f990cd9](https://github.com/folke/todo-comments.nvim/commit/f990cd9c1d3e701f6746b523b71784ec2498ae35)) * debug code ([b09c700](https://github.com/folke/todo-comments.nvim/commit/b09c700ecf878092e91ed4b041c6eb7c840df994)) * defer highlight updates to prevent weird behavior of treesitter ([a4e433e](https://github.com/folke/todo-comments.nvim/commit/a4e433ee690455f94b4fba8fbc3241d061dc90f3)) * dont show signs for multiline comments ([3fe59db](https://github.com/folke/todo-comments.nvim/commit/3fe59db6dd6fb07857e0b9670a3b711104dfb53a)) * escape special characters in commentstring ([5fd5086](https://github.com/folke/todo-comments.nvim/commit/5fd5086a50f8bc012f50858805080c79ccb204bf)) * exit when buffer no longer exists ([3bc3bce](https://github.com/folke/todo-comments.nvim/commit/3bc3bceb4f1122028891830b2b408cd570e21859)) * fall back to syntax Comment if treesitter is not available ([b4dec37](https://github.com/folke/todo-comments.nvim/commit/b4dec37ba24c6c31d8129f601ff5db6cb4b9c99a)) * if todo is lazyloaded, then skip VimEnter ([564dc45](https://github.com/folke/todo-comments.nvim/commit/564dc4564cd47854f36e09e3d1910acb7e41e67d)) * improved comment support with treesitter ([219bc7e](https://github.com/folke/todo-comments.nvim/commit/219bc7ef4439b6fa53bc9db1dd14b11221e83d7d)) * is_comment now checks highlighter TS queries instead of parse tree ([d5f9bfc](https://github.com/folke/todo-comments.nvim/commit/d5f9bfc164c7ea306710d1a0a9d2db255387b1db)) * is_comment. Fixes [#145](https://github.com/folke/todo-comments.nvim/issues/145) ([1814fec](https://github.com/folke/todo-comments.nvim/commit/1814feca54540497de99d474dd6c9de6b691cf01)) * jumping to todo comments didnt use the correct line for is_comment checks ([c8c5446](https://github.com/folke/todo-comments.nvim/commit/c8c54465c74761ec95399584ed670700849ae401)) * keep previous options from setup ([8560546](https://github.com/folke/todo-comments.nvim/commit/8560546c466d1f555573d37e062e95e7ae94bbab)) * listen to treesitter changes to redo highlights ([9b276eb](https://github.com/folke/todo-comments.nvim/commit/9b276ebeeced9e15707c27e0b2588e7b3e19d9c5)) * matchstr fails with error about passing a dictionary as a string when string is binary [#23](https://github.com/folke/todo-comments.nvim/issues/23) ([ca2b794](https://github.com/folke/todo-comments.nvim/commit/ca2b7945e9bb58a5a8ab341b269028dd05d7ec61)) * never use comments to highlight quickfix buffers ([7a5e9c9](https://github.com/folke/todo-comments.nvim/commit/7a5e9c991670a834ed29951e58d29551f7a73fe3)) * pass kw start to is_comment. Fixes [#153](https://github.com/folke/todo-comments.nvim/issues/153) ([d3c6ec6](https://github.com/folke/todo-comments.nvim/commit/d3c6ec66caa07a31a16d3ed4b954a88742daa909)) * properly clear todo highlights in stop ([98b1ebf](https://github.com/folke/todo-comments.nvim/commit/98b1ebf198836bdc226c0562b9f906584e6c400e)) * properly escape commentstring [#19](https://github.com/folke/todo-comments.nvim/issues/19) ([a5c255c](https://github.com/folke/todo-comments.nvim/commit/a5c255c6860ae9456f339dc35586a6d47b6fd2cf)) * Properly pass options into jump function ([#143](https://github.com/folke/todo-comments.nvim/issues/143)) ([96391ae](https://github.com/folke/todo-comments.nvim/commit/96391ae41e63a5edba260adfd7312462b54ddc8e)) * re-apply highlights when treesitter bytes changes. Fixes [#134](https://github.com/folke/todo-comments.nvim/issues/134) ([e90b17e](https://github.com/folke/todo-comments.nvim/commit/e90b17e45c39f6f37994a2f0f60dde8472b8457d)) * remove FIX from alts for FIX ([e3b96b2](https://github.com/folke/todo-comments.nvim/commit/e3b96b253150c217a603fa11b79b90fcb2d1a649)) * remove set_current_win ([d2b9b26](https://github.com/folke/todo-comments.nvim/commit/d2b9b265ae250ac3c1737180095352080059d212)) * revert extmarks to add_highlight ([4a27e05](https://github.com/folke/todo-comments.nvim/commit/4a27e05519827ba1594d5ce3fde874040f005bfe)) * ripgrep gives exit code 2 on error. Exit code 1 means no results ([3ad4967](https://github.com/folke/todo-comments.nvim/commit/3ad4967972ed463ce1dfd38161ea98862b2bdffa)) * set fg_dark and fg_light to black and white for colorschemes that dont set Normal ([b64859a](https://github.com/folke/todo-comments.nvim/commit/b64859a2313472284fb0d29d9bc9e0108725ecc4)) * show error when running Todo without doing setup() ([f0cc7d3](https://github.com/folke/todo-comments.nvim/commit/f0cc7d3eb7c017c87c1ef52bf3f51d292971ef29)) * show warning message when no results were found ([09aa8de](https://github.com/folke/todo-comments.nvim/commit/09aa8de5ddb2483cafb955645bb4f98701736a98)) * skip possibly bad regex results ([014959e](https://github.com/folke/todo-comments.nvim/commit/014959e82aabc07a16739c771bf40e7fd6de3fe9)) * sort keywords by length in descending order ([#157](https://github.com/folke/todo-comments.nvim/issues/157)) ([2adb83e](https://github.com/folke/todo-comments.nvim/commit/2adb83e0fb082a5f1c40f3def4c8b18ec767c5ee)) * todo comments was broken for non treesitter files. Fixes [#150](https://github.com/folke/todo-comments.nvim/issues/150) ([f244aa3](https://github.com/folke/todo-comments.nvim/commit/f244aa391774b29878db580eff63a9e26dc5f084)) * Update docs ([2273076](https://github.com/folke/todo-comments.nvim/commit/2273076591b9ce78f562b52e3c0b4e34102f54a5)) * update README to 0.6 diagnostic hl ([#78](https://github.com/folke/todo-comments.nvim/issues/78)) ([672cd22](https://github.com/folke/todo-comments.nvim/commit/672cd22bd15928434374ac52d0cf38dd250231df)) * updated default colors to use 0.6 diagnostic highlights ([6570fd2](https://github.com/folke/todo-comments.nvim/commit/6570fd271d17fec1966522f3a19cc6f4c88824c4)) * use nvim_win_call instead of changing current window to apply highlights ([bff9e31](https://github.com/folke/todo-comments.nvim/commit/bff9e315ac3b5854a08d5a73b898822bdec1a5c3)) * use options.search.command for telescope ([ed24570](https://github.com/folke/todo-comments.nvim/commit/ed24570d07e0ffae9969006009a91ecabfff1493)) * use seperate hl group for signs using correct SignColumn bg color ([bf138df](https://github.com/folke/todo-comments.nvim/commit/bf138dff36602a1da40bbebabef8bae61735635c)) * use white as fg for color schemes that dont define a fg for Normal ([ec820ad](https://github.com/folke/todo-comments.nvim/commit/ec820ade091c28b221eb2f6d0ee02c554a61a8e8)) * When todo-comments.nvim as optional and report an error the first time you use it. ([#129](https://github.com/folke/todo-comments.nvim/issues/129)) ([5f90941](https://github.com/folke/todo-comments.nvim/commit/5f9094198563b693439837b593815dc18768fda8)) ### Performance Improvements * defer settings up todo-comments ([5e84162](https://github.com/folke/todo-comments.nvim/commit/5e8416265a23c8b8b4711be73b465e6f6566f49b)) * defer setup to BufReadPre ++once ([455f49e](https://github.com/folke/todo-comments.nvim/commit/455f49e6e263fdd2fe1bfff2b1eb7c7457fbf68f)) * redraw was always doing the whole file! Fixes [#155](https://github.com/folke/todo-comments.nvim/issues/155) ([bca0e00](https://github.com/folke/todo-comments.nvim/commit/bca0e00644c22a3eecedce703c0db080dd6bdc55)) * throttle todo redraw calls. Fixes [#154](https://github.com/folke/todo-comments.nvim/issues/154) ([a9df434](https://github.com/folke/todo-comments.nvim/commit/a9df4342a564e9d95340f60a38a523fda27cdb2e)) folke-todo-comments.nvim-ae0a2af/LICENSE000066400000000000000000000261351467200153200201250ustar00rootroot00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. folke-todo-comments.nvim-ae0a2af/README.md000066400000000000000000000154001467200153200203700ustar00rootroot00000000000000# ✅ Todo Comments **todo-comments** is a lua plugin for Neovim >= 0.8.0 to highlight and search for todo comments like `TODO`, `HACK`, `BUG` in your code base. ![image](https://user-images.githubusercontent.com/292349/118135272-ad21e980-b3b7-11eb-881c-e45a4a3d6192.png) ## ✨ Features - **highlight** your todo comments in different styles - optionally only highlights todos in comments using **TreeSitter** - configurable **signs** - open todos in a **quickfix** list - open todos in [Trouble](https://github.com/folke/trouble.nvim) - search todos with [Telescope](https://github.com/nvim-telescope/telescope.nvim) & [FzfLua](https://github.com/ibhagwan/fzf-lua) ## ⚡️ Requirements - Neovim >= 0.8.0 (use the `neovim-pre-0.8.0` branch for older versions) - a [patched font](https://www.nerdfonts.com/) for the icons, or change them to simple ASCII characters - optional: + [ripgrep](https://github.com/BurntSushi/ripgrep) and [plenary.nvim](https://github.com/nvim-lua/plenary.nvim) are used for searching. + [Trouble](https://github.com/folke/trouble.nvim) + [Telescope](https://github.com/nvim-telescope/telescope.nvim) + [FzfLua](https://github.com/ibhagwan/fzf-lua) ## 📦 Installation Install the plugin with your preferred package manager: ### [lazy.nvim](https://github.com/folke/lazy.nvim) ```lua { "folke/todo-comments.nvim", dependencies = { "nvim-lua/plenary.nvim" }, opts = { -- your configuration comes here -- or leave it empty to use the default settings -- refer to the configuration section below } } ``` ## ⚙️ Configuration Todo comes with the following defaults: ```lua { signs = true, -- show icons in the signs column sign_priority = 8, -- sign priority -- keywords recognized as todo comments keywords = { FIX = { icon = " ", -- icon used for the sign, and in search results color = "error", -- can be a hex color, or a named color (see below) alt = { "FIXME", "BUG", "FIXIT", "ISSUE" }, -- a set of other keywords that all map to this FIX keywords -- signs = false, -- configure signs for some keywords individually }, TODO = { icon = " ", color = "info" }, HACK = { icon = " ", color = "warning" }, WARN = { icon = " ", color = "warning", alt = { "WARNING", "XXX" } }, PERF = { icon = " ", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } }, NOTE = { icon = " ", color = "hint", alt = { "INFO" } }, TEST = { icon = "⏲ ", color = "test", alt = { "TESTING", "PASSED", "FAILED" } }, }, gui_style = { fg = "NONE", -- The gui style to use for the fg highlight group. bg = "BOLD", -- The gui style to use for the bg highlight group. }, merge_keywords = true, -- when true, custom keywords will be merged with the defaults -- highlighting of the line containing the todo comment -- * before: highlights before the keyword (typically comment characters) -- * keyword: highlights of the keyword -- * after: highlights after the keyword (todo text) highlight = { multiline = true, -- enable multine todo comments multiline_pattern = "^.", -- lua pattern to match the next multiline from the start of the matched keyword multiline_context = 10, -- extra lines that will be re-evaluated when changing a line before = "", -- "fg" or "bg" or empty keyword = "wide", -- "fg", "bg", "wide", "wide_bg", "wide_fg" or empty. (wide and wide_bg is the same as bg, but will also highlight surrounding characters, wide_fg acts accordingly but with fg) after = "fg", -- "fg" or "bg" or empty pattern = [[.*<(KEYWORDS)\s*:]], -- pattern or table of patterns, used for highlighting (vim regex) comments_only = true, -- uses treesitter to match keywords in comments only max_line_len = 400, -- ignore lines longer than this exclude = {}, -- list of file types to exclude highlighting }, -- list of named colors where we try to extract the guifg from the -- list of highlight groups or use the hex color if hl not found as a fallback colors = { error = { "DiagnosticError", "ErrorMsg", "#DC2626" }, warning = { "DiagnosticWarn", "WarningMsg", "#FBBF24" }, info = { "DiagnosticInfo", "#2563EB" }, hint = { "DiagnosticHint", "#10B981" }, default = { "Identifier", "#7C3AED" }, test = { "Identifier", "#FF00FF" } }, search = { command = "rg", args = { "--color=never", "--no-heading", "--with-filename", "--line-number", "--column", }, -- regex that will be used to match keywords. -- don't replace the (KEYWORDS) placeholder pattern = [[\b(KEYWORDS):]], -- ripgrep regex -- pattern = [[\b(KEYWORDS)\b]], -- match without the extra colon. You'll likely get false positives }, } ``` ### Jumping Two methods are available to jump to the next/previous todo comment. ```lua vim.keymap.set("n", "]t", function() require("todo-comments").jump_next() end, { desc = "Next todo comment" }) vim.keymap.set("n", "[t", function() require("todo-comments").jump_prev() end, { desc = "Previous todo comment" }) -- You can also specify a list of valid jump keywords vim.keymap.set("n", "]t", function() require("todo-comments").jump_next({keywords = { "ERROR", "WARNING" }}) end, { desc = "Next error/warning todo comment" }) ``` ## 🚀 Usage **Todo** matches on any text that starts with one of your defined keywords (or alt) followed by a colon: - TODO: do something - FIX: this should be fixed - HACK: weird code warning Todos are highlighted in all regular files. Each of the commands below accept the following arguments: - `cwd` - Specify the directory to search for comments, like: ```vim :TodoTelescope cwd=~/projects/foobar ``` - `keywords` - Comma separated list of keywords to filter results by. Keywords are case-sensitive. ```vim :TodoTelescope keywords=TODO,FIX ``` ### 🔎 `:TodoQuickFix` This uses the quickfix list to show all todos in your project. ![image](https://user-images.githubusercontent.com/292349/118135332-bf9c2300-b3b7-11eb-9a40-1307feb27c44.png) ### 🔎 `:TodoLocList` This uses the location list to show all todos in your project. ![image](https://user-images.githubusercontent.com/292349/118135332-bf9c2300-b3b7-11eb-9a40-1307feb27c44.png) ### 🚦 `:Trouble todo` List all project todos in [trouble](https://github.com/folke/trouble.nvim) Use Trouble's filtering: `Trouble todo filter = {tag = {TODO,FIX,FIXME}}` > See screenshot at the top ### 🔭 `:TodoTelescope` Search through all project todos with Telescope ![image](https://user-images.githubusercontent.com/292349/118135371-ccb91200-b3b7-11eb-9002-66af3b683cf0.png) > [!Note] > The same can be done with `:TodoFzfLua` folke-todo-comments.nvim-ae0a2af/doc/000077500000000000000000000000001467200153200176565ustar00rootroot00000000000000folke-todo-comments.nvim-ae0a2af/doc/todo-comments.nvim.txt000066400000000000000000000204341467200153200241620ustar00rootroot00000000000000*todo-comments.nvim.txt* For Neovim Last change: 2024 September 16 ============================================================================== Table of Contents *todo-comments.nvim-table-of-contents* 1. Todo Comments |todo-comments.nvim-todo-comments| - Features |todo-comments.nvim-todo-comments-features| - Requirements |todo-comments.nvim-todo-comments-requirements| - Installation |todo-comments.nvim-todo-comments-installation| - Configuration |todo-comments.nvim-todo-comments-configuration| - Usage |todo-comments.nvim-todo-comments-usage| 2. Links |todo-comments.nvim-links| ============================================================================== 1. Todo Comments *todo-comments.nvim-todo-comments* **todo-comments** is a lua plugin for Neovim >= 0.8.0 to highlight and search for todo comments like `TODO`, `HACK`, `BUG` in your code base. FEATURES *todo-comments.nvim-todo-comments-features* - **highlight** your todo comments in different styles - optionally only highlights todos in comments using **TreeSitter** - configurable **signs** - open todos in a **quickfix** list - open todos in Trouble - search todos with Telescope & FzfLua REQUIREMENTS *todo-comments.nvim-todo-comments-requirements* - Neovim >= 0.8.0 (use the `neovim-pre-0.8.0` branch for older versions) - a patched font for the icons, or change them to simple ASCII characters - optional: - ripgrep and plenary.nvim are used for searching. - Trouble - Telescope - FzfLua INSTALLATION *todo-comments.nvim-todo-comments-installation* Install the plugin with your preferred package manager: LAZY.NVIM ~ >lua { "folke/todo-comments.nvim", dependencies = { "nvim-lua/plenary.nvim" }, opts = { -- your configuration comes here -- or leave it empty to use the default settings -- refer to the configuration section below } } < CONFIGURATION *todo-comments.nvim-todo-comments-configuration* Todo comes with the following defaults: >lua { signs = true, -- show icons in the signs column sign_priority = 8, -- sign priority -- keywords recognized as todo comments keywords = { FIX = { icon = " ", -- icon used for the sign, and in search results color = "error", -- can be a hex color, or a named color (see below) alt = { "FIXME", "BUG", "FIXIT", "ISSUE" }, -- a set of other keywords that all map to this FIX keywords -- signs = false, -- configure signs for some keywords individually }, TODO = { icon = " ", color = "info" }, HACK = { icon = " ", color = "warning" }, WARN = { icon = " ", color = "warning", alt = { "WARNING", "XXX" } }, PERF = { icon = " ", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } }, NOTE = { icon = " ", color = "hint", alt = { "INFO" } }, TEST = { icon = "⏲ ", color = "test", alt = { "TESTING", "PASSED", "FAILED" } }, }, gui_style = { fg = "NONE", -- The gui style to use for the fg highlight group. bg = "BOLD", -- The gui style to use for the bg highlight group. }, merge_keywords = true, -- when true, custom keywords will be merged with the defaults -- highlighting of the line containing the todo comment -- * before: highlights before the keyword (typically comment characters) -- * keyword: highlights of the keyword -- * after: highlights after the keyword (todo text) highlight = { multiline = true, -- enable multine todo comments multiline_pattern = "^.", -- lua pattern to match the next multiline from the start of the matched keyword multiline_context = 10, -- extra lines that will be re-evaluated when changing a line before = "", -- "fg" or "bg" or empty keyword = "wide", -- "fg", "bg", "wide", "wide_bg", "wide_fg" or empty. (wide and wide_bg is the same as bg, but will also highlight surrounding characters, wide_fg acts accordingly but with fg) after = "fg", -- "fg" or "bg" or empty pattern = [[.*<(KEYWORDS)\s*:]], -- pattern or table of patterns, used for highlighting (vim regex) comments_only = true, -- uses treesitter to match keywords in comments only max_line_len = 400, -- ignore lines longer than this exclude = {}, -- list of file types to exclude highlighting }, -- list of named colors where we try to extract the guifg from the -- list of highlight groups or use the hex color if hl not found as a fallback colors = { error = { "DiagnosticError", "ErrorMsg", "#DC2626" }, warning = { "DiagnosticWarn", "WarningMsg", "#FBBF24" }, info = { "DiagnosticInfo", "#2563EB" }, hint = { "DiagnosticHint", "#10B981" }, default = { "Identifier", "#7C3AED" }, test = { "Identifier", "#FF00FF" } }, search = { command = "rg", args = { "--color=never", "--no-heading", "--with-filename", "--line-number", "--column", }, -- regex that will be used to match keywords. -- don't replace the (KEYWORDS) placeholder pattern = [[\b(KEYWORDS):]], -- ripgrep regex -- pattern = [[\b(KEYWORDS)\b]], -- match without the extra colon. You'll likely get false positives }, } < JUMPING ~ Two methods are available to jump to the next/previous todo comment. >lua vim.keymap.set("n", "]t", function() require("todo-comments").jump_next() end, { desc = "Next todo comment" }) vim.keymap.set("n", "[t", function() require("todo-comments").jump_prev() end, { desc = "Previous todo comment" }) -- You can also specify a list of valid jump keywords vim.keymap.set("n", "]t", function() require("todo-comments").jump_next({keywords = { "ERROR", "WARNING" }}) end, { desc = "Next error/warning todo comment" }) < USAGE *todo-comments.nvim-todo-comments-usage* **Todo** matches on any text that starts with one of your defined keywords (or alt) followed by a colon: - TODO: do something - FIX: this should be fixed - HACK: weird code warning Todos are highlighted in all regular files. Each of the commands below accept the following arguments: - `cwd` - Specify the directory to search for comments, like: >vim :TodoTelescope cwd=~/projects/foobar < - `keywords` - Comma separated list of keywords to filter results by. Keywords are case-sensitive. >vim :TodoTelescope keywords=TODO,FIX < :TODOQUICKFIX ~ This uses the quickfix list to show all todos in your project. :TODOLOCLIST ~ This uses the location list to show all todos in your project. :TROUBLE TODO ~ List all project todos in trouble Use Trouble’s filtering: `Trouble todo filter = {tag = {TODO,FIX,FIXME}}` See screenshot at the top :TODOTELESCOPE ~ Search through all project todos with Telescope [!Note] The same can be done with `:TodoFzfLua` ============================================================================== 2. Links *todo-comments.nvim-links* 1. *image*: https://user-images.githubusercontent.com/292349/118135272-ad21e980-b3b7-11eb-881c-e45a4a3d6192.png 2. *image*: https://user-images.githubusercontent.com/292349/118135332-bf9c2300-b3b7-11eb-9a40-1307feb27c44.png 3. *image*: https://user-images.githubusercontent.com/292349/118135332-bf9c2300-b3b7-11eb-9a40-1307feb27c44.png 4. *image*: https://user-images.githubusercontent.com/292349/118135371-ccb91200-b3b7-11eb-9002-66af3b683cf0.png Generated by panvimdoc vim:tw=78:ts=8:noet:ft=help:norl: folke-todo-comments.nvim-ae0a2af/lua/000077500000000000000000000000001467200153200176725ustar00rootroot00000000000000folke-todo-comments.nvim-ae0a2af/lua/telescope/000077500000000000000000000000001467200153200216555ustar00rootroot00000000000000folke-todo-comments.nvim-ae0a2af/lua/telescope/_extensions/000077500000000000000000000000001467200153200242135ustar00rootroot00000000000000folke-todo-comments.nvim-ae0a2af/lua/telescope/_extensions/todo-comments.lua000066400000000000000000000042221467200153200275060ustar00rootroot00000000000000local has_telescope, telescope = pcall(require, "telescope") if not has_telescope then error("This plugins requires nvim-telescope/telescope.nvim") end local Config = require("todo-comments.config") local Highlight = require("todo-comments.highlight") local make_entry = require("telescope.make_entry") local pickers = require("telescope.builtin") local function keywords_filter(opts_keywords) assert(not opts_keywords or type(opts_keywords) == "string", "'keywords' must be a comma separated string or nil") local all_keywords = vim.tbl_keys(Config.keywords) if not opts_keywords then return all_keywords end local filters = vim.split(opts_keywords, ",") return vim.tbl_filter(function(kw) return vim.tbl_contains(filters, kw) end, all_keywords) end local function todo(opts) opts = opts or {} opts.vimgrep_arguments = { Config.options.search.command } vim.list_extend(opts.vimgrep_arguments, Config.options.search.args) opts.search = Config.search_regex(keywords_filter(opts.keywords)) opts.prompt_title = "Find Todo" opts.use_regex = true local entry_maker = make_entry.gen_from_vimgrep(opts) opts.entry_maker = function(line) local ret = entry_maker(line) ret.display = function(entry) local display = string.format("%s:%s:%s ", entry.filename, entry.lnum, entry.col) local text = entry.text local start, finish, kw = Highlight.match(text) local hl = {} if start then kw = Config.keywords[kw] or kw local icon = Config.options.keywords[kw].icon or " " display = icon .. " " .. display table.insert(hl, { { 0, #icon + 1 }, "TodoFg" .. kw }) text = vim.trim(text:sub(start)) table.insert(hl, { { #display, #display + finish - start + 2 }, "TodoBg" .. kw, }) table.insert(hl, { { #display + finish - start + 1, #display + finish + 1 + #text }, "TodoFg" .. kw, }) display = display .. " " .. text end return display, hl end return ret end pickers.grep_string(opts) end return telescope.register_extension({ exports = { ["todo-comments"] = todo, todo = todo } }) folke-todo-comments.nvim-ae0a2af/lua/todo-comments/000077500000000000000000000000001467200153200224625ustar00rootroot00000000000000folke-todo-comments.nvim-ae0a2af/lua/todo-comments/config.lua000066400000000000000000000153751467200153200244450ustar00rootroot00000000000000local Util = require("todo-comments.util") --- @class TodoConfig local M = {} M.keywords = {} --- @type TodoOptions M.options = {} M.loaded = false M.ns = vim.api.nvim_create_namespace("todo-comments") --- @class TodoOptions -- TODO: add support for markdown todos local defaults = { signs = true, -- show icons in the signs column sign_priority = 8, -- sign priority -- keywords recognized as todo comments keywords = { FIX = { icon = " ", -- icon used for the sign, and in search results color = "error", -- can be a hex color, or a named color (see below) alt = { "FIXME", "BUG", "FIXIT", "ISSUE" }, -- a set of other keywords that all map to this FIX keywords -- signs = false, -- configure signs for some keywords individually }, TODO = { icon = " ", color = "info" }, HACK = { icon = " ", color = "warning" }, WARN = { icon = " ", color = "warning", alt = { "WARNING", "XXX" } }, PERF = { icon = " ", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } }, NOTE = { icon = " ", color = "hint", alt = { "INFO" } }, TEST = { icon = "⏲ ", color = "test", alt = { "TESTING", "PASSED", "FAILED" } }, }, gui_style = { fg = "NONE", -- The gui style to use for the fg highlight group. bg = "BOLD", -- The gui style to use for the bg highlight group. }, merge_keywords = true, -- when true, custom keywords will be merged with the defaults -- highlighting of the line containing the todo comment -- * before: highlights before the keyword (typically comment characters) -- * keyword: highlights of the keyword -- * after: highlights after the keyword (todo text) highlight = { multiline = true, -- enable multine todo comments multiline_pattern = "^.", -- lua pattern to match the next multiline from the start of the matched keyword multiline_context = 10, -- extra lines that will be re-evaluated when changing a line before = "", -- "fg" or "bg" or empty keyword = "wide", -- "fg", "bg", "wide" or empty. (wide is the same as bg, but will also highlight surrounding characters) after = "fg", -- "fg" or "bg" or empty -- pattern can be a string, or a table of regexes that will be checked pattern = [[.*<(KEYWORDS)\s*:]], -- pattern or table of patterns, used for highlightng (vim regex) -- pattern = { [[.*<(KEYWORDS)\s*:]], [[.*\@(KEYWORDS)\s*]] }, -- pattern used for highlightng (vim regex) comments_only = true, -- uses treesitter to match keywords in comments only max_line_len = 400, -- ignore lines longer than this exclude = {}, -- list of file types to exclude highlighting throttle = 200, }, -- list of named colors where we try to extract the guifg from the -- list of hilight groups or use the hex color if hl not found as a fallback colors = { error = { "DiagnosticError", "ErrorMsg", "#DC2626" }, warning = { "DiagnosticWarn", "WarningMsg", "#FBBF24" }, info = { "DiagnosticInfo", "#2563EB" }, hint = { "DiagnosticHint", "#10B981" }, default = { "Identifier", "#7C3AED" }, test = { "Identifier", "#FF00FF" }, }, search = { command = "rg", args = { "--color=never", "--no-heading", "--with-filename", "--line-number", "--column", }, -- regex that will be used to match keywords. -- don't replace the (KEYWORDS) placeholder pattern = [[\b(KEYWORDS):]], -- ripgrep regex -- pattern = [[\b(KEYWORDS)\b]], -- match without the extra colon. You'll likely get false positives }, } M._options = nil function M.setup(options) if vim.fn.has("nvim-0.8.0") == 0 then error("todo-comments needs Neovim >= 0.8.0. Use the 'neovim-pre-0.8.0' branch for older versions") end M._options = options if vim.api.nvim_get_vvar("vim_did_enter") == 0 then vim.defer_fn(function() M._setup() end, 0) else M._setup() end end function M._setup() M.options = vim.tbl_deep_extend("force", {}, defaults, M.options or {}, M._options or {}) -- -- keywords should always be fully overriden if M._options and M._options.keywords and M._options.merge_keywords == false then M.options.keywords = M._options.keywords end for kw, opts in pairs(M.options.keywords) do M.keywords[kw] = kw for _, alt in pairs(opts.alt or {}) do M.keywords[alt] = kw end end local function tags(keywords) local kws = keywords or vim.tbl_keys(M.keywords) table.sort(kws, function(a, b) return #b < #a end) return table.concat(kws, "|") end function M.search_regex(keywords) return M.options.search.pattern:gsub("KEYWORDS", tags(keywords)) end M.hl_regex = {} local patterns = M.options.highlight.pattern patterns = type(patterns) == "table" and patterns or { patterns } for _, p in pairs(patterns) do p = p:gsub("KEYWORDS", tags()) table.insert(M.hl_regex, p) end M.colors() M.signs() require("todo-comments.highlight").start() M.loaded = true end function M.signs() for kw, opts in pairs(M.options.keywords) do vim.fn.sign_define("todo-sign-" .. kw, { text = opts.icon, texthl = "TodoSign" .. kw, }) end end function M.colors() local normal = Util.get_hl("Normal") local normal_fg = normal.foreground local normal_bg = normal.background local default_dark = "#000000" local default_light = "#FFFFFF" if not normal_fg and not normal_bg then normal_fg = default_light normal_bg = default_dark elseif not normal_fg then normal_fg = Util.maximize_contrast(normal_bg, default_dark, default_light) elseif not normal_bg then normal_bg = Util.maximize_contrast(normal_fg, default_dark, default_light) end local fg_gui = M.options.gui_style.fg local bg_gui = M.options.gui_style.bg local sign_hl = Util.get_hl("SignColumn") local sign_bg = (sign_hl and sign_hl.background) and sign_hl.background or "NONE" for kw, opts in pairs(M.options.keywords) do local kw_color = opts.color or "default" local hex if kw_color:sub(1, 1) == "#" then hex = kw_color else local colors = M.options.colors[kw_color] colors = type(colors) == "string" and { colors } or colors for _, color in pairs(colors) do if color:sub(1, 1) == "#" then hex = color break end local c = Util.get_hl(color) if c and c.foreground then hex = c.foreground break end end end if not hex then error("Todo: no color for " .. kw) end local fg = Util.maximize_contrast(hex, normal_fg, normal_bg) vim.cmd("hi def TodoBg" .. kw .. " guibg=" .. hex .. " guifg=" .. fg .. " gui=" .. bg_gui) vim.cmd("hi def TodoFg" .. kw .. " guibg=NONE guifg=" .. hex .. " gui=" .. fg_gui) vim.cmd("hi def TodoSign" .. kw .. " guibg=" .. sign_bg .. " guifg=" .. hex .. " gui=NONE") end end return M folke-todo-comments.nvim-ae0a2af/lua/todo-comments/fzf.lua000066400000000000000000000013071467200153200237530ustar00rootroot00000000000000local Config = require("todo-comments.config") local Grep = require("fzf-lua.providers.grep") local M = {} ---@param filter? string|string[] local function keywords_filter(filter) local all = vim.tbl_keys(Config.keywords) if not filter then return all end local filters = type(filter) == "string" and { filter } or filter return vim.tbl_filter(function(kw) return vim.tbl_contains(filters, kw) end, all) end ---@param opts? {keywords: string[]} function M.todo(opts) opts = vim.tbl_extend("force", { no_esc = true, multiline = true, }, opts or {}) opts.no_esc = true opts.search = Config.search_regex(keywords_filter(opts.keywords)) return Grep.grep(opts) end return M folke-todo-comments.nvim-ae0a2af/lua/todo-comments/highlight.lua000066400000000000000000000244021467200153200251360ustar00rootroot00000000000000-- FIX: dddddd -- TODO: foobar -- dddddd local Config = require("todo-comments.config") local M = {} M.enabled = false M.bufs = {} M.wins = {} -- PERF: fully optimised -- FIX: ddddddasdasdasdasdasda -- PERF: dddd -- ddddd -- dddddd -- ddddddd -- FIXME: dddddd -- FIX: ddd -- HACK: hmmm, this looks a bit funky -- TODO: What else? -- NOTE: adding a note -- -- FIX: this needs fixing -- WARNING: ??? -- FIX: ddddd -- continuation -- @TODO foobar -- @hack foobar ---@alias TodoDirty table ---@type table M.state = {} function M.match(str, patterns) local max_line_len = Config.options.highlight.max_line_len if max_line_len and #str > max_line_len then return end patterns = patterns or Config.hl_regex if not type(patterns) == "table" then patterns = { patterns } end for _, pattern in pairs(patterns) do local m = vim.fn.matchlist(str, [[\v\C]] .. pattern) if #m > 1 and m[2] then local match = m[2] local kw = m[3] ~= "" and m[3] or m[2] local start = str:find(match, 1, true) return start, start + #match, kw end end end -- This method returns nil if this buf doesn't have a treesitter parser --- @return boolean? true or false otherwise function M.is_comment(buf, row, col) if vim.treesitter.highlighter.active[buf] then local captures = vim.treesitter.get_captures_at_pos(buf, row, col) for _, c in ipairs(captures) do if c.capture == "comment" then return true end end else local win = vim.fn.bufwinid(buf) return win ~= -1 and vim.api.nvim_win_call(win, function() for _, i1 in ipairs(vim.fn.synstack(row + 1, col)) do local i2 = vim.fn.synIDtrans(i1) local n1 = vim.fn.synIDattr(i1, "name") local n2 = vim.fn.synIDattr(i2, "name") if n1 == "Comment" or n2 == "Comment" then return true end end end) end end local function add_highlight(buffer, ns, hl, line, from, to) -- vim.api.nvim_buf_set_extmark(buffer, ns, line, from, { -- end_line = line, -- end_col = to, -- hl_group = hl, -- priority = 500, -- }) vim.api.nvim_buf_add_highlight(buffer, ns, hl, line, from, to) end function M.get_state(buf) if not M.state[buf] then M.state[buf] = { dirty = {}, comments = {} } end return M.state[buf] end function M.redraw(buf, first, last) first = math.max(first - Config.options.highlight.multiline_context, 0) last = math.min(last + Config.options.highlight.multiline_context, vim.api.nvim_buf_line_count(buf)) local state = M.get_state(buf) for i = first, last do state.dirty[i] = true end if not M.timer then M.timer = vim.defer_fn(M.update, Config.options.highlight.throttle) end end ---@type vim.loop.Timer M.timer = nil function M.update() M.timer = nil for buf, state in pairs(M.state) do if vim.api.nvim_buf_is_valid(buf) then if not vim.tbl_isempty(state.dirty) then local dirty = vim.tbl_keys(state.dirty) table.sort(dirty) local i = 1 while i <= #dirty do local first = dirty[i] local last = dirty[i] while dirty[i + 1] == dirty[i] + 1 do i = i + 1 last = dirty[i] end M.highlight(buf, first, last) i = i + 1 end state.dirty = {} end else M.state[buf] = nil end end end -- highlights the range for the given buf function M.highlight(buf, first, last, _event) if not vim.api.nvim_buf_is_valid(buf) then return end vim.api.nvim_buf_clear_namespace(buf, Config.ns, first, last + 1) -- clear signs for _, sign in pairs(vim.fn.sign_getplaced(buf, { group = "todo-signs" })[1].signs) do if sign.lnum - 1 >= first and sign.lnum - 1 <= last then vim.fn.sign_unplace("todo-signs", { buffer = buf, id = sign.id }) end end local lines = vim.api.nvim_buf_get_lines(buf, first, last + 1, false) ---@type {kw: string, start:integer}? local last_match for l, line in ipairs(lines) do local ok, start, finish, kw = pcall(M.match, line) local lnum = first + l - 1 if ok and start then ---@cast kw string if Config.options.highlight.comments_only and not M.is_quickfix(buf) and not M.is_comment(buf, lnum, start - 1) then kw = nil else last_match = { kw = kw, start = start } end end local is_multiline = false if not kw and last_match and Config.options.highlight.multiline then if M.is_comment(buf, lnum, last_match.start) and line:find(Config.options.highlight.multiline_pattern, last_match.start) then kw = last_match.kw start = last_match.start finish = start is_multiline = true else last_match = nil end end if kw then kw = Config.keywords[kw] or kw end local opts = Config.options.keywords[kw] if opts then start = start - 1 finish = finish - 1 local hl_fg = "TodoFg" .. kw local hl_bg = "TodoBg" .. kw local hl = Config.options.highlight if not is_multiline then -- before highlights if hl.before == "fg" then add_highlight(buf, Config.ns, hl_fg, lnum, 0, start) elseif hl.before == "bg" then add_highlight(buf, Config.ns, hl_bg, lnum, 0, start) end -- tag highlights if hl.keyword == "wide" or hl.keyword == "wide_bg" then add_highlight(buf, Config.ns, hl_bg, lnum, math.max(start - 1, 0), finish + 1) elseif hl.keyword == "wide_fg" then add_highlight(buf, Config.ns, hl_fg, lnum, math.max(start - 1, 0), finish + 1) elseif hl.keyword == "bg" then add_highlight(buf, Config.ns, hl_bg, lnum, start, finish) elseif hl.keyword == "fg" then add_highlight(buf, Config.ns, hl_fg, lnum, start, finish) end end -- after highlights if hl.after == "fg" then add_highlight(buf, Config.ns, hl_fg, lnum, finish, #line) elseif hl.after == "bg" then add_highlight(buf, Config.ns, hl_bg, lnum, finish, #line) end if not is_multiline then -- signs local show_sign = Config.options.signs if opts.signs ~= nil then show_sign = opts.signs end if show_sign then vim.fn.sign_place( 0, "todo-signs", "todo-sign-" .. kw, buf, { lnum = lnum + 1, priority = Config.options.sign_priority } ) end end end end end -- highlights the visible range of the window function M.highlight_win(win, force) win = win or vim.api.nvim_get_current_win() if force ~= true and not M.is_valid_win(win) then return end vim.api.nvim_win_call(win, function() local buf = vim.api.nvim_win_get_buf(win) local first = vim.fn.line("w0") - 1 local last = vim.fn.line("w$") M.redraw(buf, first, last) end) end function M.is_float(win) local opts = vim.api.nvim_win_get_config(win) return opts and opts.relative and opts.relative ~= "" end function M.is_valid_win(win) if not vim.api.nvim_win_is_valid(win) then return false end -- avoid E5108 after pressing q: if vim.fn.getcmdwintype() ~= "" then return false end -- dont do anything for floating windows if M.is_float(win) then return false end local buf = vim.api.nvim_win_get_buf(win) return M.is_valid_buf(buf) end function M.is_quickfix(buf) return vim.api.nvim_buf_get_option(buf, "buftype") == "quickfix" end function M.is_valid_buf(buf) -- Skip special buffers local buftype = vim.api.nvim_buf_get_option(buf, "buftype") if buftype ~= "" and buftype ~= "quickfix" then return false end local filetype = vim.api.nvim_buf_get_option(buf, "filetype") if vim.tbl_contains(Config.options.highlight.exclude, filetype) then return false end return true end -- will attach to the buf in the window and highlight the active buf if needed function M.attach(win) win = win or vim.api.nvim_get_current_win() if not M.is_valid_win(win) then return end local buf = vim.api.nvim_win_get_buf(win) if not M.bufs[buf] then vim.api.nvim_buf_attach(buf, false, { on_lines = function(_event, _buf, _tick, first, _last, last_new) if not M.enabled then return true end -- detach from this buffer in case we no longer want it if not M.is_valid_buf(buf) then return true end M.redraw(buf, first, last_new) end, on_detach = function() M.state[buf] = nil M.bufs[buf] = nil end, }) local highlighter = require("vim.treesitter.highlighter") local hl = highlighter.active[buf] if hl then -- also listen to TS changes so we can properly update the buffer based on is_comment hl.tree:register_cbs({ on_bytes = function(_, _, row) M.redraw(buf, row, row + 1) end, on_changedtree = function(changes) for _, ch in ipairs(changes or {}) do M.redraw(buf, ch[1], ch[3] + 1) end end, }) end M.bufs[buf] = true M.highlight_win(win) M.wins[win] = true elseif not M.wins[win] then M.highlight_win(win) M.wins[win] = true end end function M.stop() M.enabled = false pcall(vim.cmd, "autocmd! Todo") pcall(vim.cmd, "augroup! Todo") M.wins = {} ---@diagnostic disable-next-line: missing-parameter vim.fn.sign_unplace("todo-signs") for buf, _ in pairs(M.bufs) do if vim.api.nvim_buf_is_valid(buf) then pcall(vim.api.nvim_buf_clear_namespace, buf, Config.ns, 0, -1) end end M.bufs = {} end function M.start() if M.enabled then M.stop() end M.enabled = true -- setup autocmds -- TODO: make some of the below configurable vim.api.nvim_exec( [[augroup Todo autocmd! autocmd BufWinEnter,WinNew * lua require("todo-comments.highlight").attach() autocmd WinScrolled * lua require("todo-comments.highlight").highlight_win() autocmd ColorScheme * lua vim.defer_fn(require("todo-comments.config").colors, 10) augroup end]], false ) -- attach to all bufs in visible windows for _, win in pairs(vim.api.nvim_list_wins()) do M.attach(win) end end return M folke-todo-comments.nvim-ae0a2af/lua/todo-comments/init.lua000066400000000000000000000006641467200153200241360ustar00rootroot00000000000000local config = require("todo-comments.config") local jump = require("todo-comments.jump") local M = {} M.setup = config.setup function M.reset() require("plenary.reload").reload_module("todo") require("todo-comments").setup() end function M.disable() require("todo-comments.highlight").stop() end function M.enable() require("todo-comments.highlight").start() end M.jump_prev = jump.prev M.jump_next = jump.next return M folke-todo-comments.nvim-ae0a2af/lua/todo-comments/jump.lua000066400000000000000000000023171467200153200241430ustar00rootroot00000000000000local config = require("todo-comments.config") local highlight = require("todo-comments.highlight") local util = require("todo-comments.util") local M = {} ---@param up boolean local function jump(up, opts) opts = opts or {} opts.keywords = opts.keywords or {} local win = vim.api.nvim_get_current_win() local buf = vim.api.nvim_get_current_buf() local pos = vim.api.nvim_win_get_cursor(win) local from = pos[1] + 1 local to = vim.api.nvim_buf_line_count(buf) if up then from = pos[1] - 1 to = 1 end for l = from, to, up and -1 or 1 do local line = vim.api.nvim_buf_get_lines(buf, l - 1, l, false)[1] or "" local ok, start, _, kw = pcall(highlight.match, line) if ok and start then if config.options.highlight.comments_only and highlight.is_comment(buf, l - 1, start) == false then kw = nil end end if kw and #opts.keywords > 0 and not vim.tbl_contains(opts.keywords, kw) then kw = nil end if kw then vim.api.nvim_win_set_cursor(win, { l, start - 1 }) return end end util.warn("No more todo comments to jump to") end function M.next(opts) jump(false, opts) end function M.prev(opts) jump(true, opts) end return M folke-todo-comments.nvim-ae0a2af/lua/todo-comments/search.lua000066400000000000000000000065641467200153200244450ustar00rootroot00000000000000local Config = require("todo-comments.config") local Highlight = require("todo-comments.highlight") local Util = require("todo-comments.util") local M = {} local function keywords_filter(opts_keywords) assert(not opts_keywords or type(opts_keywords) == "string", "'keywords' must be a comma separated string or nil") local all_keywords = vim.tbl_keys(Config.keywords) if not opts_keywords then return all_keywords end local filters = vim.split(opts_keywords, ",") return vim.tbl_filter(function(kw) return vim.tbl_contains(filters, kw) end, all_keywords) end function M.process(lines) local results = {} for _, line in pairs(lines) do local file, row, col, text = line:match("^(.+):(%d+):(%d+):(.*)$") if file then local item = { filename = file, lnum = tonumber(row), col = tonumber(col), line = text, } local start, finish, kw = Highlight.match(text) if start then kw = Config.keywords[kw] or kw item.tag = kw item.text = vim.trim(text:sub(start)) item.message = vim.trim(text:sub(finish + 1)) table.insert(results, item) end end end return results end function M.search(cb, opts) opts = opts or {} opts.cwd = opts.cwd or "." opts.cwd = vim.fn.fnamemodify(opts.cwd, ":p") opts.disable_not_found_warnings = opts.disable_not_found_warnings or false if not Config.loaded then Util.error("todo-comments isn't loaded. Did you run setup()?") return end local command = Config.options.search.command if vim.fn.executable(command) ~= 1 then Util.error(command .. " was not found on your path") return end local ok, Job = pcall(require, "plenary.job") if not ok then Util.error("search requires https://github.com/nvim-lua/plenary.nvim") return end local args = {} vim.list_extend(args, Config.options.search.args) vim.list_extend(args, { Config.search_regex(keywords_filter(opts.keywords)), opts.cwd }) Job:new({ command = command, args = args, on_exit = vim.schedule_wrap(function(j, code) if code == 2 then local error = table.concat(j:stderr_result(), "\n") Util.error(command .. " failed with code " .. code .. "\n" .. error) end if code == 1 and opts.disable_not_found_warnings ~= true then Util.warn("no todos found") end local lines = j:result() cb(M.process(lines)) end), }):start() end local function parse_opts(opts) if not opts or type(opts) ~= "string" then return opts end return { keywords = opts:match("keywords=(%S*)"), cwd = opts:match("cwd=(%S*)"), } end function M.setqflist(opts) M.setlist(opts) end function M.setloclist(opts) M.setlist(opts, true) end function M.setlist(opts, use_loclist) opts = parse_opts(opts) or {} opts.open = (opts.open ~= nil and { opts.open } or { true })[1] M.search(function(results) if use_loclist then vim.fn.setloclist(0, {}, " ", { title = "Todo", id = "$", items = results }) else vim.fn.setqflist({}, " ", { title = "Todo", id = "$", items = results }) end if opts.open then if use_loclist then vim.cmd([[lopen]]) else vim.cmd([[copen]]) end end local win = vim.fn.getqflist({ winid = true }) if win.winid ~= 0 then Highlight.highlight_win(win.winid, true) end end, opts) end return M folke-todo-comments.nvim-ae0a2af/lua/todo-comments/util.lua000066400000000000000000000025751467200153200241530ustar00rootroot00000000000000--- @class Util local M = {} function M.get_hl(name) local ok, hl = pcall(vim.api.nvim_get_hl_by_name, name, true) if not ok then return end for _, key in pairs({ "foreground", "background", "special" }) do if hl[key] then hl[key] = string.format("#%06x", hl[key]) end end return hl end local function rgb_to_linear(c) c = c / 255 return c <= 0.04045 and c / 12.92 or ((c + 0.055) / 1.055) ^ 2.4 end local function relative_luminance(color) return 0.2126 * color.r + 0.7152 * color.g + 0.0722 * color.b end function M.hex2linear_srgb(hex) hex = hex:gsub("#", "") return { r = rgb_to_linear(tonumber("0x" .. hex:sub(1, 2))), g = rgb_to_linear(tonumber("0x" .. hex:sub(3, 4))), b = rgb_to_linear(tonumber("0x" .. hex:sub(5, 6))), } end function M.contrast_ratio(c1, c2) local lum1 = relative_luminance(c1) local lum2 = relative_luminance(c2) if lum1 < lum2 then lum1, lum2 = lum2, lum1 end return (lum1 + 0.05) / (lum2 + 0.05) end function M.maximize_contrast(base, fg1, fg2) base = M.hex2linear_srgb(base) return M.contrast_ratio(base, M.hex2linear_srgb(fg1)) > M.contrast_ratio(base, M.hex2linear_srgb(fg2)) and fg1 or fg2 end function M.warn(msg) vim.notify(msg, vim.log.levels.WARN, { title = "TodoComments" }) end function M.error(msg) vim.notify(msg, vim.log.levels.ERROR, { title = "TodoComments" }) end return M folke-todo-comments.nvim-ae0a2af/lua/trouble/000077500000000000000000000000001467200153200213465ustar00rootroot00000000000000folke-todo-comments.nvim-ae0a2af/lua/trouble/providers/000077500000000000000000000000001467200153200233635ustar00rootroot00000000000000folke-todo-comments.nvim-ae0a2af/lua/trouble/providers/todo.lua000066400000000000000000000017571467200153200250450ustar00rootroot00000000000000local Config = require("todo-comments.config") local Search = require("todo-comments.search") local util = require("trouble.util") local function todo(_win, _buf, cb, opts) Search.search(function(results) local ret = {} for _, item in pairs(results) do local row = (item.lnum == 0 and 1 or item.lnum) - 1 local col = (item.col == 0 and 1 or item.col) - 1 local pitem = { row = row, col = col, message = item.text, sign = Config.options.keywords[item.tag].icon, sign_hl = "TodoFg" .. item.tag, -- code = string.lower(item.tag), -- source = "todo", severity = 0, range = { start = { line = row, character = col }, ["end"] = { line = row, character = -1 }, }, } table.insert(ret, util.process_item(pitem, vim.fn.bufnr(item.filename, true))) end if #ret == 0 then util.warn("no todos found") end cb(ret) end, opts.cmd_options) end return todo folke-todo-comments.nvim-ae0a2af/lua/trouble/sources/000077500000000000000000000000001467200153200230315ustar00rootroot00000000000000folke-todo-comments.nvim-ae0a2af/lua/trouble/sources/todo.lua000066400000000000000000000024771467200153200245130ustar00rootroot00000000000000---@diagnostic disable: inject-field local Config = require("todo-comments.config") local Item = require("trouble.item") local Search = require("todo-comments.search") ---@type trouble.Source local M = {} ---@diagnostic disable-next-line: missing-fields M.config = { formatters = { todo_icon = function(ctx) return { text = Config.options.keywords[ctx.item.tag].icon, hl = "TodoFg" .. ctx.item.tag, } end, }, modes = { todo = { events = { "BufEnter", "BufWritePost" }, source = "todo", groups = { { "tag", format = "{todo_icon} {tag}" }, -- { "directory" }, { "filename", format = "{file_icon} {filename} {count}" }, }, sort = { { buf = 0 }, "filename", "pos", "message" }, format = "{todo_icon} {text} {pos}", }, }, } function M.get(cb) Search.search(function(results) local items = {} ---@type trouble.Item[] for _, item in pairs(results) do local row = item.lnum local col = item.col - 1 items[#items + 1] = Item.new({ buf = vim.fn.bufadd(item.filename), pos = { row, col }, end_pos = { row, col + #item.tag }, text = item.text, filename = item.filename, item = item, source = "todo", }) end cb(items) end, {}) end return M folke-todo-comments.nvim-ae0a2af/plugin/000077500000000000000000000000001467200153200204075ustar00rootroot00000000000000folke-todo-comments.nvim-ae0a2af/plugin/todo.vim000066400000000000000000000005601467200153200220720ustar00rootroot00000000000000command! -nargs=* TodoQuickFix lua require("todo-comments.search").setqflist() command! -nargs=* TodoLocList lua require("todo-comments.search").setloclist() command! -nargs=* TodoTelescope Telescope todo-comments todo command! -nargs=* TodoFzfLua lua require("todo-comments.fzf").todo() command! -nargs=* TodoTrouble Trouble todo folke-todo-comments.nvim-ae0a2af/selene.toml000066400000000000000000000000471467200153200212620ustar00rootroot00000000000000std="vim" [lints] mixed_table="allow" folke-todo-comments.nvim-ae0a2af/stylua.toml000066400000000000000000000001331467200153200213240ustar00rootroot00000000000000indent_type = "Spaces" indent_width = 2 column_width = 120 [sort_requires] enabled = true folke-todo-comments.nvim-ae0a2af/vim.toml000066400000000000000000000002451467200153200206020ustar00rootroot00000000000000[selene] base = "lua51" name = "vim" [vim] any = true [jit] any = true [assert] any = true [describe] any = true [it] any = true [before_each.args] any = true