# Vi

Shortcuts and stuff for Vi(m) But mostly Vim


# Commenting multiple lines

  1. Move cursor to starting line
  2. Press ctrl+v
  3. Use down arrow to mark multiple lines for commenting
  4. Press shift+i
  5. Type #
  6. Press esc and wait a second

# Uncommenting multiple lines

  1. Move cursor to starting line
  2. Press ctrl+v
  3. Use down arrow to mark multiple lines for uncommenting
  4. Press x

# Delete multiple lines

  1. Move cursor to starting line
  2. Press shift+v
  3. Use down arrow to mark multiple lines for deleting
  4. Press d

# Delete to end of line

Delete from the cursor to the end of the line and then enter insert mode

  1. Move cursor to start of where you want to delete
  2. Press shift+c

# Search and replace

:s/needle

# Search & Replace

The search pattern accepts regex.

# S&R on current line

:s/foo/bar/

# S&R on all lines

:%s/foo/bar/
Last Updated: 2022/09/17 16:45+00:00