# Vi
Shortcuts and stuff for Vi(m) But mostly Vim
# Commenting multiple lines
- Move cursor to starting line
- Press
ctrl
+v
- Use down arrow to mark multiple lines for commenting
- Press
shift
+i
- Type
#
- Press
esc
and wait a second
# Uncommenting multiple lines
- Move cursor to starting line
- Press
ctrl
+v
- Use down arrow to mark multiple lines for uncommenting
- Press
x
# Delete multiple lines
- Move cursor to starting line
- Press
shift
+v
- Use down arrow to mark multiple lines for deleting
- Press
d
# Delete to end of line
Delete from the cursor to the end of the line and then enter insert mode
- Move cursor to start of where you want to delete
- Press
shift
+c
# Search and replace
# Search
: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/