nvim-telescope / telescope-file-browser.nvim

File Browser extension for telescope.nvim
MIT License
1.68k stars 92 forks source link

start: Executable not found #314

Closed peter-lyr closed 1 year ago

peter-lyr commented 1 year ago

Description

fb_actions.open failed in windows 10

image

I want to open some file with system method, here is where the error caused.

fb_actions.open = function(prompt_bufnr)
  local quiet = action_state.get_current_picker(prompt_bufnr).finder.quiet
  local selections = fb_utils.get_selected_files(prompt_bufnr, true)
  if vim.tbl_isempty(selections) then
    fb_utils.notify("actions.open", { msg = "No selection to be opened!", level = "INFO", quiet = quiet })
    return
  end

  local cmd = vim.fn.has "win32" == 1 and "start" or vim.fn.has "mac" == 1 and "open" or "xdg-open"
  for _, selection in ipairs(selections) do
    require("plenary.job")
      :new({
        command = cmd,
        args = { selection:absolute() },
      })
      :start()
  end
  actions.close(prompt_bufnr)
end

Neovim version

NVIM v0.9.2
Build type: RelWithDebInfo
LuaJIT 2.1.1694082368

Operating system and version

Windows 10

Steps to reproduce

  1. nvim -n
  2. e c:\test.lua
  3. source %

test.lua

local cmd = 'start'
local selection = [[c:\a.bat]]
require("plenary.job")
  :new({
    command = cmd,
    args = { selection },
  })
  :start()

Expected behavior

execute a.bat

Actual behavior

cause error.

Minimal config

no config
jamestrew commented 1 year ago

I believe this is a windows executable $PATH issue - not something we can fix with neovim or this plugin. I'm not a Windows user so I'm not sure how this is done but you need to add start into your $PATH such that :echo executable('start') shows 1.

Otherwise you can used this workaround https://github.com/nvim-telescope/telescope-file-browser.nvim/issues/198#issuecomment-1364608502