https://github.com/willghatch/zsh-snippets
Snippet expansion for zsh
https://github.com/willghatch/zsh-snippets
Last synced: 5 months ago
JSON representation
Snippet expansion for zsh
- Host: GitHub
- URL: https://github.com/willghatch/zsh-snippets
- Owner: willghatch
- Created: 2014-11-17T04:08:34.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2018-03-09T21:18:35.000Z (about 7 years ago)
- Last Synced: 2024-08-13T07:15:53.928Z (8 months ago)
- Language: Shell
- Size: 125 KB
- Stars: 36
- Watchers: 3
- Forks: 7
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- jimsghstars - willghatch/zsh-snippets - Snippet expansion for zsh (Shell)
README
Install
-------For the lazy:
git clone https://github.com/willghatch/zsh-snippets.git
echo "source zsh-snippets/snippets.plugin.zsh" >> ~/.zshrcBetter, use [zgen](https://github.com/tarjoilija/zgen) or antigen. Here is how to do it with zgen:
zgen load willghatch/zsh-snippets
The Magic
---------Expand text anywhere on the command line, like aliases.
ps aux tg! # ! represents cursor position
# M-x snippet-expand, or hopefully you bind it to a key
ps aux | grep! # ! is your new cursor positionAdd snippets
snippet-add d "/my/long/directory/or/something like that"
# then you can expand d to... that long thingList snippets
help-list-snippets # pulls up help in a your pager
# or
# M-x run-help-list-snippets -- does the same thingThis snippet stuff has been floating around in a few different forms and names. I think the first version was from http://zshwiki.org/home/examples/zleiab. My version adds some (in my opinion) handy interface functions, and packages it in a plugin for easy use with antigen.
License
-------I've seen parts of this code all over the web, so I assume it's fair game. All my contributions I dedicate to the public domain.