Xcode how to delete current line

Discussion in 'iOS Programming' started by 1458279, Dec 9, 2011.

  1. 1458279 Suspended

    1458279

    Joined:
    May 1, 2010
    Location:
    California
    #1
    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.
     
  2. xStep macrumors 68000

    Joined:
    Jan 28, 2003
    Location:
    Less lost in L.A.
    #2
    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.
     
  3. 1458279 thread starter Suspended

    1458279

    Joined:
    May 1, 2010
    Location:
    California
    #3
    Wow, guess I'm going to learn the keyboard macro stuff then :rolleyes:
     
  4. RonC macrumors regular

    Joined:
    Oct 18, 2007
    Location:
    Chicago-area
    #4
    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.
     
  5. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #5
    triple-click selects a line

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

    Joined:
    Jun 2, 2008
    #6
    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.
     
  7. seepel macrumors 6502

    seepel

    Joined:
    Dec 22, 2009
    #7
    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?
     
  8. idelovski macrumors regular

    Joined:
    Sep 11, 2008
    #8
    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. ;)
     

Share This Page