试图通过FTP(Mac OS X)打开文件时,Vim无法识别用户名

试图通过FTP(Mac OS X)打开文件时,Vim无法识别用户名,vim,ftp,Vim,Ftp,我正试图用Vim在远程服务器上编辑一些文件。我以前在其他服务器上管理过,没有遇到任何问题,但在本例中,当我键入: $vimftp://username@xxxxxx.com/ 系统会提示我输入密码,我输入密码后会看到: Name (notixvalet.com:george): User cannot log in. Please login with USER and PASS. Please login with USER and PASS. Please login with USE

我正试图用Vim在远程服务器上编辑一些文件。我以前在其他服务器上管理过,没有遇到任何问题,但在本例中,当我键入:

$vimftp://username@xxxxxx.com/

系统会提示我输入密码,我输入密码后会看到:

Name (notixvalet.com:george): User cannot log in. 
Please login with USER and PASS. 
Please login with USER and PASS. 
Please login with USER and PASS. 
ftp: Login failed 
“george”是我在本地机器(Mac OS X 10.8)上的用户名。Vim似乎忽略了我给它的用户名,并试图以“george”的身份登录,无论我做什么。为了测试这一点,我在MacBook上创建了一个新帐户,该帐户的用户名与我尝试登录的服务器上的用户名相同,然后我可以从该帐户很好地登录。这显然是一个非常黑客的解决方案-我如何从我的常规帐户使用正确的用户名连接


(顺便说一句,我使用的用户名和密码完全正确-我可以使用它们通过FTP客户端(如FileZilla)连接到服务器。)

您用来编辑远程文件的插件是
netrw
,正如Ingo在评论中所指出的那样。您可以通过
:h netrw
阅读插件帮助文件。特别是:

  NETRC                         *netrw-netrc*

  The <.netrc> file, typically located in your home directory, contains lines
  therein which map a hostname (machine name) to the user id and password you
  prefer to use with it.

  The typical syntax for lines in a <.netrc> file is given as shown below.
  Ftp under Unix usually supports <.netrc>; ftp under Windows usually doesn't.
  >
     machine {full machine name} login {user-id} password "{password}"
     default login {user-id} password "{password}"

  Your ftp client must handle the use of <.netrc> on its own, but if the
  <.netrc> file exists, an ftp transfer will not ask for the user-id or
  password.

     Note:
     Since this file contains passwords, make very sure nobody else can
     read this file!  Most programs will refuse to use a .netrc that is
     readable for others.  Don't forget that the system administrator can
     still read the file!  Ie. for Linux/Unix: chmod 600 .netrc
NETRC*netrw NETRC*
该文件通常位于主目录中,包含行
其中,将主机名(机器名)映射到用户id和密码
我更喜欢和它一起使用。
文件中行的典型语法如下所示。
Unix下的Ftp通常支持;Windows下的ftp通常不会。
>
机器{完整机器名}登录{用户id}密码{密码}
默认登录名{user id}密码{password}
您的ftp客户端必须自行处理的使用,但如果
文件存在时,ftp传输不会要求用户id或
密码。
注:
由于此文件包含密码,请确保没有其他人可以
读这个文件!大多数程序都会拒绝使用.netrc
为他人阅读。别忘了系统管理员可以
还在读文件!例如,对于Linux/Unix:chmod 600.netrc

您是否有可能忘记从其他服务器复制~/.netrc文件,您可以在这些服务器上进行连接而不会出现问题?或者它的权限不正确,如上一段所述?

您用来编辑远程文件的插件是
netrw
,正如Ingo在评论中所指出的那样。您可以通过
:h netrw
阅读插件帮助文件。特别是:

  NETRC                         *netrw-netrc*

  The <.netrc> file, typically located in your home directory, contains lines
  therein which map a hostname (machine name) to the user id and password you
  prefer to use with it.

  The typical syntax for lines in a <.netrc> file is given as shown below.
  Ftp under Unix usually supports <.netrc>; ftp under Windows usually doesn't.
  >
     machine {full machine name} login {user-id} password "{password}"
     default login {user-id} password "{password}"

  Your ftp client must handle the use of <.netrc> on its own, but if the
  <.netrc> file exists, an ftp transfer will not ask for the user-id or
  password.

     Note:
     Since this file contains passwords, make very sure nobody else can
     read this file!  Most programs will refuse to use a .netrc that is
     readable for others.  Don't forget that the system administrator can
     still read the file!  Ie. for Linux/Unix: chmod 600 .netrc
NETRC*netrw NETRC*
该文件通常位于主目录中,包含行
其中,将主机名(机器名)映射到用户id和密码
我更喜欢和它一起使用。
文件中行的典型语法如下所示。
Unix下的Ftp通常支持;Windows下的ftp通常不会。
>
机器{完整机器名}登录{用户id}密码{密码}
默认登录名{user id}密码{password}
您的ftp客户端必须自行处理的使用,但如果
文件存在时,ftp传输不会要求用户id或
密码。
注:
由于此文件包含密码,请确保没有其他人可以
读这个文件!大多数程序都会拒绝使用.netrc
为他人阅读。别忘了系统管理员可以
还在读文件!例如,对于Linux/Unix:chmod 600.netrc

您是否有可能忘记从其他服务器复制~/.netrc文件,您可以在这些服务器上进行连接而不会出现问题?或者它的权限不正确,如上一段所述?

您有什么理由不直接使用FTP客户端连接和浏览服务器,并使用MacVim进行编辑?堆栈溢出不是问题追踪器。向负责的netrw插件作者(Charles Campbell)发送电子邮件;他的地址可以在源代码中找到。您有什么理由不直接使用FTP客户端连接和浏览服务器并编辑MacVim?堆栈溢出不是问题跟踪程序。向负责的netrw插件作者(Charles Campbell)发送电子邮件;他的地址可以在源代码中找到。哦!编辑~/.netrc文件似乎已经修复了它。事实上,那里似乎已经有我在vim中连接到的其他服务器的登录信息,尽管我没有把它们放在那里的记忆。。。我已经很久没有试过这么做了,我肯定早就知道这个问题了,并且忘记了我是怎么做的。哎呀!谢谢你的回答。哦!编辑~/.netrc文件似乎已经修复了它。事实上,那里似乎已经有我在vim中连接到的其他服务器的登录信息,尽管我没有把它们放在那里的记忆。。。我已经很久没有试过这么做了,我肯定早就知道这个问题了,并且忘记了我是怎么做的。哎呀!谢谢你的回答。