Snip: a dead-simple but quite powerful text expander and more

Inspired by Snippy and snippits, I wrote a simple tool called snip.
It helps you to automatically fill in text for you (which can be dynamically created) and/or to perform custom keypresses and operations.

It works like this: you bind a key (in your WM or with xbindkeys) to launch `snip` with the `load` or `save` argument.

  • `load` will look in a folder in your $HOME for snips (small text files) and present them through dmenu. If your snip has the executable flag it will be executed, otherwise the literal contents of the file are taken. xdotool is used to type the output (which gets entered where your cursor is).
  • `save` is just a convenience wrapper that uses zenity to quickly create new snips

While comparable to snippits, I find it better because it presents the options with dmenu (you don't need to type the name on the beforehand manually), it uses the xdg basedir spec and since it uses several great, tried & proven existing utilities, it does its job in less then 50 lines of shellscript.

I wrote some some example snips which demonstrate entering static chunks of text, using xdotool for automating keypresses, aspell for automatic spell checking (and word replacing), inserting url's from your uzbl bookmarks/history, and some dynamic output based on current time, $USER and zenity input.
I'm sure a lot of people will come up with more cool things :)

Add comment