❯ vi ssh://wzy@localhost:22//home/wzy/
[fern] ERROR: {'stderr': [''], 'args': ['ssh', '-T', '-x', 'wzy@localhost:22', 'cat /home/wzy/'], 'exitval': 143, 'stdout': ['']}
❯ ssh -T -x wzy@localhost:22 cat /home/wzy/
ssh: Could not resolve hostname localhost:22: Name or service not known
❯ ssh -T -x ssh://wzy@localhost:22 cat /home/wzy
cat: /home/wzy: Is a directory
❯ ssh -T -x ssh://wzy@localhost:22 ls /home/wzy/
Applications
Desktop
Documents
Downloads
...
Should add ssh:// prefix, and judge the file type (directory or normal file) then use ls or cat
index e126d13..6b52c24 100644
--- a/autoload/fern_ssh/connection.vim
+++ b/autoload/fern_ssh/connection.vim
@@ -11,7 +11,7 @@ endfunction
function! s:connection_start(args, ...) abort dict
let options = copy(a:0 ? a:1 : {})
- let args = ['ssh', '-T', '-x', self.host, s:cmdline(a:args)]
+ let args = ['ssh', '-T', '-x', 'ssh://' . self.host, s:cmdline(a:args)]
call fern#logger#debug(args)
return s:Process.start(args, options)
endfunction
it can fix the prefix bug, for ls and cat, I think a command like test -d $(realpath /home/wzy/Desktop/h) && ls /home/wzy/Desktop/h || cat /home/wzy/Desktop/h to judge filetype may be useful, but directory is different from normal file -- vi should get a files list containing by a directory, then use fern to handle it.
A weird behaviour is Fern /home/wzy/Desktop in vi can work normally -- use Fern to open the directory, Fern /home/wzy/LICENSE cannot work, fern will return a blank buffer only containing a line LICENSE/. Looks like fern think LICENSE is a directory not a normal file.
❯ vi ssh://wzy@localhost:22//home/wzy/ [fern] ERROR: {'stderr': [''], 'args': ['ssh', '-T', '-x', 'wzy@localhost:22', 'cat /home/wzy/'], 'exitval': 143, 'stdout': ['']} ❯ ssh -T -x wzy@localhost:22 cat /home/wzy/ ssh: Could not resolve hostname localhost:22: Name or service not known ❯ ssh -T -x ssh://wzy@localhost:22 cat /home/wzy cat: /home/wzy: Is a directory ❯ ssh -T -x ssh://wzy@localhost:22 ls /home/wzy/ Applications Desktop Documents Downloads ...Should add
ssh://prefix, and judge the file type (directory or normal file) then uselsorcatit can fix the prefix bug, for
lsandcat, I think a command liketest -d $(realpath /home/wzy/Desktop/h) && ls /home/wzy/Desktop/h || cat /home/wzy/Desktop/hto judge filetype may be useful, but directory is different from normal file -- vi should get a files list containing by a directory, then use fern to handle it.A weird behaviour is
Fern /home/wzy/Desktopin vi can work normally -- use Fern to open the directory,Fern /home/wzy/LICENSEcannot work, fern will return a blank buffer only containing a lineLICENSE/. Looks like fern think LICENSE is a directory not a normal file.