我在使用功能更新VIM中的信息时遇到了麻烦.我的代码如下:
map <F4> :call UpdateTitle()<cr>'s
"Update the latest modification time and filename
function UpdateTitle()
normal m'
execute '/# *Last modified:/s@:.*$@\=strftime(": %Y-%m-%d %H:%M")@'
normal ''
normal mk
execute '/# *Filename:/s@:.*$@\=": ".expand("%:t")@'
execute "noh"
normal 'k
echohl WarningMsg | echo "Successful in updating the copyright." | echohl None
endfunction
Run Code Online (Sandbox Code Playgroud)
当我按下F4VIM时,它会工作.但它始终显示错误消息E20: Mark not set.我以为错误发生在最后两行.但我找不到解决方案.
我试过了echoerr.它有效,但不是我的意思.我试着echomsg和echo孤独.但它不起作用.没有消息输出.但是错误消息显示为E20: Mark not set.
此外,即使我删除整个回声线.同样的错误再次出现.
VIM版本是7.0.237.
vim ×1