Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 vim 中strlen,我可以计算一行中的字符数。
strlen
示例:计算最后一行的字符
strlen(getline('$'))
我如何计算缓冲区中的字符?
您可以g CTRL-G用来显示当前缓冲区的统计信息,包括字符数。
g CTRL-G
line2byte(line('$') + 1)在脚本中工作。
line2byte(line('$') + 1)