gpt4 book ai didi

Vim 高级替换

转载 作者:行者123 更新时间:2023-12-04 19:40:27 24 4
gpt4 key购买 nike

我做过很多复杂的编辑,过去也经常使用 sed,但这是我不太清楚该怎么做的事情。我知道如何使用行首和行尾 (^$) 和通配符 (.*$),甚至可以使用 CRs,但这是柱状的。我有以下几行:

!********************************************************************************
! *
! Processing Overview: *
! *
! begin-setup *
! begin-heading *
! begin-footing *
! begin-report *
! Strd-begin-Program *
! STRD-Print-Lis *
! Prompt-Parameters *
! Feedback-Value-Update *

为了统一性和可读性,我需要将星号移至所有行的第 81 列。任何人都知道该怎么做?TIA,大卫

最佳答案

一个选项是这样的

%norm $x80|p

分解

%             operate on the entire buffer
norm following normal command
$ go to end of the line
x delete the character
80| goto column 80
p paste

注意需要设置virtual edit。我的 _vimrc

中有以下条目
 set ve=all

关于Vim 高级替换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60566144/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com