如何编辑_wimrc 以在vim 中使用firefox 打开html 文件? [英] how to edit the _wimrc to open html file with firefox in vim?

查看:26
本文介绍了如何编辑_wimrc 以在vim 中使用firefox 打开html 文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习html,想在vim中编辑一个html文件,
当我完成 html 文件时,按 F4 以使用 firefox 或 chrome 运行它,
我怎样才能在我的 _vimrc 配置文件中写一行来这样做?
在我的 _vimrc 中:

I am learning html, want to edit a html file in vim ,
when i finished the html file, press F4 to run it with firefox or chrome,
how can i write a line in my _vimrc configuration file to do so ?
in my _vimrc :

:map <F4> :w !c:\Program Files\Mozilla Firefox\firefox.exe<cr>   
:map <F5> :w !firefox<cr>   

我已经设置了我的环境路径
c:\Program Files\Mozilla Firefox\firefox.exe
他们都不能运行,我得到找不到命令.

i have set my environment path
c:\Program Files\Mozilla Firefox\firefox.exe
neither of them can run ,i got can't find command.

当我将配置行修改为:

:map <F4> :w !"c:\Program Files\Mozilla Firefox\firefox.exe"<cr> 

F4可以打开firefox,但是firefox不打开我当前正在编辑的html文件.

pressing F4 can make firefox open ,but the firefox don't open my current editing html file.

  "c:\Program Files\Mozilla Firefox\firefox.exe"    file:\\c:\workspace\test.html      

可以打开 test.html ,我如何在我的 _vimrc 文件中设置它?

can open the test.html ,how can i set it in my _vimrc file?

推荐答案

如果您只在控制台中使用 vi(m),这将起作用,但您必须按 Enter 一次才能返回到控制台中的 html 文档

If you are only using vi(m) in the console, this will work but you will have to hit enter once to get back to the html document within the editor:

nnoremap <F4> :exe '!"c:\Program Files\Mozilla Firefox\firefox.exe" %'<CR>

如果你正在使用 gvim,这将避免必须点击输入额外的时间:

If you are using gvim, this will avoid having to hit enter that extra time:

nnoremap <F4> :exe ':silent !"c:\Program Files\Mozilla Firefox\firefox.exe" %'<CR>

这篇关于如何编辑_wimrc 以在vim 中使用firefox 打开html 文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆