• Stars
    star
    3,435
  • Rank 13,010 (Top 0.3 %)
  • Language
    Python
  • License
    GNU General Publi...
  • Created over 4 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Fast as FUCK nvim completion. SQLite, concurrent scheduler, hundreds of hours of optimization.

coq.nvim 🐔

Named after the famous theorem prover

coq also means in français québécois, and I guess 🥖.

Fast as FUCK and loads of features.

Faster Than Pure Lua

  • Native C in-memory B-trees

  • SQLite VM interrupts

  • Coroutine based incremental & interruptible scheduler

  • TCP-esque flow control

More details at the PERFORMANCE.md

Features

Note: Due to compression, reality is faster than gifs

Fast as fuck

  • Results on every keystroke

  • Throttling? Never heard of her

  • Real time performance statistics

  • Look at the gifs! The bottom few are the fastest when I didn't slow down on purpose to show features.

Fuzzy Search

Error correction: cour -> colour_space, flgr -> flag_group, nasp -> Namespace

fuzz_search.img

Preview

  • Press key to view documentation in big buffer

  • Auto open preview on side with most space

  • Customizable location: n, s, w, e

  • Ubiquitous: Tags, LSP, TreeSitter, Paths, Snippets

doc_popup.img

LSP

  • Incremental completion

  • Client-side caching

  • Multi-server completion (i.e. tailwind + cssls)

  • Multi-encoding utf-8, utf-16, utf-32

  • Header imports

lsp_imports.img

  • Snippet Support

lsp_snippets.img

Install the Nvim Official LSP integration

Requires 2 lines of change to support LSP snippets

local lsp = require "lspconfig"
local coq = require "coq" -- add this

lsp.<server>.setup(<stuff...>)                              -- before
lsp.<server>.setup(coq.lsp_ensure_capabilities(<stuff...>)) -- after

Snippets

snippet_norm.img

  • Linked regions

snippet_expand.img

snip_load.img

The % statistic comes from compiling the 10,000 snippets

TreeSitter

  • Shows context

  • Partial document parsing

  • Auto-disable if document is too big

  • Unicode ready

treesitter.img

Treesitter is still unstable in nvim0.5: slow and crash prone

The promise is that Treesitter will have real time parsing on every keystroke, but it's actually too slow on big files.

The Treesitter source only parses a limited number of lines about the cursor and only on Idle events due to unrealized performance promises.

CTags

  • LSP like

  • Incremental & automatic background compilation

  • Non-blocking

ctags.img

Requires Universal CTags, NOT ctags

# MacOS
brew uninstall ctags           # bad
brew install   universal-ctags # good

# Ubuntu
apt remove  ctags              # bad
apt install universal-ctags    # good

Paths

  • Preview contents

  • $VARIABLE expansion, %EVEN_UNDER_WINDOWS%

  • Relative to both cwd and file path

paths.img

Buffers

  • Real time completion

  • Fast in files with thousands of lines

buffers.img

Registers

  • words Last yank 0 + custom a-z coq_settings.clients.registers.words

  • lines coq_settings.clients.registers.lines (a-z)

Tmux

tmux.img

Tabnine

  • CPU preserving flow control

  • Auto download & install & update

  • Platform specific cgroupv2 & taskpolicy core pinning / CPU management.

tabnine.img

T9 is disabled by default, I might remove it, if they do not improve the CPU usage. Their own bug tracker.

Enable via: coq_settings.clients.tabnine.enabled=true

Modular lua sources & external third party integrations

repl.img

Shown above: shell repl.

Some other built-ins:

Statistics

:COQstats

statistics.img

Validating config parser

  • Prevents typos & type errors in your config

Here I make a type error on purpose inputting string instead of an integer.

conf_demo.img

Pretty

pretty.gif

If you can't see icons properly:

Either set let g:coq_settings = { 'display.icons.mode': 'none' } to disable icons, or install a supported font

Install

Needs python virtual env

apt install --yes -- python3-venv

Minimum version: python:3.8.2, nvim: 0.5, sqlite: recentish

Install the usual way, ie. VimPlug, Vundle, etc

" main one
Plug 'ms-jpq/coq_nvim', {'branch': 'coq'}
" 9000+ Snippets
Plug 'ms-jpq/coq.artifacts', {'branch': 'artifacts'}

" lua & third party sources -- See https://github.com/ms-jpq/coq.thirdparty
" Need to **configure separately**

Plug 'ms-jpq/coq.thirdparty', {'branch': '3p'}
" - shell repl
" - nvim lua api
" - scientific calculator
" - comment banner
" - etc

Documentation

To start coq

" the [-s, --shut-up] flag will remove the greeting message
:COQnow [--shut-up]

🌟 If required, it will ask you to run :COQdeps, please run it and do :COQnow again.

There is built-in help command

:COQhelp [--web] [topic]

FAQ

Default hotkeys?

Always:

key function
<c-space> manual completion
<c-h> edit snippet placeholder

When completion menu is open:

key function
<c-k> move preview to bigger window
<esc> exit to normal
<backspace> backspace
<enter> select completion
<tab> next result
<s-tab> prev result

Unbound:

keymap function
coq_settings.keymap.repeat repeat last edit
coq_settings.keymap.eval_snips evulate snippet in document / under selection

When hovering over a result, entering any key [a-z] will select it

This is a vim thing, I have zero control over :(

. Repeat

Set coq_settings.keymap.repeat to a hotkey.

See :COQhelp keybind for details

Flickering

By default, the old results are cleared on each keystroke, so the popup menu is closed right away.

You can disable this: at the cost of having stale results shown until the new ones come in.

let g:coq_settings = { 'display.pum.fast_close': v:false }

This is not the default because some LSP servers are very slow (ie. tailwindcss), leading to stale results being shown for too long.

Autostart COQ

let g:coq_settings = { 'auto_start': v:true } or let g:coq_settings = { 'auto_start': 'shut-up' }

This must be set BEFORE require("coq")

LSP too slow to show up on keystroke.

You have some options, each has its trade off:

  1. Increase the coq_settings.limits.completion_auto_timeout.

This will slow down feedback on every keystroke, as coq waits for LSP.

  1. Use the manual completion hotkey (default <c-space>)

Annoying! And the manual completion also has a timeout coq_settings.limits.completion_manual_timeout.

Some LSP servers will still fail to respond within the default .66 seconds, in that case pressing <c-space> multiple times might actually help some LSP servers catch up, depending on their implementation.

LSP sometimes not importing

Increase coq_settings.clients.lsp.resolve_timeout

This will however, make applying edits slower.

Missing Results

On keystroke only a max of coq_settings.match.max_results are shown.

Use manual completion hotkey to show all results.

Some LSP servers give inconsistent completions

This 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.

To 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.

So 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.

Use the manual hotkey if you need to see everything.

My vim crashed!

Disable TreeSitter

Treesitter still needs stability work.

I want to use a different python version

vim.g.python3_host_prog=<absolute path to python>

If you like this...

Also check out

  • sad, it's a modern sed that does previews with syntax highlighting, and lets you pick and choose which chunks to edit.

  • CHADTree, it's a FULLY featured file manager.

  • isomorphic-copy, it's a cross platform clipboard that is daemonless, and does not require third party support.

Special Thanks & Acknowledgements

The snippets are compiled from the following open source projects:

Super special thanks goes to Typescript LSP.

Nothing like good motivation to improve my design than dumping 1000 results on my client every other keystroke.

More Repositories

1

sad

CLI search and replace | Space Age seD
Rust
1,681
star
2

chadtree

File manager for Neovim. Better than NERDTree.
Python
1,618
star
3

noact

Minimalist React (< 70 lines)
TypeScript
317
star
4

lua-async-await

Async Await in 90 lines of code.
Lua
309
star
5

gay

Colour your text / terminal to be more gay. 🏳️‍🌈
Python
305
star
6

isomorphic_copy

Cross platform clipboard | networkless! remote copy
Python
206
star
7

kde-in-docker

So you can run KDE inside a browser
Dockerfile
109
star
8

docker-time-machine

Zero Configuration, time machine for MacOS | Docker 🐳
Shell
83
star
9

markdown-live-preview

markdown live preview | works with any editor
Python
73
star
10

windows-in-docker

Manage Windows in Docker (easy)
Python
61
star
11

coq.thirdparty

Module lua sources for `coq.nvim`, first & third party
Lua
61
star
12

windows-in-docker-old

WHY? So you can run Windows "as a container"
Shell
51
star
13

nvim_rc

Python
49
star
14

simple-traefik-dash

Zero conf service dashboard for Traefik v2 Ingress Controller
F#
33
star
15

sync-dockerhub-readme

Github action to sync <readme.md> to Dockerhub
Python
22
star
16

simple-traefik-identity

Simple & Configurable -- single sign-on auth, for Traefik.
F#
22
star
17

coq.artifacts

Python
16
star
18

docker-home-router

Python
13
star
19

vim.bench

Reproducible nvim completion framework benchmarks.
Python
13
star
20

vim.conf-2023

SCSS
10
star
21

download-windows-iso

Python script to download official windows iso
Python
9
star
22

pynvim_pp

Python
8
star
23

snips

Vim Snippet
7
star
24

tmux_rc

Python
6
star
25

forechan

Go style CSP for Python
Python
6
star
26

lab

We have cloud at home - mom
Shell
6
star
27

kaleidoscope

Interactive & arbitrary Chaos Game fractal visualization tool
TypeScript
5
star
28

vim.benchmarks

5
star
29

nda

NPM - Domain Agnostic :: use with NPM dependency manager
TypeScript
5
star
30

nodebook-docker

Docker in Docker version of Nodebook (multilang repl)
Dockerfile
5
star
31

shell_rc

Shell
5
star
32

simple-markdown-showcase

Responsive personal portfolio pages using Github APIs.
Python
5
star
33

bing-daily-images

A docker container that downloads bing daily images for you.
Python
4
star
34

simple-reeducks

Minimalist Classless Redux in Swift
Swift
4
star
35

auto-github-push

Github action to refresh various Github inactivity countdowns.
Python
4
star
36

sortd

sorting commands for stdin -> stdout
Python
4
star
37

ms-jpq

4
star
38

iterm2

Python
3
star
39

ms-jpq.github.io

https://ms-jpq.github.io
HTML
3
star
40

std2

Python
3
star
41

vim.conf

TeX
3
star
42

defcon604-2023

Shell
2
star
43

emacs_rc

Emacs Lisp
2
star
44

fda

Fsharp - Domain Agnostic :: use with Paket dependency manager
F#
2
star
45

py-dev

Python
2
star
46

deb

2
star
47

kaleidoscope-page

Page for Kaleidoscope
HTML
1
star
48

languagetool-cli

Python
1
star
49

homebrew-sad

Ruby
1
star
50

cda

SASS - Domain Agnostic :: use with NPM dependency manager
SCSS
1
star
51

noact-page

Page for Noact
CSS
1
star
52

deb-src

PPA builder, hosted on Github pages
Makefile
1
star
53

mol

Minimal hardware accelerated `curl -- linux.iso | qemu-system-aarch64` scripts.
Shell
1
star