{"id":13803730,"url":"https://github.com/whonore/Coqtail","last_synced_at":"2025-05-13T16:32:26.172Z","repository":{"id":27043897,"uuid":"92962561","full_name":"whonore/Coqtail","owner":"whonore","description":"Interactive Coq Proofs in Vim","archived":false,"fork":false,"pushed_at":"2025-03-29T20:34:41.000Z","size":944,"stargazers_count":288,"open_issues_count":33,"forks_count":36,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-08T18:19:47.929Z","etag":null,"topics":["coq","proof-assistant","vim"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/whonore.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2017-05-31T15:46:39.000Z","updated_at":"2025-04-06T09:19:41.000Z","dependencies_parsed_at":"2024-03-30T22:24:05.545Z","dependency_job_id":"ca2055ad-27ab-4d12-ac69-56726b2a30b0","html_url":"https://github.com/whonore/Coqtail","commit_stats":{"total_commits":580,"total_committers":28,"mean_commits":"20.714285714285715","dds":"0.16034482758620694","last_synced_commit":"299d0acdb9b697fd951df81a5d67e3f5cb6ed4f9"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whonore%2FCoqtail","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whonore%2FCoqtail/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whonore%2FCoqtail/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whonore%2FCoqtail/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/whonore","download_url":"https://codeload.github.com/whonore/Coqtail/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253981922,"owners_count":21994357,"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":["coq","proof-assistant","vim"],"created_at":"2024-08-04T01:00:37.344Z","updated_at":"2025-05-13T16:32:21.142Z","avatar_url":"https://github.com/whonore.png","language":"Python","funding_links":[],"categories":["Projects"],"sub_categories":["User Interfaces"],"readme":"# Coqtail\n\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)\n[![Vim Tests](https://github.com/whonore/Coqtail/workflows/Vim%20Tests/badge.svg?branch=main)](https://github.com/whonore/Coqtail/actions?query=workflow%3AVim%20Tests)\n[![Python Tests](https://github.com/whonore/Coqtail/workflows/Python%20Tests/badge.svg?branch=main)](https://github.com/whonore/Coqtail/actions?query=workflow%3APython%20Tests)\n[![Coq Tests](https://github.com/whonore/Coqtail/workflows/Coq%20Tests/badge.svg?branch=main)](https://github.com/whonore/Coqtail/actions?query=workflow%3ACoq%20Tests)\n\n## Interactive Coq Proofs in Vim\n\nCoqtail enables interactive Coq proof development in Vim similar to [CoqIDE] or\n[ProofGeneral].\n\nIt supports:\n- [Coq 8.4 - 8.20]\n- Python \u003e=3.6 (see [here](#python-2-support) for older versions)\n- Vim \u003e=7.4 and Neovim \u003e=0.3\n- Simultaneous Coq sessions in different buffers\n- Non-blocking communication between Vim and Coq (Vim \u003e=8.0 and NeoVim only)\n\n## Installation\n\nAs a [vim package]:\n```sh\nmkdir -p ~/.vim/pack/coq/start\ngit clone https://github.com/whonore/Coqtail.git ~/.vim/pack/coq/start/Coqtail\nvim +helptags\\ ~/.vim/pack/coq/start/Coqtail/doc +q\n```\n\nUsing [pathogen]:\n```sh\ngit clone https://github.com/whonore/Coqtail.git ~/.vim/bundle/Coqtail\nvim +Helptags +q\n```\n\nUsing [Vundle]:\n```sh\nPlugin 'whonore/Coqtail' (add this line in .vimrc)\nvim +PluginInstall +qa\n```\n\nUsing [VimPlug]:\n```sh\nPlug 'whonore/Coqtail' (add this line in .vimrc)\nvim +PlugInstall +qa\n```\n\n### Requirements\n\n- Vim compiled with `+python3` (3.6 or later) or the `pynvim` Python package for Neovim\n- Vim configuration options `filetype plugin on`, and optionally `filetype\n  indent on` and `syntax on` (e.g. in `.vimrc`)\n- [Coq 8.4 - 8.20]\n\nNewer versions of Coq have not yet been tested, but should still work as long as\nthere are no major changes made to the [XML protocol].\nNote that for Coq \u003e=8.9, the `coqidetop` executable must be available, which may\nrequire additionally installing CoqIDE depending on the installation method.\nSee [here](#coq-executable) for help with pointing Coqtail to the appropriate location.\n\n## Usage\n\nCoqtail provides the following commands and mappings, which are available in any\nbuffer with the `coq` filetype (set automatically for files with a `.v`\nextension, or manually with `:setfiletype coq`).\nSee `:help coqtail` for more details.\n\n| Command | Mapping | Description |\n|---|---|---|\n| **Starting and Stopping** | |\n| `CoqStart` | `\u003cleader\u003ecc` | Launch Coqtail in the current buffer. |\n| `CoqStop` | `\u003cleader\u003ecq` | Quit Coqtail in the current buffer. |\n| `CoqInterrupt` | `CTRL-C` | Send SIGINT to Coq. |\n| **Movement** | |\n| `{n}CoqNext` | `\u003cleader\u003ecj` | Send the next `n` (1 by default) sentences to Coq. |\n| `{n}CoqUndo` | `\u003cleader\u003eck` | Step back `n` (1 by default) sentences. |\n| `{n}CoqToLine` | `\u003cleader\u003ecl` | Send/rewind all sentences up to line `n` (cursor position by default). `n` can also be `$` to check the entire buffer. |\n| `{n}CoqOmitToLine` | No default (see [Mappings](#mappings)) | Same as `CoqToLine`, but skip processing of and admit all opaque proofs. Similar to Proof General's [`proof-omit-proofs-option`](https://proofgeneral.github.io/doc/master/userman/Coq-Proof-General/#Omitting-proofs-for-speed). See `:help CoqOmitToLine` for more information. |\n| `CoqToTop` | `\u003cleader\u003ecT` | Rewind to the beginning of the file. |\n| `CoqJumpToEnd` | `\u003cleader\u003ecG` | Move the cursor to the end of the checked region. |\n| `CoqJumpToError` | `\u003cleader\u003ecE` | Move the cursor to the start of the error region. |\n| `CoqGotoDef[!] \u003carg\u003e` | `\u003cleader\u003ecgd` | Populate the quickfix list with possible locations of the definition of `\u003carg\u003e` and try to jump to the first one. If your Vim supports `'tagfunc'` you can also use `CTRL-]`, `:tag`, and friends. |\n| **Queries** | |\n| `Coq \u003cargs\u003e` | | Send arbitrary queries to Coq (e.g. `Check`, `About`, `Print`, etc.). |\n| `Coq Check \u003carg\u003e` | `\u003cleader\u003ech` | Show the type of `\u003carg\u003e` (the mapping will use the term under the cursor or the highlighted range in visual mode). |\n| `Coq About \u003carg\u003e` | `\u003cleader\u003eca` | Show information about `\u003carg\u003e`. |\n| `Coq Print \u003carg\u003e` | `\u003cleader\u003ecp` | Show the definition of `\u003carg\u003e`. |\n| `Coq Locate \u003carg\u003e` | `\u003cleader\u003ecf` | Show where `\u003carg\u003e` is defined. |\n| `Coq Search \u003cargs\u003e` | `\u003cleader\u003ecs` | Show theorems about `\u003cargs\u003e`. |\n| **Panel Management** | |\n| `CoqRestorePanels` | `\u003cleader\u003ecr` | Re-open the Goal and Info panels. |\n| `{n}CoqGotoGoal` | `\u003cleader\u003ecgg` | Scroll the Goal panel to the start of the `n`th goal (defaults to 1). Number of lines shown is controlled by `g:coqtail_goal_lines`. |\n| `{n}CoqGotoGoal!` | `\u003cleader\u003ecgG` | Scroll the Goal panel to the end of the `n`th goal. |\n| `CoqGotoGoalNext` | `]g` | Scroll the Goal panel to the start of the next goal. |\n| `CoqGotoGoalNext!` | `]G` | Scroll the Goal panel to the end of the next goal. |\n| `CoqGotoGoalPrev` | `[g` | Scroll the Goal panel to the start of the previous goal. |\n| `CoqGotoGoalPrev!` | `[G` | Scroll the Goal panel to the end of the previous goal. |\n\n## Configuration\n\n### Mappings\n\nThe mappings above are set by default, but you can disable them all and define\nyour own by setting `g:coqtail_nomap = 1` in your `.vimrc`.\nSome of the commands, such as `CoqNext`, also have insert-mode mappings by\ndefault, which can be disabled with `g:coqtail_noimap`.\n\nAlternatively, you can keep the defaults but remap specific commands.\nFor example, use `map \u003cleader\u003eci \u003cPlug\u003eCoqInterrupt` to avoid hijacking `CTRL-C`.\nIf a mapping for a command already exists when Coqtail is loaded, the default\nmapping for that command won't be defined.\n\nThe `\u003cleader\u003ec` prefix may be inconvenient depending on your `mapleader` setting.\nIn that case you can set a custom prefix with `g:coqtail_map_prefix` (or\n`g:coqtail_imap_prefix` for just insert-mode mappings).\n\nFinally, after defining the standard keybindings, Coqtail will call a vim\nfunction named `CoqtailHookDefineMappings` (if one is defined). This makes it\neasy to add additional mappings without removing the standard mappings, and\nto add mappings which are only active in Coqtail-managed buffers. One way to\nuse this hook is to make bindings for commands which augment the standard\nCoqtail bindings instead of replacing them. One concrete example is:\n\n```vim\nfunction CoqtailHookDefineMappings()\n  imap \u003cbuffer\u003e \u003cS-Down\u003e \u003cPlug\u003eCoqNext\n  imap \u003cbuffer\u003e \u003cS-Left\u003e \u003cPlug\u003eCoqToLine\n  imap \u003cbuffer\u003e \u003cS-Up\u003e \u003cPlug\u003eCoqUndo\n  nmap \u003cbuffer\u003e \u003cS-Down\u003e \u003cPlug\u003eCoqNext\n  nmap \u003cbuffer\u003e \u003cS-Left\u003e \u003cPlug\u003eCoqToLine\n  nmap \u003cbuffer\u003e \u003cS-Up\u003e \u003cPlug\u003eCoqUndo\nendfunction\n```\n\nAdding that snippet to your `.vimrc` would create new bindings for `CoqNext`,\n`CoqToLine`, and `CoqUndo`. Those bindings would be active in all Coq buffers,\nincluding Coqtail panels, but inactive in other buffers. The standard Coqtail\nbindings (`\u003cleader\u003ecj`, etc) would remain active.\n\n### Coq Executable\n\nBy default Coqtail uses the first `coq(ide)top(.opt)` found in your `PATH`.\nUse `b:coqtail_coq_path` (or `g:coqtail_coq_path`) to specify a different\ndirectory to search in (these are automatically set if the `$COQBIN` environment\nvariable is set).\nYou can also override the name of the Coq executable to use with\n`b:coqtail_coq_prog` (or `g:coqtail_coq_prog`).\nFor example, to use the [HoTT library](https://github.com/HoTT/HoTT):\n\n```vim\nlet b:coqtail_coq_path = '/path/to/HoTT'\nlet b:coqtail_coq_prog = 'hoqidetop'\n```\n\n### Project Files\n\nThere are two standard methods for configuring Coq project settings:\n[`_CoqProject` files](https://coq.inria.fr/refman/practical-tools/utilities.html#building-a-project-with-coqproject-overview),\nand\n[dune projects](https://coq.inria.fr/refman/practical-tools/utilities.html#building-a-coq-project-with-dune).\nCoqtail supports both, and while it should usually do the right thing by\ndefault, its behavior can be controlled by setting the `g:coqtail_build_system`\noption to one of `'prefer-dune'` (default), `'prefer-coqproject'`, `'dune'`, or\n`'coqproject'`.\nAdditional arguments can also be passed to the Coq executable through\n`:CoqStart` (e.g., `:CoqStart -w all`).\n\n#### Dune Settings\n\nDune projects can be configured to automatically compile the dependencies for\nthe current file on `:CoqStart` by setting `g:coqtail_dune_compile_deps = 1`.\n\n#### _CoqProject Settings\n\nBy default, Coqtail searches the current and parent directories for a\n`_CoqProject` file, but additional or different project files can be specified\nwith `g:coqtail_project_files`.\nIf multiple files are found, their argument lists will be concatenated.\nFor example, to include arguments from both `_CoqProject` and `_CoqProject.local`:\n\n```vim\nlet g:coqtail_project_files = ['_CoqProject', '_CoqProject.local']\n```\n\n### Syntax Highlighting and Indentation\n\nCoqtail also comes with an ftdetect script for Coq, as well as modified versions\nof Vincent Aravantinos' [syntax] and [indent] scripts for Coq.\nThese scripts are used by default but can be disabled by setting\n`g:coqtail_nosyntax = 1` and `g:coqtail_noindent = 1` respectively.\nFormatting of comments can be disabled with `g:coqtail_noindent_comment`.\n\nIn addition to the Coq syntax, Coqtail defines highlighting groups for the\nsentences that are currently or have already been checked by Coq (`CoqtailSent`\nand `CoqtailChecked`), any lines that raised an error (`CoqtailError`), and the\nbeginnings and ends of omitted proofs (`CoqtailOmitted`).\nBy default these are defined as:\n\n```vim\nif \u0026t_Co \u003e 16\n  if \u0026background ==# 'dark'\n    hi def CoqtailChecked ctermbg=17 guibg=#113311\n    hi def CoqtailSent    ctermbg=60 guibg=#007630\n  else\n    hi def CoqtailChecked ctermbg=17 guibg=LightGreen\n    hi def CoqtailSent    ctermbg=60 guibg=LimeGreen\n  endif\nelse\n  hi def CoqtailChecked ctermbg=4 guibg=LightGreen\n  hi def CoqtailSent    ctermbg=7 guibg=LimeGreen\nendif\nhi def link CoqtailError Error\nhi def link CoqtailOmitted coqProofAdmit\n```\n\nTo override these defaults simply set your own highlighting (`:help :hi`) before\n`syntax/coq.vim` is sourced (e.g., in your `.vimrc`).\nNote, however, that many colorschemes call `syntax clear`, which clears\nuser-defined highlighting, so it is recommended to place your settings in a\n`ColorScheme` autocommand.\nFor example:\n\n```vim\naugroup CoqtailHighlight\n  autocmd!\n  autocmd ColorScheme *\n    \\  hi def CoqtailChecked ctermbg=236\n    \\| hi def CoqtailSent    ctermbg=237\naugroup END\n```\n\nIf you feel distracted by the error highlighting while editing a failed\nsentence, you can use the sequence `\u003cleader\u003ecl` (`:CoqToLine`) while the cursor\nis inside that sentence. If it isn't, you can use `\u003cleader\u003ecE`\n(`:CoqJumpToError`) to move it to an appropriate position.\n\n### Proof Diffs\n\nSince 8.9, Coq can generate [proof diffs] to highlight the differences in the\nproof context between successive steps.\nTo enable proof diffs manually, use `:Coq Set Diffs \"on\"` or `:Coq Set Diffs \"removed\"`.\nTo automatically enable proof diffs on every `:CoqStart`, set\n`g:coqtail_auto_set_proof_diffs = 'on'` (or `= 'removed'`).\nBy default, Coqtail highlights these diffs as follows:\n\n```vim\nhi def link CoqtailDiffAdded DiffText\nhi def link CoqtailDiffAddedBg DiffChange\nhi def link CoqtailDiffRemoved DiffDelete\nhi def link CoqtailDiffRemovedBg DiffDelete\n```\n\nSee the [above instructions](#syntax-highlighting-and-indentation) on how to\noverride these defaults.\n\n### More Options\n\nSee `:help coqtail-configuration` for a description of all the configuration options.\n\n## Vim Plugin Interoperability\n\n### Jumping between matches\n\nCoqtail defines `b:match_words` patterns to support jumping between matched text\nwith `%` using the [matchup] or [matchit] plugins.\n\n### Automatically closing blocks\n\nCoqtail defines patterns to enable automatic insertion of the appropriate `End`\ncommand for code blocks such as `Section`s, `Module`s, and `match` expressions\nwith [endwise].\n\n### Tags\n\nCoqtail supports the `:tag` family of commands by locating a term on the fly\nwith `tagfunc`.\nHowever, as this relies on Coq's `Locate` command, it only works if the point\nwhere the term is defined has already been evaluated by Coq.\nAn alternative is to disable Coqtail's default `tagfunc` (`let g:coqtail_tagfunc\n= 0`) and instead use [universal-ctags] in conjunction with [coq.ctags], to\nstatically generate a `tags` file.\nThis works especially well with something like the [gutentags] plugin to\nautomatically keep the `tags` file in sync with the Coq source.\n\n### Latex/Unicode input\n\nCoqtail and Coq can handle non-ASCII characters in identifiers, notations, etc.,\nbut Coqtail does not provide a method for inputting these characters itself.\nInstead one can use one of the native Vim options (e.g.,\n[`i_CTRL-K`](https://vimhelp.org/insert.txt.html#i_CTRL-K) or\n[`i_CTRL-V_digit`](https://vimhelp.org/insert.txt.html#i_CTRL-V_digit)) or a\nplugin like [latex-unicoder] or [unicode.vim].\n\n## Thanks\n\nParts of Coqtail were originally inspired by/adapted from [Coquille] (MIT\nLicense, Copyright (c) 2013, Thomas Refis).\n\n---\n\n#### Python 2 Support\n\nPython 2 and 3.5 have reached their [end-of-life](https://pythonclock.org/) so\nCoqtail no longer supports them in order to simplify the code and take advantage\nof newer features.\nSee [YouCompleteMe] for help building Vim with Python 3 support.\nIf you cannot upgrade Vim, the [python2] branch still supports older Pythons.\n\n[python2]: https://github.com/whonore/Coqtail/tree/python2\n[Coq 8.4 - 8.20]: https://coq.inria.fr/download\n[CoqIDE]: https://coq.inria.fr/refman/practical-tools/coqide.html\n[ProofGeneral]: https://proofgeneral.github.io/\n[XML protocol]: https://github.com/coq/coq/blob/master/dev/doc/xml-protocol.md\n[vim package]: https://vimhelp.org/repeat.txt.html#packages\n[pathogen]: https://github.com/tpope/vim-pathogen\n[Vundle]: https://github.com/VundleVim/Vundle.vim\n[VimPlug]: https://github.com/junegunn/vim-plug\n[syntax]: http://www.vim.org/scripts/script.php?script_id=2063\n[indent]: http://www.vim.org/scripts/script.php?script_id=2079\n[matchup]: https://github.com/andymass/vim-matchup\n[matchit]: http://ftp.vim.org/pub/vim/runtime/macros/matchit.txt\n[endwise]: https://github.com/tpope/vim-endwise\n[proof diffs]: https://coq.inria.fr/refman/proofs/writing-proofs/proof-mode.html#coq:opt.Diffs\n[Coquille]: https://github.com/the-lambda-church/coquille\n[YouCompleteMe]: https://github.com/ycm-core/YouCompleteMe/wiki/Building-Vim-from-source\n[universal-ctags]: https://github.com/universal-ctags/ctags\n[coq.ctags]: https://github.com/tomtomjhj/coq.ctags\n[gutentags]: https://github.com/ludovicchabant/vim-gutentags\n[latex-unicoder]: https://github.com/joom/latex-unicoder.vim\n[unicode.vim]: https://github.com/chrisbra/unicode.vim\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhonore%2FCoqtail","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwhonore%2FCoqtail","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhonore%2FCoqtail/lists"}