3
我想插入文件名和行号到文件中的某些地方。例如,这行:如何用Vim中的函数结果替换字符串?
_debug('init');
我想更换
:s/debug('/debug('(%current_filename_here%:%current_line_number_here%)\ /g
得到这个
_debug('(filename.ext:88) init');
我尝试使用扩张('%:t'
)来获取文件名和行("."
)至获取行号,但我不知道如何使用它来替换表达式。
我该怎么做?
什么手段@在这种情况下? – Neka
我不能直接在表达式中使用Vim函数,只能通过printf对吧? – Neka
您可以使用vim功能。 @只是一个分隔符。这是习惯写功能':■///''不过:■###'工程,以及,一样':■@@@'... – Amadan