如何在我的VIM .netrc文件中添加多个帐户(计算机,登录名和密码)? [英] How do I add multiple accounts (machine, login, password) to my VIM .netrc file?
问题描述
我一直只是通过 .netrc 连接到一台服务器,并且工作正常,但现在我需要能够连接原始服务器和新帐户.当我添加新的帐户信息(machine
,login
,password
)时,它只是登录到.netrc文件中第一个出现的原始帐户中.
I have been just connecting to one server via .netrc and it worked fine but now I need to be able to connect the original server and a new account. When I add new account information (machine
, login
, password
) it just signs into the original account that comes first in the .netrc file.
现在,我的VIM .netrc文件如下所示:
So right now my VIM .netrc file looks like this:
machine oldsite.com
login old_username
password oldpassword
machine newsite.com
login new_username
password new_password
如何让VIM/.netrc问我要登录哪个帐户?
推荐答案
我意识到我的问题不在.netrc文件中,而在我的.vimrc文件中.我要做的是创建一个新的ftp到newsite.com的映射.这就是我在.vimrc中拥有的功能,以使其正常工作
I realized that my problem was not in the .netrc file but in my .vimrc file. What I had to do was create a new mapping to ftp to newsite.com. So this is what I have in my .vimrc to get it working
map <silent> ;n :e ftp.newsite.com/public_html/<CR>
map <silent> ;o :e ftp.oldsite.com/public_html/<CR>
造成麻烦的原因是,我忘记了仅将快捷方式'; o'分配给oldsite.com的情况.更清楚地说,我基本上已经完全忘记了它是如何工作的.只有通过回溯所有相关文件,我才能弄清楚.
The reason for my trouble was that I forgot all about the shortcut ';o' being assigned just to oldsite.com. To be more clear, I had basically forgotten exactly how it all worked. Only by back tracking through all relevant files did I figure it out.
这篇关于如何在我的VIM .netrc文件中添加多个帐户(计算机,登录名和密码)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!