{"id":13857218,"url":"https://github.com/sgtpep/pmenu","last_synced_at":"2025-04-11T20:30:38.139Z","repository":{"id":2292263,"uuid":"44352682","full_name":"sgtpep/pmenu","owner":"sgtpep","description":"A dynamic terminal-based menu inspired by dmenu written in Python without dependencies with an optional MRU ordering which could also be used as an application launcher and CtrlP alternative.","archived":false,"fork":false,"pushed_at":"2022-03-29T02:59:00.000Z","size":94,"stargazers_count":124,"open_issues_count":4,"forks_count":6,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-25T16:22:42.150Z","etag":null,"topics":["application-launcher","ctrlp","dmenu","ncurses","vim"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sgtpep.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-16T00:16:32.000Z","updated_at":"2025-03-01T14:31:06.000Z","dependencies_parsed_at":"2022-08-06T12:01:33.325Z","dependency_job_id":null,"html_url":"https://github.com/sgtpep/pmenu","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgtpep%2Fpmenu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgtpep%2Fpmenu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgtpep%2Fpmenu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgtpep%2Fpmenu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sgtpep","download_url":"https://codeload.github.com/sgtpep/pmenu/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248476085,"owners_count":21110209,"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":["application-launcher","ctrlp","dmenu","ncurses","vim"],"created_at":"2024-08-05T03:01:30.340Z","updated_at":"2025-04-11T20:30:38.116Z","avatar_url":"https://github.com/sgtpep.png","language":"Python","funding_links":[],"categories":["Python","\u003ca name=\"option-picker\"\u003e\u003c/a\u003eFuzzy finders and option pickers"],"sub_categories":[],"readme":"# pmenu\n\nA dynamic terminal-based menu inspired by dmenu written in Python without dependencies with an optional [MRU](https://en.wikipedia.org/wiki/Most_Recently_Used) ordering which could also be used as an application launcher and CtrlP alternative.\n\nDiscussion: https://bbs.archlinux.org/viewtopic.php?id=201674.\n\n## Dependencies\n\nPython 3.3+.\n\n## Usage examples\n\nDisplay some menu items:\n\n```bash\necho -e \"foo\\nbar\\nbaz\" | pmenu\npmenu foo bar baz\necho -e \"foo\\nbar\" | pmenu baz qux\n```\n\n![screencast 1](https://raw.githubusercontent.com/sgtpep/pmenu/master/screencasts/1.gif)\n\nPick some file from the current directory:\n\n```bash\ncommand ls /usr/bin/ | pmenu\nfind -maxdepth 3 -type f ! -path \"./.git/*\" ! -path \"./.svn/*\" -printf '%P\\n' | LC_COLLATE=C sort | pmenu\n```\n\n![screencast 2](https://raw.githubusercontent.com/sgtpep/pmenu/master/screencasts/2.gif)\n\nPick some file from the current directory for editing in VIM using Ctrl-P shortcut (a la the [CtrlP](http://kien.github.io/ctrlp.vim/) plugin):\n\n```vim\nfunction! Pmenu()\n  let item_command = \"find -maxdepth 3 -type f -regextype posix-egrep ! -regex '.*/(__pycache__|\\.git|\\.svn|node_modules)/.*' -printf '%P\\\\n'\"\n  if isdirectory(\"./.git\")\n    let item_command = \"git ls-files\"\n  endif\n  let cache_name = fnamemodify(getcwd(), \":t\")\n  let items = sort(systemlist(item_command))\n  let current_item = expand(\"%:.\")\n  if !empty(current_item)\n    let items = filter(copy(items), \"v:val != \" . shellescape(current_item))\n  endif\n  let selected_items = systemlist(\"pmenu -n \" . shellescape(cache_name), items)\n  if !empty(selected_items)\n    execute \"edit \" . fnameescape(selected_items[0])\n  endif\n  redraw!\nendfunction\nnnoremap \u003csilent\u003e \u003cC-P\u003e :call Pmenu()\u003cCR\u003e\nvnoremap \u003csilent\u003e \u003cC-P\u003e :call Pmenu()\u003cCR\u003e\n```\n\n![screencast 3](https://raw.githubusercontent.com/sgtpep/pmenu/master/screencasts/3.gif)\n\nPick a title from the markdown file and jump to it:\n\n```vim\nfunction! PmenuMarkdownTitle()\n  let titles = filter(getline(1, '$'), \"v:val =~ '^#\\\\+\\\\s'\")\n  let selected_paths = systemlist('pmenu', titles)\n  if !empty(selected_paths)\n    call search('^#\\+\\s' . selected_paths[0])\n  endif\n  redraw!\nendfunction\nnnoremap \u003csilent\u003e \u003cC-T\u003e :call PmenuMarkdownTitle()\u003cCR\u003e\n```\n\nPick and show a definition from the WordNet dictionary on the dict server (dict.org by default) using either the curl or dict command:\n\n```bash\npmenu -c \"m={} \u0026\u0026 curl -s \\\"dict://dict.org/m:\\${m:-a}:wn:prefix\\\" | awk -F \\\\\\\" '! array[tolower(\\$2)]++ { print \\$2 }'\" | xargs -I '{}' curl -s \"dict://dict.org/d:{}:wn\" | grep -vP \"^(\\d+ |\\.)\" | less\npmenu -c \"dict -fm -d wn -s prefix -- {} | awk '! array[tolower(\\$4)]++ { print \\$4 }'\" | xargs dict -d wn | less\n```\n\nPick and start a VirtualBox virtual machine:\n\n```bash\nvboxmanage startvm \"`vboxmanage list vms | sed 's/^\"\\(.*\\)\".*/\\1/' | pmenu`\"\n```\n\nPick and jump to a subdirectory in ~/Projects:\n\n```bash\ncd \"`cd ~/Projects; pmenu *`\"\n```\n\n## pmenu-run\n\nThe script `pmenu-run` is an example of an application launcher built with `pmenu` similar to `dmenu_run`, `gmrun` and `bashrun`. It builds the menu from system \\*.desktop files and launches the selected item in the current terminal or detached from it depending on the application type.\n\nBind any shortcut using your desktop preferences to one the following commands depending of what terminal emulator you use:\n\n```bash\nxterm -e pmenu-run\nurxvt -e pmenu-run\n```\n\n`pmenu-run` passes all provided additional options to `pmenu`. This could be used to add more items to the launcher menu, like `pmenu-run command1 command2 command3`.\n\n## Installation\n\nCopy `pmenu` (and optionally `pmenu-run`) to any location from your `$PATH`, say `/usr/local/bin`.\n\nThere is the AUR package for Arch Linux: https://aur.archlinux.org/packages/pmenu/.\n\n## Command-line interface\n\n```\nusage: pipe newline-separated menu items to stdin and/or pass them as positional arguments\n\npositional arguments:\n  item                  the menu item text\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -c COMMAND, --command COMMAND\n                        the shell command which output will populate the menu\n                        items on every keystroke ({} will be replaced by the\n                        current input text)\n  -n NAME, --name NAME  the cache file name with the most recently used items\n  -p PROMPT, --prompt PROMPT\n                        the prompt text\n  -v, --version         show program's version number and exit\n```\n\n## Keyboard shortcuts\n\n- `Ctrl-C`, `Ctrl-G`, `Ctrl-[`, `Escape`: quit without selecting an item\n- `Ctrl-H`, `Backspace`: delete the character before the cursor\n- `Ctrl-I`, `Tab`: complete the selected item\n- `Ctrl-J`, `Ctrl-M`, `Enter`: quit and output the selected item\n- `Ctrl-N`, 'Down': select the next item\n- `Ctrl-P`, 'Up': select the previous item\n- `Ctrl-U`: delete the entire line\n- `Ctrl-W`: delete the word before the cursor\n\n## Alternatives\n\n### dmenu-like menus\n\n- [Heatseeker](https://github.com/rschmitt/heatseeker) `Rust` `terminal`\n- [Icepick](https://github.com/felipesere/icepick) `Rust` `terminal`\n- [PathPicker](https://facebook.github.io/PathPicker/) `Python` `terminal`\n- [Selecta](https://github.com/garybernhardt/selecta) `Ruby` `terminal`\n- [bemenu](https://github.com/Cloudef/bemenu) `C` `Wayland` `X11` `terminal`\n- [dmenu2](https://bitbucket.org/melek/dmenu2) `C` `X11`\n- [dmenu](http://tools.suckless.org/dmenu/) `C` `X11`\n- [fzf](https://github.com/junegunn/fzf) `Go` `terminal`\n- [fzy](https://github.com/jhawthorn/fzy) `C` `terminal`\n- [gof](https://github.com/mattn/gof) `Go` `terminal`\n- [gpicker](http://www.nongnu.org/gpicker/) `C` `X11`\n- [happyfinder](https://github.com/hugows/hf) `Go` `terminal`\n- [hmenu](https://github.com/sulami/hmenu) `Haskell` `terminal`\n- [peco](https://github.com/peco/peco) `Go` `terminal`\n- [percol](https://github.com/mooz/percol) `Python` `terminal`\n- [pick](https://github.com/thoughtbot/pick) `C` `terminal`\n- [rofi](https://github.com/DaveDavenport/rofi) `C` `X11`\n- [selector](http://fleuret.org/cgi-bin/gitweb/gitweb.cgi?p=selector) `C` `terminal`\n- [slmenu](https://bitbucket.org/rafaelgg/slmenu) `C` `terminal`\n- [smenu](https://github.com/p-gen/smenu) `C` `terminal`\n- [tmenu](https://github.com/dhamidi/tmenu) `C` `terminal`\n- [tpick](https://github.com/smblott-github/tpick) `C` `terminal`\n- [ppick](https://github.com/alanbork/ppick) 'C' 'terminal'\n- [vis-menu](http://martanne.github.io/vis/man/vis-menu.1.html) `C` `terminal`\n\n### dmenu wrappers\n\n- [Yeganesh](http://dmwit.com/yeganesh/) `Haskel`\n- [xboomx](https://github.com/victorhaggqvist/xboomx) `Python`\n- [yegonesh](https://github.com/klowner/yegonesh) `Go`\n\n### Application launchers\n\n- [Albert](https://github.com/ManuelSchneid3r/albert) `C++` `X11`\n- [Kupfer](http://engla.github.io/kupfer/) `Python` `X11`\n- [bashrun2](http://henning-bekel.de/bashrun2/) `Bash` `terminal`\n- [bashrun](http://bashrun.sourceforge.net/) `Bash` `terminal`\n- [dmenu_run](http://tools.suckless.org/dmenu/) `Shell` `X11`\n- [gmrun](http://sourceforge.net/projects/gmrun/) `C` `X11`\n- [lighthouse](https://github.com/emgram769/lighthouse) `C` `X11`\n- [rrun](https://github.com/buster/rrun) `Rust` `X11`\n- [shellex](https://github.com/Merovius/shellex) `C` `X11`\n- [xboomx](https://github.com/victorhaggqvist/xboomx) `Python` `X11`\n- [xlauncher](https://github.com/vatriani/xlauncher) `C` `X11`\n\n### Vim menus\n\n- [CtrlP](http://kien.github.io/ctrlp.vim/)\n- [FuzzyFinder](http://www.vim.org/scripts/script.php?script_id=1984)\n- [LeaderF](https://github.com/Yggdroot/LeaderF)\n- [LustyExplorer](http://www.vim.org/scripts/script.php?script_id=1890)\n- [LycosaExplorer](http://www.vim.org/scripts/script.php?script_id=3659)\n- [Unite](https://github.com/Shougo/unite.vim)\n- [asyncfinder.vim](https://github.com/vim-scripts/asyncfinder.vim)\n- [ku](http://www.vim.org/scripts/script.php?script_id=2337)\n\n## License and copyright\n\nThe project is released under the General Public License (GPL), version 3.\n\nCopyright © 2015, Danil Semelenov.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsgtpep%2Fpmenu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsgtpep%2Fpmenu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsgtpep%2Fpmenu/lists"}