This projects aims at gathering/developing new completion scripts that are not available in Zsh yet. The scripts are meant to be contributed to the Zsh project when stable enough.

[yuki@beaune.local]$ git clone https://github.com/zsh-users/zsh-completions.git




# zsh-completionsを利用する Github => zsh-completions  
fpath=(~/.zsh-completions $fpath)


autoload -U compinit; compinit
zstyle ':completion:*:sudo:*' command-path /usr/local/sbin /usr/local/bin \
                             /usr/sbin /usr/bin /sbin /bin /usr/X11R6/bin \




[yuki@beaune.local]$ adb <ここでTAB>


[yuki@beaune.local]$ adb bugreport 
bugreport       -- return all information from the device
connect         -- connect to a device via TCP/IP
devices         -- list all connected devices
disconnect      -- disconnect from a TCP/IP device
emu             -- run emulator console command
forward         -- forward socket connections
get-serialno       -- prints: <serial-number>
get-state          -- prints: offline | bootloader | device
help            -- show help message
install         -- push this padbage file to the device and install it
jdwp            -- list PIDs of processes hosting a JDWP transport
kill-server        -- kill the server if it is running
logcat          -- view device log
ppp                -- run PPP over USB
pull            -- copy file/dir from device
push            -- copy file/dir to device
reboot             -- reboots the device, optionally into the bootloader or recovery program
reboot-bootloader  -- reboots the device into the bootloader
remount            -- remounts the /system partition on the device read-write
root               -- restarts the adbd daemon with root permissions
shell           -- run remote shell interactively or command
start-server       -- ensure that there is a server running
status-window      -- continuously print device status for a specified device
sync            -- copy host->device only if changed
tcpip              -- restarts the adbd daemon listening on TCP on the specified port
uninstall       -- remove this app padbage from the device
usb                -- restarts the adbd daemon listening on USB
version         -- show version number



[yuki@beaune.local]$ adb shell <ここでTAB>
zsh: do you wish to see all 162 possibilities (41 lines)? 
acceld                    hostapd                   mm-aenc-omxqcelp13-test   run-as                  
am                        hostapd_cli               mm-audio-native-test      schedtest               
app_process               hostapd_wps               mm-jpeg-dec-test          schedtop                
applypatch                id                        mm-jpeg-enc-test          sdptool                 
athtestcmd                ifconfig                  mm-vdec-omx-property-mgr  sendevent               
battery_charging          iftop                     mm-vdec-omx-test          service                 
bluetoothd                ime                       mm-venc-omx-test          servicemanager          
bmgr                      input                     monkey                    setconsole              
bootanimation             insmod                    mount                     setprop                 
bugreport                 installd                  mtpd                      sh                      
cat                       ioctl                     mv                        sleep                   
chmod                     ionice                    mwmainte                  smd                     
chown                     iperf                     nandread                  start                   
cmp                       iptables                  ndc                       stop                    
cnd                       iwconfig                  netcfg                    surfaceflinger          
dalvikvm                  iwevent                   netd                      svc^M                   
date                      iwgetid                   netmgrd                   sync                    
dbus-daemon               iwlist                    netstat                   system_server           
dd                        iwmulticall               newfs_msdos               tc                      
debuggerd                 iwpriv                    nl_listener               test_diag               
dexopt                    iwspy                     notify                    tgmd                    
df                        keystore                  omx_tests                 tmsd                    
dgstmgrd                  kill                      orientationd              toolbox                 
dhcpcd                    linker                    pand                      top                     
diag_klog                 ln                        ping                      trpd                    
diag_mdlog                loc_api_app               pm                        uimd                    
dmesg                     log                       port-bridge               umount                  
dnsmasq                   logcat                    pppd                      vdc                     
dumpstate                 logwrapper                printenv                  vmstat                  
dumpsys                   ls                        ps                        vold                    
dvz                       lsmod                     qmuxd                     watchprops              
fotad                     mediaserver               racoon                    wipe                    
fsck_msdos                mkdir                     reboot                    wiperiface              
geomagneticd              mm-abl-test               recEvent                  wlan_tool               
getevent                  mm-adec-omxQcelp13-test   renice                    wmiconfig               
getprop                   mm-adec-omxaac-test       rild                      wpa_supplicant          
gzip                      mm-adec-omxevrc-test      rm                                                
handset-keypress          mm-adec-omxmp3-test       rmdir                             

利用できるコマンド一覧が補完されます。adb logcatの場合はFilterの種類が表示され、サブコマンドごとに適切な補完がされていることがわかります。


[yuki@beaune.local]$ adb logcat -<ここでTAB>
-b                           -- loads an alternate log buffer for viewing, such
-c                           -- clears (flushes) the entire log and exits
-d                           -- dumps the log to the screen and exits
-f                           -- writes log message output to file. The default 
-g                           -- prints the size of the specified log buffer and
-s                           -- sets the default filter spec to silent
-v                           -- sets the output format for log messages

[yuki@beaune.local]$ adb install -<ここでTAB>
-l                           -- forward-lock the app
-r                           -- reinstall the app, keeping its data
-s                           -- install on SD card instead of internal storage







  • 補完便利
  • 補完対象が豊富
  • たまに待ち時間が気になる補完もある
  • 設定が簡単という所が敷居が低くて良い