ZSH completions for teamocil/itermocil

I’ve noticed that even with installed OhMyZSH I don’t get proper completions for an itermocil in Z-shell (ZSH) terminal – proper completions being list of names of files from ~/.teamocil folder, sans extensions.

I’ve looked at OhMyZSH plugins and wrote my own for itermocil – a file ~/.oh-my-zsh/plugins/itermocil/itermocil.plugin.zsh with this content:

_itermocil () {
  compadd -- `ls -1 ~/.teamocil/ | rev | cut -d "." -f 2- | rev`
}

compdef _itermocil itermocil

And added it to plugins environment variable in .zshrc.

However, while doing so I’ve noticed that my .zshrc already contained this line:

compctl -g '~/.teamocil/*(:t:r)' teamocil

Googling a bit revealed that (:t:r) modifier to * wildcard are the basename sans extension modifiers for wildcard expansion in ZSH.

Which meant all I really needed was the same line in my .zshrc again, only this time with itermocil at the end instead of teamocil.

Advertisements

My Oh-my-ZSH theme (with command run date output)

I’ve decided to share my Oh-my-ZSH theme.

People used to have themes that include date/time in the prompt, but that’s only useful to know when command before prompt finished executing.
However, it doesn’t say much regarding time of command execution start.

For sure, if you open terminal and get prompt with 13:00:00 you can wait 5 minutes and then exec some command – for example echo or ls.
The command finishes, say, in 1 second, showing you 13:05:01 in new prompt. That lets you know when command finished. But not when it started.

I’ve added additional output of start datetime via preexec_functions hook of ZSH.

Here’s the code (moved to pastebing ’cause can’t get WordPress not to ruin slashes/backslashes )-: ) and a sample screenshot:
http://pastebin.com/cUvrbsgv

UPD: I’ve also fixed colorizing and moved end time to separate output (and also removed timestamp from prompt completely since it’s no longer useful to have it in prompt)

MVMn Oh-my-ZSH theme 2.1.1

UPD: My OhMyZSH themes are now on GitHub – github.com/mvmn/dotfiles/tree/master/.oh-my-zsh/themes