linuxvim.netrc

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


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?


Solution

  • 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.