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: 0, Disagree) by Anonymous Coward on Tuesday October 24 2017, @12:31PM (12 children)

    by Anonymous Coward on Tuesday October 24 2017, @12:31PM (#586817)

    The article left out the main thing to remember in vim: try to remember which fucking mode you are in for that split second. Insert mode or not? Jesus, the modal interface is the worst thing about vim and a constant source of user error. Even worse, it is totally unnecessary.

    Starting Score:    0  points
    Moderation   0  
       Disagree=1, Total=1
    Extra 'Disagree' Modifier   0  

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

    by Anonymous Coward on Tuesday October 24 2017, @12:56PM (#586821)

    1978, terminals and 120baud modems.

    • (Score: 2) by theluggage on Tuesday October 24 2017, @02:03PM

      by theluggage (1797) on Tuesday October 24 2017, @02:03PM (#586853)

      1978, terminals and 120baud modems.

      You irresponsible clod - vi may be nice and easy for lazy young kids who can't be bothered to learn a proper line editor like sed or TECO, but what are you going to do when all the VDUs are down and you have to fix the system using only the console teleprinter*? How's someone going to check your work if its not all printed out on green music-lined paper?

      (* I'm only just old enough to have been there... the punched card readers had gone a year or two before, but there was still an infinite supply of telephone note paper with one corner cut off... )

  • (Score: 2) by TheRaven on Tuesday October 24 2017, @02:16PM (8 children)

    by TheRaven (270) on Tuesday October 24 2017, @02:16PM (#586863) Journal
    If you forget, glance at the bottom-left corner of the window and it tells you. I generally dislike modal interfaces, but in vim I quite like it because writing text and editing text should be separate activities. I find that I'm much more productive when I stay in insert mode for as long as possible while writing and then switch to command mode for editing.
    --
    sudo mod me up
    • (Score: 2) by https on Tuesday October 24 2017, @04:03PM (7 children)

      by https (5248) on Tuesday October 24 2017, @04:03PM (#586911) Journal

      Sure you can check. But having to do so *interrupts the flow* of writing. The increased cognitive load slows users down and makes errors more likely. Just because you aren't conscious of it doesn't mean it's not there.

      I'm struggling to understand how you developed the belief that writing in a text file doesn't constitute editing it.

      --
      Offended and laughing about it.
      • (Score: 0) by Anonymous Coward on Tuesday October 24 2017, @05:43PM (3 children)

        by Anonymous Coward on Tuesday October 24 2017, @05:43PM (#586960)

        Haha yeaaaah wtf is up with that? I doubt the slower interface is better over the long term, and you have to learn so many esoteric commands to use VIM that I just don't see the point. I use it only when I'm unable to access a real editor.

        Yeah you heard me, a REAL editor that doesn't require an advanced degree in Esoteria to operate.

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

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

          It is a long learning curve, but it's worth the climb. In vim I can teleport anywhere with a keystroke and make changes as quick as breathing. It's as close to telepathically linking to an interface as I've ever come. I actually get a charge out of using it, even if I'm doing something as tedious as working on a CSS file or something. Having to use an IDE more than halves my productivity and feels like having fallen into a tar pit. Those flashes of inspiration that can carry you for hours when in the flow of writing code don't come. Having to fuck around with the mouse breaks the spell every time.

          YMMV

          --
          Washington DC delenda est.
          • (Score: 0) by Anonymous Coward on Tuesday October 24 2017, @08:52PM

            by Anonymous Coward on Tuesday October 24 2017, @08:52PM (#587088)

            I don't even think it is a long learning curve. Maybe to master it, but you can be up and flying along with only a handful of commands. But if you work a lot with text files, I've found that the return on the investment is HUGE if you spend the time to learn vim beyond the basic level of competency.

        • (Score: 2) by The Mighty Buzzard on Wednesday October 25 2017, @02:31AM

          by The Mighty Buzzard (18) Subscriber Badge <themightybuzzard@proton.me> on Wednesday October 25 2017, @02:31AM (#587233) Homepage Journal

          Das racis, you Esoteriaphobe!

          --
          My rights don't end where your fear begins.
      • (Score: 2) by TheRaven on Wednesday October 25 2017, @01:32PM (2 children)

        by TheRaven (270) on Wednesday October 25 2017, @01:32PM (#587356) Journal

        But having to do so *interrupts the flow* of writing

        No it doesn't, because when you're writing you are in insert mode. When you are editing, you are in command mode or one of the visual modes. Whenever you switch from writing to editing, you are interrupting the flow. Vim adds a small UI barrier to this switch, which discourages you from doing it and makes you focus on separating the tasks of writing and editing.

        I'm struggling to understand how you developed the belief that writing in a text file doesn't constitute editing it.

        I developed this view at some point over the 150 or so articles, 4 books, and one PhD thesis that I wrote using vim, which wc tells me add up to about a million words, though I was influenced by someone else who recommended writing with cat and editing with something else.

        --
        sudo mod me up
        • (Score: 2) by https on Monday October 30 2017, @03:09AM (1 child)

          by https (5248) on Monday October 30 2017, @03:09AM (#589328) Journal

          The huge amount of work you've invested into the paradigm says nothing about how it developed. I hope you can see why I might think there is a large sunk-cost fallacy at play.

          when you're writing you are in insert mode. When you are editing, you are in command mode

          This doesn't explain how adding or erasing stuff from a file isn't editing it. What is the difference, to you?

          --
          Offended and laughing about it.
          • (Score: 2) by TheRaven on Monday October 30 2017, @10:07AM

            by TheRaven (270) on Monday October 30 2017, @10:07AM (#589395) Journal

            This doesn't explain how adding or erasing stuff from a file isn't editing it. What is the difference, to you?

            Erasing is editing. Adding in the middle is editing. If you want to be productive, these should be separate tasks from writing, because they break flow. I started off using OpenOffice for a lot of stuff and found that there was always a temptation to either play with formatting or to go back and rewrite things. I'm most productive when I sit in insert mode and type, then go back and edit as a separate pass. Apparently I'm not the only one, because you'll find a lot of other writers recommending this workflow. Vim, by accident rather than design, encourages this pattern.

            --
            sudo mod me up
  • (Score: 2) by bart9h on Wednesday October 25 2017, @01:34AM

    by bart9h (767) on Wednesday October 25 2017, @01:34AM (#587208)

    What mode I am in? Normal mode, of course. I stay in normal mode all the time. You enter insert mode to to type text, then immediately hit ESC to go back to normal mode.

    One does not stay in insert mode.