{"id":16540048,"url":"https://github.com/tyru/empty-prompt.vim","last_synced_at":"2025-11-29T08:04:47.160Z","repository":{"id":66794646,"uuid":"232033301","full_name":"tyru/empty-prompt.vim","owner":"tyru","description":"Vim plugin to add mappings only when shell prompt is empty","archived":false,"fork":false,"pushed_at":"2020-01-10T04:36:07.000Z","size":10,"stargazers_count":14,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-14T07:30:17.927Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Vim script","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tyru.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-01-06T05:51:37.000Z","updated_at":"2024-07-01T08:11:01.000Z","dependencies_parsed_at":"2023-04-15T17:17:36.278Z","dependency_job_id":null,"html_url":"https://github.com/tyru/empty-prompt.vim","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tyru%2Fempty-prompt.vim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tyru%2Fempty-prompt.vim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tyru%2Fempty-prompt.vim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tyru%2Fempty-prompt.vim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tyru","download_url":"https://codeload.github.com/tyru/empty-prompt.vim/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241774206,"owners_count":20018229,"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":[],"created_at":"2024-10-11T18:51:27.070Z","updated_at":"2025-11-29T08:04:47.095Z","avatar_url":"https://github.com/tyru.png","language":"Vim script","funding_links":[],"categories":[],"sub_categories":[],"readme":"# empty-prompt.vim\n\nVim plugin to add mappings only when shell prompt is empty\n\n## Requirements\n\n* Vim 8.2 or higher\n\n## Usage\n\nAfter installing this plugin, write this to your vimrc.\n\n```vim\nfunction! s:empty_prompt_mappings() abort\n  \" If current line is empty prompt ...\n  \n  \" : works as \u003cC-w\u003e:\n  call empty_prompt#map(#{lhs: ':', rhs: '\u003cC-w\u003e:'})\n  \" \u003cEsc\u003e works as \u003cC-w\u003eN\n  call empty_prompt#map(#{lhs: '\u003cEsc\u003e', rhs: '\u003cC-w\u003eN'})\n  \n  \" ... Add more mappings you like\n  \nendfunction\nautocmd VimEnter * ++once call s:empty_prompt_mappings()\n```\n\n## Customize\n\n`g:empty_prompt#pattern` (default: `\u0026shell =~# 'sh$' ? '\\$ $' : '\u003e\\s*$'`)\n\nIf current line on terminal window matches this pattern, fire given mapping.\n\nDefault is:\n* current line ends with `$ ` (`\u0026shell` ends with `sh` (bash/zsh/...) like Unix environment)\n* current line ends with `\u003e` (otherwise, cmd.exe/powershell like Windows)\n\nIf the default value does not fit your environment, please consider customize the value.\n\n## API\n\n### `empty_prompt#map({'lhs': \u003cstring\u003e, 'rhs': \u003cstring\u003e [, 'fallback': \u003cstring\u003e]})`\n\n```vim\ncall empty_prompt#map(#{lhs: '\u003cEsc\u003e', rhs: \"\u003cC-w\u003eN\"})\n```\n\nThis will be expanded to:\n\n```\ntnoremap \u003cexpr\u003e {lhs} empty_prompt#is_empty() ? {rhs} : {fallback}\n```\n\n`{fallback}` is optional.\nDefault `{fallback}` is same as `{lhs}`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftyru%2Fempty-prompt.vim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftyru%2Fempty-prompt.vim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftyru%2Fempty-prompt.vim/lists"}