How do I add multiple accounts (machine, login, password) to my VIM .netrc file?

梦想的初衷 提交于 2019-12-12 00:37:41

问题


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.

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

How can I make VIM/.netrc ask me which account I want to sign into?


回答1:


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> 

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.



来源:https://stackoverflow.com/questions/4575312/how-do-i-add-multiple-accounts-machine-login-password-to-my-vim-netrc-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!