Stories
Slash Boxes
Comments

SoylentNews is people

posted by martyb on Tuesday October 24 2017, @07:28AM   Printer-friendly
from the what-about-emacs? dept.

It's an old article, but if you use vi/m it's always good to read a refresher. I've been using the editor for almost 30 years and always learn something new:

If you spend a lot of time typing plain text, writing programs or HTML, you can save much of that time by using a good editor and using it effectively. This paper will present guidelines and hints for doing your work more quickly and with fewer mistakes.

The open source text editor Vim (Vi IMproved) will be used here to present the ideas about effective editing, but they apply to other editors just as well. Choosing the right editor is actually the first step towards effective editing. The discussion about which editor is the best for you would take too much room and is avoided. If you don't know which editor to use or are dissatisfied with what you are currently using, give Vim a try; you won't be disappointed.

[...] The point is that you need to get to know these commands. You might object that you can't possibly learn all these commands - there are hundreds of different movement commands, some simple, some very clever - and it would take weeks of training to learn them all. Well, you don't need to; instead realize what your specific way of editing is, and learn only those commands that make your editing more effective.

There are three basic steps:

        1. While you are editing, keep an eye out for actions you repeat and/or spend quite a bit of time on.
        2. Find out if there is an editor command that will do this action quicker. Read the documentation, ask a friend, or look at how others do this.
        3. Train using the command. Do this until your fingers type it without thinking.


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, Funny) by Techwolf on Tuesday October 24 2017, @02:00PM (12 children)

    by Techwolf (87) on Tuesday October 24 2017, @02:00PM (#586851)

    Someone need to patch VIM so one can exit the program without having to switch terminals and killall VIM.

    I have search and read all the hints online. The only thing that happens is the q! and other characters are typed on the screen as part of the document text.

    Can someone please point me to a keyboard vender that actually sells a keyboard that has the "meta" key?

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

    Total Score:   3  
  • (Score: 0) by Anonymous Coward on Tuesday October 24 2017, @02:22PM (1 child)

    by Anonymous Coward on Tuesday October 24 2017, @02:22PM (#586865)

    You... You're making a joke right?

    • (Score: 2) by Techwolf on Monday November 06 2017, @02:31AM

      by Techwolf (87) on Monday November 06 2017, @02:31AM (#592773)

      Sadly, no. I been running Gentoo for the past 10 plus years and masked vim so it never plagues me again.

  • (Score: 0) by Anonymous Coward on Tuesday October 24 2017, @02:26PM (4 children)

    by Anonymous Coward on Tuesday October 24 2017, @02:26PM (#586867)

    Is there bright text saying -- INSERT -- at the bottom? Press esc first. In fact, mash esc a bunch of times.

    Then access the command line thingie. Press colon (:). You should get a colon prompt at the bottom. That's where you type q!.

    q = quit
    ! = do it even if there are unsaved changes

    Another handy one is wa (save all).

    w = write
    a = all buffers

    Lots of people use wq.

    w = write
    q = quit

    Can also be combined: wqa.

    w = write
    q = quit
    a = all buffers

    Vim is a modal editor. Insert is one mode, then there's the mode when you esc out of insert (this is where things like cw (change word) work), then there's the command prompt where q! works. There are other modes as well such as search (/ after esc from insert mode) and visual/visual line (v and V respectively after esc from insert mode).

    • (Score: 2) by DECbot on Tuesday October 24 2017, @03:59PM (3 children)

      by DECbot (832) on Tuesday October 24 2017, @03:59PM (#586906) Journal

      And what do you do when your computer vendor is too hip to include [theverge.com] the ESC key on your keyboard?
       

      (don't bother telling me how to do it with the bar, I have no interest with laptops and keyboards that double as razor blades.)

      --
      cats~$ sudo chown -R us /home/base
      • (Score: 2) by pbnjoe on Tuesday October 24 2017, @04:42PM

        by pbnjoe (313) on Tuesday October 24 2017, @04:42PM (#586925) Journal

        Press Ctrl + [ instead. :)

        But best not to purchase from that vendor in the first place.

      • (Score: 2) by Phoenix666 on Tuesday October 24 2017, @07:25PM

        by Phoenix666 (552) on Tuesday October 24 2017, @07:25PM (#587033) Journal

        You mean, there's no escape?

        --
        Washington DC delenda est.
      • (Score: 2) by TheRaven on Wednesday October 25 2017, @01:35PM

        by TheRaven (270) on Wednesday October 25 2017, @01:35PM (#587358) Journal
        The MacBooks have an escape key, it's just software defined on the buzzword bar (and controllable from the terminal, so you can teach vim to set the other keys to behave like function keys but displaying the name of the action that you've defined for them to use). The iPad, in contrast, has no escape key on its keyboard. The fact that the iPad Pro keyboard has an emoji key, but no escape, makes it a bit of a joke (but if anyone knows a way of making the emoji key work as escape, let me know...)
        --
        sudo mod me up
  • (Score: 2) by Arik on Tuesday October 24 2017, @04:01PM

    by Arik (4543) on Tuesday October 24 2017, @04:01PM (#586909) Journal
    "The only thing that happens is the q! and other characters are typed on the screen as part of the document text."

    You forgot to escape colon. The full mnemonic is ESCape this :(colon) thing Quit and do !return.

    --
    If laughter is the best medicine, who are the best doctors?
  • (Score: 2) by el_oscuro on Wednesday October 25 2017, @02:03AM (1 child)

    by el_oscuro (1711) on Wednesday October 25 2017, @02:03AM (#587219)

    While this is obviously a joke, try running vimtutor, then follow the tutorial. You would be surprised how much you learn, even if you have been using vi awhile.

    --
    SoylentNews is Bacon! [nueskes.com]
    • (Score: 2) by Techwolf on Monday November 06 2017, @02:33AM

      by Techwolf (87) on Monday November 06 2017, @02:33AM (#592775)

      Sorry, it is not a joke. I masked vim on my gentoo system so I never be plague by that program ever again.

  • (Score: 0) by Anonymous Coward on Wednesday October 25 2017, @04:17AM

    by Anonymous Coward on Wednesday October 25 2017, @04:17AM (#587262)

    Reminds me of this gem pertinent to the whole thread actually https://www.gnu.org/fun/jokes/ed-msg.html [gnu.org]

  • (Score: 2) by Wootery on Wednesday October 25 2017, @10:06AM

    by Wootery (2341) on Wednesday October 25 2017, @10:06AM (#587316)

    I'm a fan of Vim, but it's a fair point. Why is Vim so hard to close?