{"id":15168742,"url":"https://github.com/whonore/coqtail","last_synced_at":"2025-05-16T07:07:21.997Z","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":291,"open_issues_count":33,"forks_count":35,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-05-13T16:40:05.101Z","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-05-11T13:37:01.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":254485065,"owners_count":22078767,"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-09-27T06:41:18.091Z","updated_at":"2025-05-16T07:07:21.935Z","avatar_url":"https://github.com/whonore.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"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/actions/workflows/vim-tests.yml/badge.svg?branch=main)](https://github.com/whonore/Coqtail/actions/workflows/vim-tests.yml)\n[![Python Tests](https://github.com/whonore/Coqtail/actions/workflows/python-tests.yml/badge.svg?branch=main)](https://github.com/whonore/Coqtail/actions/workflows/python-tests.yml)\n[![Rocq Tests](https://github.com/whonore/Coqtail/actions/workflows/coq-tests.yml/badge.svg?branch=main)](https://github.com/whonore/Coqtail/actions/workflows/coq-tests.yml)\n\n## Interactive Rocq Proofs in Vim\n\nCoqtail enables interactive Rocq (née Coq) proof development in Vim similar to\n[RocqIDE] or [ProofGeneral].\n\nIt supports:\n- [Rocq 8.4 - 9.0]\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 Rocq sessions in different buffers\n- Non-blocking communication between Vim and Rocq (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- [Rocq 8.4 - 9.0]\n\nNewer versions of Rocq have not yet been tested, but should still work as long\nas there are no major changes made to the [XML protocol].\nNote that for Rocq \u003e=8.9, the `coqidetop` executable must be available, which\nmay require additionally installing RocqIDE depending on the installation method.\nSee [here](#rocq-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`).\nAll commands with a `Rocq` prefix also have an alias beginning with `Coq`.\nSee `:help coqtail` for more details.\n\n| Command | Mapping | Description |\n|---|---|---|\n| **Starting and Stopping** | |\n| `RocqStart` | `\u003cleader\u003ecc` | Launch Coqtail in the current buffer. |\n| `RocqStop` | `\u003cleader\u003ecq` | Quit Coqtail in the current buffer. |\n| `RocqInterrupt` | `CTRL-C` | Send SIGINT to Rocq. |\n| **Movement** | |\n| `{n}RocqNext` | `\u003cleader\u003ecj` | Send the next `n` (1 by default) sentences to Rocq. |\n| `{n}RocqUndo` | `\u003cleader\u003eck` | Step back `n` (1 by default) sentences. |\n| `{n}RocqToLine` | `\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}RocqOmitToLine` | No default (see [Mappings](#mappings)) | Same as `RocqToLine`, 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 RocqOmitToLine` for more information. |\n| `RocqToTop` | `\u003cleader\u003ecT` | Rewind to the beginning of the file. |\n| `RocqJumpToEnd` | `\u003cleader\u003ecG` | Move the cursor to the end of the checked region. |\n| `RocqJumpToError` | `\u003cleader\u003ecE` | Move the cursor to the start of the error region. |\n| `RocqGotoDef[!] \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| `Rocq \u003cargs\u003e` | | Send arbitrary queries to Rocq (e.g. `Check`, `About`, `Print`, etc.). |\n| `Rocq 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| `Rocq About \u003carg\u003e` | `\u003cleader\u003eca` | Show information about `\u003carg\u003e`. |\n| `Rocq Print \u003carg\u003e` | `\u003cleader\u003ecp` | Show the definition of `\u003carg\u003e`. |\n| `Rocq Locate \u003carg\u003e` | `\u003cleader\u003ecf` | Show where `\u003carg\u003e` is defined. |\n| `Rocq Search \u003cargs\u003e` | `\u003cleader\u003ecs` | Show theorems about `\u003cargs\u003e`. |\n| **Panel Management** | |\n| `RocqRestorePanels` | `\u003cleader\u003ecr` | Re-open the Goal and Info panels. |\n| `{n}RocqGotoGoal` | `\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}RocqGotoGoal!` | `\u003cleader\u003ecgG` | Scroll the Goal panel to the end of the `n`th goal. |\n| `RocqGotoGoalNext` | `]g` | Scroll the Goal panel to the start of the next goal. |\n| `RocqGotoGoalNext!` | `]G` | Scroll the Goal panel to the end of the next goal. |\n| `RocqGotoGoalPrev` | `[g` | Scroll the Goal panel to the start of the previous goal. |\n| `RocqGotoGoalPrev!` | `[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 `RocqNext`, 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\u003eRocqInterrupt` 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\u003eRocqNext\n  imap \u003cbuffer\u003e \u003cS-Left\u003e \u003cPlug\u003eRocqToLine\n  imap \u003cbuffer\u003e \u003cS-Up\u003e \u003cPlug\u003eRocqUndo\n  nmap \u003cbuffer\u003e \u003cS-Down\u003e \u003cPlug\u003eRocqNext\n  nmap \u003cbuffer\u003e \u003cS-Left\u003e \u003cPlug\u003eRocqToLine\n  nmap \u003cbuffer\u003e \u003cS-Up\u003e \u003cPlug\u003eRocqUndo\nendfunction\n```\n\nAdding that snippet to your `.vimrc` would create new bindings for `RocqNext`,\n`RocqToLine`, and `RocqUndo`.\nThose bindings would be active in all Rocq buffers, including Coqtail panels,\nbut inactive in other buffers.\nThe standard Coqtail bindings (`\u003cleader\u003ecj`, etc) would remain active.\n\n### Rocq 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 Rocq 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 Rocq project settings:\n[`_CoqProject` files](https://rocq-prover.org/doc/master/refman/practical-tools/utilities.html#building-a-project-with-coqproject-overview),\nand\n[dune projects](https://rocq-prover.org/doc/master/refman/practical-tools/utilities.html#building-a-rocq-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 Rocq executable through\n`:RocqStart` (e.g., `:RocqStart -w all`).\n\n#### Dune Settings\n\nDune projects can be configured to automatically compile the dependencies for\nthe current file on `:RocqStart` 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 Rocq, as well as modified\nversions of Vincent Aravantinos' [syntax] and [indent] scripts for Rocq.\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 Rocq syntax, Coqtail defines highlighting groups for the\nsentences that are currently or have already been checked by Rocq (`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` (`:RocqToLine`) while the cursor\nis inside that sentence.\nIf it isn't, you can use `\u003cleader\u003ecE` (`:RocqJumpToError`) to move it to an\nappropriate position.\n\n### Proof Diffs\n\nSince 8.9, Rocq can generate [proof diffs] to highlight the differences in the\nproof context between successive steps.\nTo enable proof diffs manually, use `:Rocq Set Diffs \"on\"` or `:Rocq Set Diffs\n\"removed\"`.\nTo automatically enable proof diffs on every `:RocqStart`, 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 Rocq's `Locate` command, it only works if the point\nwhere the term is defined has already been evaluated by Rocq.\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 Rocq source.\n\n### Latex/Unicode input\n\nCoqtail and Rocq can handle non-ASCII characters in identifiers, notations,\netc., but 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[Rocq 8.4 - 9.0]: https://rocq-prover.org/install\n[RocqIDE]: https://rocq-prover.org/doc/master/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://rocq-prover.org/doc/master/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"}