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

Overview

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 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 show 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, Paths, Snippets

doc_popup.img

LSP

  • Incremental completion

  • Client-side caching

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

  • Header imports

lsp_imports.img

  • Snippet Support

lsp_snippets.img

Install the Nvim Official LSP integration

Requires 1 line of change to support LSP snippets

.setup() -- before lsp..setup(coq.lsp_ensure_capabilities()) -- after ">
local lsp = require "lspconfig"

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

If you are using packer.nvim

.setup(require("coq")().lsp_ensure_capabilities()) end) ">
vim.schedule(function ()
  local lsp = require "lspconfig"
  require("packer").loader("coq_nvim coq.artifacts")
  lsp.<server>.setup(require("coq")().lsp_ensure_capabilities(<stuff...>))
end)

Snippets

snippet_norm.img

  • Linked regions

snippet_expand.img

The % statistic comes from compiling the 10,000 snippets

See FAQ to see limitations due to upstream bug

CTags

  • Incremental & automatic background compilation

  • Tag location & context

  • 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

  • Relative to both cwd and file path

paths.img

Buffers

  • Real time completion

  • Fast in files with thousands of lines

buffers.img

TreeSitter

  • Unicode ready

  • I don't have a picture, it's boring

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 on Idle events due to unrealized performance promises.

Tmux

tmux.img

Tabnine

  • CPU preserving flow control

  • Auto download & install & update

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

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

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'}
-- packer
use { 'ms-jpq/coq_nvim', branch = 'coq'} -- main one
use { 'ms-jpq/coq.artifacts', branch= 'artifacts'} -- 9000+ Snippets

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
manual completion
edit snippet placeholder

When completion menu is open:

key function
move preview to bigger window
exit to normal
backspace
select completion
next result
prev result

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

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

Autostart COQ

let g:coq_settings = { 'auto_start': v:true } (or the lua way)

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 )

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 multiple times might actually help some LSP servers catch up, depending on their implementation.

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.

Auto completion mess up snippet regions (the ones you can jump to)

This is an upstream nvim issue.

Theoretically I can work around this by writing my own nvim extmark reconciliator, or I can go and cuddle my puppy and let upstream fix it.

My vim crashed!

Disable TreeSitter

Treesitter still needs stability work.

I want to use a different python version

vim.g.python3_host_prog=

Note: ~/ will not be expanded to $HOME, use vim.env.HOME .. (lua) or $HOME . (viml) instead.

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.

Owner
i love my dog
dogs are love dogs are life
i love my dog
A cd command that learns - easily navigate directories from the command line

NAME autojump - a faster way to navigate your filesystem DESCRIPTION autojump is a faster way to navigate your filesystem. It works by maintaining a d

William Ting 14.5k Jan 03, 2023
A stupidly simple task list to keep you productive and focused.

StupidlySimple-TaskList A stupidly simple task list to keep you productive and focused. There is really nothing to it. This is a terminal-based script

Jack Soderstrom 1 Nov 28, 2021
Random scripts and other bits for interacting with the SpaceX Starlink user terminal hardware

starlink-grpc-tools This repository has a handful of tools for interacting with the gRPC service implemented on the Starlink user terminal (AKA "the d

270 Dec 29, 2022
MsfMania is a command line tool developed in Python that is designed to bypass antivirus software on Windows and Linux/Mac in the future

MsfMania MsfMania is a command line tool developed in Python that is designed to bypass antivirus software on Windows and Linux/Mac in the future. Sum

446 Dec 21, 2022
Shortcut-Maker - It is a tool that can be set to run any tool with a single command

Shortcut-Maker It is a tool that can be set to run any tool with a single command Coded by Dave Smith(Owner of Sl Cyber Warriors) Command list 👇 pkg

Dave Smith 10 Sep 14, 2022
A terminal utility to sort image files based on their characteristics.

About A terminal utility to sort image files based on their characteristics. Motivation This program was developed after I've realized that I had too

José Ferreira 1 Dec 10, 2022
A simple command line virtual operating system, written in python

Virtual operating system A simple virtual operating system written in python. (Under development). Currently, the following commands are supported: Co

B.Jothin kumar 7 Nov 15, 2022
Package installer for python

This is a package that adds a JSON file to your project that records all of the packages used in it and allows people to install it with a single command.

Anmol Malik 1 May 23, 2022
This is a CLI utility that allows you to view RedFlagDeals.com on the command line.

RFD Description Motivation Installation Usage View Hot Deals View and Sort Hot Deals Search Advanced View Posts Shell Completion bash zsh Description

Dave G 8 Nov 29, 2022
Terminal Colored Text for Python

Terminal Colored Text for Python

R3CKhi-**75 3 Sep 10, 2022
Double Pendulum visualised with fetching system information in Python.

Show off your terminal, in style. A nice relaxing double pendulum simulation using ASCII, able to simulate multiple pendulums at once, and provide tra

Nekurone 62 Dec 14, 2022
A webmining CLI tool & library for python.

minet is a webmining command line tool & library for python (= 3.6) that can be used to collect and extract data from a large variety of web sources

médialab Sciences Po 165 Dec 17, 2022
TUIFIManager - A cross-platform terminal-based file manager

TUIFI Manager A cross-platform terminal-based file manager (and component), mean

142 Dec 26, 2022
You'll never want to use cd again.

Jmp Description Have you ever used the cd command? You'll never touch that outdated thing again when you try jmp. Navigate your filesystem with unprec

Grant Holmes 21 Nov 03, 2022
Neovim integration for Google Keep, built using gkeepapi

Gkeep.nvim Neovim integration for Google Keep, built using gkeepapi Requirements Neovim 0.5 Python 3.6+ A patched font (optional. Used for icons) Tabl

Steven Arcangeli 143 Jan 02, 2023
OneDriveExplorer - A command line and GUI based application for reconstructing the folder structure of OneDrive from the UserCid.dat file

OneDriveExplorer - A command line and GUI based application for reconstructing the folder structure of OneDrive from the UserCid.dat file

Brian Maloney 100 Dec 13, 2022
A CLI/Shell supporting OpenRobot API and more!

A CLI/Shell supporting JeyyAPI, OpenRobot API and RePI API.

OpenRobot Packages 1 Jan 06, 2022
Oil is a new Unix shell. It's our upgrade path from bash to a better language and runtime

Oil is a new Unix shell. It's our upgrade path from bash to a better language and runtime. It's also for Python and JavaScript users who avoid shell!

2.4k Jan 08, 2023
keep your machine's shell history synchronize

SyncShell Yet another tool for laziness Keep your machine's shell history synchronize Get SyncShell Currently, SyncShell is just available on PyPi and

Masoud Ghorbani 53 Dec 12, 2022
Wordle - Wordle solver with python

wordle what is wordle? https://www.powerlanguage.co.uk/wordle/ preparing $ pip i

shidocchi 0 Jan 24, 2022