Thursday, April 27, 2017

vi tips

To format text removing line wraps:
!}fmt

To mark/delete/paste blocks:
  • At the beginning of the block: ma [mark a]
  • At the end of the block d'a/y'a [delete till a, yank till a]
  • To paste the block: p/P
To change everything from upper to lowercase:
%s/.*/\L&/
To search and replace "text1" with "text2" throughout the file:
1,$s/text1/text2/g

No comments:

Post a Comment