Is there a way to make TeXShop insert an arbitrary number of spaces when I press the tab key instead of inserting a tab? This functionality is in TeXnicle and I really like it, but TeXShop is my favorite editor.
A related question is how to easily indent multiple lines of code with spaces (not tabs) in TeXShop. When I think about it, I don't even know how to indent multiple lines of code with tabs!
The setting in TeXnicle is shown in the following picture:
I have put together some code which will add a single space (or more) in front of an arbitary number of selected lines in TeXShop. I need some help here, however. After I run the script, TeXShop deselects the original selection. Why is this bad? You cannot quickly rerun the script on the same selection. It wouldn't be efficient to make a key binding for this script.
(*BASIC STRUCTURE OF THIS SCRIPT*) --repeat with each line in theselection --do shell script "sed 's/^/ /' --THIS THING JUST ADDS A SPACE IN FRONT OF EACH LINE OF INPUT tell application "TeXShop" --get the front document set thisDoc to the front document set mySel to selection of thisDoc set selContent to content of selection of thisDoc set outcome to do shell script "echo " & (quoted form of selContent) & "|sed 's/^/ /' " set content of selection of thisDoc to outcome end tell
Is there a way to fix this script so that it leaves the selection selected after running?