Thread: VI trouble

  1. #1
    Microsoft Lover afreedboy's Avatar
    Join Date
    Nov 2003
    Posts
    189

    Question VI trouble

    well, I am a new user in Linux.

    I tried to use vi . In vi, when I type two lines, for example:

    123
    456

    from the second line 456 I press backspace from 6, so I would delete 6,5,4, but after 4 it didn't go up to 3. It stopped at after deleting 4.

    Is there any way to make it to go to 3,2,1? Coz sometimes I press enter wrong and I couldn't delete extra blank lines.

    Thanks

  2. #2
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    deletes just fine for me. are you using vi or vim?

  3. #3
    Registered User
    Join Date
    Sep 2004
    Posts
    197
    by default, vi and vim won't do this. There are settings in vim you can work with though to have it do this. If you want them to be set every time you start vim, you can add it to .vimrc
    I will look for the setting here in a sec.

    Edit, found it
    use :set backspace=2 while in vim, or add set backspace=2 to your .vimrc in your home directory.
    Last edited by Xipher; 09-20-2004 at 08:47 AM.

  4. #4
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    err.... why don't you just use dw (delete word) or x?
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  5. #5
    Registered User whistlenm1's Avatar
    Join Date
    Jan 2002
    Posts
    124
    Uppercase X is equivalent to backspace and lowercase x deletes the character at the cursor position.
    Man's mind once streched by a new idea, never regains its original dimensions
    - Oliver Wendell Holmes

    In other words, if you teach your cat to bark (output) and eat dog food (input) that doesn't make him a dog. It would have to chase cars, chew bones, and have puppies before I'd call it Rover ;-)
    - WaltP

  6. #6
    Microsoft Lover afreedboy's Avatar
    Join Date
    Nov 2003
    Posts
    189
    Quote Originally Posted by Xipher
    Edit, found it
    use :set backspace=2 while in vim,

    How? press Esc and type it??

  7. #7
    Registered User
    Join Date
    Sep 2004
    Posts
    197
    you type that when in exec mode, not edit mode. so basicly yea, hit escape once or twice and you should be in exec mode.

  8. #8
    Microsoft Lover afreedboy's Avatar
    Join Date
    Nov 2003
    Posts
    189
    Quote Originally Posted by Xipher
    add set backspace=2 to your .vimrc in your home directory.

    I can't find .vimrc file, though I find .viminfo.

    In .viminfo, I don't know where to add.

    that is what I found out in .viminfo:

    # This viminfo file was generated by Vim 6.2.
    # You may edit it if you're careful!

    # Value of 'encoding' when this file was written
    *encoding=utf-8


    # hlsearch on (H) or off (h):
    ~H
    # Last Search Pattern:
    ~Msle0~/\<printf\>

    # Command Line History (newest to oldest):
    :q!
    :q
    :se backspace=1
    :se backspace=2
    :se nu
    :se
    :wq
    :wqw
    :j
    :Wq

    # Search String History (newest to oldest):
    ? \<printf\>

    # Expression History (newest to oldest):

    # Input Line History (newest to oldest):

    # Input Line History (newest to oldest):

    # Registers:
    "0 LINE 0
    **
    ""1 LINE 0

    "- CHAR 0
    =

    # File marks:
    thanks

  9. #9
    Registered User
    Join Date
    Sep 2004
    Posts
    197
    make one
    just do vim ~/.vimrc
    enter what I posted, save the file, open up a test file, and check. Should work just fine.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 6
    Last Post: 01-03-2007, 03:02 PM
  2. Is it so trouble?
    By Yumin in forum Tech Board
    Replies: 4
    Last Post: 01-30-2006, 04:10 PM
  3. Help on Vi for the C programming
    By mehuldoshi in forum C Programming
    Replies: 9
    Last Post: 07-26-2002, 10:41 AM
  4. Line Numbers in VI and/or Visual C++ :: C++
    By kuphryn in forum C++ Programming
    Replies: 2
    Last Post: 02-10-2002, 10:54 PM
  5. Question on Vi Editor
    By pritesh in forum Linux Programming
    Replies: 4
    Last Post: 12-10-2001, 12:49 PM