Snippits is a text expansion ruby program for Linux like Texter and Textpander. This howto describes how to get it up and running on Ubuntu gutsy.
1) install necessary packages
Code:
sudo apt-get install ruby ruby1.8-dev rdoc rubygems libruby-extras xautomation xsel aspell libaspell-dev aspell-en build-essential
sudo gem install raspell
sudo gem install snippits
update: thanks to the raven for pointing out that raspell has some additional dependencies
2) modify your path. NOTE: according to the lifehacker article, it looks as though this step may not be necessary. who knows, try it both ways.
Once those are done, you need to add the gems bin folder to your path. Put the following line at the end of your ~/.profile.
Code:
export PATH="/var/lib/gems/1.8/bin:$PATH"
3) logout and login
You'll want to logout and log back in for the changes to your path to take effect.
4) Create your snippits folder
Create a folder called ~/.snippits
Confirm everything is working
You now have everything you need to run snippits. Make a file called test in the ~/.snippits folder.
Code:
gedit ~/.snippits/test
Type any sort of text you want in there, save and close. Now open gedit again. Now we're really going to make sure everything is in place. With gedit in front of you, do the following:
- Press Alt+F2 to pull up the Run Command... dialog box
- Type 'ks test' and hit enter
What you typed in the the ~/.snippits/test file should get typed into gedit.
Time to make things smooth...
Now that snippits is working, we want to make it easy to use:
5) Create a {paste} snippit
Code:
gedit ~/.snippits/do
Put the following into the file:
Code:
{shift}{control}{left}{shift}c{control}{paste}
Save and close the file
6) Map a keyboard shortcut to 'ks do'
There are several ways to do this and it's too hard for me to describe them all. I'll cover the compiz way for now.
Install compizconfig-settings-manager
Code:
sudo apt-get install compizconfig-settings-manager
Go to System -> Preferences -> Advanced Desktop Effect Settings
You should see something that looks similar to below:
Click on General Settings and then the commands tab.
Type in
to command 0, then click on the actions tab and click the arrow next to the commands line item. Click on run command 0, and press a shortcut key (I used f6).
Close Advanced Desktop Effect Settings.
7) Test this setup
Create another snippit, we'll call this one test2
Code:
gedit ~/.snippits/test2
Put something in here, save it, and close.
Open up gedit again, type test2 and hit your shortcut key (f6 in my case).
If everything has gone according to plan, the text should automatically be highlighted, copied to the clipboard, and then the snippit called test2 will be expanded.
Now all you need to do to have a shortcut that can be expanded is to name a single word file (like email) in your ~/.snippits folder. Put your email address in there. Now you can type email<f6> in just about any X program that supports the copy operation with ctrl+c to have your email address quickly expanded.
Good luck, and happy texting.