## Selecting Lines for Operations ```plaintext :1,20s/hello/world # search/replace only for first 20 lines :20,$s/hello/world # search/replace for lines from 20 onwards :$-20,$s/hello/world # search/replace for last 20 lines of file :.,.+5s/hello/world # search/replace from current line to 5 lines down ``` ## Search And Replace ```plaintext :s@hello@
hello
# if / occurs in search/replace string ``` ## Matching and Deleting ```plaintext :g/pattern/d # delete matched lines :g/pattern/-1d # delete line before each match :g/pattern/+1d # delete line after each match :g/pattern/-1,+1d # delete from line before to line after :%d # delete all lines (useful to abort Ctrl+X+E :.,$d # delete all lines from current onwards :1,.d # delete all lines from start to current ``` ## Folding ```plaintext ```