Search this site


Metadata

Articles

Projects

Presentations

zsh compctl

Got bored after doing some homework tonight and added a few more completions to my zsh config. The top two are yanked from petef's zshrc
compctl -g '/u9/psionic/Mail/*(/:t)' -P '+' folder
compctl -g '/var/db/pkg/*(/:t)' pkg_delete pkg_info
compctl -g "/tmp/screens/S-${USER}/*(p:t)" screen
compctl -g "*(-/D)" + -g "*.class(.:r)" java
What do they do? (Listed in order)
  • for the program 'folder' complete to any directory in /u9/psionic/Mail/ and drop the path above it (like basename(1)). Also prefix it with a '+' character.
    fury(~) [1] !127! % folder +TAB
    drafts      exec        inbox       lists       old         rtp         spam        
    duplicates  foo         jason       main        outbox      security    work        
    
  • complete package names under freebsd for pkg_delete and pkg_info
    nightfall(~/foo/project) [1021] % pkg_info TAB
    ORBit2-2.12.1_1               isc-dhcp3-server-3.0.1.r14_6  png-1.2.6
    adns-1.0_1                    jad-1.5.8c                    portupgrade-20041226_1
    aspell-0.60.2                 jpeg-6b_3                     ruby-1.8.2_3
    ... the list goes on ...
    
  • complete screen sessions
    nightfall(~/foo/project) [1022] !1! % screen -x TAB
    11950.ttyp6.nightfall  16783.ttyp2.nightfall  16852.ttypa.nightfall  709.ttyp8.nightfall
    16146.ttypn.nightfall  16801.ttyp4.nightfall  17336.ttyp0.nightfall  741.ttypc.nightfall
    
  • complete java class names without the '.class' extension
    nightfall(~/foo/project/os1/step1) [1024] % java sys/TAB
    ExitCode  Kernel    Panic