Skip to content
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.
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE Format readmen with prettier Sep 10, 2018
pmenu Increment a version Jan 18, 2017
pmenu-run Change the method of opening graphical apps in background, update the… Dec 2, 2015


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.



Python 3.3+.

Usage examples

Display some menu items:

echo -e "foo\nbar\nbaz" | pmenu
pmenu foo bar baz
echo -e "foo\nbar" | pmenu baz qux

screencast 1

Pick some file from the current directory:

command ls /usr/bin/ | pmenu
find -maxdepth 3 -type f ! -path "./.git/*" ! -path "./.svn/*" -printf '%P\n' | LC_COLLATE=C sort | pmenu

screencast 2

Pick some file from the current directory for editing in VIM using Ctrl-P shortcut (a la the CtrlP plugin):

function! Pmenu()
  let item_command = "find -maxdepth 3 -type f -regextype posix-egrep ! -regex '.*/(__pycache__|\.git|\.svn|node_modules)/.*' -printf '%P\\n'"
  if isdirectory("./.git")
    let item_command = "git ls-files"
  let cache_name = fnamemodify(getcwd(), ":t")
  let items = sort(systemlist(item_command))
  let current_item = expand("%:.")
  if !empty(current_item)
    let items = filter(copy(items), "v:val != " . shellescape(current_item))
  let selected_items = systemlist("pmenu -n " . shellescape(cache_name), items)
  if !empty(selected_items)
    execute "edit " . fnameescape(selected_items[0])
nnoremap <silent> <C-P> :call Pmenu()<CR>
vnoremap <silent> <C-P> :call Pmenu()<CR>

screencast 3

Pick a title from the markdown file and jump to it:

function! PmenuMarkdownTitle()
  let titles = filter(getline(1, '$'), "v:val =~ '^#\\+\\s'")
  let selected_paths = systemlist('pmenu', titles)
  if !empty(selected_paths)
    call search('^#\+\s' . selected_paths[0])
nnoremap <silent> <C-T> :call PmenuMarkdownTitle()<CR>

Pick and show a definition from the WordNet dictionary on the dict server ( by default) using either the curl or dict command:

pmenu -c "m={} && curl -s \"dict://\${m:-a}:wn:prefix\" | awk -F \\\" '! array[tolower(\$2)]++ { print \$2 }'" | xargs -I '{}' curl -s "dict://{}:wn" | grep -vP "^(\d+ |\.)" | less
pmenu -c "dict -fm -d wn -s prefix -- {} | awk '! array[tolower(\$4)]++ { print \$4 }'" | xargs dict -d wn | less

Pick and start a VirtualBox virtual machine:

vboxmanage startvm "`vboxmanage list vms | sed 's/^"\(.*\)".*/\1/' | pmenu`"

Pick and jump to a subdirectory in ~/Projects:

cd "`cd ~/Projects; pmenu *`"


The 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.

Bind any shortcut using your desktop preferences to one the following commands depending of what terminal emulator you use:

xterm -e pmenu-run
urxvt -e pmenu-run

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.


Copy pmenu (and optionally pmenu-run) to any location from your $PATH, say /usr/local/bin.

There is the AUR package for Arch Linux:

Command-line interface

usage: pipe newline-separated menu items to stdin and/or pass them as positional arguments

positional arguments:
  item                  the menu item text

optional arguments:
  -h, --help            show this help message and exit
  -c COMMAND, --command COMMAND
                        the shell command which output will populate the menu
                        items on every keystroke ({} will be replaced by the
                        current input text)
  -n NAME, --name NAME  the cache file name with the most recently used items
  -p PROMPT, --prompt PROMPT
                        the prompt text
  -v, --version         show program's version number and exit

Keyboard shortcuts

  • Ctrl-C, Ctrl-G, Ctrl-[, Escape: quit without selecting an item
  • Ctrl-H, Backspace: delete the character before the cursor
  • Ctrl-I, Tab: complete the selected item
  • Ctrl-J, Ctrl-M, Enter: quit and output the selected item
  • Ctrl-N, 'Down': select the next item
  • Ctrl-P, 'Up': select the previous item
  • Ctrl-U: delete the entire line
  • Ctrl-W: delete the word before the cursor


dmenu-like menus

dmenu wrappers

Application launchers

Vim menus

License and copyright

The project is released under the General Public License (GPL), version 3.

Copyright © 2015, Danil Semelenov.

You can’t perform that action at this time.