When writing shell scripts, it is frequently necessary to call external commands in $PATH. Some of these have long names (e.g. system-config-printer-applet or xfwm4-workspace-settings), and it would be useful to be able to complete them while in insert mode. Shells like bash and zsh have this capability built in.However, this isn't built into any of Vim's ins-completion defaults.http://vimdoc.sourceforge.net/htmldoc/insert.html#ins-completionThe feature was requested in 2004, but does not seem to have been implemented since then.http://comments.gmane.org/gmane.editors.vim/26022Is there a setting or plugin to enable this?
Insert mode completion of executables in `$PATH` (like `compgen -c`)
autocompletion;external command
This recipe enables dictionary completion for shell scripts via regular keyword completion and omni completion:Add the following lines to ~/.vimrc to enable dictionary completion in shell scripts:augroup shellscripts     prevent duplicates if .vimrc is sourced twice.    autocmd!     tell Vim where the dictionary is    autocmd FileType sh setlocal complete+=k~/shellcmds.txt dictionary=~/shellcmds.txt     completions for hyphenated commands    autocmd FileType sh setlocal iskeyword+=-     generate the dictionary    autocmd FileType sh call system(compgen -c > ~/shellcmds.txt)augroup ENDOpen a shell script in a new Vim instance.Press <C-n> (keyword completion) or <C-x><C-k> (omni completion) in insert mode to perform completion.If you want to keep your vimrc lean and clean, you can move the important bits of the snippet above in a proper ftplugin.The file:~/.vim/after/ftplugin/sh.vimIts content:setlocal complete+=k~/shellcmds.txtsetlocal dictionary=~/shellcmds.txtsetlocal iskeyword+=-silent call system(compgen -c > ~/shellcmds.txt)Dictionary completion is a cheap and easy way to get completion for unsupported languages and frameworks.