LoginSignup
1
1

More than 5 years have passed since last update.

[Fixed] WindowsでVimFiler + neossh(unite-ssh)が動作しない

Last updated at Posted at 2016-07-05

2016/07/20 追記

VimFilerの作者であるShougoさんがコメントに書かれているが、今朝方のVimFilerへのコミットで当問題の修正を行っていただいた。
当方でも最新バージョンにアップデートして正常に動作することを確認した。

Issueを立てていた訳でもないのに、こちらの投稿を拾って対応いただきありがとうございました。

はじめに

かれこれ半年近く悩んでいるのだが、未だ解決策が分からないのでいっそのことqiitaに現状をまとめてみることにした。
GitHubにIssueを立てるにしてもどのプラグインが問題なのか切り分けが出来ていないため、どこにIssueを立てていいのかすら判断できない。

環境

  • OS: Windows 7 Pro
  • バージョン: Vim 7.4.1952(kaoriyaパッチ適用済みの独自ビルド)
  • ssh/scpコマンド: plink.exe / pscp.exe(PuTTY同梱のもの)

vimrcの設定周り

.vimrc
let g:neossh#ssh_command = 'plink.exe -P PORT HOSTNAME'
let g:neossh#copy_directory_command = 'pscp.exe -P PORT -q -r $srcs $dest'
let g:neossh#copy_file_command = 'pscp.exe -P PORT -q $srcs $dest'

問題

vimfiler, neossh, uniteを全て最新版にしてから:VimFiler ssh://でリモートファイルの編集を行おうとすると、ディレクトリ一覧は正常に取得できるが、編集したいファイルにカーソルを移動してeを押すと空のディレクトリを開いた表示になる。

:let g:unite_source_ssh_enable_debug = 1した後の:messages

# :VimFiler ssh://user@host//usr/www/htdocs/
path = //user@host//usr/www/htdocs/
parse_result = ['user@host', '', '/usr/www/htdocs/']
path = //user@host//usr/www/htdocs/
parse_result = ['user@host', '', '/usr/www/htdocs/']
files = ['.', '..', 'index.html']
path = //user@host//usr/www/htdocs/
parse_result = ['user@host', '', '/usr/www/htdocs/']
files = ['.', '..', 'index.html']
# e キーを押した時
path = //user@host://usr/www/htdocs/index.html/
parse_result = ['user@host', '', '/usr/www/htdocs/index.html/']
files = []
path = //user@host://usr/www/htdocs/index.html/
parse_result = ['user@host', '', '/usr/www/htdocs/index.html/']
files = []

:messagesの内容を読む限り、"index.html"の末尾に"/"が追加されてしまっている。
どこで"/"が追加されているかが問題なのだが、問題を追えずにいる。

正常に動作していたバージョン

試行

試行1: 最新版のUnite + neosshでアクセスした場合

:VimFiler ssh://ではなく:Unite ssh://とするとディレクトリ、ファイル共に正常に開ける。
ただし、バッファ名がファイル名ではなくvimfiler:default@1のようになってしまう1

試行2: plink.exe/pscp.exeをcygwinのssh.exe/scp.exeに変更する

動作は変わらず、同様のエラーとなったためssh/scpコマンドの問題ではないようだ。

試行3: vimfilerのみ次のコミットを適用

vimfiler:f43f736の次のコミットは Issues on_BufReadCmd and on_FileReadCmd #343というIssueの修正だが、これを適用してeを押すとバッファ名は編集したいファイル名となるが、中身は空となる。
:let g:unite_source_ssh_enable_debug = 1としても:messagesに何も出力されないので、今のところこれ以上追っていない。

試行4: unite-sshのみ次のコミットを適用

neossh:9b8d0cbの次のコミットはCannot open files through vimfiler/Unite when using neossh.vim #14というIssueの修正だが、これを適用すると若干:messagesの内容が変化するが、最新版と同じく"index.html"の末尾に/を追加してしまっている。

 # :VimFiler ssh://user@host//usr/www/htodcs/
path = //user@host//usr/www/htdocs/
parse_result = ['user@host', '', '/usr/www/htdocs/']
path = //user@host//usr/www/htdocs/
parse_result = ['user@host', '', '/usr/www/htdocs/']
command_line = plink.exe  user@host "sh -c 'LC_TIME=C ls -lFa /usr/www/htdocs/'" '/usr/www/htdocs/'
output = total 16^@drwxrwxr-x 2 user user 4096 Jun 23 15:22 ./^@drwxrwxr-x 9 user user 4096 Jun 24 13:40 ../^@-rw-rw-r-- 1 user user 4201 Jul  5 13:54 index.html
files = ['.', '..', 'index.html']
path = //user@host//usr/www/htdocs/
parse_result = ['user@host', '', '/usr/www/htdocs/']
files = ['.', '..', 'index.html']
# e キーを押した時
path = //user@host://usr/www/htdocs/index.html/
parse_result = ['user@host', '', '/usr/www/htdocs/index.html/']
command_line = plink.exe  user@host "sh -c 'LC_TIME=C ls -lFa /usr/www/htdocs/index.html/'" '/usr/www/htdocs/index.html/'
output = ls: /usr/www/htdocs/index.html/: Not a directory
files = []
path = //user@host://usr/www/htdocs/index.html/
parse_result = ['user@host', '', '/usr/www/htdocs/index.html/']
files = []

修正の中身を見るとeditコマンドではなくVimFilerコマンドを実行するようになっているのでVimFiler側の修正が必要なのだろうと思ったが、このコミットの直近のコミットをvimfilerに適用しても動作は変わらなかった。

代替案

  1. :Unite ssh://でアクセスする
  2. 「正常に動作していたバージョン」でfreeze
  3. netrwを使う
  4. リモートファイルの編集をやめる

:Unite ssh://でアクセスすればバッファ名がvimfiler:default@1となること以外は特に不満はない。
ないのだが、ローカルファイルの編集の際には変わらずvimfilerを使っているので、どうせなら同一UIでやりたいというのが本音である。


  1. 「正常に動作していたバージョン」ではssh://user@host//usr/www/htdocs/index.htmlとなる。ただし、:VimFiler ssh://user@host//usr/www/htdocs/index.htmlとすると同様にvimfiler:default@1となる。 

1
1
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1