{"id":13895437,"url":"https://github.com/Gelio/cmp-natdat","last_synced_at":"2025-07-17T11:30:53.014Z","repository":{"id":199737572,"uuid":"703631323","full_name":"Gelio/cmp-natdat","owner":"Gelio","description":"nvim-cmp source to autocomplete natural dates and turm them into ISO dates","archived":false,"fork":false,"pushed_at":"2024-12-29T14:15:37.000Z","size":94,"stargazers_count":25,"open_issues_count":3,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-12-29T15:20:56.344Z","etag":null,"topics":["nvim-cmp"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Gelio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-10-11T15:48:24.000Z","updated_at":"2024-12-29T14:15:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"e364751d-4bfc-4ba8-811d-ecbe55ba2fa8","html_url":"https://github.com/Gelio/cmp-natdat","commit_stats":null,"previous_names":["gelio/cmp-natdat"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Gelio/cmp-natdat","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gelio%2Fcmp-natdat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gelio%2Fcmp-natdat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gelio%2Fcmp-natdat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gelio%2Fcmp-natdat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Gelio","download_url":"https://codeload.github.com/Gelio/cmp-natdat/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gelio%2Fcmp-natdat/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265600513,"owners_count":23795710,"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":["nvim-cmp"],"created_at":"2024-08-06T18:02:12.964Z","updated_at":"2025-07-17T11:30:52.736Z","avatar_url":"https://github.com/Gelio.png","language":"Lua","readme":"# cmp-natdat\n\nA [nvim-cmp](https://github.com/hrsh7th/nvim-cmp) source for turning natural\ndates into ISO dates.\n\n## Demo\n\nhttps://github.com/Gelio/cmp-natdat/assets/889383/1d6d388d-2a10-4923-9156-b99764c5a342\n\n## Examples\n\n- `@now` -\u003e `2023-10-13 12:38`\n- `@tomorrow` -\u003e `2023-10-14`\n- `@last Friday 2pm` -\u003e `2023-10-06 14:00`\n- `@Oct 8 2021` -\u003e `2021-10-08`\n- `@today 14:20` -\u003e `2023-10-13 14:20`\n\n## Features\n\n- autocomplete for partially typed month names, relative dates\n- supported formats:\n  - `now`\n  - `yesterday`, `today`, `tomorrow` with optional time\n  - days of week (Monday -\u003e Sunday), with optional `last`/`next` modifier and\n    time\n  - full dates: month, day, optional year, optional time\n  - time: am/pm, or 24h format\n\n## Setup\n\n1. Install the plugin\n\n   Using [lazy.nvim](https://github.com/folke/lazy.nvim):\n\n   ```lua\n   { \"Gelio/cmp-natdat\", config = true }\n   ```\n\n   `config = true` is necessary so lazy.nvim calls\n   `require(\"cmp_natdat\").setup()` to register the source.\n\n   Using [packer.nvim](https://github.com/wbthomason/packer.nvim):\n\n   ```lua\n   use {\n       \"Gelio/cmp-natdat\",\n       config = function()\n            require(\"cmp_natdat\").setup()\n       end\n   }\n   ```\n\n2. Add the source to the list in your nvim-cmp configuration\n\n   ```lua\n   sources = {\n       { name = \"natdat\" },\n       --- other sources...\n   }\n   ```\n\n## Configuration (optional)\n\n`cmp-natdat` accepts the following optional configuration, passed as a table to\nthe `setup()` method:\n\n- `cmp_kind_text` - the text to use as the completion item's label in the\n  nvim-cmp completions popup.\n\n  Default: `Text`\n\n- `highlight_group` - the name of an existing highlight group to use for that\n  completion item's label in the nvim-cmp completions popup.\n\n  Default: `CmpItemKindText`\n\nExample:\n\n```lua\n{\n    \"Gelio/cmp-natdat\",\n    config = function()\n        require(\"cmp_natdat\").setup({\n            cmp_kind_text = \"NatDat\",\n            highlight_group = \"Red\",\n        })\n    end,\n}\n```\n\n![cmp-natdat completions in the nvim-cmp popup are labeled \"NatDat\" in red](https://github.com/Gelio/cmp-natdat/assets/889383/52730df8-e355-4f4e-842f-d4cb283fbb12)\n\nTo get the most out of the custom cmp kind text, you can also use\n[lspkind.nvim](https://github.com/onsails/lspkind.nvim) to show the calendar\nicon (📆) for cmp-natdat completions:\n\n```lua\nrequire(\"lspkind\").init({\n    symbol_map = {\n        NatDat = \"📅\",\n    },\n})\n```\n\n![cmp-natdat completions use the calendar icon](https://github.com/Gelio/cmp-natdat/assets/889383/9bf4df4c-fdfb-44d7-a60f-2a8370c94935)\n\n## WARNING: cool tech inside\n\nParsing the dates is done using [pcomb](./lua/pcomb/), a Lua parser combinator\nlibrary. Its API is inspired by Rust's [nom](https://github.com/rust-bakery/nom)\ncrate.\n\n`pcomb` can also be used in other plugins to parse other text input into a more\nstructured format. It is flexible and makes it easy to build parsers from the\nbottom-up:\n\n```lua\n---@type pcomb.Parser\u003c{ [1]: integer, [2]: pcomb.NIL | integer }\u003e\nlocal day_of_month_and_opt_year = psequence.sequence({\n    -- Day of month\n    pcharacter.integer,\n    pcombinator.opt(psequence.preceded(\n        pcharacter.multispace1,\n        -- Year\n        pcharacter.integer,\n    ))\n})\n```\n\n## Contributing\n\nSee [CONTRIBUTING.md](./CONTRIBUTING.md).\n","funding_links":[],"categories":["Lua"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGelio%2Fcmp-natdat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FGelio%2Fcmp-natdat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGelio%2Fcmp-natdat/lists"}