使用当前文件名和文件路径从vim执行bash命令 [英] Execute bash commands from vim with name of current file name and path to file
本文介绍了使用当前文件名和文件路径从vim执行bash命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图这样做是为了在不更改时间戳的情况下保存文件.
I'm trying to do this to save a file without changing the timestamp.
nnoremap
%:ph:h
和 %
特殊变量不是内插的.有没有办法做到这一点?
The %:ph:h
and %
special variables aren't interpolated, however. Is there a way to achieve this?
推荐答案
为什么要呢,它是一个字符串.您想要的是将您的字符串与一些变量组合/连接:
Why should it, it is a string. What you want is to combine/concat your string with some variables:
'silent !file=' . expand('%:p:h') . ' && mtime ..........
这篇关于使用当前文件名和文件路径从vim执行bash命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文