nosduco / remote-sshfs.nvim

Explore, edit, and develop on a remote machine via SSHFS with Neovim
MIT License
179 stars 6 forks source link

can't access remote files in `nvim-tree` or `netrw`, but can create files over `sshfs` #24

Closed futurisold closed 3 months ago

futurisold commented 3 months ago

Description

I'm using this plugin to work remotely, among many others.

nvim-tree (evennetrw) doesn't show anything from the mounted folder on the server, however, you can perform edit operations from nvim-tree directly, such as creating a new file (see image, I basically pressed a on top of the folder in nvim-tree explorer).

I checked on the server and the file was indeed created.

Thanks

Neovim version

NVIM v0.10.0
Build type: Release
LuaJIT 2.1.1716656478

Operating system and version

macOS Sonoma 14.5 (23F79)

Windows variant

No response

nvim-tree & remote-sshfs versions

"nvim-tree.nvim": { "branch": "master", "commit": "517e4fbb9ef3c0986da7047f44b4b91a2400f93c" } "remote-sshfs.nvim": { "branch": "main", "commit": "217cb9578d0e1e4777d3906bf02210100fa7ba9d" }

Clean room replication

clean.lua:

vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1

vim.cmd [[set runtimepath=$VIMRUNTIME]]
vim.cmd [[set packpath=/tmp/nvt-min/site]]
local package_root = "/tmp/nvt-min/site/pack"
local install_path = package_root .. "/packer/start/packer.nvim"
local function load_plugins()
  require("packer").startup {
    {
    "wbthomason/packer.nvim",
    "nvim-tree/nvim-tree.lua",
    "nvim-tree/nvim-web-devicons",
    -- ADD PLUGINS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
    'nosduco/remote-sshfs.nvim',
    "nvim-telescope/telescope.nvim", branch = "0.1.x",
    "nvim-lua/plenary.nvim",
    },

    config = {
      package_root = package_root,
      compile_path = install_path .. "/plugin/packer_compiled.lua",
      display = { non_interactive = true },
    },
  }
end
if vim.fn.isdirectory(install_path) == 0 then
  print "Installing nvim-tree and dependencies."
  vim.fn.system { "git", "clone", "--depth=1", "https://github.com/wbthomason/packer.nvim", install_path }
end
load_plugins()
require("packer").sync()
vim.cmd [[autocmd User PackerComplete ++once echo "Ready!" | lua setup()]]
vim.opt.termguicolors = true
vim.opt.cursorline = true

-- MODIFY NVIM-TREE SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
_G.setup = function()
    require("nvim-tree").setup {}
    require('remote-sshfs').setup {
      connections = {
        ssh_configs = { -- which ssh configs to parse for hosts list
          vim.fn.expand "$HOME" .. "/.ssh/config",
          "/etc/ssh/ssh_config",
        },
        sshfs_args = { -- arguments to pass to the sshfs command
          "-o reconnect",
          "-o auto_cache",
          "-o Ciphers=aes128-ctr",
          "-o ConnectTimeout=5",
          "-C",
          "-o cache_timeout=60",
          "-o cache=yes",
        },
      },
      mounts = {
        base_dir = vim.fn.expand "$HOME" .. "/.sshfs/", -- base directory for mount points
        unmount_on_exit = true, -- run sshfs as foreground, will unmount on vim exit
      },
      handlers = {
        on_connect = {
          change_dir = true, -- when connected change vim working directory to mount point
        },
        on_disconnect = {
          clean_mount_folders = false, -- remove mount point folder on disconnect/unmount
        },
        on_edit = {}, -- not yet implemented
      },
      ui = {
        select_prompts = false, -- not yet implemented
        confirm = {
          connect = true, -- prompt y/n when host is selected to connect to
          change_dir = false, -- prompt y/n to change working directory on connection (only applicable if handlers.on_connect.change_dir is enabled)
        },
      },
      log = {
        enable = false, -- enable logging
        truncate = false, -- truncate logs
        types = { -- enabled log types
          all = false,
          util = false,
          handler = false,
          sshfs = false,
        },
      },
    }
    require('telescope').setup {}

end

-- UNCOMMENT this block for diagnostics issues, substituting pattern and cmd as appropriate.
-- Requires diagnostics.enable = true in setup.
--[[
vim.api.nvim_create_autocmd("FileType", {
  pattern = "lua",
  callback = function()
    vim.lsp.start { cmd = { "lua-language-server" } }
  end,
})
]]

Steps to reproduce

1. nvim -nu /tmp/clean.lua
2. :RemoteSSHFSConnect
3. :NvimTreeOpen
4. expand the mounted folder

Expected behavior

List all files, directories, normal navigation as one would have locally.

Actual behavior

image

futurisold commented 3 months ago

Closing as this does not seem to be an issue related to remote-sshfs. Reopened on nvim-tree side (https://github.com/nvim-tree/nvim-tree.lua/issues/2794).