Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 在我的桌面上找不到该文件_Html_Vim - Fatal编程技术网

Html 在我的桌面上找不到该文件

Html 在我的桌面上找不到该文件,html,vim,Html,Vim,C:\Documents and Settings\Sania\desktop中有一个简单的html文件test.html 我可以用firefox打开它,音乐就会播放 <!DOCTYPE html> <html> <body> <audio src="file:///C:/m1.mp3" controls="controls" autoplay="autoplay"></audio> </body&

C:\Documents and Settings\Sania\desktop
中有一个简单的html文件test.html
我可以用firefox打开它,音乐就会播放

<!DOCTYPE html>    
<html>    
<body>    
<audio src="file:///C:/m1.mp3" controls="controls" autoplay="autoplay"></audio>    
</body>    
</html>    
我如何修改某些内容,以便在gvim中按F4并播放音乐


当我用gvim打开它时,

我已经提到了正确转义的必要性,甚至在你的问题中也提到了这一点,你显然是从哪里得到映射的

:nnoremap <F4> :exe ':silent !"c:\Program Files\Mozilla Firefox\firefox.exe"' shellescape(expand('%:p'), 1)<CR>
:nnoremap:exe”:无提示!“c:\Program Files\Mozilla Firefox\Firefox.exe”'shellescape(展开('%:p'),1)

PS:Firefox的路径最好通过
shellescape()
传递,而不是手动转义;我将此作为练习留给您。

文件路径中的空格似乎有问题,请注意它是如何在文档后的第一个空格处截断的。为了进行测试,请将
test.html
放在路径中没有空格的目录中,类似于
C:\test.html
,然后重试。如果这样做有效的话,你必须弄清楚如何在重新映射后发送到firefox的文件名周围加引号。这可能和引用一样简单。如果是这种情况,请发回,我将写一个实际的答案。是的,正如@esel所提到的,请确保在每个空格前使用“\”来转义文件路径中的空白。您还可以使用
escape()
而不是逐个转义空格:
:exe'静默!“'.escape('c:\Program Files\Mozilla Firefox\Firefox.exe',”。“%:p'
。我已经阅读了
:help shellescape()
,不知道shellescape(expand('%:p')中的数字
1
,1)是什么意思,expand('%:p')会产生当前的文件名。帮助告诉你:For
,需要转义更多的字符,
1
配置该字符。对于
system()。
firefox cann't found the file in Firefox /C:/Documents  。
:nnoremap <F4> :exe ':silent !"c:\Program Files\Mozilla Firefox\firefox.exe"' shellescape(expand('%:p'), 1)<CR>