Possible to add spacing every 4 characters in vi?

自古美人都是妖i 提交于 2021-01-27 06:06:20

问题


Is it possible to add spacing every 4 characters in vi? And if it is, what's a good google term to search for to learn how to do similar stuff?


回答1:


To add a space every 4 characters you could use the following command (at least in VIM):

:%s/\(....\)/\1 /g

If you Google "VIM Substitution" you should end up with some useful examples.

Example:

To add a space every 4 characters you could use

becomes

To a dd a  spa ce e very  4 c hara cter s yo u co uld  use 


来源:https://stackoverflow.com/questions/4847845/possible-to-add-spacing-every-4-characters-in-vi

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!