zsh-snippets
September 25, 2016 ยท View on GitHub
Persistent zsh-snippets based on willghatch/zsh-snippets
- add, udpate, delete, list snippets
- supports auto-completion

Install: zplug
Setup aliases and widgets whihle binding keys with them
CTRL-S CTRL-Sexpands the specified snippetCTRL-S CTRL-Alists existing snippets
# in .zshrc
zplug "1ambda/zsh-snippets"
alias zsp="zsh_snippets"
bindkey '^S^S' zsh-snippets-widget-expand # CTRL-S CTRL-S (expand)
bindkey '^S^A' zsh-snippets-widget-list # CTRL-S CTRL-A (list)
Usage
All commands and snippets are auto-completed by stroking tab key
# add a `gj` snippet
$ zsp add gj "| grep java | grep -v grep"
# list snippets
# or type binded key `^s^a` (ctrl+s ctrl+a)
$ zsp list
# expand a snippet
# '!' means your current cursor in terminal, type your binded key `^s^s` (ctrl+s ctrl+s)
$ ps -ef gj!
# will be expanded into
$ ps -ef | grep java | grep -v grep
# delete a snippet
zsp delete gj
Development
Load local zsh-snippets
// in .zshrc
zplug "$SOMEWHERE/zsh-snippets", from:local, use:'snippets.plugin.zsh'
License
MIT