vi stuff

” at top of paragraph, format this paragraph
!} fmt -c

” for the whole file, format all paragraphs
!G fmt -c

“from here to the end of the file, format all paragraphs
!$ fmt -c

” from anwhere in the paragraph, format this paragraph
{!}fmt -c

Here’s how I map them in my .exrc file:
map @f !} fmt -c^M
map @F !G fmt -c^M
map ^Xf !$ fmt -c^M
map ^XF {!}fmt -c^M}^M

#To delete all lines which contain the string tornado watch:
:g/tornado watch/d

#To comment out all lines between line 6 and 22
:6,22 s/^/#/

#To run a python script inside vi
:!python script.py

About vicki

Welcome to the Sovereign Republic of Vickistan. I am the President here. Lucky me! No taxes or laws yet. Lucky you!
This entry was posted in Linux. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *