Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

1458279

Suspended
Original poster
May 1, 2010
1,601
1,521
California
I searched on this and the answers seemed to involve creating keyboard macros.

What I want to do is delete the current line. Is this already built into Xcode 4?

I know you can go to the start of the line, highlight the line and delete it, but I was wondering if this is already built in and can be assigned to a key.
 
I just use the Emacs short cuts; Ctrl-a Ctrl-k. Ctrl-k a second time will remove the end-of-line on the current line.

I'm not aware of a shorter method.
 
I just use the Emacs short cuts; Ctrl-a Ctrl-k. Ctrl-k a second time will remove the end-of-line on the current line.

I'm not aware of a shorter method.

Wow, guess I'm going to learn the keyboard macro stuff then :rolleyes:
 
I just use the Emacs short cuts; Ctrl-a Ctrl-k. Ctrl-k a second time will remove the end-of-line on the current line.

I'm not aware of a shorter method.

KarlJay et al:

Let me break out the EMACS decoder ring for a second:

Ctrl-a - Move to the beginning of the line
Ctrl-k - "Kill" (delete) characters from the current place through to the end of the line UNLESS the only thing on the line is a newline character, in which case it deletes the newline.

So the sequence ^-a ^-k ^-k moves to the beginning of the line, kills the content then deletes the newline.

Now lets see if we can avoid the Vi vs EMACS vs SAI (small animal interface) religious wars.
 
triple-click selects a line

command-left arrow move the insertion point to the start of a line, shift down arrow selects the line.
 
I have to admit, C-a C-k C-k has worked for me for ... 17 years, so I haven't felt the need to find an alternative.
 
Long time VI user here, how close do Apple text fields/XCode stay true to Emacs shortcuts? Sometimes I go a bit bonkers when I switch from my day job (Programming using vi) to XCode. Religious wars aside, is there enough overlap to justify making the switch?
 
triple-click selects a line

command-left arrow move the insertion point to the start of a line, shift down arrow selects the line.

Exactly how I've been doing it since THINK C / Code Warrior days... Feels so natural. One of the few things Xcode 4 hasn't broken. ;)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.