Stories
Slash Boxes
Comments

SoylentNews is people

posted by chromas on Wednesday August 22 2018, @09:22PM   Printer-friendly
from the :wq dept.

Over at The New Stack is a brief but entertaining history of the editor vi and Vim.

"The editor was optimized so that you could edit and feel productive when it was painting slower than you could think. Now that computers are so much faster than you can think, nobody understands this anymore," Joy said. "It was a world that is now extinct. People don't know that vi was written for a world that doesn't exist anymore."


Original Submission

 
This discussion has been archived. No new comments can be posted.
Display Options Threshold/Breakthrough Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • (Score: 3, Informative) by bzipitidoo on Thursday August 23 2018, @03:42AM (3 children)

    by bzipitidoo (4388) on Thursday August 23 2018, @03:42AM (#725051) Journal

    You don't need to know very much to do basic editing in vi. Most guides flood the beginner and occasional user with way too many details. This is a minimal set of commands for vi that I wrote up a long time ago:

    vi starts in command mode.
    Can precede most commands with a number telling how many times to
    do a command. For example, hitting 42 followed by the down arrow will
    move the cursor down 42 lines. "42x" will delete 42 characters.
    ESC Change to command mode.

    Command mode:
    Move cursor with arrow keys. If there aren't any arrow keys, j,k,h,l works.
    i Change to insert mode. Insert before cursor.
    a Change to insert mode. Insert after cursor.
    r Replace 1 character.
    R Overwrite mode.
    x Delete 1 character.
    dw Delete 1 word.
    dd Delete 1 line.
    P Put deleted text before cursor.
    p Put deleted text after cursor.
    G Go to end of file. If preceded by a number, go to that line.
                          1G goes to the start of file.
    ctrl-G Display line number where cursor is.
    J Join. Merge next line with this line.
    / Search. Follow "/" with text to find.
    : Change to command line. ":" prompt appears at bottom of screen.

    Command line:
    wq Write file and Quit
    q! Quit, don't save file.
    %s/old/new/g Substitute. Replace "old" with "new" on all lines.
    r file.txt Read "file.txt" into editor at line after cursor location.

    Starting Score:    1  point
    Moderation   +1  
       Informative=1, Total=1
    Extra 'Informative' Modifier   0  
    Karma-Bonus Modifier   +1  

    Total Score:   3  
  • (Score: 2) by bob_super on Thursday August 23 2018, @05:02AM (1 child)

    by bob_super (1357) on Thursday August 23 2018, @05:02AM (#725077)

    The problem with that list (thanks), is that if you use vi once a month or less, you're not going to remember it.
    Most other editors can be used in a blink right after you open them for the first time after a few months. vi requires regular use.

    for a world that doesn't exist anymore

    Now that the Apple assholes are killing the Fn keys, and people type so much on touchscreens, there is no question keyboard-centric vi and friends are getting even more niche. Ironic, when Linux is the most used OS (kernel) around.

    • (Score: 2) by bobthecimmerian on Friday August 24 2018, @03:23AM

      by bobthecimmerian (6834) on Friday August 24 2018, @03:23AM (#725582)

      I agree with your point. On the other hand, GVim is pretty newbie friendly. It has most of the useful options in nice menus at the top with the related keystrokes listed, so the learning curve is much less ugly - in GVim, all the newbie has to remember is 'i' to switch to insert mode and Esc to switch out of it. Or if you want the menu option Edit - Global Settings - Toggle Insert Mode (equivalent command :set im!) will put the editor permanently in Insert mode, and all other commands are just accessed from the GUI menus.

      With the benefit of hindsight, I wish I had learned vim that way. "How do I undo typing? Let me see, Edit - Undo. Oh, it's the 'u' key. Cool. How do I switch to the next buffer? ..."

  • (Score: 2) by JoeMerchant on Thursday August 23 2018, @12:16PM

    by JoeMerchant (3937) on Thursday August 23 2018, @12:16PM (#725172)

    I think one of my biggest gripes about vi is the lack of prominent visual indication for what mode you are in. That, and the lie that there's edit mode and command mode - there's also command line mode, which at least jumps the blinkincursor to the bottom of the screen.

    --
    🌻🌻 [google.com]