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

StackOverflow https://stackoverflow.com/questions/4575312

  •  14-10-2019
  •  | 
  •  

문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top