Xcode duplicate/delete line

Summer picture Summer · Feb 15, 2009 · Viewed 75.1k times · Source

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 possible to change the system wide keybindings but that's not what I'm after.

Answer

Tom Alsberg picture Tom Alsberg · Feb 15, 2009

To delete a line: Ctrl-A to go to the beginning of the line, then Ctrl-K to delete it, and another time Ctrl-K to remove the empty line. (I do not use Xcode very often, but I'm used to that in Emacs and other text inputs with Emacs-like bindings, and it seems to work in Xcode too.)

And to duplicate a line: I don't know of many programs that have a command for that, but usually I just use Copy+Paste - in Xcode it's CUA-like: Ctrl+A to go to the beginning of the line, Shift+ to select it, Command+C to copy and Command+*V to paste twice (once overriding the line and once appending to it).

(from a person that types and edits text all the time, so often in different programs, and occasionally gets pissed at having to distract himself with a dumb widget while making a little correction in a text input, that he just cannot avoid remembering these sequences and habits)