Here's a small howto on commenting and uncommenting multiple lines at once using vim.

Commenting multiple lines at once

  1. Open your file in Vim:

    vim your_file.txt
    
  2. Go to Normal mode (press Esc a few times just to be sure)

  3. Enter Visual Line Mode:

    • Press Shift + V (capital V)

    • Use j or arrow keys to select multiple lines

  4. Run the substitute command:

    • Press : (you'll see something like :'<,'> appear)

    • Type:

      s/^/# /
      
    • Then press Enter

Uncommenting multiple lines at once

  1. Open your file in Vim:

    vim your_file.txt
    
  2. Go to Normal mode (press Esc a few times just to be sure)

  3. Enter Visual Line Mode:

    • Press Shift + V (capital V)

    • Use j or arrow keys to select multiple lines

  4. Run the substitute command:

    • Press : (you'll see something like :'<,'> appear)

    • Type:

      s/^# //
      
    • Then press Enter