{"id":13682469,"url":"https://github.com/David-Kunz/cmp-npm","last_synced_at":"2025-04-30T09:32:43.195Z","repository":{"id":45696997,"uuid":"420689054","full_name":"David-Kunz/cmp-npm","owner":"David-Kunz","description":"An additional source for nvim-cmp to autocomplete packages and its versions","archived":false,"fork":false,"pushed_at":"2024-07-02T02:41:05.000Z","size":25,"stargazers_count":113,"open_issues_count":4,"forks_count":10,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-11-10T09:34:12.406Z","etag":null,"topics":["lua","neovim","nvim-cmp","plugin"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/David-Kunz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-10-24T13:15:02.000Z","updated_at":"2024-10-25T12:37:09.000Z","dependencies_parsed_at":"2024-01-14T15:23:26.248Z","dependency_job_id":"0ad65f66-84ab-4276-ba6a-2d7f091c6ff7","html_url":"https://github.com/David-Kunz/cmp-npm","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/David-Kunz%2Fcmp-npm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/David-Kunz%2Fcmp-npm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/David-Kunz%2Fcmp-npm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/David-Kunz%2Fcmp-npm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/David-Kunz","download_url":"https://codeload.github.com/David-Kunz/cmp-npm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224206082,"owners_count":17273385,"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":["lua","neovim","nvim-cmp","plugin"],"created_at":"2024-08-02T13:01:46.491Z","updated_at":"2024-11-12T02:30:51.536Z","avatar_url":"https://github.com/David-Kunz.png","language":"Lua","funding_links":[],"categories":["Lua"],"sub_categories":[],"readme":"# cmp-npm\n\nThis is an additional source for [nvim-cmp](https://github.com/hrsh7th/nvim-cmp), it allows you to\nautocomplete [npm](https://npmjs.com/) packages and its versions.\nThe source is only active if you're in a `package.json` file.\n\n![demo-cmp-npm](https://user-images.githubusercontent.com/1009936/138598207-4855e5b5-1a88-4b02-b43a-c67143527f82.gif)\n\n## Requirements\n\nIt needs the Neovim plugin [nvim-cmp](https://github.com/hrsh7th/nvim-cmp) and the [npm](https://npmjs.com/) command line tool.\n\n## Installation\n\nFor [vim-plug](https://github.com/junegunn/vim-plug):\n```\nPlug 'nvim-lua/plenary.nvim'\nPlug 'David-Kunz/cmp-npm'\n```\nFor [packer](https://github.com/wbthomason/packer.nvim):\n```\nuse {\n  'David-Kunz/cmp-npm',\n  requires = {\n    'nvim-lua/plenary.nvim'\n  }\n}\n```\n\nFor [lazy.nvim](https://github.com/folke/lazy.nvim):\n\n```\n{\n  \"David-Kunz/cmp-npm\",\n  dependencies = { 'nvim-lua/plenary.nvim' },\n  ft = \"json\",\n  config = function()\n    require('cmp-npm').setup({})\n  end\n}\n```\n\nRun the `setup` function and add the source\n```lua\nrequire('cmp-npm').setup({})\ncmp.setup({\n  ...,\n  sources = {\n    { name = 'npm', keyword_length = 4 },\n    ...\n  }\n})\n```\n(in Vimscript, make sure to add `lua \u003c\u003c EOF` before and `EOF` after the lua code)\n\nThe `setup` function accepts an options table which defaults to:\n\n```lua\n{\n  ignore = {},\n  only_semantic_versions = false,\n  only_latest_version = false\n}\n```\n\n- `ignore` (table): Allows you to filter out all versions which match one of its entries,\ne.g. `ignore = { 'beta', 'rc' }`.\n- `only_semantic_versions` (Boolean): If `true`, will filter out all versions which don't follow \n  the `major.minor.patch` schema.\n- `only_latest_version` (Boolean): If `true`, will only show latest release version.\n\n\n## Limitations\n\nThe versions are not correctly sorted (depends on `nvim-cmp`'s sorting algorithm).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDavid-Kunz%2Fcmp-npm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDavid-Kunz%2Fcmp-npm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDavid-Kunz%2Fcmp-npm/lists"}