remote-sshfs.nvim icon indicating copy to clipboard operation
remote-sshfs.nvim copied to clipboard

Installation Issue

Open undrpaidtekmnkytek opened this issue 1 year ago • 1 comments

Hope some help can be provided. I have installed the plugin, but when i attempt to load the extension, I get a bunch of errors saying none of the files exist. If I remove to call to load the extension, the extension will launch, but if I try to connect to any SSH server, the extension crashes with the following error:

E5108: Error executing lua: ...te-sshfs.nvim/lua/telescope/_extensions/remote-sshfs.lua:65: attempt to index local 'selection' (a nil value) stack traceback: ...te-sshfs.nvim/lua/telescope/_extensions/remote-sshfs.lua:65: in function 'run_replace_or_original' ...re/nvim/lazy/telescope.nvim/lua/telescope/actions/mt.lua:65: in function 'key_func' ...hare/nvim/lazy/telescope.nvim/lua/telescope/mappings.lua:293: in function <...hare/nvim/lazy/telescope.nvim/lua/telescope/mappings.lua:292>

I'm sure I'm doing something wrong, but I don't know exactly what.

I am using the LazyVim starter distro in Garuda Linux if that makes a difference.

Any assistance you could provide would be greatly appreciated.

Update: RemoteSSHFSConnect command works perfectly. The only issue there is occurs when using the included keybind.

undrpaidtekmnkytek avatar Feb 12 '25 14:02 undrpaidtekmnkytek

I have the exact same error. It seems there is something wrong with the Telescope integration, as connecting from the command with the arguments already in it works fine.

My Telescope configs have remained untouched for a long time and work fine, which makes me believe the error is within this project and not with Telescope or my config in specific. But, considering it is likely that this error only happens on some specific Telescope configs, I'll be attaching mine in case it is helpful for debugging the problem.

local actions = require("telescope.actions")
local lga_actions = require("telescope-live-grep-args.actions")

require("telescope").setup({
  extensions = {
    live_grep_args = {
      auto_quoting = true, -- enable/disable auto-quoting
      -- define mappings, e.g.
      mappings = {      -- extend mappings
        i = {
          ["<C-k>"] = lga_actions.quote_prompt(),
          ["<C-i>"] = lga_actions.quote_prompt({ postfix = " --iglob " }),
        },
      },
      -- ... also accepts theme settings, for example:
      -- theme = "dropdown", -- use dropdown theme
      -- theme = { }, -- use own theme spec
      -- layout_config = { mirror=true }, -- mirror preview pane
    },
  },
  defaults = {
    vimgrep_arguments = {
      "rg",
      "--color=never",
      "--no-heading",
      "--with-filename",
      "--line-number",
      "--column",
      -- "--smart-case",
      "--hidden",
    },
    layout_config = {
      prompt_position = "top",
    },
    sorting_strategy = "ascending",
    mappings = {
      i = {
        ["<C-d>"] = actions.preview_scrolling_down,
        ["<C-u>"] = actions.preview_scrolling_up,
        ["<C-x>"] = false,
        ["<C-j>"] = actions.move_selection_next,
        ["<C-k>"] = actions.move_selection_previous,
        ["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist,
        ["<C-s>"] = actions.cycle_previewers_next,
        ["<C-a>"] = actions.cycle_previewers_prev,
        ["<C-h>"] = "which_key",
        ["<ESC>"] = actions.close,
      },
      n = {
        ["<C-d>"] = actions.preview_scrolling_down,
        ["<C-u>"] = actions.preview_scrolling_up,
        ["<C-s>"] = actions.cycle_previewers_next,
        ["<C-a>"] = actions.cycle_previewers_prev,
      },
    },
  },
})

require("telescope").load_extension("fzf")
require("telescope").load_extension("live_grep_args")

-- Custom pickers
local previewers = require("telescope.previewers")
local builtin = require("telescope.builtin")

local M = { pickers = {} }

local connections_ok, connections = pcall(require, "remote-sshfs.connections")
local api_ok, api = pcall(require, "remote-sshfs.api")

M.pickers.fd = function()
  if api_ok and connections_ok and connections.is_connected() then
    api.find_files()
  else
    require("telescope.builtin").find_files({
      find_command = { "fd", "-H", "--type", "f", "-E", ".git" },
    })
  end
end

M.pickers.grep = function()
  if api_ok and connections_ok and connections.is_connected() then
    api.live_grep()
  else
    require("telescope").extensions.live_grep_args.live_grep_args()
  end
end

-- Git pickers

local delta_bcommits = previewers.new_termopen_previewer({
  get_command = function(entry)
    return {
      "git",
      "-c",
      "core.pager=delta",
      "-c",
      "delta.side-by-side=false",
      "diff",
      entry.value .. "^!",
      "--",
      entry.current_file,
    }
  end,
})

local delta = previewers.new_termopen_previewer({
  get_command = function(entry)
    return { "git", "-c", "core.pager=delta", "-c", "delta.side-by-side=false", "diff", entry.value .. "^!" }
  end,
})

M.pickers.git_commits = function(opts)
  opts = opts or {}
  opts.previewer = {
    delta,
    previewers.git_commit_message.new(opts),
    previewers.git_commit_diff_as_was.new(opts),
  }

  builtin.git_commits(opts)
end

M.pickers.git_buffer_commits = function(opts)
  opts = opts or {}
  opts.previewer = {
    delta_bcommits,
    previewers.git_commit_message.new(opts),
    previewers.git_commit_diff_as_was.new(opts),
  }

  builtin.git_bcommits(opts)
end

return M

NiloDrumond avatar Apr 04 '25 19:04 NiloDrumond