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.
我想调用 VCSStatus 函数,将当前工作目录(无论:pwd返回什么)传递给它。它必须是完整路径,并且没有特殊字符,例如“。” 被接受。
:pwd
:execute 'VCSStatus' getcwd()
应该做的伎俩。如果您希望改用当前文件的目录,则为:
:execute 'VCSStatus' expand('%:p:h')
(%引用当前文件,:p修改为完整的绝对路径,并:h切断文件名;cp. :help filename-modifiers)
%
:p
:h
:help filename-modifiers