miversen33 / netman.nvim

Neovim (Lua powered) Network Resource Manager
MIT License
338 stars 1 forks source link

User case docs #157

Closed serhez closed 1 year ago

serhez commented 1 year ago

Hello!

I've been quite excitedly following this plugin for a while now and have been trying to make it work with simple use cases (e.g., connect over ssh to a server and edit some files) to no avail. I have attempted reading the documentation both in the README and in the wiki to set up my config but I've not been able to grasp how to make it work. Most of the docs are geared towards other plugin devs integrating with it.

Is it possible we could get some docs on how to set up netman for common use cases such as the one described above? The functioning of the plugin seems quite opaque and hard to decipher for now.

Thanks a lot!

serhez commented 1 year ago

As an example: I've tried the integration with neo-tree and I get a netman neo-tree source to appear, but it just says "Providers" at the top, which I guess hints me that I need to set up or connect to providers to appear there. I've tried setting up an ssh provider but no luck. Could you please explain how I could get a remote server's file system to appear there? What are the steps I need to follow with netman for this? Thanks!

miversen33 commented 1 year ago

That is a really good point!

In Neo-tree, you select the providers node (double click it or press enter) and you should get a drop down showing your available providers.

You absolutely do not need to setup your own providers for this to work! This should work "out of the box" for you :) For ssh specifically, there is a very brief section that calls out that you need an SSH Config (usually found in $HOME/.ssh/config). Ironically Netman does not yet have any sort of configuration system (which is likely why you are struggling to configure it ;) )

You are absolutely right though, as an end user, Netman's doc isn't exactly tailored to you. I plan on getting a Wiki thrown together for that, though I could (and probably should) get something thrown into the vimdoc as well.

I appreciate you bringing a specific example to my attention! As the dev of Netman, its a bit hard for me to see the various ways a new user would look at this and try to use it, or how specifically they would be confused by the documentation. I figured there would be confusion of some kind but I have been kinda shooting in the dark lol. I really appreciate this :)

miversen33 commented 1 year ago

@serhez how is this? https://github.com/miversen33/netman.nvim/wiki/User-Guide

serhez commented 1 year ago

@miversen33 the user guide looks really good, I really appreciate this, thanks! Exactly what I needed.

I am however not able to get it working as in the guide. I see the neo-tree source and within it I see the "Providers" node, however expanding this node takes me to a new empty buffer, so there does not seem to be any sub-nodes in the tree. Here is a video showing it:

https://user-images.githubusercontent.com/18057093/232783679-78b1bb74-e30d-4c37-8c03-665b603f503f.mov

I'm using Lazy as my package manager and my config for netman looks like this:

local M = {
    "miversen33/netman.nvim",
    -- NOTE: Currently loaded as a dependency of neo-tree
}

function M.config()
    require("netman")
end

return M

A relevant snippet of my neo-tree config looks like this:

local M = {
    "nvim-neo-tree/neo-tree.nvim",
    dependencies = {
        -- other stuff
        "miversen33/netman.nvim",
    },
    cmd = "Neotree",
    branch = "main",
}

function M.config()
    -- other stuff
    sources = {
        "filesystem",
    "git_status",
    "netman.ui.neo-tree",
    },
    source_selector = {
        -- other stuff
        sources = {
        {
            source = "filesystem",
        display_name = icons.folder.default .. " File",
            },
        {
        source = "git_status",
        display_name = icons.git.github .. " Git",
        },
        {
        source = "remote",
        display_name = icons.globe .. " Remote",
        },
    },
    },
end

My ~/.ssh/config looks something like this (I left out some information using <...> notation):

# Personal GitHub
Host github.com
  AddKeysToAgent yes
  # UseKeychain yes
  IdentityFile ~/.ssh/id_ed25519 

# My organization's proxy machine
Host <org_proxy_host>
  HostName <org_proxy_address>
  Port 22
  User <user>
  IdentityFile ~/.ssh/id_ed25519

# My organization's machine 1
Host <org_machine_1_host>
  HostName <org_machine_1_address>
  Port 22
  User <user>
  IdentityFile ~/.ssh/id_ed25519
  ProxyCommand ssh -W %h:%p <org_proxy_host>

# My organization's machine 2
Host <org_machine_2_host>
  HostName <org_machine_2_address>
  Port 22
  User <user>
  IdentityFile ~/.ssh/id_ed25519
  ProxyCommand ssh -W %h:%p <org_proxy_host>

# My organization's GitLab
Host <org_gitlab_host>
  PreferredAuthentications publickey
  IdentityFile ~/.ssh/id_ed25519

The logs obtained using Nmlogs look normal, it's just a bunch of INFO, TRACE and DEBUG of creating handlers, setting up autocommands, etc. At the end, there is a message saying "Netman Core Initialization Complete!" which looks quite promising. I can post here the complete logs but it would take me a bit to blur my org's details; let me know if you need them.

miversen33 commented 1 year ago

Well that is unusual.

Yes please post your logs! Feel free to sanitize them (I highly recommend it). That absolutely should not be happening lol

miversen33 commented 1 year ago

Also, if you can, please provide me your lazy dotfiles? Something is amiss lol. I will see if I can get you a simple lazy config to see if the thing works at all. I suspect something is interfering with the provider open but I am not completely sure what until I see the logs :)

miversen33 commented 1 year ago

@serhez

Below is a minimal config (no package manager, saves itself in a completely different directory, etc). Try running that and lets see if you still get this behavior

-- Minimal configuration
-- mini.lua
-- Use with the --clean -u flags. EG nvim --clean -u mini.lua
-- This config will create a temp directory and will blow away that temp directory
-- everytime this configuration is loaded. Great for simulating a new installation
-- of a plugin

-- Setting some basic vim options
-- Some junk because I am sick of formatting tables in print
local _print = _G.print
local clean_string = function(...)
    local args = { n = select("#", ...), ... }
    local formatted_args = {}
    for i=1, args.n do
        local item = select(i, ...)
        if not item then item = 'nil' end
        local t_type = type(item)
        if t_type == 'table' or t_type == 'function' or t_type == 'userdata' then
            item = vim.inspect(item)
        end
        table.insert(formatted_args, item)
    end
    return table.concat(formatted_args, ' ')
end
_G.print = function(...)
    _print(clean_string(...))
end

vim.opt.mouse = 'a'
vim.opt.termguicolors = true
-- If you want to play around with this, you can set the do_clean
-- variable to false. This will allow changes made to
-- underlying plugins to persist between sessions, while
-- still keeping everything in its own directory so
-- as to not affect your existing neovim installation.
--
-- Setting this to true will result in a fresh clone of
-- all modules
local do_clean = true

local sep = vim.loop.os_uname().sysname:lower():match('windows') and '\\' or '/' -- \ for windows, mac and linux both use \

local mod_path = string.format("%s%sclean-test%s", vim.fn.stdpath('cache'), sep, sep)
if vim.loop.fs_stat(mod_path) and do_clean then
    print("Found previous clean test setup. Cleaning it out")
    -- Clearing out the mods directory and recreating it so 
    -- you have a fresh run everytime
    vim.fn.delete(mod_path, 'rf')
end

vim.fn.mkdir(mod_path, 'p')

local modules = {
    {'nvim-lua/plenary.nvim'},
    {'nvim-tree/nvim-web-devicons'},
    {'MunifTanjim/nui.nvim'},
    {'nvim-neo-tree/neo-tree.nvim', branch='v2.x', mod = 'neo-tree'},
    {'miversen33/netman.nvim', mod = 'netman'}
}

for _, module in ipairs(modules) do
    local repo = module[1]
    local branch = module.branch
    local module_name = repo:match('/(.*)')
    local module_path = string.format('%s%s%s', mod_path, sep, module_name)
    if not vim.loop.fs_stat(module_name) then
        -- The module doesn't exist, download it
        local cmd = {
            'git',
            'clone'
        }
        if branch then
            table.insert(cmd, '--branch')
            table.insert(cmd, branch)
        end
        table.insert(cmd, string.format('https://github.com/%s', repo))
        table.insert(cmd, module_path)
        vim.fn.system(cmd)
        local message = string.format("Downloaded %s", module_name)
        if branch then
            message = string.format("%s on branch %s", message, branch)
        end
        print(message)
    end
    vim.opt.runtimepath:append(module_path)
end

print("Finished installing plugins. Beginning Setup of plugins")

for _, module in ipairs(modules) do
    if module.mod then
        print(string.format("Loading %s", module.mod))
        local success, err = pcall(require, module.mod)
        if not success then
            print(string.format("Failed to load module %s", module.mod))
            error(err)
        end
    end
end

-- --> Do you module setups below this line <-- --

local neo_tree = require("neo-tree")

neo_tree.setup({
    sources = {
        "filesystem",
        "netman.ui.neo-tree"
    },
    source_selector = {
        winbar = true,
        sources = {
            { source = "filesystem" },
            { source = "remote" }
        }
    }
})

-- --> Do your module setups above this line <-- --

print("Completed minimal setup!, you can run `:Neotree toggle` now")
serhez commented 1 year ago

These are the logs, the sanitized stuff is within <...>:

----------------------------------------------------
Neovim Version: 0.10
System: Darwin 22.2.0 Darwin Kernel Version 22.2.0: Fri Nov 11 02:03:51 PST 2022; root:xnu-8792.61.2~4/RELEASE_ARM64_T6000 arm64
Netman Version: 1.01
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Running Provider Details
    netman.providers.docker --patterns docker --protocol docker --version 0.2
    netman.providers.ssh --patterns ssh,scp,sftp --protocol ssh --version 0.2
Not Running Provider Details
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
----------------------------------------------------
Logs
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: INFO]     -- ...re/nvim/lazy/netman.nvim/lua/netman/tools/utils/init.lua:clear_orphans:75 Searching for Orphaned directories
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: TRACE]     -- ...re/nvim/lazy/netman.nvim/lua/netman/tools/utils/init.lua:clear_orphans:90    Checking if 64933 is alive
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: TRACE]     -- ...re/nvim/lazy/netman.nvim/lua/netman/tools/utils/init.lua:clear_orphans:96    Removing Orphaned Directory /Users/<user>/.cache/nvim/netman/remote_files/64933
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: TRACE]     -- ...re/nvim/lazy/netman.nvim/lua/netman/tools/utils/init.lua:clear_orphans:90    Checking if 69494 is alive
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: INFO]     -- ...re/nvim/lazy/netman.nvim/lua/netman/tools/utils/init.lua:clear_orphans:103    Orphaned directories cleared
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: TRACE]    -- ...re/nvim/lazy/netman.nvim/lua/netman/tools/utils/init.lua:setup_exit_handler:107   Setting Exit Handler
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: INFO]     -- ...er/.local/share/nvim/lazy/netman.nvim/lua/netman/api.lua:init:1225    --------------------Netman API initialization started!---------------------
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: INFO]     -- ...er/.local/share/nvim/lazy/netman.nvim/lua/netman/api.lua:init:1226    Creating Netman augroup
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: TRACE]    -- ...er/.local/share/nvim/lazy/netman.nvim/lua/netman/api.lua:init_config:100  Decoding Netman Configuration
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: TRACE]    -- ...er/.local/share/nvim/lazy/netman.nvim/lua/netman/api.lua:init_config:128  Loaded Configuration
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: INFO]     -- ...er/.local/share/nvim/lazy/netman.nvim/lua/netman/api.lua:load_provider:940    Attempting to import provider: netman.providers.ssh
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: INFO]     -- ...er/.local/share/nvim/lazy/netman.nvim/lua/netman/api.lua:load_provider:948    Validating Provider: netman.providers.ssh
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: INFO]     -- ...er/.local/share/nvim/lazy/netman.nvim/lua/netman/api.lua:load_provider:959    Validation finished
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: TRACE]    -- ...er/.local/share/nvim/lazy/netman.nvim/lua/netman/api.lua:load_provider:971    Initializing netman.providers.ssh:0.2
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: provider] [Level: TRACE]    -- ...share/nvim/lazy/netman.nvim/lua/netman/providers/ssh.lua:parse_user_sshconfig:1677  Processing SSH host: github.com
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: provider] [Level: TRACE]    -- ...share/nvim/lazy/netman.nvim/lua/netman/providers/ssh.lua:parse_user_sshconfig:1677  Processing SSH host: <host>
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: provider] [Level: TRACE]    -- ...share/nvim/lazy/netman.nvim/lua/netman/providers/ssh.lua:parse_user_sshconfig:1677  Processing SSH host: <host>
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: provider] [Level: TRACE]    -- ...share/nvim/lazy/netman.nvim/lua/netman/providers/ssh.lua:parse_user_sshconfig:1677  Processing SSH host: <host>
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: provider] [Level: TRACE]    -- ...share/nvim/lazy/netman.nvim/lua/netman/providers/ssh.lua:parse_user_sshconfig:1677  Processing SSH host: <host>
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: TRACE]    -- ...er/.local/share/nvim/lazy/netman.nvim/lua/netman/api.lua:load_provider:1007   Reducing ssh down to ssh
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: TRACE]    -- ...er/.local/share/nvim/lazy/netman.nvim/lua/netman/api.lua:load_provider:1007   Reducing scp down to scp
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: TRACE]    -- ...er/.local/share/nvim/lazy/netman.nvim/lua/netman/api.lua:load_provider:1007   Reducing sftp down to sftp
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: DEBUG]    -- ...er/.local/share/nvim/lazy/netman.nvim/lua/netman/api.lua:init_provider_autocmds:318   Creating Autocommand FileReadCmd for Provider ssh on Protocol ssh
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: DEBUG]    -- ...er/.local/share/nvim/lazy/netman.nvim/lua/netman/api.lua:init_provider_autocmds:318   Creating Autocommand BufUnload for Provider ssh on Protocol ssh
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: DEBUG]    -- ...er/.local/share/nvim/lazy/netman.nvim/lua/netman/api.lua:init_provider_autocmds:318   Creating Autocommand BufEnter for Provider ssh on Protocol ssh
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: DEBUG]    -- ...er/.local/share/nvim/lazy/netman.nvim/lua/netman/api.lua:init_provider_autocmds:318   Creating Autocommand BufWriteCmd for Provider ssh on Protocol ssh
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: DEBUG]    -- ...er/.local/share/nvim/lazy/netman.nvim/lua/netman/api.lua:init_provider_autocmds:318   Creating Autocommand BufReadCmd for Provider ssh on Protocol ssh
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: DEBUG]    -- ...er/.local/share/nvim/lazy/netman.nvim/lua/netman/api.lua:init_provider_autocmds:318   Creating Autocommand FileWriteCmd for Provider ssh on Protocol ssh
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: DEBUG]    -- ...er/.local/share/nvim/lazy/netman.nvim/lua/netman/api.lua:init_provider_autocmds:318   Creating Autocommand FileReadCmd for Provider ssh on Protocol scp
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: DEBUG]    -- ...er/.local/share/nvim/lazy/netman.nvim/lua/netman/api.lua:init_provider_autocmds:318   Creating Autocommand BufUnload for Provider ssh on Protocol scp
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: DEBUG]    -- ...er/.local/share/nvim/lazy/netman.nvim/lua/netman/api.lua:init_provider_autocmds:318   Creating Autocommand BufEnter for Provider ssh on Protocol scp
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: DEBUG]    -- ...er/.local/share/nvim/lazy/netman.nvim/lua/netman/api.lua:init_provider_autocmds:318   Creating Autocommand BufWriteCmd for Provider ssh on Protocol scp
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: DEBUG]    -- ...er/.local/share/nvim/lazy/netman.nvim/lua/netman/api.lua:init_provider_autocmds:318   Creating Autocommand BufReadCmd for Provider ssh on Protocol scp
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: DEBUG]    -- ...er/.local/share/nvim/lazy/netman.nvim/lua/netman/api.lua:init_provider_autocmds:318   Creating Autocommand FileWriteCmd for Provider ssh on Protocol scp
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: DEBUG]    -- ...er/.local/share/nvim/lazy/netman.nvim/lua/netman/api.lua:init_provider_autocmds:318   Creating Autocommand FileReadCmd for Provider ssh on Protocol sftp
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: DEBUG]    -- ...er/.local/share/nvim/lazy/netman.nvim/lua/netman/api.lua:init_provider_autocmds:318   Creating Autocommand BufUnload for Provider ssh on Protocol sftp
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: DEBUG]    -- ...er/.local/share/nvim/lazy/netman.nvim/lua/netman/api.lua:init_provider_autocmds:318   Creating Autocommand BufEnter for Provider ssh on Protocol sftp
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: DEBUG]    -- ...er/.local/share/nvim/lazy/netman.nvim/lua/netman/api.lua:init_provider_autocmds:318   Creating Autocommand BufWriteCmd for Provider ssh on Protocol sftp
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: DEBUG]    -- ...er/.local/share/nvim/lazy/netman.nvim/lua/netman/api.lua:init_provider_autocmds:318   Creating Autocommand BufReadCmd for Provider ssh on Protocol sftp
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: DEBUG]    -- ...er/.local/share/nvim/lazy/netman.nvim/lua/netman/api.lua:init_provider_autocmds:318   Creating Autocommand FileWriteCmd for Provider ssh on Protocol sftp
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: INFO]     -- ...er/.local/share/nvim/lazy/netman.nvim/lua/netman/api.lua:load_provider:1041   Initialized netman.providers.ssh successfully!
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: INFO]     -- ...er/.local/share/nvim/lazy/netman.nvim/lua/netman/api.lua:load_provider:940    Attempting to import provider: netman.providers.docker
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: INFO]     -- ...er/.local/share/nvim/lazy/netman.nvim/lua/netman/api.lua:load_provider:948    Validating Provider: netman.providers.docker
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: INFO]     -- ...er/.local/share/nvim/lazy/netman.nvim/lua/netman/api.lua:load_provider:959    Validation finished
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: TRACE]    -- ...er/.local/share/nvim/lazy/netman.nvim/lua/netman/api.lua:load_provider:971    Initializing netman.providers.docker:0.2
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: provider] [Level: TRACE]    -- ...re/nvim/lazy/netman.nvim/lua/netman/providers/docker.lua:nil:1957   {
  cmd_pieces = { "docker", "-v" },
  command = "docker -v",
  exit_code = 0,
  opts = {
    STDERR_JOIN = "",
    STDOUT_JOIN = ""
  },
  signal = 0,
  stderr = "",
  stdout = "Docker version 20.10.20, build 9fdeb9c"
}
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: TRACE]    -- ...er/.local/share/nvim/lazy/netman.nvim/lua/netman/api.lua:load_provider:1007   Reducing docker down to docker
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: DEBUG]    -- ...er/.local/share/nvim/lazy/netman.nvim/lua/netman/api.lua:init_provider_autocmds:318   Creating Autocommand FileReadCmd for Provider docker on Protocol docker
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: DEBUG]    -- ...er/.local/share/nvim/lazy/netman.nvim/lua/netman/api.lua:init_provider_autocmds:318   Creating Autocommand BufUnload for Provider docker on Protocol docker
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: DEBUG]    -- ...er/.local/share/nvim/lazy/netman.nvim/lua/netman/api.lua:init_provider_autocmds:318   Creating Autocommand BufEnter for Provider docker on Protocol docker
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: DEBUG]    -- ...er/.local/share/nvim/lazy/netman.nvim/lua/netman/api.lua:init_provider_autocmds:318   Creating Autocommand BufWriteCmd for Provider docker on Protocol docker
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: DEBUG]    -- ...er/.local/share/nvim/lazy/netman.nvim/lua/netman/api.lua:init_provider_autocmds:318   Creating Autocommand BufReadCmd for Provider docker on Protocol docker
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: DEBUG]    -- ...er/.local/share/nvim/lazy/netman.nvim/lua/netman/api.lua:init_provider_autocmds:318   Creating Autocommand FileWriteCmd for Provider docker on Protocol docker
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: INFO]     -- ...er/.local/share/nvim/lazy/netman.nvim/lua/netman/api.lua:load_provider:1041   Initialized netman.providers.docker successfully!
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: INFO]     -- ...er/.local/share/nvim/lazy/netman.nvim/lua/netman/api.lua:init:1234    --------------------Netman API initialization complete!--------------------
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: INFO]     -- ...r/.local/share/nvim/lazy/netman.nvim/lua/netman/init.lua:init:95  --------------------Netman Core Initializating!--------------------
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: TRACE]    -- ...r/.local/share/nvim/lazy/netman.nvim/lua/netman/init.lua:init:96  Setting Commands
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: TRACE]    -- ...r/.local/share/nvim/lazy/netman.nvim/lua/netman/init.lua:init:107 Setting Vim Command: command! -nargs=1 NmloadProvider   lua require("netman.api").load_provider(<f-args>)
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: TRACE]    -- ...r/.local/share/nvim/lazy/netman.nvim/lua/netman/init.lua:init:107 Setting Vim Command: command! -nargs=1 NmunloadProvider lua require("netman.api").unload_provider(<f-args>)
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: TRACE]    -- ...r/.local/share/nvim/lazy/netman.nvim/lua/netman/init.lua:init:107 Setting Vim Command: command! -nargs=1 NmreloadProvider lua require("netman.api").reload_provider(<f-args>)
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: TRACE]    -- ...r/.local/share/nvim/lazy/netman.nvim/lua/netman/init.lua:init:107 Setting Vim Command: command! -nargs=? Nmlogs           lua require("netman.api").generate_log(<f-args>)
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: TRACE]    -- ...r/.local/share/nvim/lazy/netman.nvim/lua/netman/init.lua:init:107 Setting Vim Command: command! -nargs=1 Nmdelete         lua require("netman").delete(<f-args>)
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: TRACE]    -- ...r/.local/share/nvim/lazy/netman.nvim/lua/netman/init.lua:init:107 Setting Vim Command: command! -nargs=+ Nmread           lua require("netman").read(<f-args>)
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: TRACE]    -- ...r/.local/share/nvim/lazy/netman.nvim/lua/netman/init.lua:init:107 Setting Vim Command: command!          Nmwrite          lua require("netman").write()
[2023-04-18 16:05:56] [SID: gscxzcmpylggmia] [Logger: system] [Level: INFO]     -- ...r/.local/share/nvim/lazy/netman.nvim/lua/netman/init.lua:init:111 --------------------Netman Core Initialization Complete!--------------------
[2023-04-18 16:06:00] [SID: gscxzcmpylggmia] [Logger: system] [Level: TRACE]     -- ...er/.local/share/nvim/lazy/netman.nvim/lua/netman/api.lua:generate_log:1056   
miversen33 commented 1 year ago

That log isn't helpful at all, great :upside_down_face:

@serhez To be clear, these are the logs you got after you clicked the "Provider" node in Neo-tree? There should be some logs that are there indicating that you selected the provider node, as well as the providers and hosts that are found on that click. It seems like some logs are missing, though that could be a bug too, who knows.

Also, can you try that minimal config to verify if this occurs in a minimal setup for you? I haven't tested Netman on Mac yet, so this will be a bit of a crash course it sounds like :)

serhez commented 1 year ago

I tried the minimal config you suggested and it does work with it! I see my ssh hosts listed under the ssh node, and the docker node is also there. However, when trying to expand the individual ssh nodes, I get the following error:

Unable to read ssh://<host>///, received error / doesn't exist
E5108: Error executing lua: .../clean-test//netman.nvim/lua/netman/ui/neo-tree/init.lua:1018: bad argument #1 to 'ipairs' (table expected, got nil)
stack traceback:
        [C]: in function 'ipairs'
        .../clean-test//netman.nvim/lua/netman/ui/neo-tree/init.lua:1018: in function 'navigate'
        ...an-test//netman.nvim/lua/netman/ui/neo-tree/commands.lua:14: in function 'func'
        ...m/clean-test//neo-tree.nvim/lua/neo-tree/ui/renderer.lua:782: in function <...m/clean-test//neo-tree.nvim/lua/neo-tree/ui/renderer.lua:780>

This may be because of some bad ssh config on my side? Or, perhaps, these servers are tricky and restrict the file system based on the authenticated user, so maybe netman does not contemplate these edge cases. Also, accessing these servers requires to provide user and password/passphrase, is netman able to prompt for these?

serhez commented 1 year ago

W.r.t. my dotfiles, I think it's more productive to refer you to my nvim-config repo than copy pasting some snippets here. The netman config is here and the neo-tree config is here. The generic lazy config is here, but I would imagine that's not too relevant. Let me know if you need any other info you cannot find in these three files.

miversen33 commented 1 year ago

If the minimal config works, that means there is something fucky with your Neovim configuration. I don't know what though, but maybe that can get you moving in the right direction?

Also, accessing these servers requires to provide user and password/passphrase, is netman able to prompt for these?

33

Not yet :/ Its not an easy problem to solve. I would bet you if you look at :Nmlogs, you will see password failure (or access denial) on those the server as the providers log out both the commands being ran and their output.

I will take a poke at your config and see if I can figure out whats up. To completely test this, try opening an SSH server that does not require a password/passphrase or any kind (IE, copy your key to it) and see if you can browse it in the minimal configuration :)

serhez commented 1 year ago

If you think it will help you improve the plugin then feel free to look for what might be going wrong with my config, but if not don't bother! I will try figuring out myself and if I can't I'll come back to bother a bit more hehe.

I will also test some other ssh servers with no auth walls to see if I can get them working.

One thing though, had you considered the case where the user may not have access to the root directory (i.e., /) of the server? Maybe we could set some way to specify in netman's config a different default directory for specific hosts, e.g., /users/john/ instead of /. I obviously don't have much insight into the implementation of netman, but I got the impression that if I don't have access to the root directory, I'll never be able to connect to that server via this plugin.

miversen33 commented 1 year ago

110

Sure have ;) The ssh provider will resolve your home directory and open that for you when you open an ssh host. It makes some assumptions along the way to ensure that "works"

miversen33 commented 1 year ago

@serhez I can successfully recreate your issue in an ubuntu container using your dotfiles. I will let you know if I can figure out what is going on, though I have a hunch

miversen33 commented 1 year ago

@serhez I have no idea what window_picker is, but it is consuming the navigate event that Neo-tree fires. If you comment out these 3 lines, the netman source responds as its supposed to.

The issue is that after "selecting" the provider node, something prevents Netman from being able to proceed. The function that Neo-tree calls to open the node is never called and thus nothing happens.

miversen33 commented 1 year ago

Now the question is, why does everything else work but not Netman...?

Edit: Figured that out too. open_with_window_picker is a function that Netman can provide to open, well with a window picker. Netman does not currently implement that function. I will have to investigate this a bit and see if I can figure out what its supposed to do. As a hotfix, I am going to just map that to navigate

miversen33 commented 1 year ago

@serhez can you update your version of Netman? You should now be able to use it without having to modify your Neo-tree config :)

serhez commented 1 year ago

With the latest version of netman, it works as in the minimal config! I'm still left with the error I showed above, but that could be due to the need for authentication in these servers I suppose. I'll try to get some time in the near future to try with different servers not requiring auth and looking forward to #33 👍🏻 Thanks so much for your help!

miversen33 commented 1 year ago

Wonderful! Closing this out :)