vi text editor in emulator

Discussion in 'Droid 2 Tech Issues' started by chrstdvd, Nov 4, 2010.

  1. chrstdvd

    chrstdvd Member

    Joined:
    Sep 30, 2010
    Messages:
    577
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    McKenney Va
    Ratings:
    +0
    Does anyone know how to use vi to write script files on the Droid 2?

    Specifically, I can get into vi and write a script, but I can not find out how to do the "esc" so that I can :qw (quit/write)

    I can use the cat command and write small scripts that work if there are no typo's, but I need vi to edit typo's.

    Thanks
     
  2. pool_shark

    pool_shark Active Member

    Joined:
    Mar 28, 2010
    Messages:
    1,395
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Ohio
    Ratings:
    +7
    I just use echo redirects.
    There is no esc key. I could only find control -c which doesn't help with vi.
     
  3. chrstdvd

    chrstdvd Member

    Joined:
    Sep 30, 2010
    Messages:
    577
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    McKenney Va
    Ratings:
    +0
    What is an echo redirect?

    You can save a cat file by hitting the ok button and then d. (ctrl d)

    when I hit the menu button and look at "special keys" it says that ok-] is escape, but it just types a ^] in the script. ha!
     
  4. pool_shark

    pool_shark Active Member

    Joined:
    Mar 28, 2010
    Messages:
    1,395
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Ohio
    Ratings:
    +7
    I wrote my mount and unmount scripts by typing:

    echo "blah blah blah" >> mount.sh

    I did the same thing for each line that I wrote.
     
  5. chrstdvd

    chrstdvd Member

    Joined:
    Sep 30, 2010
    Messages:
    577
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    McKenney Va
    Ratings:
    +0
    OH, DUH! Well that is cool and the same thing as doing it with the cat command but you still can not edit mount.sh on the phone in vi, because there is no way to save the changes until someone figures out a way to get back down to the command line in vi.

    If I have an empty file in vi and hit "alt:" I can get to the command line and put in the commands, but once I have modified the file, it will not work.

    Anyway I just tested your idea and it works fine. I have done a crash course in linux the past month and forgot about >> appending lines in a file. Cool.
     
  6. pool_shark

    pool_shark Active Member

    Joined:
    Mar 28, 2010
    Messages:
    1,395
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Ohio
    Ratings:
    +7
    Now that I think about it, once I moved the scripts to my sdcard, I changed the extension to .txt then edited it with word.
     
  7. chrstdvd

    chrstdvd Member

    Joined:
    Sep 30, 2010
    Messages:
    577
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    McKenney Va
    Ratings:
    +0
    I figured it out!!!

    I have experimented! I just wrote a little script in the emulator on the phone that has a few echo commands in it just to see if I can execute the script after I get out of vi.

    I do my typing, then hit the ok button then the c key (which is a control c), that moves the cursor to the top of the file. Then i type in ok v and I get a message on the command line that says "^v is not implemented"

    Then I hit the "alt :which puts the : on the command line (gets rid of error message) and type my "wq" command which wirtes the file and quits vi.

    Then I sh filename and it frigging works. COOOL! I vi'ed the file again and edited the echo statement, repeated the get out of here stuff and ran the script and it worked with the correction.

    I found out that OK z exits vi but will not save what you did.:icon_ banana:dancedroid

    Probably not the right way to do it, but IT WORKS. HEE HEE!
     
  8. pool_shark

    pool_shark Active Member

    Joined:
    Mar 28, 2010
    Messages:
    1,395
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Ohio
    Ratings:
    +7
    Nice work. You can just hit ok, c, then alt :
     
  9. chrstdvd

    chrstdvd Member

    Joined:
    Sep 30, 2010
    Messages:
    577
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    McKenney Va
    Ratings:
    +0
    Nice work. You can just hit ok, c, then alt :

    Did you already know that or just figure it out?
    Anyway thanks, much simpler than the way I figured out.
     
  10. pool_shark

    pool_shark Active Member

    Joined:
    Mar 28, 2010
    Messages:
    1,395
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Ohio
    Ratings:
    +7
    Figured it out while using your method.
     
  11. TuxDude

    TuxDude Member

    Joined:
    Dec 11, 2010
    Messages:
    45
    Likes Received:
    0
    Trophy Points:
    6
    Ratings:
    +0
    Hey guys - good to hear u ve got vim working on ur Droid phones....

    I have a DroidX which is rooted... I Would like to know where you guys got the vim binaries for the phone ? You guys built it or downloaded form some place.... Thanks....
     
  12. pool_shark

    pool_shark Active Member

    Joined:
    Mar 28, 2010
    Messages:
    1,395
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Ohio
    Ratings:
    +7
    It's part of busybox.
     
Search tags for this page

android terminal emulator vi

,
android terminal emulator vi esc
,

android terminal vi

,

android vi editor

,
android vi save
,
android vi text editor
,
how to use vi editor in android enumulator
,
vi android terminal
,
vi editor for android
,
vi on android terminal