DIY Text Expander
A couple of utilities and a dash of Bash scripting are all you need to roll out a simple yet flexible text expander.
A tool that can expand abbreviations and insert ready-made text snippets can come in handy in many situations. With a bit of Bash scripting and a couple of existing utilities, you can easily build your own text expander and learn a few clever techniques in the process.
The starting point of this project is a simple Bash script published on the Arch Linux forum . This nifty script uses a combination of the XSel  and xdotool  tools to replace an abbreviation with the related text snippet (Listing 1). The xdotool, which simulates keyboard input and mouse activity, is used to select and cut the abbreviation text (by simulating the Ctrl+Shift+Left Arrow and Ctrl+X keyboard shortcuts).
The cut abbreviation is then set as the X selection with the XSel tool. The script then fetches the appropriate text file and copies its contents as the X selection. Finally, the xdotool pastes the copied contents by simulating the Ctrl+V keyboard shortcut. So, when you type
foo and run the script, it replaces the abbreviation with the contents of the
~/.snippy/foo text file.
Buy this article as PDF
Spammers go low-volume, and 90% of IE browsers are unpatched.
Adobe scrambles to release patches for vulnerable Flash Player.
Four-inch-long computer on a stick lets you boot a full Linux system from any HDMI display device.
New statute would require companies to report break-ins to consumers.
Weird data transfer technique avoids all standard security measures.
FIDO alliance declares the beginning of the end for old-style login authentication.
The Linux New Media Awards have honored the most significant products, projects, people, and organizations for open source/Linux every year since 2000.
Legendary Uber-distro splits over the systemd controversy.
New LTS version offers many refinements for the Cinnamon and Mate desktops and significant improvement under the hood.
One of CeBIT’s most successful forums returns in 2015.