{"id":13409942,"url":"https://github.com/ms-jpq/coq_nvim","last_synced_at":"2025-05-13T21:12:21.508Z","repository":{"id":37084963,"uuid":"280048292","full_name":"ms-jpq/coq_nvim","owner":"ms-jpq","description":"Fast as FUCK nvim completion. SQLite, concurrent scheduler, hundreds of hours of optimization.","archived":false,"fork":false,"pushed_at":"2025-05-13T16:28:14.000Z","size":5429,"stargazers_count":3687,"open_issues_count":185,"forks_count":101,"subscribers_count":15,"default_branch":"coq","last_synced_at":"2025-05-13T17:35:01.859Z","etag":null,"topics":["completion","neovim","neovim-plugin"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ms-jpq.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,"zenodo":null}},"created_at":"2020-07-16T03:58:40.000Z","updated_at":"2025-05-13T16:28:18.000Z","dependencies_parsed_at":"2024-01-03T03:29:20.724Z","dependency_job_id":"602337fa-26b6-4835-8d80-72c772a21c5f","html_url":"https://github.com/ms-jpq/coq_nvim","commit_stats":{"total_commits":5382,"total_committers":48,"mean_commits":112.125,"dds":"0.37866963953920474","last_synced_commit":"4bc64cbba3eeadd16dc1d13c3becf1e8457ddce5"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ms-jpq%2Fcoq_nvim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ms-jpq%2Fcoq_nvim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ms-jpq%2Fcoq_nvim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ms-jpq%2Fcoq_nvim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ms-jpq","download_url":"https://codeload.github.com/ms-jpq/coq_nvim/tar.gz/refs/heads/coq","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254029008,"owners_count":22002284,"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":["completion","neovim","neovim-plugin"],"created_at":"2024-07-30T20:01:04.165Z","updated_at":"2025-05-13T21:12:16.497Z","avatar_url":"https://github.com/ms-jpq.png","language":"Python","funding_links":[],"categories":["Completion","Python","Table of Contents","Lua"],"sub_categories":["(requires Neovim 0.5)","Neovim Extensions","Diagnostics"],"readme":"# [coq.nvim 🐔](https://ms-jpq.github.io/coq_nvim)\n\nNamed after the [famous theorem prover](https://coq.inria.fr/)\n\n`coq` also means `鸡` in [`français québécois`](https://youtu.be/ZoAhZPRBMgE), and I guess `🥖`.\n\nFast as FUCK and loads of features.\n\n## Faster Than Pure Lua\n\n- Native C in-memory B-trees\n\n- SQLite VM interrupts\n\n- Coroutine based incremental \u0026 interruptible scheduler\n\n- TCP-esque flow control\n\nMore details at the [PERFORMANCE.md](https://github.com/ms-jpq/coq_nvim/tree/coq/docs/PERF.md)\n\n## Features\n\n**Note: Due to compression, reality is _faster_ than gifs**\n\n### Fast as fuck\n\n- Results on **every keystroke**\n\n- Throttling? Never heard of her\n\n- Real time [performance statistics](https://github.com/ms-jpq/coq_nvim/tree/coq/docs/STATS.md)\n\n- Look at the gifs! The bottom few are the **fastest when I didn't slow down on purpose** to show features.\n\n### Fuzzy Search\n\n- **Typo resistant**\n\n- Recency bonus\n\n- Proximity bonus\n\n- Weighted average of [relative ranks \u0026 ensemble metrics](https://github.com/ms-jpq/coq_nvim/tree/coq/docs/FUZZY.md)\n\nError correction: `cour` -\u003e `colour_space`, `flgr` -\u003e `flag_group`, `nasp` -\u003e `Namespace`\n\n![fuzz_search.img](https://raw.githubusercontent.com/ms-jpq/coq.artifacts/artifacts/preview/fuzzy.gif)\n\n### Preview\n\n- [Press key](https://github.com/ms-jpq/coq_nvim/tree/coq/docs/KEYBIND.md) to view documentation in big buffer\n\n- Auto open preview on **side with most space**\n\n- [Customizable location](https://github.com/ms-jpq/coq_nvim/tree/coq/docs/DISPLAY.md): n, s, w, e\n\n- Ubiquitous: Tags, LSP, TreeSitter, Paths, Snippets\n\n![doc_popup.img](https://raw.githubusercontent.com/ms-jpq/coq.artifacts/artifacts/preview/preview.gif)\n\n### LSP\n\n- **Incremental completion**\n\n- **Client-side caching**\n\n- **Multi-server** completion (i.e. `tailwind` + `cssls`)\n\n- **Multi-encoding** `utf-8`, `utf-16`, `utf-32`\n\n- Header imports\n\n![lsp_imports.img](https://raw.githubusercontent.com/ms-jpq/coq.artifacts/artifacts/preview/lsp_import.gif)\n\n- Snippet Support\n\n![lsp_snippets.img](https://raw.githubusercontent.com/ms-jpq/coq.artifacts/artifacts/preview/lsp_snippet.gif)\n\nInstall the [Nvim Official LSP integration](https://github.com/neovim/nvim-lspconfig)\n\n**Requires 2 lines of change to support LSP snippets**\n\n```lua\nlocal lsp = require \"lspconfig\"\nlocal coq = require \"coq\" -- add this\n\nlsp.\u003cserver\u003e.setup(\u003cstuff...\u003e)                              -- before\nlsp.\u003cserver\u003e.setup(coq.lsp_ensure_capabilities(\u003cstuff...\u003e)) -- after\n```\n\n### Snippets\n\n- [**Over 9000** built-in snippets](https://raw.githubusercontent.com/ms-jpq/coq.artifacts/artifacts/coq%2Bsnippets%2Bv2.json)\n\n- 99% of LSP grammar, 95% of Vim grammar\n\n- [Press key](https://github.com/ms-jpq/coq_nvim/tree/coq/docs/KEYBIND.md) to jump to next edit region.\n\n![snippet_norm.img](https://raw.githubusercontent.com/ms-jpq/coq.artifacts/artifacts/preview/snip.gif)\n\n- Linked regions\n\n![snippet_expand.img](https://raw.githubusercontent.com/ms-jpq/coq.artifacts/artifacts/preview/expand_snippet.gif)\n\n- Custom snippets with [**Live Repl**](https://github.com/ms-jpq/coq_nvim/tree/coq/docs/SNIPS.md)\n\n![snip_load.img](https://raw.githubusercontent.com/ms-jpq/coq.artifacts/artifacts/preview/snip_load.gif)\n\n_The `%` statistic comes from compiling the 10,000 snippets_\n\n### TreeSitter\n\n- **Shows context**\n\n- **Partial document parsing**\n\n- Auto-disable if document is too big\n\n- Unicode ready\n\n![treesitter.img](https://raw.githubusercontent.com/ms-jpq/coq.artifacts/artifacts/preview/treesitter.gif)\n\n**Treesitter is still unstable in nvim0.5: slow and crash prone**\n\nThe promise is that Treesitter will have real time parsing on every keystroke, but it's actually too slow on big files.\n\nThe Treesitter source only parses a limited number of lines about the cursor and only on `Idle` events due to unrealized performance promises.\n\n### CTags\n\n- **LSP like**\n\n- Incremental \u0026 automatic **background compilation**\n\n- Non-blocking\n\n![ctags.img](https://raw.githubusercontent.com/ms-jpq/coq.artifacts/artifacts/preview/tags.gif)\n\n**Requires `Universal CTags`, NOT `ctags`**\n\n```sh\n# MacOS\nbrew uninstall ctags           # bad\nbrew install   universal-ctags # good\n\n# Ubuntu\napt remove  ctags              # bad\napt install universal-ctags    # good\n```\n\n### Paths\n\n- **Preview contents**\n\n- `$VARIABLE` expansion, `%EVEN_UNDER_WINDOWS%`\n\n- Relative to both `cwd` and file path\n\n![paths.img](https://raw.githubusercontent.com/ms-jpq/coq.artifacts/artifacts/preview/paths.gif)\n\n### Buffers\n\n- **Real time** completion\n\n- **Fast** in files with thousands of lines\n\n![buffers.img](https://raw.githubusercontent.com/ms-jpq/coq.artifacts/artifacts/preview/buffers.gif)\n\n### Registers\n\n- **words** Last yank `0` + custom `a-z` `coq_settings.clients.registers.words`\n\n- **lines** `coq_settings.clients.registers.lines` (`a-z`)\n\n### Tmux\n\n![tmux.img](https://raw.githubusercontent.com/ms-jpq/coq.artifacts/artifacts/preview/tmux.gif)\n\n### Tabnine\n\n- CPU preserving flow control\n\n- Auto download \u0026 install \u0026 update\n\n- Platform specific `cgroupv2` \u0026 `taskpolicy` core pinning / CPU management.\n\n![tabnine.img](https://raw.githubusercontent.com/ms-jpq/coq.artifacts/artifacts/preview/tabnine.gif)\n\n_T9 is disabled by default, I might remove it, if they do not improve the CPU usage. [Their own bug tracker](https://github.com/codota/TabNine/issues/43)._\n\nEnable via: `coq_settings.clients.tabnine.enabled=true`\n\n### [Modular lua sources](https://github.com/ms-jpq/coq.thirdparty) \u0026 external third party integrations\n\n- **Even faster than pure lua**! (transparent `sqlite` caching)\n\n- [**Tons of built-ins**](https://github.com/ms-jpq/coq.thirdparty)\n\n- External third party plugins too\n\n- [Easy to hack](https://github.com/ms-jpq/coq_nvim/tree/coq/docs/CUSTOM_SOURCES.md)\n\n![repl.img](https://raw.githubusercontent.com/ms-jpq/coq.artifacts/artifacts/preview/repl.gif)\n\nShown above: shell repl.\n\nSome other built-ins:\n\n- nvim lua API\n\n- [vim runtime](https://github.com/neovim/neovim/tree/master/runtime/autoload): `ada, c, clojure, css, haskell, html, js, php, syntax`\n\n- [scientific calculator](https://linux.die.net/man/1/bc)\n\n- [comment banners](https://linux.die.net/man/6/figlet)\n\n- [moo!](https://linux.die.net/man/1/cowsay)\n\n- [vimtex](https://github.com/lervag/vimtex)\n\n- [orgmode.nvim](https://github.com/kristijanhusak/orgmode.nvim)\n\n- [vim dadbod](https://github.com/kristijanhusak/vim-dadbod-completion)\n\n- [nvim-dap](https://github.com/mfussenegger/nvim-dap)\n\n### Statistics\n\n`:COQstats`\n\n![statistics.img](https://raw.githubusercontent.com/ms-jpq/coq.artifacts/artifacts/preview/stats.gif)\n\n### Validating config parser\n\n- Prevents typos \u0026 type errors in your config\n\nHere I make a type error on purpose inputting `string` instead of an `integer`.\n\n![conf_demo.img](https://raw.githubusercontent.com/ms-jpq/coq.artifacts/artifacts/preview/conf.png)\n\n### Pretty\n\n- [Customizable](https://github.com/ms-jpq/coq_nvim/tree/coq/docs/DISPLAY.md)\n\n![pretty.gif](https://raw.githubusercontent.com/ms-jpq/coq.artifacts/artifacts/preview/pretty.gif)\n\n**If you can't see icons properly**:\n\nEither set `let g:coq_settings = { 'display.icons.mode': 'none' }` to disable icons, or [install a supported font](https://www.nerdfonts.com/#home)\n\n## Install\n\n**Windows** requires symlinks support in git.\n\n```bash\ngit config --global core.symlinks true\n```\n\nNeeds python virtual env\n\n```bash\napt install --yes -- python3-venv\n```\n\n**Minimum version**: python:`3.8.2`, nvim: `0.5`, sqlite: `recentish`\n\n\u003cdetails\u003e\n  \u003csummary\u003eVim\u003c/summary\u003e\n\n  Install the usual way, ie. VimPlug, Vundle, etc\n\n  ```VimL\n  \" main one\n  Plug 'ms-jpq/coq_nvim', {'branch': 'coq'}\n  \" 9000+ Snippets\n  Plug 'ms-jpq/coq.artifacts', {'branch': 'artifacts'}\n\n  \" lua \u0026 third party sources -- See https://github.com/ms-jpq/coq.thirdparty\n  \" Need to **configure separately**\n\n  Plug 'ms-jpq/coq.thirdparty', {'branch': '3p'}\n  \" - shell repl\n  \" - nvim lua api\n  \" - scientific calculator\n  \" - comment banner\n  \" - etc\n  ```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eNeovim\u003c/summary\u003e\n\n  ### lazy.nvim\n\n  ```lua\n  {\n    \"neovim/nvim-lspconfig\", -- REQUIRED: for native Neovim LSP integration\n    lazy = false, -- REQUIRED: tell lazy.nvim to start this plugin at startup\n    dependencies = {\n      -- main one\n      { \"ms-jpq/coq_nvim\", branch = \"coq\" },\n  \n      -- 9000+ Snippets\n      { \"ms-jpq/coq.artifacts\", branch = \"artifacts\" },\n  \n      -- lua \u0026 third party sources -- See https://github.com/ms-jpq/coq.thirdparty\n      -- Need to **configure separately**\n      { 'ms-jpq/coq.thirdparty', branch = \"3p\" }\n      -- - shell repl\n      -- - nvim lua api\n      -- - scientific calculator\n      -- - comment banner\n      -- - etc\n    },\n    init = function()\n      vim.g.coq_settings = {\n          auto_start = true, -- if you want to start COQ at startup\n          -- Your COQ settings here\n      }\n    end,\n    config = function()\n      -- Your LSP settings here\n    end,\n  }\n  ```\n\u003c/details\u003e\n\n## Documentation\n\nTo start `coq`\n\n```viml\n\" the [-s, --shut-up] flag will remove the greeting message\n:COQnow [--shut-up]\n```\n\n🌟 If required, it will ask you to run `:COQdeps`, please run it and do `:COQnow` again.\n\nThere is built-in [help command](https://github.com/ms-jpq/coq_nvim/tree/coq/docs/README.md)\n\n```viml\n:COQhelp [--web] [topic]\n```\n\n- [:COQhelp config](https://github.com/ms-jpq/coq_nvim/tree/coq/docs/CONF.md)\n\n- [:COQhelp keybind](https://github.com/ms-jpq/coq_nvim/tree/coq/docs/KEYBIND.md)\n\n- [:COQhelp snips](https://github.com/ms-jpq/coq_nvim/tree/coq/docs/SNIPS.md)\n\n- [:COQhelp fuzzy](https://github.com/ms-jpq/coq_nvim/tree/coq/docs/FUZZY.md)\n\n- [:COQhelp comp](https://github.com/ms-jpq/coq_nvim/tree/coq/docs/COMPLETION.md)\n\n- [:COQhelp display](https://github.com/ms-jpq/coq_nvim/tree/coq/docs/DISPLAY.md)\n\n- [:COQhelp sources](https://github.com/ms-jpq/coq_nvim/tree/coq/docs/SOURCES.md)\n\n- [:COQhelp misc](https://github.com/ms-jpq/coq_nvim/tree/coq/docs/MISC.md)\n\n- [:COQhelp perf](https://github.com/ms-jpq/coq_nvim/tree/coq/docs/PERF.md)\n\n- [:COQhelp stats](https://github.com/ms-jpq/coq_nvim/tree/coq/docs/STATS.md)\n\n- [:COQhelp custom_sources](https://github.com/ms-jpq/coq_nvim/tree/coq/docs/CUSTOM_SOURCES.md)\n\n## FAQ\n\n#### Default hotkeys?\n\nAlways:\n\n| key         | function                 |\n| ----------- | ------------------------ |\n| `\u003cc-space\u003e` | manual completion        |\n| `\u003cc-h\u003e`     | edit snippet placeholder |\n\nWhen completion menu is open:\n\n| key           | function                      |\n| ------------- | ----------------------------- |\n| `\u003cc-k\u003e`       | move preview to bigger window |\n| `\u003cesc\u003e`       | exit to normal                |\n| `\u003cbackspace\u003e` | backspace                     |\n| `\u003center\u003e`     | select completion             |\n| `\u003ctab\u003e`       | next result                   |\n| `\u003cs-tab\u003e`     | prev result                   |\n\nUnbound:\n\n| keymap                           | function                                      |\n| -------------------------------- | --------------------------------------------- |\n| `coq_settings.keymap.repeat`     | repeat last edit                              |\n| `coq_settings.keymap.eval_snips` | evulate snippet in document / under selection |\n\n**When hovering over a result, entering any key [a-z] will select it**\n\nThis is a vim thing, I have zero control over :(\n\n#### `.` Repeat\n\nSet `coq_settings.keymap.repeat` to a hotkey.\n\nSee `:COQhelp keybind` for details\n\n#### Flickering\n\nBy default, the old results are cleared on each keystroke, so the popup menu is closed right away.\n\nYou can disable this: at the cost of having stale results shown until the new ones come in.\n\n`let g:coq_settings = { 'display.pum.fast_close': v:false }`\n\nThis is not the default because some LSP servers are very slow (ie. tailwindcss), leading to stale results being shown for too long.\n\n#### Autostart COQ\n\n`let g:coq_settings = { 'auto_start': v:true }` or `let g:coq_settings = { 'auto_start': 'shut-up' }`\n\nThis must be set **BEFORE** `require(\"coq\")`\n\n#### LSP too slow to show up on keystroke.\n\nYou have some options, each has its trade off:\n\n1. Increase the `coq_settings.limits.completion_auto_timeout`.\n\nThis will slow down feedback on _every keystroke_, as `coq` waits for LSP.\n\n2. Use the manual completion hotkey (default `\u003cc-space\u003e`)\n\nAnnoying! And the manual completion also has a timeout `coq_settings.limits.completion_manual_timeout`.\n\nSome LSP servers will still fail to respond within the default `.66` seconds, in that case pressing `\u003cc-space\u003e` multiple times might actually help some LSP servers catch up, depending on their implementation.\n\n#### LSP sometimes not importing\n\nIncrease `coq_settings.clients.lsp.resolve_timeout`\n\nThis will however, make applying edits slower.\n\n#### Missing Results\n\nOn keystroke only a max of `coq_settings.match.max_results` are shown.\n\nUse manual completion hotkey to show all results.\n\n#### Some LSP servers give inconsistent completions\n\nThis happens when certain LSP servers give you 1000s of unfiltered results in _alphabetical order_ and you still have to respond in a few dozen milliseconds.\n\nTo eliminate `a-z` bias, `coq` does a random sort on the resultset and process and cache as many of them as possible within the performance window.\n\nSo if some results are not in the SQLite cache, and have yet to be processed, they will be missing. They might however still show up on later keystrokes.\n\nUse the manual hotkey if you need to see everything.\n\n#### My vim crashed!\n\n**Disable TreeSitter**\n\nTreesitter still needs stability work.\n\n#### I want to use a different python version\n\n`vim.g.python3_host_prog=\u003cabsolute path to python\u003e`\n\n## If you like this...\n\nAlso check out\n\n- [`sad`](https://github.com/ms-jpq/sad), it's a modern `sed` that does previews with syntax highlighting, and lets you pick and choose which chunks to edit.\n\n- [`CHADTree`](https://github.com/ms-jpq/chadtree), it's a FULLY featured file manager.\n\n- [isomorphic-copy](https://github.com/ms-jpq/isomorphic-copy), it's a cross platform clipboard that is daemonless, and does not require third party support.\n\n## Special Thanks \u0026 Acknowledgements\n\nThe snippets are compiled from the following open source projects:\n\n- [Shougo/neosnippet-snippets](https://github.com/Shougo/neosnippet-snippets)\n\n- [fatih/vim-go](https://github.com/fatih/vim-go)\n\n- [honza/vim-snippets](https://github.com/honza/vim-snippets)\n\n- [Ikuyadeu/vscode-R](https://github.com/Ikuyadeu/vscode-R)\n\n- [Rocketseat/rocketseat-vscode-react-native-snippets](https://github.com/Rocketseat/rocketseat-vscode-react-native-snippets)\n\n- [dsznajder/vscode-es7-javascript-react-snippets](https://github.com/dsznajder/vscode-es7-javascript-react-snippets)\n\n- [johnpapa/vscode-angular-snippets](https://github.com/johnpapa/vscode-angular-snippets)\n\n- [sdras/vue-vscode-snippets](https://github.com/sdras/vue-vscode-snippets)\n\n- [snipsnapdev/snipsnap](https://github.com/snipsnapdev/snipsnap)\n\n- [xabikos/vscode-javascript](https://github.com/xabikos/vscode-javascript)\n\n- [xabikos/vscode-react](https://github.com/xabikos/vscode-react)\n\n- [rafamadriz/friendly-snippets](https://github.com/rafamadriz/friendly-snippets)\n\nSuper special thanks goes to [Typescript LSP](https://github.com/typescript-language-server/typescript-language-server).\n\nNothing like good motivation to improve my design than dumping 1000 results on my client every other keystroke.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fms-jpq%2Fcoq_nvim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fms-jpq%2Fcoq_nvim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fms-jpq%2Fcoq_nvim/lists"}