Playing online?
Can't get Ctrl+V to work correctly for ComputerCraft?
Fighting the urge to scoop your eyes out with a rusty spoon white trying to program in ComputerCraft directly?
Did you know you can get linux to type the contents of the clipboard into minecraft?... Here's how:
First, install some tools:
You'll need to install "xdotool" and "xbindkeys."
You can install these from the command line with "[sudo] apt-get install xdotool, xbindkeys"
Then, copy and paste this script
.. into a sensible location (for example, to "~/autopaste.py)
You'll need to make that script 'runnable', which assuming you've saved it as something like "~/autopaste.py" can be done (via command line) with "chmod +x autopaste.py"
Grab "Pyperclip" for clipboard access
The excellent "pyperclip" module is required, so you'll need to follow that link, and save "pyperclip.py" in the same location.
Set up configuration file for xbindkeys
Then, get xbindkeys to create a default config file and place it where it'll get automatically loaded using:
"xbindkeys --defaults > $HOME/.xbindkeysrc"
Open up this file, and comment out those examples if you don't want them. We're going to add a command to this config file to run the script you copied when you press "Windows+V". Copy the command below into the file:
"~/autoclip.py"
Mod4+Super_L+v
Last, watch it run:
Make sure xbindkeys is running (you can also check the current shortcut keys with "xbindkeys -s"), then open up an editor in ComputerCraft (within minecraft), copy some code to the clipboard (just as you would normally), and hit "Windows+V"... you should now see linux doing the frantic typing for you, leaving you to make coffee.
More info + Other notes:
Spoiler
Changing the shortcut key
If you want to change the key combination, run "xbindkeys -mk", press the key combination you want, and replace "Mod4+Super_L+v" in the config file with the results that xbindkeys prints out for you.
Changing the typing speed
At the top of "~/autoclip.py" (assuming that is what you saved the script above as), there is a variable "key_press_delay_ms" which is the delay (in milliseconds) between each key press. If you find the typing speed too fast (for example, if latency is causing characters to skip), increase the delay.
It's missing characters as it's typing!
You may have too much lag on your connection for how fast the clipboard is being typed. See "Changing the typing speed" for help with that.
You can, but I find when using linux that only the first line gets pasted - even then, the last character is removed.
I suspect it's caused by *nix using single character for line return, where windows uses CR+LF (two characters) - so copying from a linux clipboard ends up with a 'unexpected' error at the end of the first line.
It's slower to use the above method, but at least it works, where-as Ctrl+V doesn't.
On the command line, can you check xdotool and xbindkeys are installed? ("xdotool --help" and "xbindkeys --help" should do it)
Did you download and put the "pyperclip.py" file in the same location as the script?
(Oh! Being python, you may need to add an empty "__init__.py" file in the same folder, so python knows it should look in that folder for imports)
If you run "xbindkeys -mk" and press the combination you want, does the output match what you have added to the ~/.xbindkeysrc file?