Results 1 to 5 of 5
Hello Linuxians,
Nice to be here.
Does anyone know of a way to spellcheck the clipboard, with aspell or ispell for example. It would help to have a global spellcheck ...
- 03-08-2008 #1
[SOLVED] Spellcheck the Clipboard
Hello Linuxians,
Nice to be here.
Does anyone know of a way to spellcheck the clipboard, with aspell or ispell for example. It would help to have a global spellcheck for anything that involves text.
- 03-10-2008 #2Linux Newbie
- Join Date
- Sep 2007
- Posts
- 160
Hi Agnot,
the xsel command gives you access to the clipboard content. You
could use it to transfer the clipboard text to an editor, spellcheck it, and
put it back.
I use vim, so the following comes to my mind:
This will start vim with the content of the clipboard and enable spell checking.Code:xsel -o -b | vim +:set\ spell -
Once you're done, you can push the changed text back to the clipboard
with some vi commands like these
This second part is not elegant yet, but with some scripting, this couldCode:ggVG:!xsel -i -b :q!
all happen with a keystroke.
This is just to illustrate the principle. It should work with other editors in a
similar fashion.
cheers, kai
- 03-11-2008 #3
kai,
Thanks much for the ideas. I will see what I can do about the scripting!
- 03-11-2008 #4Linux Newbie
- Join Date
- Sep 2007
- Posts
- 160
anytime,
and post back if you make it work! :·)
cheers, kai
- 03-19-2008 #5
I wouldn't think to do otherwise.
Here is what I got:
#!/usr/bin/bsh
#Clipboard to file <-o> for out,
#<-b>, the only clipboard section I could get to work.
xsel -o -b > .spelchec
#Just in case it is a long file, wait.
wait
#Spell check the file with Aspell.
aspell -c .spelchec
#Wait until Aspell is finished.
wait
#Page the checked file & pipe back to clipboard, <-i> for in.
less .spelchec | xsel -i -b
#Wait to be sure to clear pipe to clipboard.
wait
#chmod for security. In background to avoid conflict with past to original.
chmod 600 .spelchec &
#chmod could be a remove command too. For security.
#(It is going to be making .spelchec.bak files too.)
I named it .spell and put it in my home directory, made it executable by owner and put an alias in my .bashrc "alias spell='./.spell'" . I made a launcher on my desktop with the command "/home/my_directory/.spell" , "open in a terminal." And I made a keyboard shortcut in Gnome.
Had to download xsel. xclip actually looks better, so maybe somebody should work with it. Used Aspell. Oh yeah, my favorite pager, less, will probably need installed if you didn't already.
Corrected clipboard contents are easy to past back to original because the highlighted text should remain so if left alone. If you leave something uncorrected and change your mind after exiting, you can restart without recopying from original.
Now I have a global spell checker that checks anything I can copy to clipboard. It keeps a single global word list with a history of all my additions. (The way I change programs, this is very convenient.) It is very fast. It is familiar--reducing errors. And it is Aspell, my favorite checker.




