leaderssite.blogg.se

Ubuntu text expander
Ubuntu text expander









ubuntu text expander

Instead of adding these tags manually, you can create a simple Bash script that inserts the tags around the currently selected text fragment: #!/bin/bash Suppose you often work on articles containing light HTML markup, such as for italics, for bold, and so on. The good news is that you can easily repurpose the script for other uses.

ubuntu text expander

The original Snippy Bash script is essentially a one-trick pony: Expanding abbreviations is all it can do.

ubuntu text expander

This problem is easy to fix by adding the -delay 0 parameter to all xdotool key commands, for example: xdotool key -delay 0 ctrl+shift+Left If the script doesn't behave properly, the most likely cause is the default 12ms delay that xdotool inserts between keystrokes. Make the script executable using the chmod +x snippy.sh command, and then test the script to make sure it works. Create a new script file, paste the contents of Listing 1 in it, and save as the snippy.sh file. snippy directory and populate it with files containing text snippets.

Ubuntu text expander install#

To do the same on openSUSE, run the zypper install xsel xdotool command as root. On Debian and Ubuntu, this can be done by running the apt-get install xsel xdotool command as root. XSel and xdotool are available in the software repositories of most mainstream Linux distributions, so you can install both utilities using your distro's package manager. Before you start tweaking the script, however, you need to install the required packages. With a bit of creative tweaking, this script can be adapted for other text-expansion tasks, too. So, when you type foo and run the script, it replaces the abbreviation with the contents of the ~/.snippy/foo text file. Finally, the xdotool pastes the copied contents by simulating the Ctrl+V keyboard shortcut. The script then fetches the appropriate text file and copies its contents as the X selection. The cut abbreviation is then set as the X selection with the XSel tool.











Ubuntu text expander