Coming from Eclipse and having been used to duplicate lines all the time, it\'s pretty strange finding out that Xcode has no such function. Or does it?
I know it\'s
I tried the key bindings solution, but it I couldn't get it to work. However editing my XCode key bindings works like a charm. Here's how I made it.
This solution does not alter the contents of the Clipboard!
Open the XCode Key Bindings:
In the Edit User Scripts Dialog:
Duplicate Line Up:
using terms from application "Xcode"
tell first text document
set {startLine, endLine} to selected paragraph range
if startLine > 1 then
set theText to (paragraphs startLine through endLine)
set theText to (theText as string)
make new paragraph at beginning of paragraph (startLine) with data theText
set selected paragraph range to {endLine + 1, endLine + endLine - startLine + 1}
else
beep 1
end if
end tell
end using terms from
Duplicate Line Down:
using terms from application "Xcode"
tell first text document
set {startLine, endLine} to selected paragraph range
if endLine < (count paragraphs) then
set theText to (paragraphs startLine through endLine)
set theText to (theText as string)
(* delete (paragraphs startLine through endLine) *)
make new paragraph at beginning of paragraph (endLine + 1) with data theText
set selected paragraph range to {startLine, endLine}
else
beep 1
end if
end tell
end using terms from