{"id":24620128,"url":"https://github.com/amarz45/nvim-cmp-buffer-lines","last_synced_at":"2025-10-06T12:31:07.887Z","repository":{"id":63193347,"uuid":"548607807","full_name":"amarz45/nvim-cmp-buffer-lines","owner":"amarz45","description":"nvim-cmp completion source for buffer lines","archived":false,"fork":false,"pushed_at":"2023-10-12T13:56:16.000Z","size":1214,"stargazers_count":69,"open_issues_count":4,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-08T17:28:57.088Z","etag":null,"topics":["cmp","lua","luajit","neovim","neovim-plugin","nvim-cmp","nvim-plugin","nvim-treesitter","tree-sitter"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amarz45.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":"2022-10-09T22:43:46.000Z","updated_at":"2024-11-13T15:36:31.000Z","dependencies_parsed_at":"2024-11-25T01:30:35.218Z","dependency_job_id":null,"html_url":"https://github.com/amarz45/nvim-cmp-buffer-lines","commit_stats":null,"previous_names":["amarz45/nvim-cmp-buffer-lines","amarakon/nvim-cmp-buffer-lines"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amarz45%2Fnvim-cmp-buffer-lines","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amarz45%2Fnvim-cmp-buffer-lines/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amarz45%2Fnvim-cmp-buffer-lines/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amarz45%2Fnvim-cmp-buffer-lines/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amarz45","download_url":"https://codeload.github.com/amarz45/nvim-cmp-buffer-lines/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235524159,"owners_count":19003817,"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":["cmp","lua","luajit","neovim","neovim-plugin","nvim-cmp","nvim-plugin","nvim-treesitter","tree-sitter"],"created_at":"2025-01-25T01:03:10.323Z","updated_at":"2025-10-06T12:31:02.494Z","avatar_url":"https://github.com/amarz45.png","language":"Lua","readme":"nvim-cmp Buffer Lines\n================\n\n## Contents\n\n- \u003ca href=\"#preview\" id=\"toc-preview\"\u003ePreview\u003c/a\u003e\n- \u003ca href=\"#introduction\" id=\"toc-introduction\"\u003eIntroduction\u003c/a\u003e\n- \u003ca href=\"#installation\" id=\"toc-installation\"\u003eInstallation\u003c/a\u003e\n  - \u003ca href=\"#packernvim\" id=\"toc-packernvim\"\u003epacker.nvim\u003c/a\u003e\n- \u003ca href=\"#setup\" id=\"toc-setup\"\u003eSetup\u003c/a\u003e\n  - \u003ca href=\"#options\" id=\"toc-options\"\u003eOptions\u003c/a\u003e\n  - \u003ca href=\"#command-line\" id=\"toc-command-line\"\u003eCommand-line\u003c/a\u003e\n  - \u003ca href=\"#only-for-certain-file-types\"\n    id=\"toc-only-for-certain-file-types\"\u003eOnly for certain file types\u003c/a\u003e\n- \u003ca href=\"#todo\" id=\"toc-todo\"\u003eTODO\u003c/a\u003e\n\n## Preview\n\n![](preview.gif)\n\n## Introduction\n\nnvim-cmp Buffer Lines is a completion source for\n[nvim-cmp](https://github.com/hrsh7th/nvim-cmp) that provides a source\nfor all the lines in the current buffer. This is especially useful for\n[C programmers](#only-for-certain-file-types). It uses\n[tree-sitter](https://github.com/nvim-treesitter/nvim-treesitter) if you\nhave it installed on your system. tree-sitter is optional but\nrecommended.\n\n## Installation\n\n### [packer.nvim](https://github.com/wbthomason/packer.nvim)\n\n``` lua\nrequire \"packer\".startup(function(use)\n    use \"amarakon/nvim-cmp-buffer-lines\"\nend)\n```\n\n## Setup\n\n``` lua\nrequire \"cmp\".setup {\n    sources = {\n        {\n            name = \"buffer-lines\",\n            option = { … }\n        }\n    }\n}\n```\n\n### Options\n\n| Option               | Type    | Default | Description                                                                                                                                                                                         |\n|:---------------------|:--------|:--------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `words`              | Boolean | `false` | Include words                                                                                                                                                                                       |\n| `comments`           | Boolean | `false` | Include comments                                                                                                                                                                                    |\n| `line_numbers` | Boolean | `false`  | Include line numbers in the completion menu (does not apply on selection/confirmation)\n| `line_number_separator` | String | `\" \"`  | The separator between the line number and the line text (only used if `line_numbers` is set.\n| `leading_whitespace` | Boolean | `true`  | Include leading whitespace in the completion menu (does not apply on selection/confirmation)                                                                                                        |\n| `max_indents`        | Number  | `0`     | Maximum indentation level lines can be shown (0-indexed). For example, lines with one or more indents will not be shown when this is set to `1`. Set to `0` to show an unlimited amount of indents. |\n| `max_size`           | Number  | `100`   | Maximum file size (in kB) for which this plugin will be activated                                                                                                                                   |\n\n### Command-line\n\nYou can use this source for searching for patterns in the command-line.\nI recommend using it in conjunction with\n[cmp-buffer](https://github.com/hrsh7th/cmp-buffer) for a\nbread-and-butter combination. The following code block is the\nconfiguration I use and recommend.\n\n``` lua\n-- Enable `buffer` and `buffer-lines` for `/` and `?` in the command-line\nrequire \"cmp\".setup.cmdline({ \"/\", \"?\" }, {\n    mapping = require \"cmp\".mapping.preset.cmdline(),\n    sources = {\n        {\n            name = \"buffer\",\n            option = { keyword_pattern = [[\\k\\+]] }\n        },\n        { name = \"buffer-lines\" }\n    }\n})\n```\n\n### Only for certain file types\n\n``` lua\n-- Only enable `buffer-lines` for C and C++\nrequire \"cmp\".setup.filetype({ \"c\", \"cpp\" }, {\n    sources = {\n        { name = \"buffer-lines\" }\n    }\n})\n```\n\n## TODO\n\n- [x] Automatically update the source\n- [x] Cut comments from lines\n  - [x] Test it to prove it works in all use cases\n  - [x] Find a more efficient implementation with\n    [tree-sitter](https://github.com/nvim-treesitter/nvim-treesitter) or\n    LSP (Language Server Protocol)\n- [x] Omit duplicate lines\n- [x] Add an option to show line numbers\n- [x] Show indentation level in the completion menu, but not when\n  selecting or confirming\n- [x] Add an option to choose the maximum indentation level lines will\n  be shown\n- [ ] Make the plugin more efficient for editing large files\n- [x] Add an option to set a file size limit\n- [x] Add configuration options\n- [ ] Add syntax highlighting\n- [x] Use the current buffer instead of buffer 0\n  - [ ] Add an option to use all buffers\n","funding_links":[],"categories":["Lua"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famarz45%2Fnvim-cmp-buffer-lines","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famarz45%2Fnvim-cmp-buffer-lines","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famarz45%2Fnvim-cmp-buffer-lines/lists"}