Vim: How to delete the first n characters from every line or region? - Editors

This is a discussion on Vim: How to delete the first n characters from every line or region? - Editors ; Hi, Using Vim how does one delete the first n characters of ever line ? Alternatively in visual mode how can one apply such an operation to a selected region ? TIA b thomas...

+ Reply to Thread
Results 1 to 3 of 3

Vim: How to delete the first n characters from every line or region?

  1. Default Vim: How to delete the first n characters from every line or region?

    Hi,

    Using Vim how does one delete the first n characters of ever line ?
    Alternatively in visual mode how can one apply such an operation to
    a selected region ?

    TIA
    b thomas

  2. Default Re: Vim: How to delete the first n characters from every line or region?

    :%s/^.\{5}//gic

    This will delete first 5 chars of every line

    For more info,

    :h regular-expression

    B Thomas wrote:
    > Hi,
    >
    > Using Vim how does one delete the first n characters of ever line ?
    > Alternatively in visual mode how can one apply such an operation to
    > a selected region ?
    >
    > TIA
    > b thomas



  3. Default Re: Vim: How to delete the first n characters from every line orregion?

    B Thomas wrote:

    > Using Vim how does one delete the first n characters of ever line ?
    > Alternatively in visual mode how can one apply such an operation to
    > a selected region ?


    gg
    0
    ctrl-v


    Then press the 'l' key so that you have the appropriate number of
    characters covered in the region. Then press 'x'.

+ Reply to Thread

Similar Threads

  1. How to delete the space characters from the string
    By Application Development in forum C
    Replies: 4
    Last Post: 11-20-2007, 10:21 AM
  2. Delete all not allowed characters..
    By Application Development in forum Python
    Replies: 10
    Last Post: 10-25-2007, 07:30 PM
  3. How to delete specific characters from a string?
    By Application Development in forum RUBY
    Replies: 11
    Last Post: 10-12-2007, 07:38 AM
  4. vim delete characters problem
    By Application Development in forum Editors
    Replies: 4
    Last Post: 01-12-2007, 05:15 PM
  5. Delete characters right of cursor
    By Application Development in forum ODBC
    Replies: 0
    Last Post: 01-19-2006, 07:32 PM