{"id":22031843,"url":"https://github.com/cheat/vim-cheat","last_synced_at":"2025-07-17T09:34:59.385Z","repository":{"id":72085091,"uuid":"293575300","full_name":"cheat/vim-cheat","owner":"cheat","description":"A natural-language snippet manager for `vim`","archived":false,"fork":false,"pushed_at":"2020-09-07T16:14:27.000Z","size":6,"stargazers_count":11,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-02T12:29:39.939Z","etag":null,"topics":["cheat","cheatsheets","natural-language","snippets-manager","vim","vim-plugin"],"latest_commit_sha":null,"homepage":"","language":"Vim script","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/cheat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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":"2020-09-07T16:14:06.000Z","updated_at":"2024-05-06T11:44:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"655ca2b1-8273-48a6-8cb2-8ee129fc0a32","html_url":"https://github.com/cheat/vim-cheat","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/cheat/vim-cheat","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheat%2Fvim-cheat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheat%2Fvim-cheat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheat%2Fvim-cheat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheat%2Fvim-cheat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cheat","download_url":"https://codeload.github.com/cheat/vim-cheat/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheat%2Fvim-cheat/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265589542,"owners_count":23793558,"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":["cheat","cheatsheets","natural-language","snippets-manager","vim","vim-plugin"],"created_at":"2024-11-30T08:23:44.384Z","updated_at":"2025-10-14T12:06:00.588Z","avatar_url":"https://github.com/cheat.png","language":"Vim script","funding_links":[],"categories":[],"sub_categories":[],"readme":"vim-cheat\n=========\n`vim-cheat` is a natural-language snippet manager for `vim`, built atop\n[cheat][] and [fzf][].\n\nWhile the goal of most snippet managers is to minimize keystrokes, `vim-cheat`\naims to reduce the cognitive load associated with common programming tasks. It\ndoes so by providing a task-focused repository of snippets that can be\nqueried with natural language.\n\n`vim-cheat` is context-aware, and can be configured to return only snippets\nthat are relevant to the `filetype` of the current buffer. This makes\n\"polyglot\" work less mentally taxing by reducing the cost of context-switching\namong languages.\n\nUse `vim-cheat` in conjunction with [snippets][].\n\n\nExample\n-------\n`vim-cheat` works by leveraging `cheat`'s tagging mechanism: `vim-cheat` uses\n`fzf.vim` to filter and retrieve cheatsheets by tag.\n\nAs a concrete example, imagine that we're writing a Go application that must\nconnect to MySQL. Which method does this?\n\nIs it `mysql_connect`? Err, no - that's PHP. I think it's `mysql.createConnection`?\nWait, no - that's Node. Is it `mysql.connector.connect`? Ah, no - that's\nPython.\n\n`vim-cheat` frees us from having to remember these details. Run `:Cheat` and\ntype `connect database` into the prompt, and the appropriate Go snippet will\nbe pasted into your buffer. (Snippets can be pasted from insert mode as well.)\n\n\nInstallation\n------------\n`vim-cheat` can be installed as described in `:help packages`, or by using a\npackage manager like Pathogen, Vundle, or Plug.\n\n`vim-cheat` additionally requires that the following dependencies be\ninstalled:\n\n- `cheat`:   https://github.com/cheat/cheat\n- `fzf`:     https://github.com/junegunn/fzf\n- `fzf.vim`: https://github.com/junegunn/fzf.vim\n\nYou are encouraged cultivate a snippet collection that best serves your\npersonal needs. With that said, the following repository serves as a starting\npoint:\n\nhttps://github.com/cheat/snippets\n\n\nFunctions\n---------\n#### cheat#read_ft ####\nRead a snippet into the current buffer. The `fzf` selection menu will contain\nonly cheatsheets that are tagged with the buffer's `filetype`.\n\n\n#### cheat#read_all ####\n\nRead a snippet into the current buffer. The `fzf` selection menu will contain\nall cheatsheets available on all cheatpaths.\n\n\n#### cheat#read_smart ####\nRead a snippet into the current buffer. If the buffer's `filetype` is known,\nthe `fzf` selection menu will contain only cheatsheets that are tagged with\nthe buffer's `filetype`. Otherwise, the selection menu will contain all\ncheatsheets available on all cheatpaths.\n\n\n#### cheat#edit_ft ####\nOpen an existing cheatsheet for editing. The `fzf` selection menu will contain\nonly cheatsheets that are tagged with the buffer's `filetype`. (Note that it\nis not currently possible to create a new cheatsheet using this function.)\n\n\n#### cheat#edit_all ####\nOpen a cheatsheet for editing. The `fzf` selection menu will contain all\ncheatsheets available on all cheatpaths. (Note that it is not currently\npossible to create a new cheatsheet using this function.)\n\n\n#### cheat#edit_smart ####\nOpen an existing cheatsheet for editing. If the buffer's `filetype` is known,\nthe `fzf` selection menu will contain only cheatsheets that are tagged with\nthe buffer's `filetype`. Otherwise, the selection menu will contain all\ncheatsheets available on all cheatpaths. (Note that it is not currently\npossible to create a new cheatsheet using this function.)\n\n\n#### cheat#dirs ####\nDisplay the configured cheatsheet directories. (This function simply wraps the\n`cheat -d` command.)\n\n\n#### cheat#tags ####\nDisplay the cheatsheet tags that are in use. (This function simply wraps the\n`cheat -T` command.)\n\n\n#### cheat#version ####\nDisplay the current `cheat` version. (This function simply wraps the `cheat -v`\ncommand.)\n\n\nOptions\n-------\n#### cheat_bin ####\nThe path to the `cheat` executable. Defaults to `cheat`.\n\n\n#### cheat_fzf_options ####\nOptions that will be passed to `fzf`. Defaults to the following:\n\n\n```vim\ng:cheat_fzf_options = [\n      \\    '--header-lines',\n      \\    '1',\n      \\    '--tiebreak',\n      \\    'begin',\n      \\    '--preview-window',\n      \\    'right:40%',\n      \\    '--preview',\n      \\    g:cheat_fzf_preview,\n      \\]\n```\n\n\n#### cheat_fzf_preview ####\nThe command `fzf` will use for generating a cheatsheet preview. Defaults to the\nfollowing:\n\n```bash\n  cheat --colorize `echo {} | cut -f1 -d\" \"`\n```\n\n\n## Config ##\nYou should map the functions exposed by this plugin to convenient wrappers in\nyour `vimrc`. The following is an example configuration:\n\n```vim\n\" ex-mode commands:\ncommand Cheat call cheat#read_smart()\ncommand CheatDirs call cheat#dirs()\ncommand CheatEdit call cheat#edit_smart()\ncommand CheatVersion call cheat#version()\n\n\" insert-mode: press Ctrl+s to open snippet selection menu:\ninoremap \u003cc-s\u003e \u003cc-o\u003e:call cheat#read_smart()\u003cCR\u003e\n```\n\nBecause `vim-cheat` wraps the `cheat` executable, you must configure your\n`cheatpaths` as well. Example:\n\n```yaml\ncheatpaths:\n  - name: snippet-community\n    path: ~/path/to/community/snippets\n    tags: [ snippet ]\n    readonly: true\n\n  - name: snippet-personal\n    path: ~/path/to/personal/snippets\n    tags: [ snippet, personal ]\n    readonly: false\n```\n\nSee the `cheat` project documentation for more information on configuring\n`cheatpaths`:\n\nhttps://github.com/cheat/cheat/#cheatpaths\n\nSee Also\n--------\n`vim-cheat` pairs nicely with [vim-so][].\n\n[cheat]:    https://github.com/cheat/cheat\n[fzf.vim]:  https://github.com/junegunn/fzf.vim\n[fzf]:      https://github.com/junegunn/fzf\n[snippets]: https://github.com/cheat/snippets\n[vim-so]:   https://github.com/cheat/vim-so\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheat%2Fvim-cheat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcheat%2Fvim-cheat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheat%2Fvim-cheat/lists"}